add get touch coordinate function to xidatong-riscv64.

This commit is contained in:
TXuian 2022-07-15 01:26:58 -07:00
parent 1818e23744
commit e1999f5af9
3 changed files with 208 additions and 214 deletions

View File

@ -75,8 +75,7 @@ static void SetSdaState(void* data, uint8 sda_state)
if (sda_state) {
gpio_set_drive_mode(bus_param->i2c_sda_pin, GPIO_DM_OUTPUT );
gpio_set_pin(bus_param->i2c_sda_pin , GPIO_PV_HIGH );
}
else {
} else {
gpio_set_drive_mode(bus_param->i2c_sda_pin, GPIO_DM_OUTPUT );
gpio_set_pin(bus_param->i2c_sda_pin , GPIO_PV_LOW );
}
@ -88,8 +87,7 @@ static void SetSclState(void* data, uint8 scl_state)
if (scl_state) {
gpio_set_drive_mode(bus_param->i2c_scl_pin, GPIO_DM_OUTPUT );
gpio_set_pin(bus_param->i2c_scl_pin , GPIO_PV_HIGH );
}
else {
} else {
gpio_set_drive_mode(bus_param->i2c_scl_pin, GPIO_DM_OUTPUT );
gpio_set_pin(bus_param->i2c_scl_pin , GPIO_PV_LOW );
}
@ -289,11 +287,9 @@ static x_size_t I2cSendBytes(struct I2cBus* bus, struct I2cDataStandard* msg)
count --;
ptr ++;
bytes ++;
}
else if (ret == 0) {
} else if (ret == 0) {
return 0;
}
else {
} else {
KPrintf("send bytes: error %d", ret);
return ret;
@ -333,8 +329,7 @@ static x_size_t I2cRecvBytes(struct I2cBus* bus, struct I2cDataStandard* msg)
if (val >= 0) {
*ptr = val;
bytes ++;
}
else {
} else {
break;
}
@ -406,8 +401,7 @@ static x_err_t I2cBitSendAddress(struct I2cBus* bus, struct I2cDataStandard* msg
return -EPIO;
}
}
}
else {
} else {
addr1 = msg->addr << 1;
if (flags & I2C_RD)
addr1 |= 1;