|
|
@@ -16,6 +16,7 @@
|
|
16
|
16
|
*/
|
|
17
|
17
|
|
|
18
|
18
|
void Print_Register_Contents(uint8_t address);
|
|
|
19
|
+void Send_TX_Flush_Command(void);
|
|
19
|
20
|
|
|
20
|
21
|
/* Startup and initial configuration of the NRF24L01 */
|
|
21
|
22
|
void Initialize_NRF24L01(void)
|
|
|
@@ -147,6 +148,8 @@ void Send_Test_Message(void)
|
|
147
|
148
|
transmissionFinished = true; //TODO: indicate failure
|
|
148
|
149
|
sprintf(debugString, "%s\r\n", "max ret");
|
|
149
|
150
|
Print_Debug_String(debugString);
|
|
|
151
|
+
|
|
|
152
|
+ Send_TX_Flush_Command(); /* Remove the packet from the TX FIFO as it is not done automatically */
|
|
150
|
153
|
}
|
|
151
|
154
|
|
|
152
|
155
|
timeout ++; // TODO: this should work without the time out, as MAX_RT should be triggered if no ACK is received
|
|
|
@@ -269,6 +272,7 @@ void Write_NRF_Register(uint8_t address, uint8_t registerContents)
|
|
269
|
272
|
NRF_CSN_PORT |= (1 << NRF_CSN_PIN); // Stop the transmission
|
|
270
|
273
|
}
|
|
271
|
274
|
|
|
|
275
|
+// TODO: clean up functions
|
|
272
|
276
|
void Send_Activate_Command(void)
|
|
273
|
277
|
{
|
|
274
|
278
|
/* First write the write command with the address */
|
|
|
@@ -285,6 +289,17 @@ void Send_Activate_Command(void)
|
|
285
|
289
|
NRF_CSN_PORT |= (1 << NRF_CSN_PIN); // Stop the transmission
|
|
286
|
290
|
}
|
|
287
|
291
|
|
|
|
292
|
+void Send_TX_Flush_Command(void)
|
|
|
293
|
+{
|
|
|
294
|
+ /* First write the write command with the address */
|
|
|
295
|
+ NRF_CSN_PORT &= ~(1 << NRF_CSN_PIN); // Start the transmission
|
|
|
296
|
+ SPDR = 0xE1;
|
|
|
297
|
+
|
|
|
298
|
+ while(!(SPSR & (1<<SPIF))); // Wait for transmission complete
|
|
|
299
|
+
|
|
|
300
|
+ NRF_CSN_PORT |= (1 << NRF_CSN_PIN); // Stop the transmission
|
|
|
301
|
+}
|
|
|
302
|
+
|
|
288
|
303
|
|
|
289
|
304
|
|
|
290
|
305
|
void Write_Message_To_TX_FIFO(uint8_t length, uint8_t * buffer)
|