Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial LoRaWAN-lib-st-murata ST-DEVKIT-LRWAN mbed
main.h
00001 /* 00002 * Copyright (c) Ivano Calabrese 00003 * Licensed under the Apache License, Version 2.0); 00004 */ 00005 00006 #include "mbed.h" 00007 #include "PinMap.h" 00008 #include "BufferedSerial.h" 00009 //#include "GenericPingPong.h" 00010 00011 void SystemClock_Config(void); 00012 00013 extern BufferedSerial *ser; 00014 extern void dump(const char *title, const void *data, int len, bool dwords = false); 00015 00016 #define dprintf(...) { ser->printf(__VA_ARGS__); ser->printf("\r\n"); } 00017 00018 /*! 00019 * Defines the application data transmission duty cycle. 5s, value in [ms]. 00020 */ 00021 #define APP_TX_DUTYCYCLE 60000 00022 00023 /*! 00024 * Defines a random delay for application data transmission duty cycle. 1s, 00025 * value in [ms]. 00026 */ 00027 #define APP_TX_DUTYCYCLE_RND 1000 00028 00029 00030 /*! 00031 * LoRaWAN application port 00032 */ 00033 #define LORAWAN_APP_PORT 1 00034 00035 #define LORAWAN_APP_DATA_SIZE 1 00036 00037 /*! 00038 * User application data buffer size 00039 */ 00040 #define LORAWAN_APP_DATA_MAX_SIZE 64 00041 00042 /*! 00043 * Mote device IEEE EUI (big endian) 00044 */ 00045 //#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x44, 0x55, 0x66, 0x77, 0x88 } 00046 #define LORAWAN_DEVICE_EUI { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11 } 00047 00048 /*! 00049 * Application IEEE EUI (big endian) 00050 */ 00051 #define LORAWAN_APPLICATION_EUI { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11 } 00052 00053 /*! 00054 * AES encryption/decryption cipher application key 00055 */ 00056 #define LORAWAN_APPLICATION_KEY { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11 } 00057 00058 /*! 00059 * When set to 1 the application uses the Over-the-Air activation procedure 00060 * When set to 0 the application uses the Personalization activation procedure 00061 */ 00062 #define OVER_THE_AIR_ACTIVATION 0 00063 00064 /*! 00065 * Indicates if the end-device is to be connected to a private or public network 00066 */ 00067 #define LORAWAN_PUBLIC_NETWORK true 00068 00069 /*! 00070 * Default datarate 00071 */ 00072 #define LORAWAN_DEFAULT_DATARATE DR_0 00073 00074 /*! 00075 * LoRaWAN confirmed messages 00076 */ 00077 #define LORAWAN_CONFIRMED_MSG_ON false 00078 00079 /*! 00080 * Current network ID 00081 */ 00082 #define LORAWAN_NETWORK_ID ( uint32_t )0 00083 00084 /*! 00085 * Device address on the network (big endian) 00086 */ 00087 #define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x12345678 00088 00089 /*! 00090 * AES encryption/decryption cipher network session key 00091 */ 00092 #define LORAWAN_NWKSKEY { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } 00093 00094 /*! 00095 * AES encryption/decryption cipher application session key 00096 */ 00097 #define LORAWAN_APPSKEY { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } 00098 00099 /*! 00100 * LoRaWAN Adaptive Data Rate 00101 * 00102 * \remark Please note that when ADR is enabled the end-device should be static 00103 */ 00104 #define LORAWAN_ADR_ON 1 00105 00106 #if defined( USE_BAND_868 ) 00107 00108 /*! 00109 * LoRaWAN ETSI duty cycle control enable/disable 00110 * 00111 * \remark Please note that ETSI mandates duty cycled transmissions. Use only for test purposes 00112 */ 00113 #define LORAWAN_DUTYCYCLE_ON false 00114 00115 #define LC4 { 867100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00116 #define LC5 { 867300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00117 #define LC6 { 867500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00118 #define LC7 { 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00119 #define LC8 { 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00120 #define LC9 { 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 } 00121 #define LC10 { 868300000, { ( ( DR_6 << 4 ) | DR_6 ) }, 1 } 00122 00123 #endif 00124 00125 /*! 00126 * Indicates if the MAC layer network join status has changed. 00127 */ 00128 static bool IsNetworkJoinedStatusUpdate = false;
Generated on Wed Jul 13 2022 13:15:10 by
1.7.2