changed TP_CS macros. Added TP_CS_PORT
This commit is contained in:
parent
21cb0c7454
commit
9b46b61f57
3 changed files with 12 additions and 11 deletions
|
@ -8,10 +8,10 @@ __inline uint16_t lld_readX(void) {
|
|||
uint16_t x;
|
||||
|
||||
txbuf[0] = 0xd0;
|
||||
SET_CS(0);
|
||||
spiSend(&SPID1, 1, txbuf);
|
||||
TP_CS_LOW;
|
||||
spiSend(&SPID1, 1, txbuf);
|
||||
spiReceive(&SPID1, 2, rxbuf);
|
||||
SET_CS(1);
|
||||
TP_CS_HIGH;
|
||||
|
||||
x = rxbuf[0] << 4;
|
||||
x |= rxbuf[1] >> 4;
|
||||
|
@ -25,10 +25,10 @@ __inline uint16_t lld_readY(void) {
|
|||
uint16_t y;
|
||||
|
||||
txbuf[0] = 0x90;
|
||||
SET_CS(0);
|
||||
TP_CS_LOW;
|
||||
spiSend(&SPID1, 1, txbuf);
|
||||
spiReceive(&SPID1, 2, rxbuf);
|
||||
SET_CS(1);
|
||||
TP_CS_HIGH;
|
||||
|
||||
y = rxbuf[0] << 4;
|
||||
y |= rxbuf[1] >> 4;
|
||||
|
|
|
@ -8,10 +8,10 @@ __inline uint16_t lld_readX(void) {
|
|||
uint16_t x;
|
||||
|
||||
txbuf[0] = 0xd0;
|
||||
SET_CS(0);
|
||||
spiSend(&SPID1, 1, txbuf);
|
||||
TP_CS_LOW;
|
||||
spiSend(&SPID1, 1, txbuf);
|
||||
spiReceive(&SPID1, 2, rxbuf);
|
||||
SET_CS(1);
|
||||
TP_CS_HIGH;
|
||||
|
||||
x = rxbuf[0] << 4;
|
||||
x |= rxbuf[1] >> 4;
|
||||
|
@ -25,10 +25,10 @@ __inline uint16_t lld_readY(void) {
|
|||
uint16_t y;
|
||||
|
||||
txbuf[0] = 0x90;
|
||||
SET_CS(0);
|
||||
TP_CS_LOW;
|
||||
spiSend(&SPID1, 1, txbuf);
|
||||
spiReceive(&SPID1, 2, rxbuf);
|
||||
SET_CS(1);
|
||||
TP_CS_HIGH;
|
||||
|
||||
y = rxbuf[0] << 4;
|
||||
y |= rxbuf[1] >> 4;
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
#define CONVERSIONS 3
|
||||
|
||||
#define SET_CS(a) (TP_PORT->BSRR = 1 << (TP_CS + (a ? 0 : 16)))
|
||||
#define TP_CS_HIGH palSetPad(TP_PORT, TP_CS)
|
||||
#define TP_CS_LOW palClearPad(TP_PORT, TP_CS)
|
||||
|
||||
struct cal {
|
||||
float xm;
|
||||
|
|
Loading…
Add table
Reference in a new issue