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 - 2023 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. * - Undone
  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(__STC51_ATY)
  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(__STM32_HAL_ATY)
  42. #endif /* PLATFORM */
  43. /******************************************************************************/
  44. #if defined(__STC51_ATY)
  45. #define PWM_CHANNEL_1P 0x01
  46. #define PWM_CHANNEL_1N 0x02
  47. #define PWM_CHANNEL_2P 0x04
  48. #define PWM_CHANNEL_2N 0x08
  49. #define PWM_CHANNEL_3P 0x10
  50. #define PWM_CHANNEL_3N 0x20
  51. #define PWM_CHANNEL_4P 0x40
  52. #define PWM_CHANNEL_4N 0x80
  53. #define PWM_CHANNEL_5P 0xF0
  54. #define PWM_CHANNEL_6P 0xF1
  55. #define PWM_CHANNEL_7P 0xF2
  56. #define PWM_CHANNEL_8P 0xF3
  57. #define PWM_PIN_POS_0 0x00 // PWMN
  58. #define PWM_PIN_POS_1 0x01 // PWMN_2
  59. #define PWM_PIN_POS_2 0x02 // PWMN_3
  60. #define PWM_PIN_POS_3 0x03 // PWMN_4
  61. #elif defined(__STM32_HAL_ATY)
  62. #define PWM_T2C2 0x22
  63. #define PWM_T3C3 0x33
  64. // #define PWM_T
  65. // #define PWM_C
  66. #elif defined(__ESP8266_RTOS_ATY)
  67. #endif /* PLATFORM */
  68. void PWM_Start(uint32_t periodS, float dutyS, uint8_t channelS);
  69. void PWM_Stop(uint8_t level, uint8_t channelS);
  70. void PwmFreqSet(uint32_t periodS, uint8_t channelS);
  71. #if defined(__STC8G_ATY)
  72. void PWM_StartPulse(uint32_t periodS, uint8_t channelS);
  73. #endif
  74. #ifdef __DEBUG_HW_PWM_ATY
  75. void PWM_Test(uint8_t testType);
  76. #endif /* __DEBUG_HW_PWM_ATY */
  77. #endif /* __HW_PWM_ATY_H */
  78. /******************************** End Of File *********************************/