led_RGB
Low_device.cpp@3:7992dc580716, 2017-07-13 (annotated)
- Committer:
- ht
- Date:
- Thu Jul 13 02:52:52 2017 +0000
- Revision:
- 3:7992dc580716
- Parent:
- 2:f1ae9529e6ee
Blink???????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ht | 0:bd903d88d2c8 | 1 | #include "Low_device.h" |
ht | 0:bd903d88d2c8 | 2 | #include "mbed.h" |
ht | 0:bd903d88d2c8 | 3 | |
ht | 1:06b34a8b0554 | 4 | DigitalOut LED_R(P6_13); /* LED1 on the GR-PEACH board */ |
ht | 1:06b34a8b0554 | 5 | DigitalOut LED_G(P6_14); /* LED2 on the GR-PEACH board */ |
ht | 1:06b34a8b0554 | 6 | DigitalOut LED_B(P6_15); /* LED3 on the GR-PEACH board */ |
ht | 1:06b34a8b0554 | 7 | DigitalOut LED_3(P2_14); /* LED3 on the Motor Drive board */ |
ht | 1:06b34a8b0554 | 8 | DigitalOut LED_2(P2_15); /* LED2 on the Motor Drive board */ |
ht | 1:06b34a8b0554 | 9 | |
ht | 2:f1ae9529e6ee | 10 | DigitalIn user_botton(P6_0); /* SW1 on the GR-PEACH board */ |
ht | 2:f1ae9529e6ee | 11 | DigitalIn push_sw(P2_13); /* SW1 on the Motor Drive board */ |
ht | 0:bd903d88d2c8 | 12 | |
ht | 0:bd903d88d2c8 | 13 | Low_device::Low_device() { |
ht | 0:bd903d88d2c8 | 14 | } |
ht | 0:bd903d88d2c8 | 15 | |
ht | 1:06b34a8b0554 | 16 | // RGB LED control |
ht | 0:bd903d88d2c8 | 17 | void Low_device::led_RGB(int led) { |
ht | 0:bd903d88d2c8 | 18 | LED_R = led & 0x1; |
ht | 0:bd903d88d2c8 | 19 | LED_G = (led >> 1 ) & 0x1; |
ht | 0:bd903d88d2c8 | 20 | LED_B = (led >> 2 ) & 0x1; |
ht | 1:06b34a8b0554 | 21 | } |
ht | 1:06b34a8b0554 | 22 | |
ht | 1:06b34a8b0554 | 23 | //led_out(on Motor drive board) |
ht | 1:06b34a8b0554 | 24 | //------------------------------------------------------------------// |
ht | 1:06b34a8b0554 | 25 | void Low_device::led_OUT(int led) |
ht | 1:06b34a8b0554 | 26 | { |
ht | 1:06b34a8b0554 | 27 | led = ~led; |
ht | 1:06b34a8b0554 | 28 | LED_3 = led & 0x1; |
ht | 1:06b34a8b0554 | 29 | LED_2 = ( led >> 1 ) & 0x1; |
ht | 2:f1ae9529e6ee | 30 | } |
ht | 2:f1ae9529e6ee | 31 | //PEACH_button_get(on GR-PEACH board) |
ht | 2:f1ae9529e6ee | 32 | //------------------------------------------------------------------// |
ht | 2:f1ae9529e6ee | 33 | unsigned int Low_device::peach_button_get( void ) |
ht | 2:f1ae9529e6ee | 34 | { |
ht | 2:f1ae9529e6ee | 35 | return (~user_botton) & 0x1; /* Read ports with switches */ |
ht | 2:f1ae9529e6ee | 36 | } |
ht | 2:f1ae9529e6ee | 37 | |
ht | 2:f1ae9529e6ee | 38 | //pushsw_get(on Motor drive board) |
ht | 2:f1ae9529e6ee | 39 | //------------------------------------------------------------------// |
ht | 2:f1ae9529e6ee | 40 | unsigned int Low_device::pushsw_get( void ) |
ht | 2:f1ae9529e6ee | 41 | { |
ht | 2:f1ae9529e6ee | 42 | return (~push_sw) & 0x1; /* Read ports with switches */ |
ht | 0:bd903d88d2c8 | 43 | } |