LaosLaser / Firmware

Embedded software (firmware) for the laser system and components, including configuration files
27 stars 27 forks source link

Change laser PWM control: rewrite using own PWM function #30

Open peteruithoven opened 9 years ago

peteruithoven commented 9 years ago

The Laser PWM control currently uses the MBED libary PWM functions: http://mbed.org/handbook/PwmOut

The PWM function has some limitations: It is limited to the PWM1 outputs, The initial state of the output cannot be set and floating point is used in the implementation to set the PWM duration.

A new object LaosPWM() should be implemented, that allows more flexibility.

Constructor: LaosPWM(pin,freq,initialpwm) methods: write(pwm), read() Requirements;

it should use CMSIS and the NXP peripheral library.
Initially it should function for PWM1 peripheral (similar to current PWM), pin can be p21..p26
PWM value should be in range of 0 to 10000 for 0 to 100%
Writing should be fast (low overhead),inline function
Clipping of set value between 0 and 100%
Writing should be double buffered (no glitches)