Open
Description
I'm looking at your code and see that the read_register
function seems to only work for commands that return single byte responses:
static uint8_t read_register(uint8_t reg)
{
uint8_t command = NRF24L01P_CMD_R_REGISTER | reg;
uint8_t status;
uint8_t read_val;
cs_low();
HAL_SPI_TransmitReceive(NRF24L01P_SPI, &command, &status, 1, 2000);
HAL_SPI_Receive(NRF24L01P_SPI, &read_val, 1, 2000);
cs_high();
return read_val;
}
If this were to support multibyte responses (like the 0A
or 0B
registers for example) how would you change that read_register
function?
Metadata
Metadata
Assignees
Labels
No labels