1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /********************** Í·Îļþ *************************/
- #include "usr.h"
- #include "hal_laser.h"
- #include "system.h"
- #include "bsp_time.h"
- #include "hal_flash.h"
- #include "hal_ble_client.h"
- #include "hal_ble_host.h"
- #if LASER_ENABLE
- static uint8_t isOrganFlag = 0;
- static uint8_t OrganEnable = 0;
- void hal_laser_Enable(uint8_t organOnOff)
- {
- isOrganFlag = organOnOff;
- }
- uint8_t hal_laser_Getstate(void)
- {
- return OrganEnable;
- }
- static void hal_laser_process(void)
- {
- static uint8_t state = 0;
- static uint32_t tim =0;
- if(TIME_GetTicks()-tim>=200){tim = TIME_GetTicks();
- switch(state){
- case 0:
- if(1 == isOrganFlag){
- state =1;
- OrganEnable = 1;
- if(0 == mFlash.isHost)BLE_Client_Tx_Send(0,BLE_CLient_T_SET_ORGAN,&OrganEnable,1);
- }
- break;
- case 1:
- if(0 == isOrganFlag){
- state =0;
- OrganEnable = 0;
- if(0 == mFlash.isHost)BLE_Client_Tx_Send(0,BLE_CLient_T_SET_ORGAN,&OrganEnable,1);
- }
- break;
- }
- }
- }
- void hal_laser_init(void){
- Process_Start(200,"hal_laser_process",hal_laser_process);
- }
- #endif
|