peripheral.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : peripheral.h
  3. * Author : WCH
  4. * Version : V1.0
  5. * Date : 2018/12/11
  6. * Description :
  7. *********************************************************************************
  8. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  9. * Attention: This software (modified or not) and binary are used for
  10. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
  11. *******************************************************************************/
  12. #ifndef PERIPHERAL_H
  13. #define PERIPHERAL_H
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*********************************************************************
  18. * INCLUDES
  19. */
  20. /*********************************************************************
  21. * CONSTANTS
  22. */
  23. // Simple BLE Peripheral Task Events
  24. #define SBP_START_DEVICE_EVT 0x0001
  25. #define SBP_PERIODIC_EVT 0x0002
  26. #define OTA_FLASH_ERASE_EVT 0x0004 //OTA Flash²Á³ýÈÎÎñ
  27. /*********************************************************************
  28. * MACROS
  29. */
  30. /*********************************************************************
  31. * FUNCTIONS
  32. */
  33. /*
  34. * Task Initialization for the BLE Application
  35. */
  36. extern void Peripheral_Init(void);
  37. /*
  38. * Task Event Processor for the BLE Application
  39. */
  40. extern uint16_t Peripheral_ProcessEvent(uint8_t task_id, uint16_t events);
  41. /*
  42. * Read flash
  43. */
  44. void FLASH_read(uint32_t addr, uint8_t *pData, uint32_t len);
  45. void IAP_FLASH_read(uint32_t addr, uint8_t *pData, uint32_t len);
  46. void app_start(void);
  47. void Upgrade_IAP_Erase(uint16_t addr);
  48. void Upgrade_IAP_Program(uint16_t addr, uint8_t *pData, uint32_t len);
  49. void Upgrade_IAP_End(void);
  50. void SwitchImageFlag(uint8_t new_flag);
  51. /*********************************************************************
  52. *********************************************************************/
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif