Difference between revisions of "File:RPI open spi1.png"
From Waveshare Wiki
Line 15: | Line 15: | ||
Note:Switch SPI/I2C directly modified here | Note:Switch SPI/I2C directly modified here | ||
</pre> | </pre> | ||
+ | *Data type | ||
+ | <pre> | ||
+ | #define UBYTE uint8_t | ||
+ | #define UWORD uint16_t | ||
+ | #define UDOUBLE uint32_t | ||
+ | </pre> | ||
+ | *Module initialization and exit processing | ||
+ | <pre> | ||
+ | void DEV_Module_Init(void); | ||
+ | void DEV_Module_Exit(void); | ||
+ | Note: here is some GPIO processing before and after using the LCD screen. | ||
+ | </pre> | ||
+ | *Write GPIO | ||
+ | <pre> | ||
+ | void DEV_Digital_Write(UWORD Pin, UBYTE Value) | ||
+ | Parameter: UWORD Pin: GPIO Pin number | ||
+ | UBYTE Value: level to be output, 0 or 1 | ||
+ | </pre> | ||
+ | *Read GPIO | ||
+ | <pre> | ||
+ | UBYTE DEV_Digital_Read(UWORD Pin) | ||
+ | Parameter:UWORD Pin:GPIO Pin number | ||
+ | Return value: level of GPIO, 0 or 1 | ||
+ | </pre> | ||
+ | *GPIO mode setting | ||
+ | void DEV_GPIO_Mode(UWORD Pin, UWORD Mode) | ||
+ | Parameters:UWORD Pin: GPIO Pin number | ||
+ | UWORD Mode: Mode, 0: input, 1: output |
Revision as of 08:12, 17 January 2022
C codes
A brief analysis of underlying interfaces
We have carried out the low-level encapsulation, if you need to know the internal implementation can go to the corresponding directory to check ,for the reason that the hardware platform and the internal implementation are different
We can open DEV_Config.c(.h) to see definitions,which in the catalogue RaspberryPi\c\lib\Config
1.There are three ways for C to drive:BCM2835 library, WiringPi library and Dev library respectively 2.We use Dev library by default. If you need to use BCM2835 or WiringPi to drive the RaspberryPi\c\Makefile, open RaspberryPi\c\Makefile and modify lines 13-15 as follows:
- Interface selection:
#define USE_SPI_4W 1 #define USE_IIC 0 Note:Switch SPI/I2C directly modified here
- Data type
#define UBYTE uint8_t #define UWORD uint16_t #define UDOUBLE uint32_t
- Module initialization and exit processing
void DEV_Module_Init(void); void DEV_Module_Exit(void); Note: here is some GPIO processing before and after using the LCD screen.
- Write GPIO
void DEV_Digital_Write(UWORD Pin, UBYTE Value) Parameter: UWORD Pin: GPIO Pin number UBYTE Value: level to be output, 0 or 1
- Read GPIO
UBYTE DEV_Digital_Read(UWORD Pin) Parameter:UWORD Pin:GPIO Pin number Return value: level of GPIO, 0 or 1
- GPIO mode setting
void DEV_GPIO_Mode(UWORD Pin, UWORD Mode) Parameters:UWORD Pin: GPIO Pin number UWORD Mode: Mode, 0: input, 1: output
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 08:01, 17 January 2022 | ![]() | 800 × 341 (117 KB) | Eng49 (talk | contribs) |
You cannot overwrite this file.
File usage
The following 15 pages use this file:
- 0.91inch OLED Module
- 0.96inch LCD Module
- 1.14inch LCD Module
- 1.3inch LCD Module
- 1.54inch LCD Module
- 1.5inch OLED Module
- 1.5inch RGB OLED Module
- 1.8inch LCD Module
- 2inch LCD Module
- Temp wiki01
- File:RPI open spi1.png
- Template:0.91inch-OLED-Module-RaspberryPi-Guides
- Template:1in54-LCD-Module-RaspberryPi-Guides
- Template:2inch-LCD-Module-RaspberryPi-Guides
- Template:LCD Module FBCP Transplant