大季 矢花
/
MB2019_main_alltimes_1123
aa
LED/LED.cpp@35:33c6cdba5630, 2019-10-29 (annotated)
- Committer:
- kishibekairohan
- Date:
- Tue Oct 29 14:54:17 2019 +0000
- Revision:
- 35:33c6cdba5630
- Parent:
- 30:8f092276b2ba
ai;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
t_yamamoto | 0:669ef71cba68 | 1 | #include "LED.h" |
t_yamamoto | 0:669ef71cba68 | 2 | |
t_yamamoto | 0:669ef71cba68 | 3 | #include "../System/Using.h" |
t_yamamoto | 0:669ef71cba68 | 4 | #include "mbed.h" |
t_yamamoto | 0:669ef71cba68 | 5 | #include <stdint.h> |
t_yamamoto | 0:669ef71cba68 | 6 | |
t_yamamoto | 0:669ef71cba68 | 7 | namespace LED { |
t_yamamoto | 0:669ef71cba68 | 8 | DigitalOut boardLED[USE_LED_NUM] = { |
t_yamamoto | 0:669ef71cba68 | 9 | DigitalOut(LED_DEBUG0_PIN), |
t_yamamoto | 0:669ef71cba68 | 10 | DigitalOut(LED_DEBUG1_PIN), |
t_yamamoto | 0:669ef71cba68 | 11 | DigitalOut(LED_DEBUG2_PIN), |
t_yamamoto | 0:669ef71cba68 | 12 | DigitalOut(LED_MU_PIN), |
t_yamamoto | 0:669ef71cba68 | 13 | }; |
M_souta | 29:44d5454ce8fa | 14 | |
kishibekairohan | 35:33c6cdba5630 | 15 | DigitalOut tapeLED[USE_TAPELED_NUM] = { |
M_souta | 30:8f092276b2ba | 16 | DigitalOut(LED_TAPE0_PIN), |
M_souta | 30:8f092276b2ba | 17 | DigitalOut(LED_TAPE1_PIN), |
M_souta | 30:8f092276b2ba | 18 | DigitalOut(LED_TAPE2_PIN), |
M_souta | 30:8f092276b2ba | 19 | DigitalOut(LED_TAPE3_PIN), |
M_souta | 30:8f092276b2ba | 20 | DigitalOut(LED_TAPE4_PIN), |
M_souta | 29:44d5454ce8fa | 21 | }; |
t_yamamoto | 0:669ef71cba68 | 22 | |
t_yamamoto | 0:669ef71cba68 | 23 | void LED::Initialize() { |
M_souta | 30:8f092276b2ba | 24 | for(uint8_t i = 0; i < USE_LED_NUM; i++) { |
t_yamamoto | 0:669ef71cba68 | 25 | boardLED[i] = LED_OFF; |
t_yamamoto | 0:669ef71cba68 | 26 | } |
M_souta | 30:8f092276b2ba | 27 | for(uint8_t i = 0; i < USE_TAPELED_NUM; i++) { |
M_souta | 29:44d5454ce8fa | 28 | tapeLED[i] = LED_OFF; |
M_souta | 29:44d5454ce8fa | 29 | } |
t_yamamoto | 0:669ef71cba68 | 30 | } |
M_souta | 30:8f092276b2ba | 31 | |
M_souta | 30:8f092276b2ba | 32 | void LED::TapeledMode(uint8_t index) { |
kishibekairohan | 35:33c6cdba5630 | 33 | int selectnum[16][4]= { |
kishibekairohan | 35:33c6cdba5630 | 34 | //1,2,4,8 |
kishibekairohan | 35:33c6cdba5630 | 35 | {0,0,0,0}, |
kishibekairohan | 35:33c6cdba5630 | 36 | {1,0,0,0}, |
kishibekairohan | 35:33c6cdba5630 | 37 | {0,1,0,0}, |
kishibekairohan | 35:33c6cdba5630 | 38 | {1,1,0,0}, |
kishibekairohan | 35:33c6cdba5630 | 39 | {0,0,1,0}, |
kishibekairohan | 35:33c6cdba5630 | 40 | {1,0,1,0}, |
kishibekairohan | 35:33c6cdba5630 | 41 | {0,1,1,0}, |
kishibekairohan | 35:33c6cdba5630 | 42 | {1,1,1,0}, |
kishibekairohan | 35:33c6cdba5630 | 43 | {0,0,0,1}, |
kishibekairohan | 35:33c6cdba5630 | 44 | {1,0,0,1}, |
kishibekairohan | 35:33c6cdba5630 | 45 | {0,1,0,1}, |
kishibekairohan | 35:33c6cdba5630 | 46 | {1,1,0,1}, |
kishibekairohan | 35:33c6cdba5630 | 47 | {0,0,1,1}, |
kishibekairohan | 35:33c6cdba5630 | 48 | {1,0,1,1}, |
kishibekairohan | 35:33c6cdba5630 | 49 | {0,1,1,1}, |
kishibekairohan | 35:33c6cdba5630 | 50 | {1,1,1,1} |
kishibekairohan | 35:33c6cdba5630 | 51 | }; |
kishibekairohan | 35:33c6cdba5630 | 52 | |
M_souta | 30:8f092276b2ba | 53 | for(uint8_t i = 0; i < USE_TAPELED_NUM; i++) { |
kishibekairohan | 35:33c6cdba5630 | 54 | tapeLED[i] = selectnum[index][i]; |
M_souta | 30:8f092276b2ba | 55 | } |
M_souta | 30:8f092276b2ba | 56 | } |
t_yamamoto | 0:669ef71cba68 | 57 | } |