|
|
2 лет назад | |
|---|---|---|
| .github | 2 лет назад | |
| LICENSE | 7 лет назад | |
| README.md | 5 лет назад | |
| README_ZH.md | 5 лет назад | |
| SConscript | 7 лет назад | |
| pcf8574.c | 4 лет назад | |
| pcf8574.h | 4 лет назад | |
| pcf8574_sample.c | 7 лет назад |
中文页 | English
The pcf8574 software package is a software package developed by RT-Thread for the I2C parallel port expansion circuit PCF8574T, compatible with PCF8574A. Using this software package, you can use the device on RT-Thread very conveniently, and support multiple PCF8574Ts mounted on an I2C bus.
This article mainly introduces the use of the package, API, and MSH test commands.
pcf8574
│ README.md // package description
│ pcf8574.c // source file
│ pcf8574.h // header file
│ pcf8574_sample.c // Sample code for software package
│ SConscript // RT-Thread default build script
│ LICENSE // License file
pcf8574 complies with the Apache-2.0 license, see the LICENSE file for details.
To use pcf8574 package, you need to select it in the package management of RT-Thread. The specific path is as follows:
RT-Thread online packages
peripheral libraries and drivers --->
pcf8574: Remote 8-bit I/O expander for I2C-bus --->
Enter the configuration menu of the pcf8574 software package for specific configuration according to your needs
--- pcf8574: Remote 8-bit I/O expander for I2C-bus
[*] Enable pcf8574 sample
Version (latest) --->
Enable pcf8574 sample: Enable pcf8574 sample
After the configuration is complete, let the RT-Thread package manager automatically update, or use the pkgs --update command to update the package to the BSP.
The use process of pcf8574 software package is generally as follows:
pcf8574_initpcf8574_port_read/pcf8574_port_write to operate 8 channels of IO at the same timepcf8574_pin_read/pcf8574_pin_write to operate one of the IOs separatelyFor detailed usage, please refer to pcf8574 sample program.
If the sample program of the pcf8574 software package is enabled, the command pcf8574_sample will be exported to the console. After the call, it will detect the PCF8574 device with the address of 0x20 on the i2c1 bus by default, and will operate the port 0 of the expansion port for testing. The results are as follows:
msh >pcf8574_sample
[D/pcf8574] pcf8574 init done
The value of pcf8574.P0 is 0
The value of pcf8574.P0 is 1
msh>
Nothing.