LPC800-MAX RGB demo using SCT and MRT
LPC800-MAX RGB demo using State-Configurable Timer(SCT) and Multi-Rate Timer(MRT).
http://www.youtube.com/watch?v=PABxoWZB0YM
Diff: SCT_PWM.h
- Revision:
- 1:4e19f154ec21
diff -r f86c572491c3 -r 4e19f154ec21 SCT_PWM.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SCT_PWM.h Mon Oct 14 03:59:30 2013 +0000 @@ -0,0 +1,30 @@ +#pragma once +#include "LPC8xx.h" + +class SCT_PWM { +public: + SCT_PWM(int pin = 7, int channel = 0); + void period(float seconds); + void period_ms(int ms); + void period_us(int us); + void pulsewidth(float seconds); + void pulsewidth_ms(int ms); + void pulsewidth_us(int us); + void write(float value); + float read(); + void swm(int pin = 7); + + SCT_PWM& operator= (float value) { + write(value); + return *this; + } + + SCT_PWM& operator= (SCT_PWM& rhs) { + write(rhs.read()); + return *this; + } + +protected: + void inst(); + int ch; +};