-
Notifications
You must be signed in to change notification settings - Fork 0
/
wio_io.h
48 lines (41 loc) · 920 Bytes
/
wio_io.h
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
#ifdef WIO_TERMINAL
#include <samd.h>
void ioInitPin () {
pinMode(WIO_KEY_A, INPUT_PULLUP);
pinMode(WIO_KEY_B, INPUT_PULLUP);
pinMode(WIO_KEY_C, INPUT_PULLUP);
pinMode(WIO_5S_UP, INPUT_PULLUP);
pinMode(WIO_5S_DOWN, INPUT_PULLUP);
pinMode(WIO_5S_LEFT, INPUT_PULLUP);
pinMode(WIO_5S_RIGHT, INPUT_PULLUP);
pinMode(WIO_5S_PRESS, INPUT_PULLUP);
pinMode(PIN_LED, OUTPUT);
pinMode(WIO_BUZZER, OUTPUT);
}
void wioLed (bool flg) {
if (flg) {
digitalWrite(PIN_LED, HIGH);
} else {
digitalWrite(PIN_LED, LOW);
}
}
void wioBeep (int ms) {
if (ms == 0) {
analogWrite(WIO_BUZZER, 0);
} else
if (ms == 1) {
analogWrite(WIO_BUZZER, 128);
} else {
analogWrite(WIO_BUZZER, 128);
delay(ms);
analogWrite(WIO_BUZZER, 0);
}
}
void wioBackLight (bool flg) {
if (flg) {
digitalWrite(LCD_BACKLIGHT, HIGH);
} else {
digitalWrite(LCD_BACKLIGHT, LOW);
}
}
#endif