diff --git a/test/rx/main.cpp b/test/rx/main.cpp index 10b8d0c..1524ab9 100644 --- a/test/rx/main.cpp +++ b/test/rx/main.cpp @@ -8,7 +8,7 @@ */ #define F_CPU 8000000UL #include "../../src/mrf24j.h" -#include "../usart.h" +#include "../usart/src/usart.h" #include #include @@ -28,34 +28,36 @@ int main() { // This is _our_ address mrf.address16_write(0x4202); mrf.handlers(&handle_rx, &handle_tx); - mrf.turbo(); + //mrf.turbo(); sei(); + printf("Started"); while(1) { //printf("txxxing...\n\r"); //mrf.send16(0x4201, "abcd"); - _delay_ms(5000); + //_delay_ms(5000); } } void handle_rx() { + printf("------------------------------------------------------\n\r"); printf("received a packet %i bytes long\n\r", mrf.get_rxinfo()->frame_length); if(mrf.get_bufferPHY()){ - printf("Packet data (PHY Payload):\n\r"); + printf("Packet data (PHY Payload): "); for (int i = 0; i < mrf.get_rxinfo()->frame_length; i++) { printf("%x", mrf.get_rxbuf()[i]); } } - // printf("\r\nASCII data (relevant data):\n\r"); - // for (int i = 0; i < mrf.rx_datalength(); i++) { - // usart::put(mrf.get_rxinfo()->rx_data[i]); - // } + printf("\r\nASCII data (relevant data): "); + for (int i = 0; i < mrf.rx_datalength(); i++) { + usart::put(mrf.get_rxinfo()->rx_data[i]); + } - printf("\r\nLQI/RSSI="); + printf("LQI/RSSI="); printf("%i/%i\n\r", mrf.get_rxinfo()->lqi, mrf.get_rxinfo()->rssi); } diff --git a/test/tx/main.cpp b/test/tx/main.cpp index 56cf8f1..8d306a7 100644 --- a/test/tx/main.cpp +++ b/test/tx/main.cpp @@ -9,7 +9,7 @@ #define F_CPU 8000000UL #include "../../src/mrf24j.h" -#include "../usart.h" +#include "../usart/src/usart.h" #include "../../src/driver.h" #include #include @@ -32,15 +32,20 @@ int main() { mrf.address16_write(0x4201); mrf.handlers(&handle_rx, &handle_tx); //mrf.enable_wake(); - mrf.set_bufferPHY(true); - mrf.turbo(); - mrf.set_power(0b1100000); + //mrf.set_bufferPHY(true); + //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"); //mrf.wake(); - mrf.send16(0x4202, "Tx Hello"); + + sprintf(tmp,"Received %i\n\r", i++); + mrf.send16(0x4202, tmp); _delay_ms(2000); }