Provides the core IoAbstraction interface and Arduino implementation of that interface.
More...
Go to the source code of this file.
|
IoAbstractionRef | internalDigitalIo () |
|
void | ioDevicePinMode (IoAbstractionRef ioDev, pinid_t pin, uint8_t dir) |
|
uint8_t | ioDeviceDigitalRead (IoAbstractionRef ioDev, pinid_t pin) |
|
void | ioDeviceDigitalWrite (IoAbstractionRef ioDev, pinid_t pin, uint8_t val) |
|
bool | ioDeviceSync (IoAbstractionRef ioDev) |
|
void | ioDeviceAttachInterrupt (IoAbstractionRef ioDev, pinid_t pin, RawIntHandler intHandler, uint8_t mode) |
|
uint8_t | ioDeviceDigitalReadS (IoAbstractionRef ioDev, pinid_t pin) |
|
bool | ioDeviceDigitalWriteS (IoAbstractionRef ioDev, pinid_t pin, uint8_t val) |
|
bool | ioDeviceDigitalWritePortS (IoAbstractionRef ioDev, pinid_t pinOnPort, uint8_t portVal) |
|
uint8_t | ioDeviceDigitalReadPortS (IoAbstractionRef ioDev, pinid_t pinOnPort) |
|
void | ioDeviceDigitalWritePort (IoAbstractionRef ioDev, pinid_t pinOnPort, uint8_t portVal) |
|
uint8_t | ioDeviceDigitalReadPort (IoAbstractionRef ioDev, pinid_t pinOnPort) |
|
Provides the core IoAbstraction interface and Arduino implementation of that interface.
◆ IoAbstractionRef
A reference to any type of IoAbstraction, that can be passed to one of the ioDevice.. functions. Normally, a reference is obtained using a helper function, such as ioUsingArduino
.
◆ internalDigitalIo()
Legacy to allow easy use of the original ioDevice... functions, for new code use internalDigitalDevice and the Arduino like helpers.
- See also
- internalDigitalDevice()
- Returns
- the device abstraction for digital pins, on ESP32 this abstraction does not need Arduino present.
◆ ioDevicePinMode()
Works in the same way as regular pinMode
but this works for any IoAbstractionRef that you wish to set the pin mode on. Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the previously created IoAbstraction |
the | pin on the device to change mode |
the | mode such as INPUT, OUTPUT, INPUT_PULLUP |
◆ ioDeviceDigitalRead()
Works in the same way as digitalRead
, but this works for any IoAbstractionRef
, on the serial versions, the port is cached, so before calling this method you need to have called ioDeviceSync
first. Moving forward we recommend using the abstractions directly as per documentation.
- See also
- ioDeviceDigitalReadS for a shortcut version that syncs first, but is less efficient if there are many reads
- Parameters
-
ioDev | the previously created IoAbstraction |
the | pin on the device to read |
◆ ioDeviceDigitalWrite()
Works in the same way as digitalWrite, but this works for any IoAbstractionRef
, on the serial versions, the port is cached, so before calling this method, you need to have called IoDeviceSync
first. Moving forward we recommend using the abstractions directly as per documentation.
- See also
- ioDeviceDigitalWriteS for a shortcut version that syncs after writing, but is less efficient with many writes.
- Parameters
-
ioDev | the previously created IoAbstraction |
pin | the pin to be updated |
val | the new value for the pin, HIGH/LOW |
◆ ioDeviceSync()
On serial versions of this abstraction, this causes synchronization to both the read and write values, so the chip and this IoAbstraction are in sync. Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the IoAbstraction to be synchronised. |
◆ ioDeviceAttachInterrupt()
void ioDeviceAttachInterrupt |
( |
IoAbstractionRef |
ioDev, |
|
|
pinid_t |
pin, |
|
|
RawIntHandler |
intHandler, |
|
|
uint8_t |
mode |
|
) |
| |
|
inline |
Attach an interrupt to any IoAbstraction, regardless of the device location this will perform the required tasks to register the interrupt in the requested mode. Note that not all devices can support all modes, check the device datasheet and the particular abstraction you are using carefully, to ensure you get the expected result. Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the IoAbstraction to use |
pin | the pin on this device to be used |
intHandler | a void function with no parameters, used to handle interrupts. THIS IS A RAW INTERRUPT AND NOT MARSHALLED |
mode | standard Arduino interrupt modes: CHANGE, RISING, FALLING |
◆ ioDeviceDigitalReadS()
Works in the same way as digitalRead
, but this works for any IoAbstractionRef
, unlike the non 'S' version this automatically calls ioDeviceSync first. Moving forward we recommend using the abstractions directly as per documentation.
- See also
- ioDeviceDigitalRead where you have more than one read / write to do at once, performs better in those cases.
- Parameters
-
ioDev | the previously created IoAbstraction |
the | pin on the device to read |
◆ ioDeviceDigitalWriteS()
Works in the same way as digitalWrite, but this works for any IoAbstractionRef
, unlike the non 'S' version this automatically calls ioDeviceSync first. Moving forward we recommend using the abstractions directly as per documentation.
- See also
- ioDeviceDigitalWrite where you have more than one read / write to do at once, performs better in those cases.
- Parameters
-
ioDev | the previously created IoAbstraction |
pin | the pin to be updated |
val | the new value for the pin, HIGH/LOW |
◆ ioDeviceDigitalWritePortS()
bool ioDeviceDigitalWritePortS |
( |
IoAbstractionRef |
ioDev, |
|
|
pinid_t |
pinOnPort, |
|
|
uint8_t |
portVal |
|
) |
| |
|
inline |
Write a whole 8 bit byte onto the port that the pin belongs to. For example if pin 42 where on PORTH then this would write to PORTH. For i2c and shift registers, it works the same, but the results are more predictable.
This version calls ioDeviceSync automatically after doing the write
Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the previously created IoAbstraction |
pinOnPort | any pin belonging to the port |
val | the new value for the port |
◆ ioDeviceDigitalReadPortS()
Reads a whole 8 bit value back from the port with automatic sync before the operation. Specify the pin on the port that you wish to read. For example if pin 42 where on PORTH then this would write to PORTH. For i2c and shift registers, it works the same, but the results are more predictable.
This version calls ioDeviceSync automatically before doing the read. Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the previously created IoAbstraction |
pin | any pin belonging to the port to be read |
- Returns
- the value of the port.
◆ ioDeviceDigitalWritePort()
void ioDeviceDigitalWritePort |
( |
IoAbstractionRef |
ioDev, |
|
|
pinid_t |
pinOnPort, |
|
|
uint8_t |
portVal |
|
) |
| |
|
inline |
Write a whole 8 bit byte onto the port that the pin belongs to. For example if pin 42 where on PORTH then this would write to PORTH. For i2c and shift registers, it works the same, but the results are more predictable.
This version does not automatically sync, call the 'S' variant for that. Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the previously created IoAbstraction |
pinOnPort | any pin belonging to the port |
val | the new value for the port |
◆ ioDeviceDigitalReadPort()
Reads a whole 8 bit value back from the port with automatic sync before the operation. Specify the pin on the port that you wish to read. For example if pin 42 where on PORTH then this would write to PORTH. For i2c and shift registers, it works the same, but the results are more predictable.
This version does not automatically sync, call the 'S' variant for that. Moving forward we recommend using the abstractions directly as per documentation.
- Parameters
-
ioDev | the previously created IoAbstraction |
pin | any pin belonging to the port to be read |
- Returns
- the value of the port.