-
Notifications
You must be signed in to change notification settings - Fork 6
/
C_LinkGPIO.cpp
47 lines (38 loc) · 1.4 KB
/
C_LinkGPIO.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
#include "C_LinkGPIO.h"
#include "../LinkGPIO.hpp"
extern "C" {
C_LinkGPIOHandle C_LinkGPIO_create() {
return new LinkGPIO();
}
void C_LinkGPIO_destroy(C_LinkGPIOHandle handle) {
delete static_cast<LinkGPIO*>(handle);
}
void C_LinkGPIO_reset(C_LinkGPIOHandle handle) {
static_cast<LinkGPIO*>(handle)->reset();
}
void C_LinkGPIO_setMode(C_LinkGPIOHandle handle,
C_LinkGPIO_Pin pin,
C_LinkGPIO_Direction direction) {
static_cast<LinkGPIO*>(handle)->setMode(
static_cast<LinkGPIO::Pin>(pin),
static_cast<LinkGPIO::Direction>(direction));
}
C_LinkGPIO_Direction C_LinkGPIO_getMode(C_LinkGPIOHandle handle,
C_LinkGPIO_Pin pin) {
return static_cast<C_LinkGPIO_Direction>(
static_cast<LinkGPIO*>(handle)->getMode(static_cast<LinkGPIO::Pin>(pin)));
}
bool C_LinkGPIO_readPin(C_LinkGPIOHandle handle, C_LinkGPIO_Pin pin) {
return static_cast<LinkGPIO*>(handle)->readPin(
static_cast<LinkGPIO::Pin>(pin));
}
void C_LinkGPIO_writePin(C_LinkGPIOHandle handle,
C_LinkGPIO_Pin pin,
bool isHigh) {
static_cast<LinkGPIO*>(handle)->writePin(static_cast<LinkGPIO::Pin>(pin),
isHigh);
}
void C_LinkGPIO_setSIInterrupts(C_LinkGPIOHandle handle, bool isEnabled) {
static_cast<LinkGPIO*>(handle)->setSIInterrupts(isEnabled);
}
}