Lora
Dependents: STEM_2019 STEM_2020
LoRaWAN.h@0:8f220b16e069, 2020-01-28 (annotated)
- Committer:
- dsubotic
- Date:
- Tue Jan 28 09:55:09 2020 +0000
- Revision:
- 0:8f220b16e069
LoRaWAN driver
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dsubotic | 0:8f220b16e069 | 1 | #ifndef MBED_LoRaWAN_H |
dsubotic | 0:8f220b16e069 | 2 | #define MBED_LoRaWAN_H |
dsubotic | 0:8f220b16e069 | 3 | |
dsubotic | 0:8f220b16e069 | 4 | #include "mbed.h" |
dsubotic | 0:8f220b16e069 | 5 | |
dsubotic | 0:8f220b16e069 | 6 | #define UART_RX PD_2 |
dsubotic | 0:8f220b16e069 | 7 | #define UART_TX PC_12 |
dsubotic | 0:8f220b16e069 | 8 | |
dsubotic | 0:8f220b16e069 | 9 | #define appEUI "AT+APPEUI=70B3D57ED0029683" |
dsubotic | 0:8f220b16e069 | 10 | #define appKEY "AT+APPKEY=7383F39F198AF48F47406485AB28AF5D" |
dsubotic | 0:8f220b16e069 | 11 | #define join "AT+JOIN" |
dsubotic | 0:8f220b16e069 | 12 | #define reboot "AT+NRB" |
dsubotic | 0:8f220b16e069 | 13 | |
dsubotic | 0:8f220b16e069 | 14 | class LoRaWAN { |
dsubotic | 0:8f220b16e069 | 15 | private: |
dsubotic | 0:8f220b16e069 | 16 | Serial serial_lora; |
dsubotic | 0:8f220b16e069 | 17 | |
dsubotic | 0:8f220b16e069 | 18 | public: |
dsubotic | 0:8f220b16e069 | 19 | /** Initialize object with default uart pins */ |
dsubotic | 0:8f220b16e069 | 20 | LoRaWAN(); |
dsubotic | 0:8f220b16e069 | 21 | |
dsubotic | 0:8f220b16e069 | 22 | /** Initialize object with specific uart pins */ |
dsubotic | 0:8f220b16e069 | 23 | LoRaWAN(PinName USART_TX, PinName USART_RX); |
dsubotic | 0:8f220b16e069 | 24 | |
dsubotic | 0:8f220b16e069 | 25 | /** Boot up the communication and checks if acking */ |
dsubotic | 0:8f220b16e069 | 26 | bool init(); |
dsubotic | 0:8f220b16e069 | 27 | |
dsubotic | 0:8f220b16e069 | 28 | /** Send LoraWAN message */ |
dsubotic | 0:8f220b16e069 | 29 | bool sendMessage(char *data_buf); |
dsubotic | 0:8f220b16e069 | 30 | |
dsubotic | 0:8f220b16e069 | 31 | /** recieve data from the LoRaWAN module */ |
dsubotic | 0:8f220b16e069 | 32 | void recieveData(char *data_buf, int numchar); |
dsubotic | 0:8f220b16e069 | 33 | |
dsubotic | 0:8f220b16e069 | 34 | |
dsubotic | 0:8f220b16e069 | 35 | }; |
dsubotic | 0:8f220b16e069 | 36 | |
dsubotic | 0:8f220b16e069 | 37 | #endif |