![](/media/cache/group/MultiTech_Logo_Color_w_Tagline_PNG_1000px.png.50x50_q85.png)
AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
Dot Library Not Included!
Because these example programs can be used for both mDot and xDot devices, the LoRa stack is not included. The libmDot library should be imported if building for mDot devices. The libxDot library should be imported if building for xDot devices. The AT firmware was last tested with mbed-os-5.4.7. Using a version past mbed-os-5.4.7 will cause the build to fail. The library used with the AT firmware has to match the mbed-os version.
Dot Library Version 3 Updates
Dot Library versions 3.x.x require a channel plan to be injected into the stack. The Dot-Examples and Dot-AT-Firmware do this by defining a macro called "CHANNEL_PLAN" that controls the channel plan that will be used in the examples. Available channel plans will be in the Dot Library repository in the plans folder.
Revision 20 and earlier of Dot-Examples and revision 15 and earlier of Dot-AT-Firmware should be used with Dot Library versions prior to 3.0.0.
Fota Library
Th Fota Library must be added to compile for mDot 3.1.0 with Fota support. Latest dev libraries and 3.2.0 release will include Fota with libmDot/libxDot.
AT Firmware Description
This AT Firmware is what ships on mDot and xDot devices. It provides an AT command interface for using the mDot or xDot for LoRa communication.
AT command documentation can be found on Multitech.com.
The firmware changelog can be found here.
The library changelog can be found here.
Dot Libraries
Dot Library Limitations
The commit messages in libmDot-mbed5 and libmDot-dev-mbed5 specify the version of the Dot library the commit contains and the version of mbed-os it was compiled against. We recommend building your application with the version of mbed-os specified in the commit message of the version of the Dot library you're using. This will ensure that you don't run into any runtime issues caused by differences in the mbed-os versions.
Stable and development libraries are available for both mDot and xDot platforms. The library chosen must match the target platform. Compiling for the mDot platform with the xDot library or vice versa will not succeed.
mDot Library
Development library for mDot.
Stable library for mDot.
xDot Library
Development library for xDot.
Stable library for xDot.
main.cpp@36:b586cd6e91f3, 11 months ago (annotated)
- Committer:
- Jason Reiss
- Date:
- Fri Sep 08 08:34:24 2023 -0500
- Revision:
- 36:b586cd6e91f3
- Parent:
- 28:c222ca8383f4
- Child:
- 41:df1086032bb4
Update AT Version to 4.2.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
9:ff62b20f7000 | 1 | #include "mbed.h" |
Mike Fiore |
9:ff62b20f7000 | 2 | #include "mDot.h" |
Mike Fiore |
9:ff62b20f7000 | 3 | #include "CommandTerminal.h" |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 4 | #include "ChannelPlans.h" |
Mike Fiore |
9:ff62b20f7000 | 5 | |
Jason Reiss |
28:c222ca8383f4 | 6 | #if defined(TARGET_XDOT_L151CC) && defined(FOTA) |
Jason Reiss |
28:c222ca8383f4 | 7 | #include "SPIFBlockDevice.h" |
Jason Reiss |
28:c222ca8383f4 | 8 | #include "DataFlashBlockDevice.h" |
Jason Reiss |
28:c222ca8383f4 | 9 | #endif |
Jason Reiss |
28:c222ca8383f4 | 10 | |
Jason Reiss |
36:b586cd6e91f3 | 11 | #if defined(TARGET_XDOT_L151CC) && defined(FOTA) |
Jason Reiss |
28:c222ca8383f4 | 12 | |
Jason Reiss |
36:b586cd6e91f3 | 13 | mbed::BlockDevice* ext_bd = NULL; |
Jason Reiss |
36:b586cd6e91f3 | 14 | |
Jason Reiss |
36:b586cd6e91f3 | 15 | mbed::BlockDevice * mdot_override_external_block_device() |
Jason Reiss |
28:c222ca8383f4 | 16 | { |
Jason Reiss |
36:b586cd6e91f3 | 17 | if (ext_bd == NULL) { |
Jason Reiss |
36:b586cd6e91f3 | 18 | ext_bd = new SPIFBlockDevice(); |
Jason Reiss |
36:b586cd6e91f3 | 19 | int ret = ext_bd->init(); |
Jason Reiss |
36:b586cd6e91f3 | 20 | if (ext_bd->init() < 0) { |
Jason Reiss |
36:b586cd6e91f3 | 21 | delete ext_bd; |
Jason Reiss |
36:b586cd6e91f3 | 22 | ext_bd = new DataFlashBlockDevice(); |
Jason Reiss |
36:b586cd6e91f3 | 23 | ret = ext_bd->init(); |
Jason Reiss |
36:b586cd6e91f3 | 24 | // Check for zero size because DataFlashBlockDevice doesn't |
Jason Reiss |
36:b586cd6e91f3 | 25 | // return an error if the chip is not present |
Jason Reiss |
36:b586cd6e91f3 | 26 | if ((ret < 0) || (ext_bd->size() == 0)) { |
Jason Reiss |
36:b586cd6e91f3 | 27 | delete ext_bd; |
Jason Reiss |
36:b586cd6e91f3 | 28 | ext_bd = NULL; |
Jason Reiss |
36:b586cd6e91f3 | 29 | } |
Jason Reiss |
36:b586cd6e91f3 | 30 | } |
Jason Reiss |
28:c222ca8383f4 | 31 | |
Jason Reiss |
36:b586cd6e91f3 | 32 | if (ext_bd != NULL) { |
Jason Reiss |
36:b586cd6e91f3 | 33 | logInfo("External flash device detected, type: %s, size: 0x%08x", |
Jason Reiss |
36:b586cd6e91f3 | 34 | ext_bd->get_type(), (uint32_t)ext_bd->size()); |
Jason Reiss |
36:b586cd6e91f3 | 35 | } |
Jason Reiss |
36:b586cd6e91f3 | 36 | } |
Mike Fiore |
9:ff62b20f7000 | 37 | |
Jason Reiss |
36:b586cd6e91f3 | 38 | return ext_bd; |
Jason Reiss |
36:b586cd6e91f3 | 39 | } |
Jason Reiss |
36:b586cd6e91f3 | 40 | #endif |
Jason Reiss |
36:b586cd6e91f3 | 41 | |
Jason Reiss |
36:b586cd6e91f3 | 42 | #if defined(TARGET_MTS_MDOT_F411RE) // ----------------------------------------------------------- |
Jason Reiss |
36:b586cd6e91f3 | 43 | |
Jason Reiss |
28:c222ca8383f4 | 44 | #define AT_TX_PIN XBEE_DOUT |
Jason Reiss |
28:c222ca8383f4 | 45 | #define AT_RX_PIN XBEE_DIN |
Jason Reiss |
28:c222ca8383f4 | 46 | #define AT_RTS_PIN XBEE_RTS |
Jason Reiss |
28:c222ca8383f4 | 47 | #define AT_CTS_PIN XBEE_CTS |
Jason Reiss |
36:b586cd6e91f3 | 48 | |
Jason Reiss |
36:b586cd6e91f3 | 49 | #define DEBUG_TX USBTX |
Jason Reiss |
36:b586cd6e91f3 | 50 | #define DEBUG_RX USBRX |
Jason Reiss |
36:b586cd6e91f3 | 51 | |
Jason Reiss |
36:b586cd6e91f3 | 52 | #elif defined(TARGET_XDOT_L151CC) // ----------------------------------------------------------- |
Jason Reiss |
36:b586cd6e91f3 | 53 | |
Jason Reiss |
28:c222ca8383f4 | 54 | #define AT_TX_PIN UART1_TX |
Jason Reiss |
28:c222ca8383f4 | 55 | #define AT_RX_PIN UART1_RX |
Jason Reiss |
28:c222ca8383f4 | 56 | #define AT_RTS_PIN UART1_RTS |
Jason Reiss |
28:c222ca8383f4 | 57 | #define AT_CTS_PIN UART1_CTS |
Jason Reiss |
36:b586cd6e91f3 | 58 | |
Jason Reiss |
36:b586cd6e91f3 | 59 | #define DEBUG_TX USBTX |
Jason Reiss |
36:b586cd6e91f3 | 60 | #define DEBUG_RX USBRX |
Jason Reiss |
36:b586cd6e91f3 | 61 | |
Jason Reiss |
36:b586cd6e91f3 | 62 | #elif defined(TARGET_NUCLEO_L476RG) // ----------------------------------------------------------- |
Jason Reiss |
36:b586cd6e91f3 | 63 | |
Jason Reiss |
36:b586cd6e91f3 | 64 | #define AT_TX_PIN D0 |
Jason Reiss |
36:b586cd6e91f3 | 65 | #define AT_RX_PIN D1 |
Jason Reiss |
36:b586cd6e91f3 | 66 | #define AT_RTS_PIN D7 |
Jason Reiss |
36:b586cd6e91f3 | 67 | #define AT_CTS_PIN D8 |
Jason Reiss |
36:b586cd6e91f3 | 68 | |
Jason Reiss |
36:b586cd6e91f3 | 69 | #define DEBUG_TX USBTX |
Jason Reiss |
36:b586cd6e91f3 | 70 | #define DEBUG_RX USBRX |
Jason Reiss |
36:b586cd6e91f3 | 71 | |
Jason Reiss |
36:b586cd6e91f3 | 72 | #elif defined(TARGET_MAX32630FTHR) // ----------------------------------------------------------- |
Jason Reiss |
36:b586cd6e91f3 | 73 | #define AT_TX_PIN UART2_TX |
Jason Reiss |
36:b586cd6e91f3 | 74 | #define AT_RX_PIN UART2_RX |
Jason Reiss |
36:b586cd6e91f3 | 75 | #define AT_RTS_PIN UART2_RTS |
Jason Reiss |
36:b586cd6e91f3 | 76 | #define AT_CTS_PIN UART2_CTS |
Jason Reiss |
36:b586cd6e91f3 | 77 | |
Jason Reiss |
36:b586cd6e91f3 | 78 | #define DEBUG_TX USBTX |
Jason Reiss |
36:b586cd6e91f3 | 79 | #define DEBUG_RX USBRX |
Jason Reiss |
36:b586cd6e91f3 | 80 | |
Jason Reiss |
36:b586cd6e91f3 | 81 | #include "MAX14690.h" |
Jason Reiss |
36:b586cd6e91f3 | 82 | |
Jason Reiss |
36:b586cd6e91f3 | 83 | I2C i2cBus(I2C2_SDA, I2C2_SCL); // P5_7, P6_0 |
Jason Reiss |
36:b586cd6e91f3 | 84 | |
Jason Reiss |
36:b586cd6e91f3 | 85 | MAX14690 max14690(&i2cBus); |
Jason Reiss |
36:b586cd6e91f3 | 86 | |
Jason Reiss |
36:b586cd6e91f3 | 87 | #elif defined(TARGET_MAX32660EVSYS) // ----------------------------------------------------------- |
Jason Reiss |
36:b586cd6e91f3 | 88 | |
Jason Reiss |
36:b586cd6e91f3 | 89 | #if defined(SWAP_UARTS) |
Jason Reiss |
36:b586cd6e91f3 | 90 | #define AT_TX_PIN UART0_TX |
Jason Reiss |
36:b586cd6e91f3 | 91 | #define AT_RX_PIN UART0_RX |
Jason Reiss |
36:b586cd6e91f3 | 92 | #define AT_RTS_PIN NC |
Jason Reiss |
36:b586cd6e91f3 | 93 | #define AT_CTS_PIN NC |
Jason Reiss |
36:b586cd6e91f3 | 94 | |
Jason Reiss |
36:b586cd6e91f3 | 95 | #define DEBUG_TX UART1C_TX |
Jason Reiss |
36:b586cd6e91f3 | 96 | #define DEBUG_RX UART1C_RX |
Jason Reiss |
36:b586cd6e91f3 | 97 | |
Jason Reiss |
28:c222ca8383f4 | 98 | #else |
Jason Reiss |
36:b586cd6e91f3 | 99 | #define AT_TX_PIN UART1C_TX |
Jason Reiss |
36:b586cd6e91f3 | 100 | #define AT_RX_PIN UART1C_RX |
Jason Reiss |
36:b586cd6e91f3 | 101 | #define AT_RTS_PIN NC |
Jason Reiss |
36:b586cd6e91f3 | 102 | #define AT_CTS_PIN NC |
Jason Reiss |
36:b586cd6e91f3 | 103 | |
Jason Reiss |
36:b586cd6e91f3 | 104 | #define DEBUG_TX UART0_TX |
Jason Reiss |
36:b586cd6e91f3 | 105 | #define DEBUG_RX UART0_RX |
Jason Reiss |
36:b586cd6e91f3 | 106 | #endif |
Jason Reiss |
36:b586cd6e91f3 | 107 | |
Jason Reiss |
36:b586cd6e91f3 | 108 | #include "flc.h" |
Jason Reiss |
36:b586cd6e91f3 | 109 | |
Jason Reiss |
36:b586cd6e91f3 | 110 | #elif defined(TARGET_MAX32670EVKIT) || defined(TARGET_XDOT_MAX32670) // ----------------------------------------------------------- |
Jason Reiss |
36:b586cd6e91f3 | 111 | |
Jason Reiss |
36:b586cd6e91f3 | 112 | #define AT_TX_PIN UART0_TX // UART0A_TX - P0_9 |
Jason Reiss |
36:b586cd6e91f3 | 113 | #define AT_RX_PIN UART0_RX // UART0A_RX - P0_8 |
Jason Reiss |
36:b586cd6e91f3 | 114 | #define AT_RTS_PIN UART0_RTS |
Jason Reiss |
36:b586cd6e91f3 | 115 | #define AT_CTS_PIN UART0_CTS |
Jason Reiss |
36:b586cd6e91f3 | 116 | |
Jason Reiss |
36:b586cd6e91f3 | 117 | #define DEBUG_TX UART1_TX // UART1A_TX - P0_29 |
Jason Reiss |
36:b586cd6e91f3 | 118 | #define DEBUG_RX UART1_RX // UART1A_RX - P0_28 |
Jason Reiss |
36:b586cd6e91f3 | 119 | |
Jason Reiss |
36:b586cd6e91f3 | 120 | #include "pwrseq_regs.h" |
Jason Reiss |
36:b586cd6e91f3 | 121 | #include "lp.h" |
Jason Reiss |
36:b586cd6e91f3 | 122 | |
Jason Reiss |
36:b586cd6e91f3 | 123 | #else // ----------------------------------------------------------------------------------------- |
Jason Reiss |
28:c222ca8383f4 | 124 | #error Unsupported target |
Jason Reiss |
28:c222ca8383f4 | 125 | #endif |
Mike Fiore |
14:f9a77400b622 | 126 | |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 127 | #ifndef CHANNEL_PLAN |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 128 | #define CHANNEL_PLAN CP_US915 |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 129 | #endif |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 130 | |
Mike Fiore |
14:f9a77400b622 | 131 | #ifndef UNIT_TEST |
Jason Reiss |
23:4f0a981c0349 | 132 | #ifndef UNIT_TEST_MDOT_LIB |
Jason Reiss |
28:c222ca8383f4 | 133 | |
Jason Reiss |
36:b586cd6e91f3 | 134 | |
Jason Reiss |
36:b586cd6e91f3 | 135 | mbed::UnbufferedSerial debug_port(DEBUG_TX, DEBUG_RX, LOG_DEFAULT_BAUD_RATE); |
Jason Reiss |
36:b586cd6e91f3 | 136 | |
Jason Reiss |
36:b586cd6e91f3 | 137 | FileHandle *mbed::mbed_override_console(int fd) |
Jason Reiss |
36:b586cd6e91f3 | 138 | { |
Jason Reiss |
36:b586cd6e91f3 | 139 | return &debug_port; |
Jason Reiss |
36:b586cd6e91f3 | 140 | } |
Jason Reiss |
36:b586cd6e91f3 | 141 | |
Jason Reiss |
28:c222ca8383f4 | 142 | |
Mike Fiore |
9:ff62b20f7000 | 143 | int main() |
Mike Fiore |
9:ff62b20f7000 | 144 | { |
Jason Reiss |
36:b586cd6e91f3 | 145 | #if defined(TARGET_XDOT_MAX32670) || defined(TARGET_XDOTES_MAX32670) |
Jason Reiss |
36:b586cd6e91f3 | 146 | |
Jason Reiss |
36:b586cd6e91f3 | 147 | // Port 1 has no pins exposed but must be configured for "low power". |
Jason Reiss |
36:b586cd6e91f3 | 148 | MXC_GPIO1->en0 = 0xFFFFFFFFUL; |
Jason Reiss |
36:b586cd6e91f3 | 149 | MXC_GPIO1->outen = 0xFFFFFFFFUL; |
Jason Reiss |
36:b586cd6e91f3 | 150 | MXC_GPIO1->padctrl0 = 0xFFFFFFFFUL; |
Jason Reiss |
36:b586cd6e91f3 | 151 | MXC_GPIO1->ps = 0x00000000UL; |
Jason Reiss |
36:b586cd6e91f3 | 152 | |
Jason Reiss |
36:b586cd6e91f3 | 153 | #if defined(TARGET_XDOTES_MAX32670) |
Jason Reiss |
36:b586cd6e91f3 | 154 | printf("\r\nXDOTES\r\n"); |
Jason Reiss |
36:b586cd6e91f3 | 155 | #elif defined(TARGET_XDOT_MAX32670) |
Jason Reiss |
36:b586cd6e91f3 | 156 | printf("\r\nXDOT15\r\n"); |
Jason Reiss |
36:b586cd6e91f3 | 157 | #endif |
Jason Reiss |
36:b586cd6e91f3 | 158 | |
Jason Reiss |
36:b586cd6e91f3 | 159 | // Work around to be moved to SystemInit.c |
Jason Reiss |
36:b586cd6e91f3 | 160 | // MXC_PWRSEQ->lpcn &= ~(1 << 31); // Ensure ERTCO is on |
Jason Reiss |
36:b586cd6e91f3 | 161 | |
Jason Reiss |
36:b586cd6e91f3 | 162 | #endif |
Jason Reiss |
36:b586cd6e91f3 | 163 | #if defined(TARGET_MAX32630FTHR) |
Jason Reiss |
36:b586cd6e91f3 | 164 | i2cBus.frequency(400000); |
Jason Reiss |
36:b586cd6e91f3 | 165 | |
Jason Reiss |
36:b586cd6e91f3 | 166 | max14690.ldo2Millivolts = 3300; |
Jason Reiss |
36:b586cd6e91f3 | 167 | max14690.ldo3Millivolts = 3300; |
Jason Reiss |
36:b586cd6e91f3 | 168 | max14690.ldo2Mode = MAX14690::LDO_ENABLED; |
Jason Reiss |
36:b586cd6e91f3 | 169 | max14690.ldo3Mode = MAX14690::LDO_ENABLED; |
Jason Reiss |
36:b586cd6e91f3 | 170 | max14690.monCfg = MAX14690::MON_HI_Z; |
Jason Reiss |
36:b586cd6e91f3 | 171 | if (max14690.init() == MAX14690_ERROR) { |
Jason Reiss |
36:b586cd6e91f3 | 172 | printf("Error initializing MAX14690.\r\n"); |
Jason Reiss |
36:b586cd6e91f3 | 173 | } else { |
Jason Reiss |
36:b586cd6e91f3 | 174 | printf("MAX14690 PMIC initialization is successful.\r\n"); |
Jason Reiss |
36:b586cd6e91f3 | 175 | } |
Jason Reiss |
36:b586cd6e91f3 | 176 | #endif |
Jason Reiss |
36:b586cd6e91f3 | 177 | #if defined(DEBUG_MAC) && defined(TARGET_MTS_MDOT_F411RE) && CHANNEL_PLAN != CP_GLOBAL |
Jason Reiss |
27:5fafd3b26ac3 | 178 | lora::ChannelPlan* plan = new lora::ChannelPlan_US915(); |
Jason Reiss |
27:5fafd3b26ac3 | 179 | mDot* dot = mDot::getInstance(plan); |
Jason Reiss |
27:5fafd3b26ac3 | 180 | #else |
Jason Reiss |
36:b586cd6e91f3 | 181 | lora::ChannelPlan* plan; |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 182 | #if CHANNEL_PLAN == CP_AS923 |
Jason Reiss |
36:b586cd6e91f3 | 183 | plan = new lora::ChannelPlan_AS923(); |
Jason Reiss |
28:c222ca8383f4 | 184 | #elif CHANNEL_PLAN == CP_AS923_2 |
Jason Reiss |
36:b586cd6e91f3 | 185 | plan = new lora::ChannelPlan_AS923(); |
Jason Reiss |
28:c222ca8383f4 | 186 | #elif CHANNEL_PLAN == CP_AS923_3 |
Jason Reiss |
36:b586cd6e91f3 | 187 | plan = new lora::ChannelPlan_AS923(); |
Jason Reiss |
36:b586cd6e91f3 | 188 | #elif CHANNEL_PLAN == CP_AS923_4 |
Jason Reiss |
36:b586cd6e91f3 | 189 | plan = new lora::ChannelPlan_AS923(); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 190 | #elif CHANNEL_PLAN == CP_US915 |
Jason Reiss |
36:b586cd6e91f3 | 191 | plan = new lora::ChannelPlan_US915(); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 192 | #elif CHANNEL_PLAN == CP_AU915 |
Jason Reiss |
36:b586cd6e91f3 | 193 | plan = new lora::ChannelPlan_AU915(); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 194 | #elif CHANNEL_PLAN == CP_EU868 |
Jason Reiss |
36:b586cd6e91f3 | 195 | plan = new lora::ChannelPlan_EU868(); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 196 | #elif CHANNEL_PLAN == CP_KR920 |
Jason Reiss |
36:b586cd6e91f3 | 197 | plan = new lora::ChannelPlan_KR920(); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 198 | #elif CHANNEL_PLAN == CP_IN865 |
Jason Reiss |
36:b586cd6e91f3 | 199 | plan = new lora::ChannelPlan_IN865(); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 200 | #elif CHANNEL_PLAN == CP_AS923_JAPAN |
Jason Reiss |
36:b586cd6e91f3 | 201 | plan = new lora::ChannelPlan_AS923_Japan(); |
Jason Reiss |
28:c222ca8383f4 | 202 | #elif CHANNEL_PLAN == CP_AS923_JAPAN1 |
Jason Reiss |
36:b586cd6e91f3 | 203 | plan = new lora::ChannelPlan_AS923_Japan1(); |
Jason Reiss |
28:c222ca8383f4 | 204 | #elif CHANNEL_PLAN == CP_AS923_JAPAN2 |
Jason Reiss |
36:b586cd6e91f3 | 205 | plan = new lora::ChannelPlan_AS923_Japan2(); |
Jason Reiss |
23:4f0a981c0349 | 206 | #elif CHANNEL_PLAN == CP_RU864 |
Jason Reiss |
36:b586cd6e91f3 | 207 | plan = new lora::ChannelPlan_RU864(); |
Jason Reiss |
36:b586cd6e91f3 | 208 | #elif CHANNEL_PLAN == CP_CN470 |
Jason Reiss |
36:b586cd6e91f3 | 209 | plan = new lora::ChannelPlan_CN470(); |
Jason Reiss |
36:b586cd6e91f3 | 210 | #elif CHANNEL_PLAN == CP_GLOBAL |
Jason Reiss |
36:b586cd6e91f3 | 211 | plan = new lora::ChannelPlan_GLOBAL(CHANNEL_PLAN); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 212 | #endif |
Jason Reiss |
36:b586cd6e91f3 | 213 | mDot* dot = mDot::getInstance(plan); |
Jason Reiss |
27:5fafd3b26ac3 | 214 | #endif //MTS_MDOT_F411RE |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 215 | assert(dot); |
Jason Reiss |
36:b586cd6e91f3 | 216 | #if CHANNEL_PLAN == CP_GLOBAL |
Jason Reiss |
36:b586cd6e91f3 | 217 | // libmDot loads correct plan |
Jason Reiss |
36:b586cd6e91f3 | 218 | #elif defined(TARGET_MAX32660EVSYS) || defined(TARGET_MAX32630FTHR) |
Jason Reiss |
36:b586cd6e91f3 | 219 | logDebug("Loading default channel plan %02x", dot->getDefaultFrequencyBand()); |
Jason Reiss |
36:b586cd6e91f3 | 220 | switch (dot->getDefaultFrequencyBand()) { |
Jason Reiss |
36:b586cd6e91f3 | 221 | case lora::ChannelPlan::US915: |
Jason Reiss |
36:b586cd6e91f3 | 222 | case lora::ChannelPlan::US915_OLD: |
Jason Reiss |
36:b586cd6e91f3 | 223 | delete plan; |
Jason Reiss |
36:b586cd6e91f3 | 224 | plan = new lora::ChannelPlan_US915(); |
Jason Reiss |
36:b586cd6e91f3 | 225 | break; |
Mike Fiore |
9:ff62b20f7000 | 226 | |
Jason Reiss |
36:b586cd6e91f3 | 227 | case lora::ChannelPlan::AU915: |
Jason Reiss |
36:b586cd6e91f3 | 228 | case lora::ChannelPlan::AU915_OLD: |
Jason Reiss |
36:b586cd6e91f3 | 229 | delete plan; |
Jason Reiss |
36:b586cd6e91f3 | 230 | plan = new lora::ChannelPlan_AU915(); |
Jason Reiss |
36:b586cd6e91f3 | 231 | break; |
Jason Reiss |
36:b586cd6e91f3 | 232 | |
Jason Reiss |
36:b586cd6e91f3 | 233 | case lora::ChannelPlan::EU868: |
Jason Reiss |
36:b586cd6e91f3 | 234 | case lora::ChannelPlan::EU868_OLD: |
Jason Reiss |
36:b586cd6e91f3 | 235 | delete plan; |
Jason Reiss |
36:b586cd6e91f3 | 236 | plan = new lora::ChannelPlan_EU868(); |
Jason Reiss |
36:b586cd6e91f3 | 237 | break; |
Jason Reiss |
36:b586cd6e91f3 | 238 | default: |
Jason Reiss |
36:b586cd6e91f3 | 239 | logInfo("Default channel plan not valid Defaulting US915"); |
Jason Reiss |
36:b586cd6e91f3 | 240 | delete plan; |
Jason Reiss |
36:b586cd6e91f3 | 241 | plan = new lora::ChannelPlan_US915(); |
Jason Reiss |
36:b586cd6e91f3 | 242 | break; |
Jason Reiss |
36:b586cd6e91f3 | 243 | } |
Jason Reiss |
36:b586cd6e91f3 | 244 | dot->setChannelPlan(plan); |
Jason Reiss |
36:b586cd6e91f3 | 245 | #elif defined(DEBUG_MAC) && defined(TARGET_MTS_MDOT_F411RE) |
Jason Reiss |
27:5fafd3b26ac3 | 246 | logDebug("Loading default channel plan %02x", dot->getDefaultFrequencyBand()); |
Jason Reiss |
27:5fafd3b26ac3 | 247 | switch (dot->getDefaultFrequencyBand()) { |
Jason Reiss |
27:5fafd3b26ac3 | 248 | case lora::ChannelPlan::AS923: |
Jason Reiss |
28:c222ca8383f4 | 249 | case lora::ChannelPlan::AS923_2: |
Jason Reiss |
28:c222ca8383f4 | 250 | case lora::ChannelPlan::AS923_3: |
Jason Reiss |
28:c222ca8383f4 | 251 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 252 | plan = new lora::ChannelPlan_AS923(); |
Jason Reiss |
27:5fafd3b26ac3 | 253 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 254 | |
Jason Reiss |
28:c222ca8383f4 | 255 | case lora::ChannelPlan::US915: |
Jason Reiss |
27:5fafd3b26ac3 | 256 | case lora::ChannelPlan::US915_OLD: |
Jason Reiss |
27:5fafd3b26ac3 | 257 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 258 | plan = new lora::ChannelPlan_US915(); |
Jason Reiss |
27:5fafd3b26ac3 | 259 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 260 | |
Jason Reiss |
28:c222ca8383f4 | 261 | case lora::ChannelPlan::AU915: |
Jason Reiss |
27:5fafd3b26ac3 | 262 | case lora::ChannelPlan::AU915_OLD: |
Jason Reiss |
27:5fafd3b26ac3 | 263 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 264 | plan = new lora::ChannelPlan_AU915(); |
Jason Reiss |
27:5fafd3b26ac3 | 265 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 266 | |
Jason Reiss |
28:c222ca8383f4 | 267 | case lora::ChannelPlan::EU868: |
Jason Reiss |
27:5fafd3b26ac3 | 268 | case lora::ChannelPlan::EU868_OLD: |
Jason Reiss |
27:5fafd3b26ac3 | 269 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 270 | plan = new lora::ChannelPlan_EU868(); |
Jason Reiss |
27:5fafd3b26ac3 | 271 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 272 | |
Jason Reiss |
27:5fafd3b26ac3 | 273 | case lora::ChannelPlan::KR920: |
Jason Reiss |
27:5fafd3b26ac3 | 274 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 275 | plan = new lora::ChannelPlan_KR920(); |
Jason Reiss |
27:5fafd3b26ac3 | 276 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 277 | |
Jason Reiss |
27:5fafd3b26ac3 | 278 | case lora::ChannelPlan::AS923_JAPAN: |
Jason Reiss |
27:5fafd3b26ac3 | 279 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 280 | plan = new lora::ChannelPlan_AS923_Japan(); |
Jason Reiss |
27:5fafd3b26ac3 | 281 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 282 | |
Jason Reiss |
28:c222ca8383f4 | 283 | case lora::ChannelPlan::AS923_JAPAN1: |
Jason Reiss |
28:c222ca8383f4 | 284 | delete plan; |
Jason Reiss |
28:c222ca8383f4 | 285 | plan = new lora::ChannelPlan_AS923_Japan1(); |
Jason Reiss |
28:c222ca8383f4 | 286 | break; |
Jason Reiss |
28:c222ca8383f4 | 287 | |
Jason Reiss |
28:c222ca8383f4 | 288 | case lora::ChannelPlan::AS923_JAPAN2: |
Jason Reiss |
28:c222ca8383f4 | 289 | delete plan; |
Jason Reiss |
28:c222ca8383f4 | 290 | plan = new lora::ChannelPlan_AS923_Japan2(); |
Jason Reiss |
28:c222ca8383f4 | 291 | break; |
Jason Reiss |
28:c222ca8383f4 | 292 | |
Jason Reiss |
27:5fafd3b26ac3 | 293 | case lora::ChannelPlan::IN865: |
Jason Reiss |
27:5fafd3b26ac3 | 294 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 295 | plan = new lora::ChannelPlan_IN865(); |
Jason Reiss |
27:5fafd3b26ac3 | 296 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 297 | |
Jason Reiss |
27:5fafd3b26ac3 | 298 | case lora::ChannelPlan::RU864: |
Jason Reiss |
27:5fafd3b26ac3 | 299 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 300 | plan = new lora::ChannelPlan_RU864(); |
Jason Reiss |
27:5fafd3b26ac3 | 301 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 302 | |
Jason Reiss |
27:5fafd3b26ac3 | 303 | default: |
Jason Reiss |
27:5fafd3b26ac3 | 304 | logInfo("Default channel plan not valid Defaulting US915"); |
Jason Reiss |
27:5fafd3b26ac3 | 305 | delete plan; |
Jason Reiss |
27:5fafd3b26ac3 | 306 | plan = new lora::ChannelPlan_US915(); |
Jason Reiss |
27:5fafd3b26ac3 | 307 | break; |
Jason Reiss |
27:5fafd3b26ac3 | 308 | } |
Jason Reiss |
27:5fafd3b26ac3 | 309 | dot->setChannelPlan(plan); |
Jason Reiss |
27:5fafd3b26ac3 | 310 | #endif |
Mike Fiore |
9:ff62b20f7000 | 311 | // Seed the RNG |
Mike Fiore |
9:ff62b20f7000 | 312 | srand(dot->getRadioRandom()); |
Mike Fiore |
9:ff62b20f7000 | 313 | |
Jason Reiss |
36:b586cd6e91f3 | 314 | mts::ATSerial serial(AT_TX_PIN, AT_RX_PIN, AT_RTS_PIN, AT_CTS_PIN, dot->getBaud()); |
Jason Reiss |
36:b586cd6e91f3 | 315 | serial.flowControl(dot->getFlowControl()); |
Mike Fiore |
9:ff62b20f7000 | 316 | |
jenkins@jenkinsdm1 | 18:63f098f042b2 | 317 | debug_port.baud(dot->getDebugBaud()); |
Mike Fiore |
9:ff62b20f7000 | 318 | |
Jason Reiss |
28:c222ca8383f4 | 319 | CommandTerminal term(serial); |
Mike Fiore |
14:f9a77400b622 | 320 | CommandTerminal::_dot = dot; |
jenkins@jenkinsdm1 | 22:a13ac7df92c0 | 321 | |
Mike Fiore |
14:f9a77400b622 | 322 | term.init(); |
Mike Fiore |
9:ff62b20f7000 | 323 | term.start(); |
Mike Fiore |
9:ff62b20f7000 | 324 | } |
Mike Fiore |
14:f9a77400b622 | 325 | |
Mike Fiore |
14:f9a77400b622 | 326 | #endif // UNIT_TEST |
Jason Reiss |
23:4f0a981c0349 | 327 | #endif |