|
|
@@ -102,9 +102,7 @@ void Send_Test_Message(void)
|
|
102
|
102
|
{
|
|
103
|
103
|
uint8_t buffer[4] = {0xDE, 0xAD, 0xBE, 0xEF};
|
|
104
|
104
|
bool transmissionFinished = false;
|
|
105
|
|
- uint8_t statusContent = 0;
|
|
106
|
105
|
|
|
107
|
|
- uint8_t registerContent[5];
|
|
108
|
106
|
STATUS_REGISTER statusRegisterContents = {.byte = 0x0};
|
|
109
|
107
|
uint8_t lengthRead;
|
|
110
|
108
|
char debugString[50] = "";
|
|
|
@@ -136,21 +134,21 @@ void Send_Test_Message(void)
|
|
136
|
134
|
Print_Debug_String(debugString);
|
|
137
|
135
|
}
|
|
138
|
136
|
|
|
139
|
|
- if (statusRegisterContent.bits.TX_DS == true)
|
|
|
137
|
+ if (statusRegisterContents.bits.TX_DS == 1)
|
|
140
|
138
|
{
|
|
141
|
139
|
transmissionFinished = true;
|
|
142
|
140
|
sprintf(debugString, "%s\r\n", "TX fin");
|
|
143
|
141
|
Print_Debug_String(debugString);
|
|
144
|
142
|
}
|
|
145
|
143
|
|
|
146
|
|
- if (statusRegisterContent.bits.MAX_RT == true)
|
|
|
144
|
+ if (statusRegisterContents.bits.MAX_RT == 1)
|
|
147
|
145
|
{
|
|
148
|
|
- transmissionFinished = true;
|
|
|
146
|
+ transmissionFinished = true; //TODO: indicate failure
|
|
149
|
147
|
sprintf(debugString, "%s\r\n", "max ret");
|
|
150
|
148
|
Print_Debug_String(debugString);
|
|
151
|
149
|
}
|
|
152
|
150
|
|
|
153
|
|
- timeout ++;
|
|
|
151
|
+ timeout ++; // TODO: this should work without the time out, as MAX_RT should be triggered if no ACK is received
|
|
154
|
152
|
} while ((transmissionFinished == false) && (timeout < 0xFF));
|
|
155
|
153
|
|
|
156
|
154
|
if (timeout >= 0xFF)
|
|
|
@@ -160,12 +158,10 @@ void Send_Test_Message(void)
|
|
160
|
158
|
}
|
|
161
|
159
|
|
|
162
|
160
|
/* Reset the interrupts */
|
|
163
|
|
- lengthRead = Read_NRF_Register(STATUS_ADDRESS, statusRegisterContents); /* TODO: use status register read function */
|
|
164
|
|
- statusContent = registerContent[0] & 0x0F;
|
|
165
|
|
- statusRegisterContents.bits.RX_DR = false;
|
|
166
|
|
- statusRegisterContents.bits.TX_DS = false;
|
|
167
|
|
- statusRegisterContents.bits.MAX_RT = false;
|
|
168
|
|
- Write_NRF_Register(STATUS_ADDRESS, statusContent);
|
|
|
161
|
+ lengthRead = Read_NRF_Register(STATUS_ADDRESS, &(statusRegisterContents.byte)); /* TODO: use status register read function */
|
|
|
162
|
+ statusRegisterContents.bits.TX_DS = 1;
|
|
|
163
|
+ statusRegisterContents.bits.MAX_RT = 1;
|
|
|
164
|
+ Write_NRF_Register(STATUS_ADDRESS, statusRegisterContents.byte);
|
|
169
|
165
|
|
|
170
|
166
|
// TODO: flush FIFO if an error occured
|
|
171
|
167
|
}
|