A hello world for inertial sensors
Dependencies: FXAS21000 FXOS8700Q mbed
Fork of FRDM-STBC-AGM01 by
led.h@4:5ab2bb2f062b, 2015-06-30 (annotated)
- Committer:
- Elecia
- Date:
- Tue Jun 30 16:23:32 2015 +0000
- Revision:
- 4:5ab2bb2f062b
- Parent:
- 3:123b546e4a5c
Added element14 link
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Elecia | 3:123b546e4a5c | 1 | #ifndef LED_INTERFACE_H |
Elecia | 3:123b546e4a5c | 2 | #define LED_INTERFACE_H |
Elecia | 3:123b546e4a5c | 3 | |
Elecia | 3:123b546e4a5c | 4 | #include "mbed.h" |
Elecia | 3:123b546e4a5c | 5 | |
Elecia | 3:123b546e4a5c | 6 | #define RED 0 |
Elecia | 3:123b546e4a5c | 7 | #define GREEN 1 |
Elecia | 3:123b546e4a5c | 8 | #define BLUE 2 |
Elecia | 3:123b546e4a5c | 9 | #define NUM_LEDS 3 |
Elecia | 3:123b546e4a5c | 10 | class SMART_LED { |
Elecia | 3:123b546e4a5c | 11 | public: |
Elecia | 3:123b546e4a5c | 12 | SMART_LED(PinName redPin, PinName greenPin, PinName bluePin); |
Elecia | 3:123b546e4a5c | 13 | void off(); |
Elecia | 3:123b546e4a5c | 14 | void set(uint8_t r, uint8_t g, uint8_t b); |
Elecia | 3:123b546e4a5c | 15 | |
Elecia | 3:123b546e4a5c | 16 | private: |
Elecia | 3:123b546e4a5c | 17 | PwmOut _redLedPwm, _greenLedPwm, _blueLedPwm; |
Elecia | 3:123b546e4a5c | 18 | PwmOut *_pwmLed[NUM_LEDS]; |
Elecia | 3:123b546e4a5c | 19 | Ticker _updateLedTick; |
Elecia | 3:123b546e4a5c | 20 | float _current[NUM_LEDS]; |
Elecia | 3:123b546e4a5c | 21 | float _goal[NUM_LEDS]; |
Elecia | 3:123b546e4a5c | 22 | |
Elecia | 3:123b546e4a5c | 23 | uint8_t _normalFadeSpeed; |
Elecia | 3:123b546e4a5c | 24 | void ledUpdateTimerTick(); |
Elecia | 3:123b546e4a5c | 25 | void fadeToRgb(uint8_t r, uint8_t g, uint8_t b); |
Elecia | 3:123b546e4a5c | 26 | |
Elecia | 3:123b546e4a5c | 27 | }; |
Elecia | 3:123b546e4a5c | 28 | |
Elecia | 3:123b546e4a5c | 29 | |
Elecia | 3:123b546e4a5c | 30 | #endif /* LED_INTERFACE_H */ |