AccelStepperI2C
v 0.1
I2C wrapper (and a bit more) for the AccelStepper Arduino library
|
Go to the documentation of this file.
20 #define DEBUG // uncomment for debug output to Serial (which has to be begun() in the main sketch)
26 #define log(...) Serial.print(__VA_ARGS__)
199 uint32_t lastI2Ctransmission = 0;
200 uint16_t sentErrorsCount = 0;
201 uint16_t resultErrorsCount = 0;
A helper class for the AccelStepperI2C (and ServoI2C) library.
bool resultOK
True if return value from previous function call was received successfully.
void prepareCommand(uint8_t cmd, uint8_t unit=-1)
bool sentOK
True if previous function call was successfully transferred to slave.
I2Cwrapper(uint8_t i2c_address, uint8_t maxBuf=maxBufDefault)
Constructor.
uint8_t clearInterrupt()
Acknowledge a received interrupt to slave so that it can clear the interupt condition and return the ...
uint16_t resultErrors()
Return and reset the number of failed receive events since the last time this method was used....
const uint8_t changeI2CaddressCmd
uint16_t transmissionErrors()
Return and reset the sum of failed commands sent and failed receive events since the last time this m...
const uint8_t setInterruptPinCmd
bool readResult(uint8_t numBytes)
uint16_t sentErrors()
Return and reset the number of failed commands sent since the last time this method was used....
bool ping()
Test if slave is listening.
const uint16_t I2CdefaultDelay
Simple and ugly serialization buffer for any data type. Template technique and CRC8 adapted from Nick...
const uint8_t interruptReason_none
You should not encounter this, as you don't want to be interrupted without a reason....
uint32_t getSlaveVersion()
Get semver compliant version of slave firmware.
const uint16_t maxBufDefault
void changeI2Caddress(uint8_t newAddress)
Permanently change the I2C address of the device. New address is stored in EEPROM (AVR) or flash memo...
const uint8_t getVersionResult
const uint8_t getVersionCmd
const uint8_t clearInterruptResult
int16_t setI2Cdelay(int16_t delay)
Define a minimum time that the master keeps between I2C transmissions. This is to make sure that the ...
const uint8_t clearInterruptCmd
void reset()
Tells the slave to reset to it's default state. It is recommended to reset the slave every time the m...
bool checkVersion(uint32_t masterVersion)
Get version of slave firmware and compare it with library version.
void setInterruptPin(int8_t pin, bool activeHigh=true)
Define a global interrupt pin which can be used by device units (steppers, servos....