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.
Fork of TLC5940 by
TLC5940.h@4:fc83415fa28c, 2015-10-17 (annotated)
- Committer:
- deton
- Date:
- Sat Oct 17 02:47:11 2015 +0000
- Revision:
- 4:fc83415fa28c
- Parent:
- 3:2c0af5f5fa13
- Child:
- 5:c35b2b62f2f3
Change refresh() as public to be used by caller that refreshes using Timer instead of Ticker in TLC5940 class.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Julepalme | 0:bdf7a64b89a7 | 1 | #ifndef TLC5940_H_ |
| Julepalme | 0:bdf7a64b89a7 | 2 | #define TLC5940_H_ |
| Julepalme | 0:bdf7a64b89a7 | 3 | |
| Julepalme | 0:bdf7a64b89a7 | 4 | #include "mbed.h" |
| deton | 1:b188393f5b49 | 5 | #include "SWSPI.h" |
| Julepalme | 0:bdf7a64b89a7 | 6 | |
| Julepalme | 0:bdf7a64b89a7 | 7 | class TLC5940 { |
| Julepalme | 0:bdf7a64b89a7 | 8 | private: |
| deton | 1:b188393f5b49 | 9 | SWSPI _spi; |
| deton | 1:b188393f5b49 | 10 | PwmOut _gsclk; |
| deton | 1:b188393f5b49 | 11 | DigitalOut _xlat; |
| deton | 3:2c0af5f5fa13 | 12 | DigitalOut _blank; |
| deton | 1:b188393f5b49 | 13 | Ticker _t; |
| deton | 3:2c0af5f5fa13 | 14 | int _gspwmcycle_us; |
| deton | 3:2c0af5f5fa13 | 15 | bool _gspwmcycle_repeat; |
| deton | 1:b188393f5b49 | 16 | uint16_t gs_data[16]; |
| Julepalme | 0:bdf7a64b89a7 | 17 | public: |
| deton | 3:2c0af5f5fa13 | 18 | /** |
| deton | 3:2c0af5f5fa13 | 19 | * Constructor. |
| deton | 3:2c0af5f5fa13 | 20 | * @param mosi -> SIN |
| deton | 3:2c0af5f5fa13 | 21 | * @param miso -> (not connect to TLC5940) |
| deton | 3:2c0af5f5fa13 | 22 | * @param sck -> SCLK |
| deton | 3:2c0af5f5fa13 | 23 | * @param xlat -> XLAT |
| deton | 3:2c0af5f5fa13 | 24 | * @param blank -> BLANK |
| deton | 3:2c0af5f5fa13 | 25 | * @param gsclk -> GSCLK |
| deton | 3:2c0af5f5fa13 | 26 | * @param gspwmcycle_us grayscale PWM cycle in [us]. consists of 4096 pulses. |
| deton | 3:2c0af5f5fa13 | 27 | * @param gspwmcycle_repeat repeat grayscale PWM cycle or not. |
| deton | 3:2c0af5f5fa13 | 28 | * If true, send BLANK pulse after each grayscale PWM cycle using Ticker. |
| deton | 3:2c0af5f5fa13 | 29 | */ |
| deton | 3:2c0af5f5fa13 | 30 | TLC5940(PinName mosi, PinName miso, PinName sck, PinName xlat, PinName blank, PinName gsclk, |
| deton | 3:2c0af5f5fa13 | 31 | int gspwmcycle_us = 20480, bool gspwmcycle_repeat = true); |
| deton | 1:b188393f5b49 | 32 | void set(int channel, uint16_t brightness); |
| Julepalme | 0:bdf7a64b89a7 | 33 | void flush(); |
| Julepalme | 0:bdf7a64b89a7 | 34 | void run(); |
| deton | 4:fc83415fa28c | 35 | void refresh(); |
| Julepalme | 0:bdf7a64b89a7 | 36 | }; |
| Julepalme | 0:bdf7a64b89a7 | 37 | |
| Julepalme | 0:bdf7a64b89a7 | 38 | #endif /* TLC5940_H_ */ |
