watchdog we are familiar with, mainly for the system after the crash of automatic reset or active reset of a way, in the system of unmanned duty is essential. But in the general human-computer interaction system, it is closed by default, to use before the first to open it, the following to see how it is used. Before you use it, firsthttps://github.com/tjCFeng/ClassA20 Download the ClassA20 class library.
In particular, to use watchdog, you need to first open the osc24m clock source, because watchdog is counting time by it. Fortunately, the system is already open by default, do not repeat the operation, of course, can also be manually specified.
The watchdog specifies the reset interval, from 0.5 seconds to 16 seconds, which can be set according to your own needs. Feeding the dog during this interval will ensure that the system continues to operate, otherwise it is forced to reset.
Take a look at its class definition:
Because there is only one watchdog, it is also a singleton class. Its properties are not many, only the specified interval and whether the forced reset, as for the method, only start, stop and feed the dog three, can be called at any time.
Due to the need for continuous dog feeding operation, the watchdog is used in the operating system, preferably with a thread to complete. The thread is a loop that waits according to its own specified interval time, times out after feeding the dog, and then continues to wait
The use of threads in Free Pascal is best implemented in a class way. APIs such as direct calls to CreateThread also work, but this is too close to the operating system and greatly reduces portability, which is not recommended. Before you use the thread class, you refer to the Pthreads cell in uses.
Experiment, when there is no boot thread, to look at the door set time, the system is forced to restart, if the thread is open, the system does not affect the continued operation. This effect does not shine, so it is not a piece.
So far, allwinner the most basic things have been said almost, the next section on the TWI is the operation of IIC. Twi is a lot of use, so the next section is ready to formally make a utility, and as an end to the analysis of the ClassA20 class library at this stage, add the content back at any time.
Use of the 9.WatchDog class "Allwinner ClassA20 class Library Analysis"