-
Notifications
You must be signed in to change notification settings - Fork 12
/
LED.cpp
79 lines (69 loc) · 1.49 KB
/
LED.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <Arduino.h>
boolean ledState;
// Arduino Due || Teensy 3.1 || Teensy 3.0 || Teensy LC || Arduino Pro Mini || ATtiny1634 || Intel Edison
#if defined (__SAM3X8E__) || defined(__MK20DX256__) || defined(__MK20DX128__) || defined(__MKL26Z64__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATtiny1634__) || defined(__ARDUINO_X86__)
const int LED_OUT = 13; // Arduino onboard LED; HIGH (= ON) while recording
void ledOff()
{
digitalWrite(LED_OUT, LOW);
ledState = false;
}
void ledOn()
{
digitalWrite(LED_OUT, HIGH);
ledState = true;
}
void setupLED()
{
pinMode(LED_OUT, OUTPUT);
ledOff();
}
// Arduino Pro Micro
#elif defined(__AVR_ATmega32U4__)
void ledOff()
{
TXLED0;
RXLED0;
ledState = false;
}
void ledOn()
{
TXLED1;
RXLED1;
ledState = true;
}
void setupLED()
{
ledOff();
}
// GR-KURUMI
#elif defined(REL_GR_KURUMI)
const int LED_OUT_R = 22; // GR-KURUMI RGB-LED; active LOW
const int LED_OUT_G = 23;
const int LED_OUT_B = 24;
void ledOff()
{
// white
pinMode(LED_OUT_R, INPUT);
pinMode(LED_OUT_G, INPUT);
pinMode(LED_OUT_B, INPUT);
ledState = false;
}
void ledOn()
{
pinMode(LED_OUT_R, OUTPUT);
pinMode(LED_OUT_G, OUTPUT);
pinMode(LED_OUT_B, OUTPUT);
// green
digitalWrite(LED_OUT_R, HIGH);
digitalWrite(LED_OUT_G, LOW);
digitalWrite(LED_OUT_B, HIGH);
ledState = true;
}
void setupLED()
{
ledOff();
}
#else
#error CPU not supported
#endif