123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include "hal_mt.h"
- #include "nrf_gpio.h"
- #include "usr_config.h"
- //#include "bsp_time.h"
- #include "system.h"
- #include "hal_ble_client.h"
- #include "hal_ble_host.h"
- /************************ º¯ÊýÉùÃ÷ ***********************************/
- void MT_process(void);
- /************************ ±äÁ¿ ***********************************/
- /************************ º¯Êý¶¨Òå ***********************************/
- static uint32_t mt_time = 0;
- void MT_Run(uint32_t tim)
- {
- SEGGER_RTT_printf(0,"MT MT_Run:%d \n",tim);
- if(tim>0){
- mt_time = tim;
- nrf_gpio_pin_write(PIN_MT_EN,1);
- Process_SetHoldOn(MT_process,1);
- }
- }
- void gpio_mt_run(uint32_t tim)
- {
- MT_Run(tim);
- }
- void MT_process(void)
- {
-
- }
- void MT_TimerCounter(void* t)
- {
- if(mt_time>0){
- if(mt_time >=HeartTime_Interval)mt_time -=HeartTime_Interval;
- else mt_time=0;;
- if(mt_time==0){
- nrf_gpio_pin_write(PIN_MT_EN,0);
- Process_SetHoldOn(MT_process,0);
- }
- }
- }
- void cb_BLE_Client_R_SHOCK(void* handle)
- {
- BLE_Client_Rx_t *target = handle;
- BLE_Host_Tx_Send(0,BLE_SHOCK,target->pDat,target->datLen);
- uint16_t t = ((uint16_t)(target->pDat[0])<<8) | ((uint16_t)(target->pDat[0])<<0);
- MT_Run(t);
- SEGGER_RTT_printf(0,"MT RUN:%d \n",t);
- }
- void MT_Init(void)
- {
- nrf_gpio_cfg_output(PIN_MT_EN); nrf_gpio_pin_write(PIN_MT_EN,0); //MT_Run(20);
- TIME_Regist(MT_TimerCounter);
- Process_Start(0,"MT_process",MT_process);
-
- BLE_Client_Rx_Regist(BLE_SHOCK,cb_BLE_Client_R_SHOCK);
- }
|