Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
Hardware PWM functions

Provides hardware pulse width modulation functions. More...

Functions

 HardwarePWM::HardwarePWM (uint8 *pins, uint8 no_of_pins)
 
bool HardwarePWM::analogWrite (uint8 pin, uint32 duty)
 Set PWM duty cycle. More...
 
bool HardwarePWM::setDuty (uint8 pin, uint32 duty)
 Set PWM duty cycle. More...
 
uint32 HardwarePWM::getDuty (uint8 pin)
 Get PWM duty cycle. More...
 
void HardwarePWM::setPeriod (uint32 period)
 Set PWM period. More...
 
uint32 HardwarePWM::getPeriod (void)
 Get PWM period. More...
 
uint8 HardwarePWM::getChannel (uint8 pin)
 Get channel number for a pin. More...
 
uint32 HardwarePWM::getMaxDuty ()
 Get the maximum duty cycle value. More...
 

Detailed Description

Provides hardware pulse width modulation functions.

Instantiate hardware PWM object.

Parameters
pinsPointer to array of pins to control
no_of_pinsQuantity of elements in array of pins

Function Documentation

bool HardwarePWM::analogWrite ( uint8  pin,
uint32  duty 
)

Set PWM duty cycle.

Parameters
pinGPIO to set
dutyValue of duty cycle to set pin to
Return values
boolTrue on success
uint8 HardwarePWM::getChannel ( uint8  pin)

Get channel number for a pin.

Parameters
pinGPIO to interrogate
Return values
uint8Channel of GPIO
uint32 HardwarePWM::getDuty ( uint8  pin)

Get PWM duty cycle.

Parameters
pinGPIO to get duty cycle for
Return values
uint32Value of PWM duty cycle
uint32 HardwarePWM::getMaxDuty ( )

Get the maximum duty cycle value.

Return values
uint32Maximum permissible duty cycle
Note
Attempt to set duty of a pin above this value will fail
uint32 HardwarePWM::getPeriod ( void  )

Get PWM period.

Return values
uint32Value of PWM period
bool HardwarePWM::setDuty ( uint8  pin,
uint32  duty 
)

Set PWM duty cycle.

Parameters
pinGPIO to set
dutyValue of duty cycle to set pin to
Return values
boolTrue on success
void HardwarePWM::setPeriod ( uint32  period)

Set PWM period.

Parameters
periodPWM period
Note
All PWM pins share the same period