IHS1.1-STM32F303K8
Revision 1:62baf2ea5573, committed 2020-10-23
- Comitter:
- maro
- Date:
- Fri Oct 23 06:37:09 2020 +0000
- Parent:
- 0:0fcc82d7750c
- Commit message:
- Blinking indicator added
Changed in this revision
CLED.cpp | Show annotated file Show diff for this revision Revisions of this file |
CLED.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0fcc82d7750c -r 62baf2ea5573 CLED.cpp --- a/CLED.cpp Thu Jul 16 08:20:57 2020 +0000 +++ b/CLED.cpp Fri Oct 23 06:37:09 2020 +0000 @@ -15,17 +15,18 @@ // ************************* object ******************************** Ticker indiTic; -CLED::CLED(int ver) : indVal(0) { +CLED::CLED(int ver) : inOn(false) { if (ver == 10) color = c10; if (ver == 11) color = c11; indiTic.attach(callback(this, &CLED::indiBlink), 400e-3); } -void CLED::set(byte* ary12, bool indi) { // 1-12[8]:{7, 3,..} +void CLED::set(byte* ary12, bool indiRow) { // 1-12[8]:{7, 3,..} int val24 = 0; for (int col = 0; col < COL_LEN; col++) { // LED number is opposit direction - byte cVal = (indi && (col == COL_LEN - 1) ? indVal : ary12[col]) >> 1; + bool isIndi = inOn && indiRow && (col == COL_LEN - 1) && (ary12[col] == 0); + byte cVal = (isIndi ? INDI_COLOR : ary12[col]) >> 1; val24 += color[cVal] << col * 3; } sel_sen = 0; //digitalWrite(sel_sen, LOW); @@ -49,5 +50,5 @@ // *************** PWM callback function **************** void CLED::indiBlink() { // indicator blink - indVal = (indVal > 0) ? 0 : INDI_COLOR; + inOn = !inOn; }
diff -r 0fcc82d7750c -r 62baf2ea5573 CLED.h --- a/CLED.h Thu Jul 16 08:20:57 2020 +0000 +++ b/CLED.h Fri Oct 23 06:37:09 2020 +0000 @@ -6,7 +6,7 @@ class CLED { public: CLED(int ver=10); - void set(byte* ary12, bool indi = false); + void set(byte* ary12, bool indiRow = false); void set(byte val12); private: @@ -15,7 +15,7 @@ static const byte c10[7]; static const byte c11[7]; static const byte INDI_COLOR; - byte indVal; + bool inOn; }; #endif