I2Cwrapper v0.3.0
Generic framework for Arduino I2C target devices
|
Firmware module for the I2Cwrapper firmare. More...
Firmware module for the I2Cwrapper firmare.
Provides access to the target's analog and digital input and output pins. Mimicks the standard Arduino functions like pinMode(), digitalRead(), etc.
Copyright (c) 2022 juh
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
Functions | |
log ("PinI2C module enabled.\n") | |
bufferIn | read (pin) |
bufferIn | read (mode) |
log ("pinMode(") | |
log (pin) | |
log (", ") | |
log (mode) | |
log (")\n\n") | |
pinMode (pin, mode) | |
bufferOut | write ((int16_t) digitalRead(pin)) |
bufferIn | read (value) |
digitalWrite (pin, value) | |
bufferOut | write ((int16_t) analogRead(pin)) |
analogWrite (pin, value) | |
for (uint8_t i=0;i< numUsedPins;i++) | |
Variables | |
uint8_t | usedPins [NUM_DIGITAL_PINS] = pin |
uint8_t | numUsedPins = 0 |
case | pinPinModeCmd |
uint8_t | mode |
break | |
case | pinDigitalReadCmd |
case | pinDigitalWriteCmd |
uint8_t | value = 0 |
case | pinAnalogReadCmd |
case | pinAnalogWriteCmd |
analogWrite | ( | pin | , |
value | |||
) |
digitalWrite | ( | pin | , |
value | |||
) |
for | ( | ) |
log | ( | " | ) |
log | ( | " | , |
" | |||
) |
log | ( | "PinI2C module enabled.\n" | ) |
log | ( | ) |
log | ( | mode | ) |
log | ( | pin | ) |
pinMode | ( | pin | , |
mode | |||
) |
bufferIn read | ( | pin | ) |
bufferOut write | ( | (int16_t) analogRead(pin) | ) |
bufferOut write | ( | (int16_t) digitalRead(pin) | ) |
break |
uint8_t mode |
numUsedPins = 0 |
case pinAnalogReadCmd |
case pinAnalogWriteCmd |
case pinDigitalReadCmd |
case pinDigitalWriteCmd |
case pinPinModeCmd |
usedPins[numUsedPins++] = pin |
int16_t value = 0 |