/********************** 头文件 *************************/ #include "bsp_gpio.h" /********************** 变量区 *************************/ /********************** 函数声明区 *************************/ void LED_AllOff(void) { nrf_gpio_pin_write(LED_RUN,1); nrf_gpio_pin_write(LED_R,1); nrf_gpio_pin_write(LED_G,1); nrf_gpio_pin_write(LED_B,1); } void LED_process(void) { #if DEBUG_LEDRUN static uint32_t tim=0; if(TIME_GetTicks()-tim>=100){ tim = TIME_GetTicks(); uint32_t err = ERR_Get(); if(err==0) nrf_gpio_pin_toggle(LED_RUN); } #endif } void LED_Init(void) { //TF_DET_PIN nrf_gpio_cfg_output(LED_RUN); nrf_gpio_pin_write(LED_RUN,1); nrf_gpio_cfg_output(LED_R); nrf_gpio_pin_write(LED_R,1); nrf_gpio_cfg_output(LED_G); nrf_gpio_pin_write(LED_G,1); nrf_gpio_cfg_output(LED_B); nrf_gpio_pin_write(LED_B,1); nrf_gpio_cfg_input(TF_DET_PIN,NRF_GPIO_PIN_PULLUP); } static uint32_t mt_time = 0; void gpio_mt_run(uint32_t tim) { mt_time = tim; nrf_gpio_pin_write(MT_EN,1); } void gpio_mt_process(void* T) { if(mt_time>0){ mt_time--; if(mt_time==0) nrf_gpio_pin_write(MT_EN,0); } } void MT_Init(void) { nrf_gpio_cfg_output(MT_EN); nrf_gpio_pin_write(MT_EN,0); gpio_mt_run(10); TIME_Regist(gpio_mt_process); } void GPIO_init(void) { LED_Init(); MT_Init(); }