#include "main.h" static uint32_t err_b = 0; /********************** 外部函数声明区 *************************/ uint32_t ERR_Get(void) { return err_b; } void ERR_process(void) { uint32_t ret = IMU_GetError(); if(ret!=err_b){ err_b = ret; LED_AllOff(); } static uint32_t tim=0; if(TIME_GetTicks()-tim>=1000){ tim = TIME_GetTicks(); if(err_b&ERR_IMU_MASK_9DOT){ #if DEBUG_ERROR SEGGER_RTT_printf(0,"ERROR(%08X):ERR_IMU_MASK_9DOT\n",err_b); #endif nrf_gpio_pin_toggle(LED_R); } if(err_b&ERR_IMU_MASK_PRESS){ #if DEBUG_ERROR SEGGER_RTT_printf(0,"ERROR(%08X):ERR_IMU_MASK_PRESS\n",err_b); #endif nrf_gpio_pin_toggle(LED_G); } if(err_b&ERR_IMU_MASK_SLAVE){ #if DEBUG_ERROR SEGGER_RTT_printf(0,"ERROR(%08X):ERR_IMU_MASK_SLAVE\n",err_b); #endif nrf_gpio_pin_toggle(LED_B); } } } void ERR_Init(void) { Process_Regist(ERR_process); }