-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathWippersnapper_DigitalGPIO.h
More file actions
61 lines (52 loc) · 1.88 KB
/
Wippersnapper_DigitalGPIO.h
File metadata and controls
61 lines (52 loc) · 1.88 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
/*!
* @file Wippersnapper_DigitalGPIO.h
*
* This file provides digital GPIO control and access.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Copyright (c) Brent Rubell 2020-2021 for Adafruit Industries.
*
* BSD license, all text here must be included in any redistribution.
*
*/
#ifndef WIPPERSNAPPER_DIGITALGPIO_H
#define WIPPERSNAPPER_DIGITALGPIO_H
#include "Wippersnapper.h"
/** Holds data about a digital input pin */
struct digitalInputPin {
uint8_t pinName; ///< Pin name
long period; ///< Timer interval, in millis, -1 if disabled.
long prvPeriod; ///< When timer was previously serviced, in millis
int prvPinVal; ///< Previous pin value
};
// forward decl.
class Wippersnapper;
/**************************************************************************/
/*!
@brief Class that provides functions for reading and interacting with
digital inputs and outputs.
*/
/**************************************************************************/
class Wippersnapper_DigitalGPIO {
public:
Wippersnapper_DigitalGPIO(int32_t totalDigitalInputPins);
~Wippersnapper_DigitalGPIO();
void
initDigitalPin(wippersnapper_pin_v1_ConfigurePinRequest_Direction direction,
uint8_t pinName, float period,
wippersnapper_pin_v1_ConfigurePinRequest_Pull pull);
void
deinitDigitalPin(wippersnapper_pin_v1_ConfigurePinRequest_Direction direction,
uint8_t pinName);
int digitalReadSvc(int pinName);
void digitalWriteSvc(uint8_t pinName, int pinValue);
void processDigitalInputs();
digitalInputPin *_digital_input_pins; /*!< Array of gpio pin objects */
private:
int32_t
_totalDigitalInputPins; /*!< Total number of digital-input capable pins */
};
#endif // WIPPERSNAPPER_DIGITALGPIO_H