| | |
| | | #include "serial_at_cmd_app.h" |
| | | #include "global_param.h" |
| | | |
| | | #define WORK_MODE_TAG |
| | | //#define WORK_MODE_ANCHOR |
| | | //#define WORK_MODE_TAG |
| | | #define WORK_MODE_ANCHOR |
| | | |
| | | void Device_Init(void) |
| | | { |
| | | // Rcc_Init(); |
| | | SystemInit(); |
| | | RCC_Configuration(); |
| | | //SystemInit(); |
| | | Nvic_Init(); |
| | | Systick_Init(); |
| | | #ifdef WORK_MODE_TAG |
| | |
| | | } |
| | | |
| | | void Program_Init(void) |
| | | { |
| | | {uint16_t i; |
| | | Usart1ParseDataCallback = UsartParseDataHandler; |
| | | parameter_init(); |
| | | for(i=0;i<255;i++) |
| | | { |
| | | g_Tagdist[i]=0xffff; |
| | | } |
| | | } |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | |
| | | int main(void) |
| | | { |
| | | |
| | | |
| | | Device_Init(); |
| | | Program_Init(); |
| | | Dw1000_Init(); |
| | | |
| | | delay_ms(1000); |
| | | #ifdef WORK_MODE_TAG |
| | | tag_sleep_configuraion(); |
| | | #endif |
| | | Dw1000_App_Init(); |
| | | /* Loop forever initiating ranging exchanges. */ |
| | | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); |
| | | while(1) |
| | | { |
| | | #ifdef WORK_MODE_TAG |
| | |
| | | Tag_App(); |
| | | } |
| | | // UART_CheckReceive(); |
| | | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); |
| | | PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); |
| | | #else |
| | | Anchor_App(); |