![](/media/cache/profiles/ce7206100d5cf8e7bb691376c7d73526.jpg.50x50_q85.jpg)
Lora support for the STM B_L072Z_LRWAN1 board out of the box. Also supports HopeRF RFM95, Murata CMWX1ZZABZ and Semtech SX1276MB1MAS/SX1276MB1LAS modules.
Dependencies: BufferedSerial SX1276GenericLib mbed USBDeviceHT
main.cpp
- Committer:
- Helmut64
- Date:
- 2017-08-08
- Revision:
- 13:5a32a1922fbc
- Parent:
- 8:3b0d7b4ff28f
- Child:
- 16:675f4d0ee9e9
File content as of revision 13:5a32a1922fbc:
/* * Copyright (c) 2017 Helmut Tschemernjak * 30826 Garbsen (Hannover) Germany * Licensed under the Apache License, Version 2.0); */ #include "main.h" /* * IMPORTANT NOTE * Use the Nucleo-L073RZ target for the STM B_L072Z_LRWAN1 LoRa board */ DigitalOut myled(LED2); BufferedSerial *ser; int main() { ser = new BufferedSerial(USBTX, USBRX); ser->baud(115200*2); ser->format(8); ser->printf("Hello World\n\r"); myled = 1; SX1276PingPong(); } void dump(const char *title, const void *data, int len, bool dwords) { dprintf("dump(\"%s\", 0x%x, %d bytes)", title, data, len); int i, j, cnt; unsigned char *u; const int width = 16; const int seppos = 7; cnt = 0; u = (unsigned char *)data; while (len > 0) { ser->printf("%08x: ", (unsigned int)data + cnt); if (dwords) { unsigned int *ip = ( unsigned int *)u; ser->printf(" 0x%08x\r\n", *ip); u+= 4; len -= 4; cnt += 4; continue; } cnt += width; j = len < width ? len : width; for (i = 0; i < j; i++) { ser->printf("%2.2x ", *(u + i)); if (i == seppos) ser->putc(' '); } ser->putc(' '); if (j < width) { i = width - j; if (i > seppos + 1) ser->putc(' '); while (i--) { printf("%s", " "); } } for (i = 0; i < j; i++) { int c = *(u + i); if (c >= ' ' && c <= '~') ser->putc(c); else ser->putc('.'); if (i == seppos) ser->putc(' '); } len -= width; u += width; ser->printf("\r\n"); } ser->printf("--\r\n"); }