touchpad driver fixes
This commit is contained in:
parent
e78626a8bb
commit
46e67f657d
2 changed files with 9 additions and 9 deletions
|
@ -91,7 +91,7 @@ void tp_lld_init(TOUCHPADDriver *tp) {
|
|||
uint16_t tp_lld_read_x(void) {
|
||||
uint8_t txbuf[1];
|
||||
uint8_t rxbuf[2];
|
||||
uint16_t y;
|
||||
uint16_t x;
|
||||
|
||||
txbuf[0] = 0xd0;
|
||||
TP_CS_LOW;
|
||||
|
@ -99,14 +99,14 @@ uint16_t tp_lld_read_x(void) {
|
|||
spiReceive(&SPID1, 2, rxbuf);
|
||||
TP_CS_HIGH;
|
||||
|
||||
y = rxbuf[0] << 4;
|
||||
y |= rxbuf[1] >> 4;
|
||||
x = rxbuf[0] << 4;
|
||||
x |= rxbuf[1] >> 4;
|
||||
|
||||
return y;
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Reads out the X direction.
|
||||
* @brief Reads out the Y direction.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
|
|
|
@ -91,7 +91,7 @@ void tp_lld_init(TOUCHPADDriver *tp) {
|
|||
uint16_t tp_lld_read_x(void) {
|
||||
uint8_t txbuf[1];
|
||||
uint8_t rxbuf[2];
|
||||
uint16_t y;
|
||||
uint16_t x;
|
||||
|
||||
txbuf[0] = 0xd0;
|
||||
TP_CS_LOW;
|
||||
|
@ -99,10 +99,10 @@ uint16_t tp_lld_read_x(void) {
|
|||
spiReceive(&SPID1, 2, rxbuf);
|
||||
TP_CS_HIGH;
|
||||
|
||||
y = rxbuf[0] << 4;
|
||||
y |= rxbuf[1] >> 4;
|
||||
x = rxbuf[0] << 4;
|
||||
x |= rxbuf[1] >> 4;
|
||||
|
||||
return y;
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue