static void xmit_spi_multi ( const BYTE *buff, /* Pointer to the data */ UINT btx /* Number of bytes to send (even number) */ ) { /* Write multiple bytes */ TM_SPI_WriteMulti(FATFS_SPI, (uint8_t *)buff, btx); }
void TM_NRF24L01_Transmit(uint8_t *data) { uint8_t count = TM_NRF24L01_Struct.PayloadSize; /* Chip enable put to low, disable it */ NRF24L01_CE_LOW; /* Go to power up tx mode */ TM_NRF24L01_PowerUpTx(); /* Clear TX FIFO from NRF24L01+ */ NRF24L01_FLUSH_TX; /* Send payload to nRF24L01+ */ NRF24L01_CSN_LOW; /* Send write payload command */ TM_SPI_Send(NRF24L01_SPI, NRF24L01_W_TX_PAYLOAD_MASK); /* Fill payload with data*/ TM_SPI_WriteMulti(NRF24L01_SPI, data, count); /* Disable SPI */ NRF24L01_CSN_HIGH; /* Send data! */ NRF24L01_CE_HIGH; }
void TM_NRF24L01_Transmit(uint8_t *data) { uint8_t count = TM_NRF24L01_Struct.PayloadSize; //Chip enable put to low, disable it NRF24L01_CE_LOW; //Go to power up tx mode TM_NRF24L01_PowerUpTx(); //Clear TX FIFO from NRF24L01+ NRF24L01_FLUSH_TX; //Send payload to nRF24L01+ NRF24L01_CSN_LOW; //Send write payload command TM_SPI_Send(NRF24L01_SPI, NRF24L01_W_TX_PAYLOAD_MASK); //Fill payload with data TM_SPI_WriteMulti(NRF24L01_SPI, data, count); NRF24L01_CSN_HIGH; //Delay(1000); //Send data! NRF24L01_CE_HIGH; }
void TM_NRF24L01_WriteRegisterMulti(uint8_t reg, uint8_t *data, uint8_t count) { NRF24L01_CSN_LOW; TM_SPI_Send(NRF24L01_SPI, NRF24L01_WRITE_REGISTER_MASK(reg)); TM_SPI_WriteMulti(NRF24L01_SPI, data, count); NRF24L01_CSN_HIGH; }