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.
main.cpp
00001 /* 00002 / ____) _ | | 00003 ( (____ _____ ____ _| |_ _____ ____| |__ 00004 \____ \| ___ | (_ _) ___ |/ ___) _ \ 00005 _____) ) ____| | | || |_| ____( (___| | | | 00006 (______/|_____)_|_|_| \__)_____)\____)_| |_| 00007 (C)2017 Semtech 00008 00009 */ 00010 00011 #include "mbed.h" 00012 #include "usb_device.h" 00013 #include "usbd_cdc_if.h" 00014 #include "string.h" 00015 #include "CmdUSB.h" 00016 #include "board.h" 00017 00018 #include "loragw_reg.h" 00019 00020 CMDMANAGER CmdManager(PA_9, PA_10); 00021 00022 void Error_Handler(void); 00023 00024 #if DEBUG_MAIN == 1 00025 #define DEBUG_MSG(str) pc.printf(str) 00026 #define DEBUG_PRINTF(fmt, args...) pc.printf("%s:%d: "fmt, __FUNCTION__, __LINE__, args) 00027 #define DEBUG_ARRAY(a,b,c) for(a=0;a!=0;){} 00028 #define CHECK_NULL(a) if(a==NULL){return LGW_HAL_ERROR;} 00029 #else 00030 #define DEBUG_MSG(str) 00031 #define DEBUG_PRINTF(fmt, args...) 00032 #define DEBUG_ARRAY(a,b,c) for(a=0;a!=0;){} 00033 #define CHECK_NULL(a) if(a==NULL){return LGW_HAL_ERROR;} 00034 #endif 00035 00036 void Error_Handler(void) { 00037 DEBUG_MSG("error\n"); 00038 } 00039 00040 int main(void) { 00041 00042 uint8_t dataflash; 00043 00044 /* Check if it is requested to jump to the bootloader (for reflashing...) */ 00045 dataflash = *(uint8_t *)DATA_EEPROM_BASE; 00046 if (dataflash == GOTO_BOOTLOADER) { 00047 FLASH_Prog(DATA_EEPROM_BASE, 0xFF); 00048 ((void (*)(void)) * ((uint32_t*) BOOTLOADER_ADDR))(); 00049 } 00050 00051 /* Initialize the concentrator */ 00052 lgw_connect(); 00053 CmdManager.Init(); 00054 00055 /* Wait for commands coming from host */ 00056 while (1) { 00057 CmdManager.ReceiveCmd(); 00058 if (CmdManager.DecodeCmd()) { 00059 CmdManager.TransmitCmd(); 00060 } 00061 } 00062 }
Generated on Tue Jul 12 2022 22:19:20 by
