I2Cwrapper v0.5.0
Generic framework for Arduino I2C target devices
ServoI2C_firmware.h File Reference

Firmware module for the I2Cwrapper firmare. More...

Detailed Description

Firmware module for the I2Cwrapper firmare.

Provides I2C access to servo motors connected to the target device. Mimicks the standard Servo library functions.

Author

Copyright (c) 2022 juh

License

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.

Note
At the moment, this will only work if controller and target use the same values for sizeof(int).
Todo:
Need to typecast the transmission of int values to int16_t.

Functions

bool validServo (int8_t s)
 
 log ("ServoI2C module enabled.\n")
 
bufferIn read (p)
 
servos[numServosattach (p)
 
bufferOut write (numServos++)
 
 log (numServos)
 
bufferIn read (min)
 
bufferIn read (max)
 
servos[numServosattach (p, min, max)
 
bufferIn read (value)
 
servos[unit] write (value)
 
servos[unit] writeMicroseconds (value)
 
 for (uint8_t i=0;i< numServos;i++)
 

Variables

const uint8_t maxServos = 4
 
Servo servos [maxServos]
 
uint8_t numServos = 0
 
case servoAttach1Cmd
 
 break
 
case servoAttach2Cmd
 
int min
 
int max
 
case servoDetachCmd
 
case servoWriteCmd
 
case servoWriteMicrosecondsCmd
 
case servoReadCmd
 
case servoReadMicrosecondsCmd
 
case servoAttachedCmd
 

Function Documentation

◆ attach() [1/2]

servos[numServos] attach ( )

◆ attach() [2/2]

servos[numServos] attach ( ,
min  ,
max   
)

◆ for()

for ( )

◆ log() [1/2]

log ( "ServoI2C module enabled.\n"  )

◆ log() [2/2]

log ( numServos  )

◆ read() [1/4]

bufferIn read ( max  )

◆ read() [2/4]

bufferIn read ( min  )

◆ read() [3/4]

bufferIn read ( )

◆ read() [4/4]

bufferIn read ( value  )

◆ validServo()

bool validServo ( int8_t  s)

◆ write() [1/2]

bufferOut write ( numServos++  )

◆ write() [2/2]

servos[unit] write ( value  )

◆ writeMicroseconds()

servos[unit] writeMicroseconds ( value  )

Variable Documentation

◆ break

break

◆ max

int max

◆ maxServos

const uint8_t maxServos = 4

◆ min

int min

◆ numServos

numServos = 0

◆ servoAttach1Cmd

case servoAttach1Cmd

◆ servoAttach2Cmd

case servoAttach2Cmd

◆ servoAttachedCmd

case servoAttachedCmd

◆ servoDetachCmd

case servoDetachCmd

◆ servoReadCmd

case servoReadCmd

◆ servoReadMicrosecondsCmd

case servoReadMicrosecondsCmd

◆ servos

Servo servos[maxServos]

◆ servoWriteCmd

case servoWriteCmd

◆ servoWriteMicrosecondsCmd

case servoWriteMicrosecondsCmd