summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2018-11-24 03:22:20 +0100
committerChristian Pointner <equinox@spreadspace.org>2018-11-24 03:22:20 +0100
commit4ef807724561efbb2c7864db498a53b1dcdcf5c1 (patch)
treec2d4ab04a7549e9542c8c2c9cbad014074812906
parentfix whitespaces (diff)
fix lora.init() and did some cleanup
-rw-r--r--lib/stdc++-minimal.cpp4
-rw-r--r--radiohead.mk2
-rw-r--r--usb-lora/usb-lora.cpp16
3 files changed, 11 insertions, 11 deletions
diff --git a/lib/stdc++-minimal.cpp b/lib/stdc++-minimal.cpp
index 50b1947..c3b0559 100644
--- a/lib/stdc++-minimal.cpp
+++ b/lib/stdc++-minimal.cpp
@@ -29,13 +29,13 @@ extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
void __cxa_pure_virtual(void) {
// this only works with serialio, it won't work with usbio
// because we would need to call usbio_task() ...
- printf("PANIC: __cxa_pure_virtual() got called ...");
+ printf("PANIC: __cxa_pure_virtual() got called ...\r\n");
for(;;);
}
void __cxa_deleted_virtual(void) {
// this only works with serialio, it won't work with usbio
// because we would need to call usbio_task() ...
- printf("PANIC: __cxa_deleted_virtual() got called ...");
+ printf("PANIC: __cxa_deleted_virtual() got called ...\r\n");
for(;;);
}
diff --git a/radiohead.mk b/radiohead.mk
index cef06b8..6352d5e 100644
--- a/radiohead.mk
+++ b/radiohead.mk
@@ -23,7 +23,7 @@
include $(SPREADAVR_PATH)/defines.mk
# TODO: add other components dependent on driver...
-RADIOHEAD_COMPONENTS := RH_$(RADIOHEAD_DRIVER) RHGenericDriver RHSPIDriver RHHardwareSPI RHGenericSPI
+RADIOHEAD_COMPONENTS := RH_$(RADIOHEAD_DRIVER) RHSPIDriver RHGenericDriver RHGenericSPI RHHardwareSPI
SRC:=$(foreach COMP,$(RADIOHEAD_COMPONENTS),$(RADIOHEAD_PATH)/$(COMP).cpp)
DEPLIBS := Arduino-SPI arduino-stub stdc++-minimal
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();