This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
ExtendedInputOutput.hpp
Go to the documentation of this file.
1 /* ✔ */
2 
3 #pragma once
4 
5 #include "ExtendedIOElement.hpp"
6 #include <Arduino.h> // pin functions and constants
7 
8 #define EXT_PIN(x) (x + NUM_DIGITAL_PINS + NUM_ANALOG_INPUTS)
9 
10 const static uint8_t tmp_HIGH = HIGH;
11 const static uint8_t tmp_LOW = LOW;
12 const static uint8_t tmp_INPUT = INPUT;
13 const static uint8_t tmp_OUTPUT = OUTPUT;
14 const static uint8_t tmp_INPUT_PULLUP = INPUT_PULLUP;
15 
16 
17 #ifdef HIGH
18 #undef HIGH
19 #endif
20 #ifdef LOW
21 #undef LOW
22 #endif
23 
24 #ifdef INPUT
25 #undef INPUT
26 #endif
27 #ifdef OUTPUT
28 #undef OUTPUT
29 #endif
30 #ifdef INPUT_PULLUP
31 #undef INPUT_PULLUP
32 #endif
33 
34 const uint8_t HIGH = tmp_HIGH;
35 const uint8_t LOW = tmp_LOW;
36 
37 const uint8_t INPUT = tmp_INPUT;
38 const uint8_t OUTPUT = tmp_OUTPUT;
40 
42 
47 namespace ExtIO {
57 extern void pinMode(pin_t pin, uint8_t mode);
59 extern void pinMode(int pin, uint8_t mode);
61 extern void digitalWrite(pin_t pin, uint8_t val);
63 extern void digitalWrite(int pin, uint8_t val);
65 extern int digitalRead(pin_t pin);
67 extern int digitalRead(int pin);
69 extern void shiftOut(pin_t dataPin, pin_t clockPin, uint8_t bitOrder,
70  uint8_t val);
72 extern void shiftOut(int dataPin, int clockPin, uint8_t bitOrder, uint8_t val);
74 extern analog_t analogRead(pin_t pin);
76 extern analog_t analogRead(int pin);
77 
78 }
79 
ExtendedIOElement.hpp
INPUT_PULLUP
const uint8_t INPUT_PULLUP
Definition: ExtendedInputOutput.hpp:39
ExtIO::pinMode
void pinMode(pin_t pin, uint8_t mode)
An ExtIO version of the Arduino function.
Definition: ExtendedInputOutput.cpp:34
pin_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
Definition: Def.hpp:17
HIGH
const uint8_t HIGH
Definition: ExtendedInputOutput.hpp:34
ExtIO::getIOElementOfPin
ExtendedIOElement & getIOElementOfPin(pin_t pin)
Find the IO element of a given extended IO pin number.
Definition: ExtendedInputOutput.cpp:15
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
analog_t
uint16_t analog_t
The type returned from analogRead and similar functions.
Definition: Def.hpp:15
ExtIO::digitalWrite
void digitalWrite(pin_t pin, uint8_t val)
An ExtIO version of the Arduino function.
Definition: ExtendedInputOutput.cpp:45
ExtIO::shiftOut
void shiftOut(pin_t dataPin, pin_t clockPin, uint8_t bitOrder, uint8_t val)
An ExtIO version of the Arduino function.
Definition: ExtendedInputOutput.cpp:67
tmp_INPUT_PULLUP
const static uint8_t tmp_INPUT_PULLUP
Definition: ExtendedInputOutput.hpp:14
tmp_HIGH
const static uint8_t tmp_HIGH
Definition: ExtendedInputOutput.hpp:10
tmp_OUTPUT
const static uint8_t tmp_OUTPUT
Definition: ExtendedInputOutput.hpp:13
LOW
const uint8_t LOW
Definition: ExtendedInputOutput.hpp:35
ExtIO
A namespace with alternatives to the standard Arduino IO functions that can be used with extended IO ...
Definition: ExtendedInputOutput.cpp:8
tmp_INPUT
const static uint8_t tmp_INPUT
Definition: ExtendedInputOutput.hpp:12
ExtendedIOElement
An abstract base class for Extended Input/Output elements.
Definition: ExtendedIOElement.hpp:59
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
ExtIO::digitalRead
int digitalRead(pin_t pin)
An ExtIO version of the Arduino function.
Definition: ExtendedInputOutput.cpp:56
INPUT
const uint8_t INPUT
Definition: ExtendedInputOutput.hpp:37
tmp_LOW
const static uint8_t tmp_LOW
Definition: ExtendedInputOutput.hpp:11
OUTPUT
const uint8_t OUTPUT
Definition: ExtendedInputOutput.hpp:38
ExtIO::analogRead
analog_t analogRead(pin_t pin)
An ExtIO version of the Arduino function.
Definition: ExtendedInputOutput.cpp:84