After the previous preparation, the basic knowledge is almost known, and you can start to build your own project. The basic operation method will not be explained in detail, and the picture will be directly posted as a reference. Because my plan is to encapsulate it into a class library instead of running routines, I will explain the structure and usage of the library. It has been synchronized to https://gitee.com/tjCFeng/PicoRPI, welcome to correct. In addition, the original author encapsulated the corresponding RP2040 series of boards, just like Arduino, which is tightly bound to each board, while I encapsulate the RP2040 chip, and do not specify the function of which pin, only complete the implementation process, and the pins are freely defined.
[attach ]532077[/attach]
After the project is created, go to https://gitee.com/tjCFeng/PicoRPI/Driver. This folder contains various peripheral libraries of RP2040, the most basic of which is the HAL.pp file.
This file implements the initialization of RP2040, such as clock configuration, and defines IO ports and various multiplexing functions. Delphi's habit is to define with T, so Pin and Alternate Function are defined as TPIN and TAF, and all other units will be used and put in this common file. The class definition should also start with T, but in order to be consistent with my previous library, it starts with C, indicating class, and HW is Hardware.
CHW is a singleton class, which can only be initialized once in its entire life cycle. Even if it is initialized repeatedly, it returns a unique instance. The usage method is CHW.Instance.xxxxxx(). The initialization of this class has been completed in the last initialization of the file, so there is no need to write code manually. The initialization is completed when the program starts. Other functions are class methods, which are static functions and are directly called through CHW.xxxxxx().
Since this file is generally not called by users, it is to provide basic functions for other peripherals, so I will briefly introduce it. And it is not perfect yet, and there will definitely be changes in the future, so please pay attention to https://gitee.com/tjCFeng/PicoRPI. (The name of PicoRPI is also going to be changed to RP2040, we will talk about it later.)