mirror of
https://github.com/whowechina/chu_pico.git
synced 2024-11-11 22:47:09 +01:00
Better timing, I think
This commit is contained in:
parent
3a28d85b53
commit
7f991e3d5f
Binary file not shown.
@ -8,7 +8,7 @@
|
||||
#define I2C_PORT i2c0
|
||||
#define I2C_SDA 16
|
||||
#define I2C_SCL 17
|
||||
#define I2C_FREQ 733*1000
|
||||
#define I2C_FREQ 633*1000
|
||||
|
||||
#define I2C_HUB_EN 19
|
||||
|
||||
|
@ -17,11 +17,18 @@ static inline void i2c_hub_init()
|
||||
gpio_init(I2C_HUB_EN);
|
||||
gpio_set_dir(I2C_HUB_EN, GPIO_OUT);
|
||||
gpio_put(I2C_HUB_EN, 1);
|
||||
|
||||
// reset at start to avoid failed power-on
|
||||
sleep_ms(10);
|
||||
gpio_put(I2C_HUB_EN, 0);
|
||||
sleep_us(50);
|
||||
gpio_put(I2C_HUB_EN, 1);
|
||||
}
|
||||
|
||||
static inline void i2c_select(i2c_inst_t *i2c_port, uint8_t chn)
|
||||
{
|
||||
i2c_write_blocking_until(i2c_port, I2C_HUB_ADDR, &chn, 1, false, time_us_64() + 1000);
|
||||
sleep_us(1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user