Krolyxon
Commit 3120783

Branches

Tags

Refs →

orion-rf.piolibdepsesp32-s3-n16r8RF24utilitypigpiogpio.cpp

39 lines · 458 B · C++

1/*
2 * GPIO Functions
3 */
4#include <pigpio.h>
5#include "gpio.h"
6
7bool initialized = 0;
8
9GPIO::GPIO()
10{
11}
12
13GPIO::~GPIO()
14{
15 gpioTerminate();
16}
17
18void GPIO::open(int port, int DDR)
19{
20 if (!initialized) {
21 gpioInitialise();
22 }
23 initialized = true;
24 gpioSetMode(port, PI_OUTPUT);
25}
26
27void GPIO::close(int port)
28{
29}
30
31int GPIO::read(int port)
32{
33 return gpioRead(port);
34}
35
36void GPIO::write(int port, int value)
37{
38 gpioWrite(port, value);
39}