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
SCT_PWM.h@1:4e19f154ec21, 2013-10-14 (annotated)
- Committer:
- va009039
- Date:
- Mon Oct 14 03:59:30 2013 +0000
- Revision:
- 1:4e19f154ec21
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 1:4e19f154ec21 | 1 | #pragma once |
va009039 | 1:4e19f154ec21 | 2 | #include "LPC8xx.h" |
va009039 | 1:4e19f154ec21 | 3 | |
va009039 | 1:4e19f154ec21 | 4 | class SCT_PWM { |
va009039 | 1:4e19f154ec21 | 5 | public: |
va009039 | 1:4e19f154ec21 | 6 | SCT_PWM(int pin = 7, int channel = 0); |
va009039 | 1:4e19f154ec21 | 7 | void period(float seconds); |
va009039 | 1:4e19f154ec21 | 8 | void period_ms(int ms); |
va009039 | 1:4e19f154ec21 | 9 | void period_us(int us); |
va009039 | 1:4e19f154ec21 | 10 | void pulsewidth(float seconds); |
va009039 | 1:4e19f154ec21 | 11 | void pulsewidth_ms(int ms); |
va009039 | 1:4e19f154ec21 | 12 | void pulsewidth_us(int us); |
va009039 | 1:4e19f154ec21 | 13 | void write(float value); |
va009039 | 1:4e19f154ec21 | 14 | float read(); |
va009039 | 1:4e19f154ec21 | 15 | void swm(int pin = 7); |
va009039 | 1:4e19f154ec21 | 16 | |
va009039 | 1:4e19f154ec21 | 17 | SCT_PWM& operator= (float value) { |
va009039 | 1:4e19f154ec21 | 18 | write(value); |
va009039 | 1:4e19f154ec21 | 19 | return *this; |
va009039 | 1:4e19f154ec21 | 20 | } |
va009039 | 1:4e19f154ec21 | 21 | |
va009039 | 1:4e19f154ec21 | 22 | SCT_PWM& operator= (SCT_PWM& rhs) { |
va009039 | 1:4e19f154ec21 | 23 | write(rhs.read()); |
va009039 | 1:4e19f154ec21 | 24 | return *this; |
va009039 | 1:4e19f154ec21 | 25 | } |
va009039 | 1:4e19f154ec21 | 26 | |
va009039 | 1:4e19f154ec21 | 27 | protected: |
va009039 | 1:4e19f154ec21 | 28 | void inst(); |
va009039 | 1:4e19f154ec21 | 29 | int ch; |
va009039 | 1:4e19f154ec21 | 30 | }; |