LoRaWAN demo application using grove peripherals generating Cayenne LPP
radio chip selection
Radio chip driver is not included, because two options are available.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.
Grove peripherals -> Cayenne demo
Read LoRaWAN-1.1 page for configuration instructions.
This project adds support for Murata discovery board, in addition to LoRa shields on NUCLEO boards.
Use with sx1272 shield with grove peripherals connected:
D8 D9: Button | RX TX | A3 A4: TempSense |
D6 D7: | SCL SDA : LED | A1 A2: Pot |
Button
Sends two different payload types: short press (under 1 sec)
long press: held down > 1 sec.
serial console keys
115200bps, 8N1
Enter key not used
Keys '0' to '3': cayenne channel number
'0': pot (rotary sensor)
'1': temperature
'2': digital out
'3': analog out
DevEUI configuration
For use on networks which force you to use DevEUI defined by network, comment out HardwareIDtoDevEUI()
.
HardwareIDtoDevEUI()
obtains DevEUI from the CPU unique hardware serial number. However, some networks may force you to use their DevEUI value.
SerialDisplay.h@5:53cd6c24a4ab, 2018-04-06 (annotated)
- Committer:
- wroberts@semtech.com
- Date:
- Fri Apr 06 17:32:22 2018 -0700
- Revision:
- 5:53cd6c24a4ab
- Parent:
- 0:62e456e60083
update for mbed-os-5.8
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wayne Roberts |
0:62e456e60083 | 1 | /* |
Wayne Roberts |
0:62e456e60083 | 2 | / _____) _ | | |
Wayne Roberts |
0:62e456e60083 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
Wayne Roberts |
0:62e456e60083 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
Wayne Roberts |
0:62e456e60083 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
Wayne Roberts |
0:62e456e60083 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
Wayne Roberts |
0:62e456e60083 | 7 | (C)2015 Semtech |
Wayne Roberts |
0:62e456e60083 | 8 | |
Wayne Roberts |
0:62e456e60083 | 9 | Description: VT100 serial display management |
Wayne Roberts |
0:62e456e60083 | 10 | |
Wayne Roberts |
0:62e456e60083 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
Wayne Roberts |
0:62e456e60083 | 12 | |
Wayne Roberts |
0:62e456e60083 | 13 | Maintainer: Miguel Luis and Gregory Cristian |
Wayne Roberts |
0:62e456e60083 | 14 | */ |
Wayne Roberts |
0:62e456e60083 | 15 | #ifndef __SERIAL_DISPLAY_H__ |
Wayne Roberts |
0:62e456e60083 | 16 | #define __SERIAL_DISPLAY_H__ |
Wayne Roberts |
0:62e456e60083 | 17 | |
Wayne Roberts |
0:62e456e60083 | 18 | #include "vt100.h" |
wroberts@semtech.com | 5:53cd6c24a4ab | 19 | #include "LoRaMac1v1.h" |
Wayne Roberts |
0:62e456e60083 | 20 | |
Wayne Roberts |
0:62e456e60083 | 21 | #ifdef ENABLE_VT100 |
Wayne Roberts |
0:62e456e60083 | 22 | |
Wayne Roberts |
0:62e456e60083 | 23 | #define ROW_START 5 |
Wayne Roberts |
0:62e456e60083 | 24 | #ifdef LORAWAN_JOIN_EUI |
Wayne Roberts |
0:62e456e60083 | 25 | #define ROW_DEVEUI ROW_START |
Wayne Roberts |
0:62e456e60083 | 26 | #define ROW_JOINEUI (ROW_DEVEUI+1) |
Wayne Roberts |
0:62e456e60083 | 27 | #define ROW_NWKKEY (ROW_JOINEUI+1) |
Wayne Roberts |
0:62e456e60083 | 28 | #ifdef OPTNEG |
Wayne Roberts |
0:62e456e60083 | 29 | #define ROW_APPKEY (ROW_JOINEUI+2) |
Wayne Roberts |
0:62e456e60083 | 30 | #define ROW_NwkId (ROW_JOINEUI+5) |
Wayne Roberts |
0:62e456e60083 | 31 | #else |
Wayne Roberts |
0:62e456e60083 | 32 | #define ROW_NwkId (ROW_JOINEUI+4) |
Wayne Roberts |
0:62e456e60083 | 33 | #endif |
Wayne Roberts |
0:62e456e60083 | 34 | #else |
Wayne Roberts |
0:62e456e60083 | 35 | #define ROW_NwkId ROW_START /* ABP */ |
Wayne Roberts |
0:62e456e60083 | 36 | #endif /* LORAWAN_JOIN_EUI */ |
Wayne Roberts |
0:62e456e60083 | 37 | |
Wayne Roberts |
0:62e456e60083 | 38 | #define ROW_DevAddr (ROW_NwkId+1) |
Wayne Roberts |
0:62e456e60083 | 39 | #define ROW_FNwkSIntKey (ROW_NwkId+2) |
Wayne Roberts |
0:62e456e60083 | 40 | #ifdef OPTNEG |
Wayne Roberts |
0:62e456e60083 | 41 | #define ROW_SNwkSIntKey (ROW_NwkId+3) |
Wayne Roberts |
0:62e456e60083 | 42 | #define ROW_NwkSEncKey (ROW_NwkId+4) |
Wayne Roberts |
0:62e456e60083 | 43 | #define ROW_AppSKey (ROW_NwkId+5) |
Wayne Roberts |
0:62e456e60083 | 44 | #else |
Wayne Roberts |
0:62e456e60083 | 45 | #define ROW_AppSKey (ROW_NwkId+3) |
Wayne Roberts |
0:62e456e60083 | 46 | #endif |
Wayne Roberts |
0:62e456e60083 | 47 | |
Wayne Roberts |
0:62e456e60083 | 48 | #define ROW_FrameType (ROW_AppSKey+2) |
Wayne Roberts |
0:62e456e60083 | 49 | #define ROW_ADR (ROW_AppSKey+3) |
Wayne Roberts |
0:62e456e60083 | 50 | #define ROW_DUTY (ROW_AppSKey+4) |
Wayne Roberts |
0:62e456e60083 | 51 | #define ROW_PUBLIC (ROW_AppSKey+6) |
Wayne Roberts |
0:62e456e60083 | 52 | #ifdef LORAWAN_JOIN_EUI |
Wayne Roberts |
0:62e456e60083 | 53 | #define ROW_JOINED (ROW_PUBLIC+1) |
Wayne Roberts |
0:62e456e60083 | 54 | #define ROW_UPLINK_ACKED (ROW_PUBLIC+3) |
Wayne Roberts |
0:62e456e60083 | 55 | #else |
Wayne Roberts |
0:62e456e60083 | 56 | #define ROW_UPLINK_ACKED (ROW_PUBLIC+2) |
Wayne Roberts |
0:62e456e60083 | 57 | #endif /* LORAWAN_JOIN_EUI */ |
Wayne Roberts |
0:62e456e60083 | 58 | |
Wayne Roberts |
0:62e456e60083 | 59 | #define ROW_UPLINK_DR (ROW_UPLINK_ACKED+1) |
Wayne Roberts |
0:62e456e60083 | 60 | #define ROW_UPLINK_FCNT (ROW_UPLINK_DR+1) |
Wayne Roberts |
0:62e456e60083 | 61 | #define ROW_UPLINK_PORT (ROW_UPLINK_DR+2) |
Wayne Roberts |
0:62e456e60083 | 62 | #define ROW_UPLINK_PAYLOAD (ROW_UPLINK_DR+3) |
Wayne Roberts |
0:62e456e60083 | 63 | |
Wayne Roberts |
0:62e456e60083 | 64 | #define ROW_DOWNLINK_RSSI (ROW_UPLINK_PAYLOAD+5) |
Wayne Roberts |
0:62e456e60083 | 65 | #define ROW_DOWNLINK_SNR (ROW_DOWNLINK_RSSI+1) |
Wayne Roberts |
0:62e456e60083 | 66 | #define ROW_DOWNLINK_FCNT (ROW_DOWNLINK_SNR+1) |
Wayne Roberts |
0:62e456e60083 | 67 | #define ROW_DOWNLINK_FPORT (ROW_DOWNLINK_FCNT+1) |
Wayne Roberts |
0:62e456e60083 | 68 | #define ROW_DOWNLINK_PAYLOAD (ROW_DOWNLINK_FPORT+1) |
Wayne Roberts |
0:62e456e60083 | 69 | |
Wayne Roberts |
0:62e456e60083 | 70 | #define ROW_END (ROW_DOWNLINK_PAYLOAD+6) |
Wayne Roberts |
0:62e456e60083 | 71 | |
Wayne Roberts |
0:62e456e60083 | 72 | void SerialDisplayInit( void ); |
Wayne Roberts |
0:62e456e60083 | 73 | void SerialDisplayUplink(uint8_t fport, const uint8_t* buffer, uint8_t bufferSize ); |
Wayne Roberts |
0:62e456e60083 | 74 | void SerialDisplayMcpsConfirm( const McpsConfirm_t*); |
Wayne Roberts |
0:62e456e60083 | 75 | void SerialDisplayMcpsIndication(const McpsIndication_t* mi); |
Wayne Roberts |
0:62e456e60083 | 76 | void SerialDisplayPrintCheckBox( bool activated ); |
Wayne Roberts |
0:62e456e60083 | 77 | #ifdef LORAWAN_JOIN_EUI |
Wayne Roberts |
0:62e456e60083 | 78 | void SerialDisplayUpdateActivationMode( bool otaa ); |
Wayne Roberts |
0:62e456e60083 | 79 | void SerialDisplayUpdateEui( uint8_t line, const uint8_t *eui ); |
Wayne Roberts |
0:62e456e60083 | 80 | void SerialDisplayUpdateNetworkIsJoined( bool state ); |
Wayne Roberts |
0:62e456e60083 | 81 | #endif /* LORAWAN_JOIN_EUI */ |
Wayne Roberts |
0:62e456e60083 | 82 | void SerialDisplayUpdateKey( uint8_t line, const uint8_t *key ); |
Wayne Roberts |
0:62e456e60083 | 83 | void SerialDisplayUpdateNwkId( uint8_t id ); |
Wayne Roberts |
0:62e456e60083 | 84 | void SerialDisplayUpdateDevAddr( uint32_t addr ); |
Wayne Roberts |
0:62e456e60083 | 85 | void SerialDisplayUpdateFrameType( bool confirmed ); |
Wayne Roberts |
0:62e456e60083 | 86 | void SerialDisplayUpdateAdr( bool adr ); |
Wayne Roberts |
0:62e456e60083 | 87 | void SerialDisplayUpdateDutyCycle( bool dutyCycle ); |
Wayne Roberts |
0:62e456e60083 | 88 | void SerialDisplayUpdatePublicNetwork( bool network ); |
Wayne Roberts |
0:62e456e60083 | 89 | void SerialDisplayUpdateData( const uint8_t *buffer ); |
Wayne Roberts |
0:62e456e60083 | 90 | void SerialDisplayUpdateUplinkAcked( bool state ); |
Wayne Roberts |
0:62e456e60083 | 91 | void SerialDisplayUpdateDonwlinkRxData( bool state ); |
Wayne Roberts |
0:62e456e60083 | 92 | bool SerialDisplayReadable( void ); |
Wayne Roberts |
0:62e456e60083 | 93 | uint8_t SerialDisplayGetChar( void ); |
Wayne Roberts |
0:62e456e60083 | 94 | extern VT100 vt; |
Wayne Roberts |
0:62e456e60083 | 95 | #endif /* ENABLE_VT100 */ |
Wayne Roberts |
0:62e456e60083 | 96 | |
Wayne Roberts |
0:62e456e60083 | 97 | #endif // __SERIAL_DISPLAY_H__ |