[Allwinner ClassA20 class library Analysis] 3. ClassA20 function and structure, classa203.classa20

Source: Internet
Author: User

[Allwinner ClassA20 class library Analysis] 3. ClassA20 function and structure, classa203.classa20
After the preparation of the first two sections, it is estimated that there is no problem with the syntax. Now we officially enter the ClassA20 class library.

First download the file: https://github.com/tjcfeng/classa20. we recommend that you download the ZIP file directly. Decompress...


A20.pas-the basis of the entire class library. It is the unit for calculating the ing address and does not need to be used directly.

Clock. pas-turn off the Clock control of some peripherals and do not need to be directly used

GP. pas-Backup register control unit

GPIO. pas-GPIO Control Unit

LRADC. pas-LRADC low-precision ADC Control Unit

PWM. pas-PWM control unit

RTC. pas-Real-Time Clock Control Unit

TWI. pas-I2C Control Unit

Timer. pas-Timer control unit

At present, we have implemented these functions, and we will prepare to implement SPI and interrupt them later. Linux interruption cannot be directly responded by user-state programs, so it is a little troublesome. It is really better than WinCE.

Project establishment:

After saving all the files, save the ClassA20 folder in the project folder for ease of management ). Select "project options" in the "project" menu in the IDE. The project configuration form is displayed.



Many options are displayed in the pop-up form. After selecting "path", you can directly enter the name of the folder to be referenced in "Supplemental unit" on the right, or click the button next to it to select a folder in the pop-up form below.



After the selection, you can reference the desired unit file in the unit.




Tip: If you want to open a unit file, or view a function or definition, move the mouse over it, press Ctrl, And the mouse will become a hand, and then click the mouse, you can directly open the file and jump to the corresponding location, which is very convenient. If you do not open or jump after clicking the mouse, the file or writing error is not found.

In addition, after creating an object, enter ". the method or attribute that can be called by the object will pop up, and Private Members in the object class will not be displayed, which can greatly improve the efficiency of code writing.


Tip: If you want to open a unit file, or view a function or definition, move the mouse over it, press Ctrl, And the mouse will become a hand, and then click the mouse, you can directly open the file and jump to the corresponding location, which is very convenient. If you do not open or jump after clicking the mouse, the file or writing error is not found.

In addition, after creating an object, enter ". the method or attribute that can be called by the object will pop up, and Private Members in the object class will not be displayed, which can greatly improve the efficiency of code writing.




Program structure:

Each unit of the ClassA20 class library is generally divided into two parts: Singleton class and common class. Take LRADC. pas as an example,


Tip: If you want to open a unit file, or view a function or definition, move the mouse over it, press Ctrl, And the mouse will become a hand, and then click the mouse, you can directly open the file and jump to the corresponding location, which is very convenient. If you do not open or jump after clicking the mouse, the file or writing error is not found.

In addition, after creating an object, enter ". the method or attribute that can be called by the object will pop up, and Private Members in the object class will not be displayed, which can greatly improve the efficiency of code writing.


Program structure:

Each unit of the ClassA20 class library is generally divided into two parts: Singleton class and common class. Take LRADC. pas as an example,


The Singleton class is generally used to encapsulate critical resources or uniformly control resources, and has no function simplification. You can directly operate the corresponding registers; A common class encapsulates a channel or a port. Common settings and functions are encapsulated and can be called directly to simplify operations.

For example, for the A20 of quanzhi, The LRADC Start and Stop collection of the two channels are controlled by the same set of registers, so they are encapsulated into the singleton class, avoid inadvertently affecting the work of the other channel when controlling one channel. However, the Data Reading operations on a specific channel can be encapsulated into a common class because they can be operated separately.

Download the classa20class library at https://github.com/tjcfeng/classa20.


Tip: If you want to open a unit file, or view a function or definition, move the mouse over it, press Ctrl, And the mouse will become a hand, and then click the mouse, you can directly open the file and jump to the corresponding location, which is very convenient. If you do not open or jump after clicking the mouse, the file or writing error is not found.

In addition, after creating an object, enter ". the method or attribute that can be called by the object will pop up, and Private Members in the object class will not be displayed, which can greatly improve the efficiency of code writing.

Program structure:

Each unit of the ClassA20 class library is generally divided into two parts: Singleton class and common class. Take LRADC. pas as an example,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.