在AI-WB2-01S的参数说明书中, 页(11/23), 表(6)中, 描述如下,
- 2 IO4 GPIO4/SPI_MOSI/MISO/IIC_SCL/PWM_CH4/ADC_CH4
- 3 IO8/NC NC, unavailable. If you need to use it, please contact Ai-Thinker.
- Bootstrap/GPIO8/SPI_MOSI/MISO/IIC_SCL/PWM_CH3
- 4 RX RXD/GPIO7/SPI_SCLK/IIC_SDA/PWM_CH2
- 5 TX TXD/GPIO16/SPI_MOSI/MISO/IIC_SCL/PWM_CH1
复制代码
希望确认的是:
1. AI-WB2-01S, 仅有管脚GPIO7可以设置为IIC_SDA; 管脚GPIO4, GPIO8, GPIO16仅可以设置为IIS_SCL;
2. 将管脚GPIO7(RX)设置为IIC_SDA, 管脚GPIO16(TX)设置为IIC_SCL, 代码如下:- static hosal_i2c_dev_t i2c0 = {
- .config = {
- .address_width = HOSAL_I2C_ADDRESS_WIDTH_7BIT,
- .freq = 100000,
- .mode = HOSAL_I2C_MODE_MASTER,
- .scl = 16,
- .sda = 7,
- },
- .port = 0,
- };
- hosal_i2c_init(&i2c0);
复制代码
, 即可以使用hosal_i2c_master_send向I2C总线输出数据;
请帮忙确认一下, 谢谢。 |
|