app_wrist.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef __WRIST_H
  2. #define __WRIST_H
  3. #include "types.h"
  4. // 启动事件
  5. #define START_DEVICE_EVT 0x0001
  6. // 事件定义
  7. // 该事件用于同步时间, 组件内依赖该事件. 必须要定义该事件
  8. #define TIMER_UI_EVT 0x0002 //for UI timer event
  9. #define TIMER_DT_EVT 0x0004 //for datetime sync
  10. #define TOUCH_PRESS_EVT 0x0008 //for touch key event
  11. #define TIMER_HR_EVT 0x0010 //for heartrate detect
  12. #define TIMER_BATT_EVT 0x0020 //for battery detect
  13. #define BATT_VALUE_EVT 0x0040 //event for battery voltage value update
  14. #define BATT_CHARGE_EVT 0x0080 //event for battery charge status change
  15. #define ACC_DATA_EVT 0x0100 //event for accelerator data change
  16. #define TIMER_LIGHT_EVT 0x0200 //for led light timeout
  17. #define TIMER_KSCAN_DEBOUNCE_EVT 0x0400 //for keyscan debounce
  18. #define TIMER_KSCAN_REPEAT_EVT 0x0800 //for keyscan repeat
  19. #define TIMER_KSCAN_LONG_EVT 0x1000 //for keyscan long press
  20. #define TIMER_KSCAN_LONG_REPEAT_EVT 0x2000 //for keyscan long press repeat
  21. #define TIMER_KSCAN_LONG_REPEAT_STOP_EVT 0x4000 //for keyscan long press repeat stop
  22. // 电池电量监测
  23. #define BATTERY_MONITOR_EVT 0x0004
  24. // 从 pwm 案例中获取的宏定义
  25. // Fast advertising interval in 625us units
  26. #define DEFAULT_FAST_ADV_INTERVAL 32
  27. // Duration of fast advertising duration in ms
  28. #define DEFAULT_FAST_ADV_DURATION 30000
  29. // Slow advertising interval in 625us units
  30. #define DEFAULT_SLOW_ADV_INTERVAL 1600
  31. // Duration of slow advertising duration in ms (set to 0 for continuous advertising)
  32. #define DEFAULT_SLOW_ADV_DURATION 0
  33. // How often to perform heart rate periodic event
  34. #define DEFAULT_HEARTRATE_PERIOD 2000
  35. // Whether to enable automatic parameter update request when a connection is formed
  36. #define DEFAULT_ENABLE_UPDATE_REQUEST FALSE
  37. // Minimum connection interval (units of 1.25ms) if automatic parameter update request is enabled
  38. #define DEFAULT_DESIRED_MIN_CONN_INTERVAL 200
  39. // Maximum connection interval (units of 1.25ms) if automatic parameter update request is enabled
  40. #define DEFAULT_DESIRED_MAX_CONN_INTERVAL 1600
  41. // Slave latency to use if automatic parameter update request is enabled
  42. #define DEFAULT_DESIRED_SLAVE_LATENCY 1
  43. // Supervision timeout value (units of 10ms) if automatic parameter update request is enabled
  44. #define DEFAULT_DESIRED_CONN_TIMEOUT 1000
  45. // 蓝牙名称
  46. #define BleName "bleLight"
  47. // 事件处理Id
  48. extern uint8 AppWrist_TaskID;
  49. // GAP connection handle
  50. static uint16 gapConnHandle;
  51. // 初始化 蓝牙应用
  52. extern void appWristInit( uint8 task_id );
  53. // 应用事件处理器
  54. extern uint16 appWristProcEvt( uint8 task_id, uint16 events );
  55. static void wristCB(uint8 event, uint8 param_size, uint8* param);
  56. #endif /* __WRIST_H */