This commit is contained in:
lmx
2025-12-18 18:33:00 +08:00
parent 8775ec8b1a
commit 3fa235d3c2
10 changed files with 100 additions and 19 deletions

View File

@ -67,15 +67,18 @@ unsigned char GetReg(unsigned char address, unsigned char *reg_data){
soft_iic_start(0);
if (0 == soft_iic_tx_byte(0, FM176_WRITE_ADDR)) {
soft_iic_stop(0);
xlog("GetReg: 【write】 addr write error\n");
return FAIL;
}
if (0 == soft_iic_tx_byte(0, address)) {
soft_iic_stop(0);
xlog("GetReg: 【reg】 addr write error\n");
return FAIL;
}
soft_iic_start(0);
if (0 == soft_iic_tx_byte(0, FM176_READ_ADDR)) {
soft_iic_stop(0);
xlog("GetReg: 【read】 addr read error\n");
return FAIL;
}
*reg_data = soft_iic_rx_byte(0, 0);
@ -96,14 +99,17 @@ unsigned char SetReg(unsigned char address, unsigned char reg_data){
soft_iic_start(0);
if (0 == soft_iic_tx_byte(0, FM176_WRITE_ADDR)) {
soft_iic_stop(0);
xlog("SetReg: 【write】 addr write error\n");
return FAIL;
}
if (0 == soft_iic_tx_byte(0, address)) {
soft_iic_stop(0);
xlog("SetReg: 【reg】 addr write error\n");
return FAIL;
}
if (0 == soft_iic_tx_byte(0, reg_data)) {
soft_iic_stop(0);
xlog("SetReg: 【reg】 data write error\n");
return FAIL;
}
soft_iic_stop(0);
@ -216,5 +222,5 @@ unsigned char FM176XX_SoftReset(void){
void rfid_delay_ms(unsigned int ms){
// delay(ms);
os_time_dly(ms/10);
mdelay(ms);
}