blob: e1179af300bd4cd8f8f4216ea97ff5f11a2492b8 (
plain)
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
|
#include "driver/gpio.h"
#include <msp430.h>
void GPIO::setup()
{
P1OUT = 0;
P2OUT = 0;
P3OUT = 0;
P4OUT = 0;
P1DIR = BIT0;
P2DIR = 0;
P3DIR = 0;
P4DIR = BIT6;
}
void GPIO::led_on(unsigned char id)
{
if (id == 0) {
P1OUT |= BIT0;
} else {
P4OUT |= BIT6;
}
}
void GPIO::led_off(unsigned char id)
{
if (id == 0) {
P1OUT &= ~BIT0;
} else {
P4OUT &= ~BIT6;
}
}
void GPIO::led_toggle(unsigned char id)
{
if (id == 0) {
P1OUT ^= BIT0;
} else {
P4OUT ^= BIT6;
}
}
GPIO gpio;
|