|
Information
说明: |
建议参照本版块置顶帖内容输入必要信息 |
芯片型号: |
TSLR8251 |
驱动SDK版本: |
tc_ble_single_sdk-V3.4.2.7 |
天易合芯原始I2C代码
bool Hrs3602_write_reg(uint8_t addr, uint8_t data)
{
#ifdef TYHX_DEMO
uint8_t data_buf[2];
data_buf[0] = addr;
data_buf[1] = data;
twi_pin_switch(1);
twi_master_transfer(0x44, data_buf, 2, true); //write
#endif
return 0;
}
uint8_t Hrs3602_read_reg(uint8_t addr)
{
uint8_t data_buf = 0;
#ifdef TYHX_DEMO
twi_pin_switch(1);
twi_master_transfer(0x44, &addr, 1, false); //write
twi_master_transfer(0x45, &data_buf, 1, true);//read
#endif
return data_buf;
}
bool Hrs3602_brust_read_reg(uint8_t addr , uint8_t *buf, uint8_t length)
{
#ifdef TYHX_DEMO
twi_pin_switch(1);
twi_master_transfer(0x44, &addr, 1, false); //write
twi_master_transfer(0x45, buf, length, true); //read
#endif
return true;
}
主供切换为泰凌微之后如何实现
|
|