Skip to content

Commit 01443c3

Browse files
committed
added defs for the digitalpin class
1 parent 5b9faf6 commit 01443c3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode/

api/Common.h

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
#include <stdint.h>
33
#include <stdbool.h>
44

5+
#ifdef __cplusplus
6+
#define pHIGH ((bool)0x1)
7+
#define pLOW ((bool)0x0)
8+
#endif
9+
510
#ifdef __cplusplus
611
extern "C"{
712
#endif
@@ -94,6 +99,12 @@ typedef uint8_t pin_size_t;
9499
#endif
95100

96101
void pinMode(pin_size_t pinNumber, PinMode pinMode);
102+
__inline int digitalToggle(uint8_t pin)
103+
{
104+
int sat = digitalRead(pin);
105+
digitalWrite(pin, (PinStatus)!sat);
106+
return !sat;
107+
}
97108
void digitalWrite(pin_size_t pinNumber, PinStatus status);
98109
PinStatus digitalRead(pin_size_t pinNumber);
99110
int analogRead(pin_size_t pinNumber);

0 commit comments

Comments
 (0)