diff options
author | Christian Pointner <equinox@spreadspace.org> | 2018-11-24 03:22:20 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2018-11-24 03:22:20 +0100 |
commit | 4ef807724561efbb2c7864db498a53b1dcdcf5c1 (patch) | |
tree | c2d4ab04a7549e9542c8c2c9cbad014074812906 /usb-lora | |
parent | fix whitespaces (diff) |
fix lora.init() and did some cleanup
Diffstat (limited to 'usb-lora')
-rw-r--r-- | usb-lora/usb-lora.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usb-lora/usb-lora.cpp b/usb-lora/usb-lora.cpp index 3d48031..d56946f 100644 --- a/usb-lora/usb-lora.cpp +++ b/usb-lora/usb-lora.cpp @@ -40,42 +40,41 @@ void recv_lora_msg() uint8_t buf[RH_RF95_MAX_MESSAGE_LEN]; uint8_t len = sizeof(buf); - led_on(); + led2_on(); if(!lora.recv(buf, &len)) { printf("lora.recv(): failed\r\n"); - led_off(); + led2_off(); return; } printf("lora.recv() got message: SNR = %d, data = ", lora.lastSNR()); for(uint8_t i = 0; i < len; ++i) printf("%s0x%02X", (i==0) ? "" : " ", buf[i]); printf("\r\n"); - led_off(); + led2_off(); } void send_lora_msg() { uint8_t data[] = "spreadspace.org/avr-utils usb-lora test using radiohead library"; + printf("lora: sending message with %d bytes\r\n", sizeof(data)); - led2_on(); + led_on(); if(!lora.send(data, sizeof(data))) { printf("lora.send(): failed\r\n"); - led2_off(); + led_off(); return; } lora.waitPacketSent(); printf("lora.send(): success\r\n"); - led2_off(); + led_off(); } void handle_cmd(uint8_t cmd) { switch(cmd) { case 's': send_lora_msg(); break; - case 'r': reset2bootloader(); break; default: printf("error\r\n"); return; } - printf("ok\r\n"); } int main(void) @@ -86,6 +85,7 @@ int main(void) cpu_init(); led_init(); usbio_init(); + arduino_init(); sei(); lora.init(); |