Hi everyone ,
sorry for my bad english
I am a student who need to understand how cc2540 reads accelerometer register on
CC2540DK-MINI. For example in this piece of code ( keyfobdemo cma3000d.c ),when I want to read
the X value of the accelerometer I didn't understand how spiReadByte works
reg --> DOUTX
*pVal --> *pXVal
void accReadReg(uint8 reg, uint8 *pVal)
{
CS = CS_ENABLED;
WAIT_1_3US(2);
spiWriteByte(reg);
spiReadByte(pVal, 0xFF);
CS = CS_DISABLED;
}
Why has passed 0xFF in input ?
spiReadByte(pVal,OxFF)
{
U0CSR &= ~0x02; // Clear TX_BYTE
U0DBUF = OXFF; --> ??
while (!(U0CSR & 0x02)); // Wait for TX_BYTE to be set
*pVal= U0DBUF;
}
thanks in advance