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.
Diff: LED/LED.cpp
- Revision:
- 35:33c6cdba5630
- Parent:
- 30:8f092276b2ba
--- a/LED/LED.cpp Tue Oct 29 08:35:05 2019 +0000
+++ b/LED/LED.cpp Tue Oct 29 14:54:17 2019 +0000
@@ -12,7 +12,7 @@
DigitalOut(LED_MU_PIN),
};
- DigitalOut tapeLED[] = {
+ DigitalOut tapeLED[USE_TAPELED_NUM] = {
DigitalOut(LED_TAPE0_PIN),
DigitalOut(LED_TAPE1_PIN),
DigitalOut(LED_TAPE2_PIN),
@@ -30,8 +30,28 @@
}
void LED::TapeledMode(uint8_t index) {
+ int selectnum[16][4]= {
+ //1,2,4,8
+ {0,0,0,0},
+ {1,0,0,0},
+ {0,1,0,0},
+ {1,1,0,0},
+ {0,0,1,0},
+ {1,0,1,0},
+ {0,1,1,0},
+ {1,1,1,0},
+ {0,0,0,1},
+ {1,0,0,1},
+ {0,1,0,1},
+ {1,1,0,1},
+ {0,0,1,1},
+ {1,0,1,1},
+ {0,1,1,1},
+ {1,1,1,1}
+ };
+
for(uint8_t i = 0; i < USE_TAPELED_NUM; i++) {
- tapeLED[i] = (index >> i) & 0x01;
+ tapeLED[i] = selectnum[index][i];
}
}
}