Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterfacePlusHostname RdWebServer mbed-rtos mbed
ledstrip.h@4:b521815f2657, 2015-08-31 (annotated)
- Committer:
- Bobty
- Date:
- Mon Aug 31 15:21:47 2015 +0000
- Revision:
- 4:b521815f2657
- Parent:
- 3:e5ea80fae61d
Tidied up and removed unnecessary code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bobty | 0:887096209439 | 1 | #ifndef LEDSTRIP__H |
Bobty | 0:887096209439 | 2 | #define LEDSTRIP__H |
Bobty | 0:887096209439 | 3 | |
Bobty | 4:b521815f2657 | 4 | // LED Strip using WS2801 with two ISRs for two SPI connected |
Bobty | 4:b521815f2657 | 5 | // LED strips running in parallel |
Bobty | 4:b521815f2657 | 6 | // Rob Dobson 2013-2014 |
Bobty | 4:b521815f2657 | 7 | |
Bobty | 0:887096209439 | 8 | #include "mbed.h" |
Bobty | 0:887096209439 | 9 | |
Bobty | 0:887096209439 | 10 | class ledstrip |
Bobty | 0:887096209439 | 11 | { |
Bobty | 0:887096209439 | 12 | private: |
Bobty | 0:887096209439 | 13 | unsigned char* mpLedValuesA; |
Bobty | 0:887096209439 | 14 | unsigned char* mpLedValuesB; |
Bobty | 0:887096209439 | 15 | unsigned char* mpCurLedValues; |
Bobty | 0:887096209439 | 16 | int mLedsInStrip; |
Bobty | 0:887096209439 | 17 | int mSplitPoint; |
Bobty | 0:887096209439 | 18 | int mLedsBufSize; |
Bobty | 0:887096209439 | 19 | SPI* mpSPI0; |
Bobty | 0:887096209439 | 20 | SPI* mpSPI1; |
Bobty | 0:887096209439 | 21 | |
Bobty | 0:887096209439 | 22 | public: |
Bobty | 0:887096209439 | 23 | static const int mColoursPerLed = 3; |
Bobty | 0:887096209439 | 24 | |
Bobty | 0:887096209439 | 25 | public: |
Bobty | 0:887096209439 | 26 | ledstrip(int length, int splitPoint); |
Bobty | 0:887096209439 | 27 | ~ledstrip(); |
Bobty | 0:887096209439 | 28 | unsigned char* GetBuffer(); |
Bobty | 0:887096209439 | 29 | int GetBufferSizeinBytes(); |
Bobty | 0:887096209439 | 30 | bool Resize(int length, int splitPoint); |
Bobty | 0:887096209439 | 31 | bool IsBusy(); |
Bobty | 0:887096209439 | 32 | int GetNumLeds() |
Bobty | 0:887096209439 | 33 | { |
Bobty | 0:887096209439 | 34 | return mLedsInStrip; |
Bobty | 0:887096209439 | 35 | } |
Bobty | 0:887096209439 | 36 | void Clear(); |
Bobty | 1:362331cec9b7 | 37 | void RawFill(int startLed, int numLeds, const unsigned char* pLedVals); |
Bobty | 3:e5ea80fae61d | 38 | void HsvFill(int startLed, int numLeds, const unsigned char* pLedVals); |
Bobty | 0:887096209439 | 39 | void Fill(int startLed, int numLeds, |
Bobty | 0:887096209439 | 40 | int r1, int g1, int b1, |
Bobty | 0:887096209439 | 41 | int r2, int g2, int b2); |
Bobty | 0:887096209439 | 42 | void Fill(int startLed, int numLeds, |
Bobty | 0:887096209439 | 43 | int r1, int g1, int b1); |
Bobty | 0:887096209439 | 44 | void ShowLeds(); |
Bobty | 0:887096209439 | 45 | |
Bobty | 0:887096209439 | 46 | }; |
Bobty | 0:887096209439 | 47 | |
Bobty | 0:887096209439 | 48 | #endif |