/**
* @file HW_PWM_ATY.h
*
* @param Project DEVICE_GENERAL_ATY_LIB
*
* @author ATY
*
* @copyright
* - Copyright 2017 - 2023 MZ-ATY
* - This code follows:
* - MZ-ATY Various Contents Joint Statement -
*
* https://mengze.top/MZ-ATY_VCJS
* - CC 4.0 BY-NC-SA -
*
* https://creativecommons.org/licenses/by-nc-sa/4.0/
* - Your use will be deemed to have accepted the terms of this statement.
*
* @brief Familiar definition of PWM for users
*
* @version
* - 1_01_220602 > ATY
* -# Preliminary version, first Release
* - Undone
********************************************************************************
*/
#ifndef __HW_PWM_ATY_H
#define __HW_PWM_ATY_H
#include "INCLUDE_ATY.h"
/******************************* For user *************************************/
// #define __DEBUG_HW_PWM_ATY
#if defined(__STC51_ATY)
#define PWM1_CHOSE PWM_PIN_POS_0
#define PWM2_CHOSE PWM_PIN_POS_0
#define PWM3_CHOSE PWM_PIN_POS_0
#define PWM4_CHOSE PWM_PIN_POS_0
#define PWM5_CHOSE PWM_PIN_POS_0
#define PWM6_CHOSE PWM_PIN_POS_0
#define PWM7_CHOSE PWM_PIN_POS_0
#define PWM8_CHOSE PWM_PIN_POS_0
#elif defined(__STM32_HAL_ATY)
#endif /* PLATFORM */
/******************************************************************************/
#if defined(__STC51_ATY)
#define PWM_CHANNEL_1P 0x01
#define PWM_CHANNEL_1N 0x02
#define PWM_CHANNEL_2P 0x04
#define PWM_CHANNEL_2N 0x08
#define PWM_CHANNEL_3P 0x10
#define PWM_CHANNEL_3N 0x20
#define PWM_CHANNEL_4P 0x40
#define PWM_CHANNEL_4N 0x80
#define PWM_CHANNEL_5P 0xF0
#define PWM_CHANNEL_6P 0xF1
#define PWM_CHANNEL_7P 0xF2
#define PWM_CHANNEL_8P 0xF3
#define PWM_PIN_POS_0 0x00 // PWMN
#define PWM_PIN_POS_1 0x01 // PWMN_2
#define PWM_PIN_POS_2 0x02 // PWMN_3
#define PWM_PIN_POS_3 0x03 // PWMN_4
#elif defined(__STM32_HAL_ATY)
#define PWM_T2C2 0x22
#define PWM_T3C3 0x33
// #define PWM_T
// #define PWM_C
#elif defined(__ESP8266_RTOS_ATY)
#endif /* PLATFORM */
void PWM_Start(uint32_t periodS, float dutyS, uint8_t channelS);
void PWM_Stop(uint8_t level, uint8_t channelS);
void PwmFreqSet(uint32_t periodS, uint8_t channelS);
#if defined(__STC8G_ATY)
void PWM_StartPulse(uint32_t periodS, uint8_t channelS);
#endif
#ifdef __DEBUG_HW_PWM_ATY
void PWM_Test(uint8_t testType);
#endif /* __DEBUG_HW_PWM_ATY */
#endif /* __HW_PWM_ATY_H */
/******************************** End Of File *********************************/