Add debug info

This commit is contained in:
CVR 2021-09-13 14:01:12 +12:00
parent 4f341661e3
commit 56e9a87b25
2 changed files with 11 additions and 4 deletions

View File

@ -31,17 +31,21 @@ int main() {
//mrf.turbo();
sei();
DDRD |= (1<<PD4) | (1<<PD5);
printf("Started");
while(1) {
//printf("txxxing...\n\r");
//mrf.send16(0x4201, "abcd");
//_delay_ms(5000);
PORTD ^= (1<<PD5);
_delay_ms(500);
}
}
void handle_rx() {
PORTD |= (1<<PD4);
printf("------------------------------------------------------\n\r");
printf("received a packet %i bytes long\n\r", mrf.get_rxinfo()->frame_length);
@ -59,6 +63,7 @@ void handle_rx() {
printf("LQI/RSSI=");
printf("%i/%i\n\r", mrf.get_rxinfo()->lqi, mrf.get_rxinfo()->rssi);
PORTD &= ~(1<<PD4);
}
void handle_tx() {

View File

@ -17,6 +17,7 @@
Mrf24j mrf;
int i = 0;
void handle_rx();
void handle_tx();
@ -36,15 +37,16 @@ int main() {
//mrf.turbo();
//mrf.set_power(0b1100000);
//mrf.sleep();
sei();
printf("Started\n\r");
int i = 0;
char tmp[20];
while(1) {
printf("txxxing...\n\r");
printf("txxxing... %i\n\r", i++);
//mrf.wake();
sprintf(tmp,"Received %i\n\r", i++);
sprintf(tmp,"Received %i\n\r", i);
mrf.send16(0x4202, tmp);
_delay_ms(2000);
@ -74,7 +76,7 @@ void handle_rx() {
void handle_tx() {
if (mrf.get_txinfo()->tx_ok) {
printf("TX went ok, got ack\n\r");
printf("TX went ok, got ack %i\n\r", i);
} else {
printf("TX failed after %i retries\n\n\r", mrf.get_txinfo()->retries);
}