HW_PWM_ATY.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * @file HW_PWM_ATY.h
  3. *
  4. * @param Project DEVICE_GENERAL_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2026 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Familiar definition of PWM for users
  20. *
  21. * @version
  22. * - 1_01_220602 > ATY
  23. * -# Preliminary version, first Release
  24. * - todo
  25. ********************************************************************************
  26. */
  27. #ifndef __HW_PWM_ATY_H
  28. #define __HW_PWM_ATY_H
  29. #include "INCLUDE_ATY.h"
  30. /******************************* For user *************************************/
  31. // #define __DEBUG_HW_PWM_ATY
  32. #if defined (__ATY_IS_8051_COMPILER)
  33. #define PWM1_CHOSE PWM_PIN_POS_0
  34. #define PWM2_CHOSE PWM_PIN_POS_0
  35. #define PWM3_CHOSE PWM_PIN_POS_0
  36. #define PWM4_CHOSE PWM_PIN_POS_0
  37. #define PWM5_CHOSE PWM_PIN_POS_0
  38. #define PWM6_CHOSE PWM_PIN_POS_0
  39. #define PWM7_CHOSE PWM_PIN_POS_0
  40. #define PWM8_CHOSE PWM_PIN_POS_0
  41. #elif defined(USE_HAL_DRIVER)
  42. #endif /* PLATFORM */
  43. // #define PWM_T01C1 0x11
  44. // #define PWM_T01C2 0x12
  45. // #define PWM_T02C1 0x21
  46. /******************************************************************************/
  47. #if defined (__ATY_IS_8051_COMPILER)
  48. #define PWM_CHANNEL_1P 0x01
  49. #define PWM_CHANNEL_1N 0x02
  50. #define PWM_CHANNEL_2P 0x04
  51. #define PWM_CHANNEL_2N 0x08
  52. #define PWM_CHANNEL_3P 0x10
  53. #define PWM_CHANNEL_3N 0x20
  54. #define PWM_CHANNEL_4P 0x40
  55. #define PWM_CHANNEL_4N 0x80
  56. #define PWM_CHANNEL_5P 0xF0
  57. #define PWM_CHANNEL_6P 0xF1
  58. #define PWM_CHANNEL_7P 0xF2
  59. #define PWM_CHANNEL_8P 0xF3
  60. #define PWM_PIN_POS_0 0x00 // PWMN
  61. #define PWM_PIN_POS_1 0x01 // PWMN_2
  62. #define PWM_PIN_POS_2 0x02 // PWMN_3
  63. #define PWM_PIN_POS_3 0x03 // PWMN_4
  64. #elif defined(USE_HAL_DRIVER)
  65. #elif defined(__ESP8266_RTOS_ATY)
  66. #endif /* PLATFORM */
  67. void PWM_Start(uint32_t periodS, float dutyS, uint8_t channelS);
  68. void PWM_Stop(uint8_t level, uint8_t channelS);
  69. void PwmFreqSet(uint32_t periodS, uint8_t channelS);
  70. #if defined (__STC8G_ATY)
  71. void PWM_StartPulse(uint32_t periodS, uint8_t channelS);
  72. #endif
  73. #ifdef __DEBUG_HW_PWM_ATY
  74. void PWM_Test(uint8_t testType);
  75. #endif /* __DEBUG_HW_PWM_ATY */
  76. #endif /* __HW_PWM_ATY_H */
  77. /******************************** End Of File *********************************/