Serial Wombat Arduino Library

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
PCB0031_Grip Class Reference

A class representing a PCB0031 Grip PCB. More...

`#include <PCB0031_Grip.h>`

Inheritance diagram for PCB0031_Grip:
[legend]
Collaboration diagram for PCB0031_Grip:
[legend]

## Public Member Functions
| PCB0031_Grip ()
int16_t | begin (uint8_t i2cAddress, bool pin3IsVoltage=false)
| Initialize a PCB0031_Grip pcb on a given I2C address.
uint16_t | readPowerVoltage_mv ()
| Returns the voltage provided to the Servos in mV.
Public Member Functions inherited from SerialWombatChip
void | configureDigitalPin (uint8_t pin, uint8_t highLow)
| Configure a pin to a digital state with the same parameters as Arduino's digitalWrite() function.
int16_t | initialize ()
| An internal function used to set up the Serial Wombat chip and this class. Call begin() instead of this function.
void | readUniqueIdentifier ()
| Read the unique identifier from the Serial Wombat chip and store it in uniqueIdentifier.
void | readDeviceIdentifier ()
| Read the device identifier from the Serial Wombat chip and store it in deviceIdentifier.
uint16_t | returnErrorCode (uint8_t *rx)
| Convert an ASCII Error code from a received packet into an integer error code.
| SerialWombatChip ()
int16_t | begin (HardwareSerial &serial, bool reset=true)
| initialize a Serial Wombat chip to use a Serial Interface.
int16_t | begin (uint8_t i2cAddress)
| initialize a Serial Wombat chip to use the default Wire I2C Interface and specified address.
int16_t | begin (TwoWire &wire, uint8_t i2cAddress, bool reset=true)
| initialize a Serial Wombat chip to use a specified I2C Interface and address.
| ~SerialWombatChip ()
int | sendPacket (uint8_t tx[], uint8_t rx[])
| Send an 8 byte packet to the Serial Wombat chip and wait for 8 bytes back.
int | sendPacket (uint8_t tx[])
| Send an 8 byte packet to the Serial Wombat chip.
int | sendPacket (uint8_t tx[], uint8_t rx[], bool retryIfEchoDoesntMatch, uint8_t beginningBytesToMatch=8, uint8_t endBytesToMatch=0)
| Send an 8 byte packet to the Serial Wombat chip and wait for 8 bytes back.
int | sendPacket (uint8_t tx[], bool retryIfEchoDoesntMatch)
| Send an 8 byte packet to the Serial Wombat chip.
int | sendPacketNoResponse (uint8_t tx[])
| Send an 8 byte packet to the Serial Wombat chip, don't wait for a response.
char * | readVersion (void)
| Request version string (combined model and firmware) and return pointer to it.
uint32_t | readVersion_uint32 (void)
| Request version as a uint32.
bool | isLatestFirmware (void)
| Check if the firmware is the latest version (or more precisely, if the firmware matches this verison of the Library)
uint16_t | readPublicData (uint8_t pin)
| Read the 16 Bit public data associated with a Serial Wombat Pin Mode.
uint16_t | readPublicData (SerialWombatDataSource dataSource)
| Read the 16 Bit public data associated with a Serial Wombat Pin Mode.
uint16_t | writePublicData (uint8_t pin, uint16_t value)
| Write a 16 bit value to a Serial Wombat pin Mode.
uint32_t | comparePublicDataToThreshold (uint16_t threshold=0)
uint16_t | readSupplyVoltage_mV (void)
| Measure the Serial Wombat chip's Supply voltage.
int16_t | readTemperature_100thsDegC (void)
| Measure the Serial Wombat chip's internal temperature.
void | hardwareReset ()
| Send a reset command to the Serial Wombat chip.
void | pinMode (uint8_t pin, uint8_t mode, bool pullDown=false, bool openDrain=false)
| Set a pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings.
void | digitalWrite (uint8_t pin, uint8_t val)
| Set an output pin High or Low.
int | digitalRead (uint8_t pin)
| Reads the state of a Pin.
int | analogRead (uint8_t pin)
| Configures pin as analog input and does an immediate A/D conversion.
void | analogWrite (uint8_t pin, int val)
| Set a pin to PWM output.
bool | queryVersion ()
| Send a version request to the Serial Wombat chip.
uint32_t | readFramesExecuted ()
| Get the number of 1mS frames that have been executed since Serial Wombat chip reset.
uint16_t | readOverflowFrames ()
| Get the number of times an overflow Frame has occured.
void | jumpToBoot ()
| Jump to Bootloader and wait for a UART download of new firmware.
uint8_t | readRamAddress (uint16_t address)
| Read Address from RAM based on 16 bit address.
int16_t | writeRamAddress (uint16_t address, uint8_t value)
| Write byte to Address in RAM based on 16 bit address.
uint32_t | readFlashAddress (uint32_t address)
| Read Address from Flash based on 32 bit address.
int16_t | readUserBuffer (uint16_t index, uint8_t *buffer, uint16_t count)
| Read data from the Serial Wombat 18AB's internal RAM buffer.
void | sleep4B ()
| Shuts down most functions of the Serial Wombat 4B chip reducing power consumption.
void | sleep8B (uint16_t delay)
| Shuts down the Serial Wombat 8B chip reducing power consumption as low as 10uA.
void | wake ()
| Called to send a dummy packet to the Serial Wombat 8B chip to wake it from sleep and ready it for other commands.
bool | isSW04 ()
| Returns true if the instance received a model number corresponding to the Serial Wombat 18 series of chips at begin.
bool | isSW18 ()
| Returns true if the instance received a model number corresponding to the Serial Wombat 18 series of chips at begin.
bool | isSW08 ()
| Returns true if the instance received a model number corresponding to the Serial Wombat 08 series of chips at begin.
bool | isPinModeSupported (int pinMode)
| Check if a specific pin mode is supported by the firmware in the Serial Wombat chip. (8B and 18AB only)
bool | isPinModeSupported (SerialWombatPinMode_t pinMode)
| Check if a specific pin mode is supported by the firmware in the Serial Wombat chip. (8B and 18AB only)
int16_t | eraseFlashPage (uint32_t address)
| Erases a page in flash. Intended for use with the Bootloader, not by end users outside of bootloading sketch.
int16_t | writeFlashRow (uint32_t address)
| Writes a row in flash. Intended for use with the Bootloader, not by end users outside of bootloading sketc.
int16_t | setThroughputPin (uint8_t pin)
| Set a pin to be a throughput monitoring pin.
int16_t | setThroughputPin (uint32_t address)
| Set this chip Address (SW8B only)
int | writeUserBuffer (uint16_t index, uint8_t *buffer, uint16_t count)
| Write bytes to the User Memory Buffer in the Serial Wombat chip.
int | writeUserBuffer (uint16_t index, char *s)
| Write bytes to the User Memory Buffer in the Serial Wombat chip.
int | writeUserBuffer (uint16_t index, const char s[])
| Write bytes to the User Memory Buffer in the Serial Wombat chip.
int16_t | writeFrameTimerPin (uint8_t pin)
| Set a pin to be a frame timer for system utilization (SW18AB Only)
int16_t | readLastErrorCommand (uint8_t *cmd)
| Returns the last Serial Wombat command that produced a protocol error.
void | registerErrorHandler (SerialWombatErrorHandler_t handler)
| Registers an error handler that is called by the SerialWombatChip sendPacket() command when a protocol error is returned by the Serial Wombat.
int16_t | echo (uint8_t data[], uint8_t count=7)
| Echo a byte array back to the host. Used for testing and debugging.
int16_t | echo (char *data)
| Echo a byte array back to the host. Used for testing and debugging.
uint32_t | readBirthday ()
| Read the birthday of the Serial Wombat 18AB chip.
int16_t | readBrand (char *data)
| Read the brand of the Serial Wombat 18AB chip.

## Public Attributes
GripServo | gs0
GripServo | gs1
GripServo | gs2
GripServo | gs3
SerialWombatAnalogInput_18AB | powerVoltage
GripServo * | gsArray [4] = { &gs0,&gs1,&gs2,&gs3 }
Public Attributes inherited from SerialWombatChip
uint16_t | _supplyVoltagemV = 0
uint8_t | model [4] = { 0 }
| Contains the last model retreived by queryVersion() as a zero-terminated string.
uint8_t | fwVersion [4] = { 0 }
| Contains the last firmware Version retreived by queryVersion() as a zero-terminated string.
uint8_t | uniqueIdentifier [16]
uint8_t | uniqueIdentifierLength = 0
uint16_t | deviceIdentifier
uint16_t | deviceRevision
uint16_t | errorCount = 0
| Incremented every time a communication or command error is detected.
bool | inBoot = false
| Set to true if boot mode is indicated by a version query.
int16_t | lastErrorCode = 0
| The last error code returned as part of a protocol error message expressed as a positive integer.
uint32_t | sendReadyTime = 0
| Used as a countdown after a reset command is issued.
uint8_t | address = 0
| The I2C address of the SerialWombatChip instance.
uint8_t | communicationErrorRetries = 5
| How many times to retry a packet if communcation bus (such as I2C) error.

## Additional Inherited Members
Static Public Member Functions inherited from SerialWombatChip
static uint8_t | find (bool keepTrying=false)
| Search the I2C Bus addresses 0x68 to 0x6F for I2C devices, and test to see if they respond to Serial Wombat version commands. Returns first address that responds properly or 0 if none found.

## Detailed Description

A class representing a PCB0031 Grip PCB.

The PCB0031_Grip class is a child class of SerialWombatChip. It adds additional functionality to the begin class to initialize GripServo classes associated with the 4 (or 3) servo/current sensor combinations.
In the case where the solder jumper for servo power voltage measurement is closed, 3 servo combinations are initialized, and an analog input for the voltage is initialized.

The class creates 4 GripServo s named gs0 thorugh gs3 .

Warning
  This board requires 5V logic for proper operation of the Current Sensor ICs Servo control will work at 3.3V, but feedback may not.

A Tutorial video is also avaialble:

https://youtu.be/TODO

Definition at line 388 of file PCB0031_Grip.h.

## Constructor & Destructor Documentation

## ◆ PCB0031_Grip()

PCB0031_Grip::PCB0031_Grip | ( |  | ) |
| inline

Definition at line 391 of file PCB0031_Grip.h.

## Member Function Documentation

## ◆ begin()

int16_t PCB0031_Grip::begin | ( | uint8_t | i2cAddress,
|  | bool | pin3IsVoltage = false )
| inline

Initialize a PCB0031_Grip pcb on a given I2C address.

Wire must be initialized before calling this function

Parameters

  i2cAddress | The I2C address of the PCB
  pin3IsVoltage | Set this to true if the voltage measurement solder jumper has been soldered closed

Returns
  Returns a negative number indicating an error code, or a non negative number indicating success

Definition at line 409 of file PCB0031_Grip.h.

## ◆ readPowerVoltage_mv()

uint16_t PCB0031_Grip::readPowerVoltage_mv | ( |  | ) |
| inline

Returns the voltage provided to the Servos in mV.

begin must be called with pin3VoltageEnable = true before using this method

this funciton calculates the value based on the 8200/2000 ohm voltage divider on the board

Returns
  Returns the servo voltage in millivolts

Definition at line 441 of file PCB0031_Grip.h.

## Member Data Documentation

## ◆ gs0

GripServo PCB0031_Grip::gs0

Definition at line 394 of file PCB0031_Grip.h.

## ◆ gs1

GripServo PCB0031_Grip::gs1

Definition at line 394 of file PCB0031_Grip.h.

## ◆ gs2

GripServo PCB0031_Grip::gs2

Definition at line 394 of file PCB0031_Grip.h.

## ◆ gs3

GripServo PCB0031_Grip::gs3

Definition at line 394 of file PCB0031_Grip.h.

## ◆ gsArray

GripServo* PCB0031_Grip::gsArray[4] = { &gs0,&gs1,&gs2,&gs3 }

Definition at line 397 of file PCB0031_Grip.h.

## ◆ powerVoltage

SerialWombatAnalogInput_18AB PCB0031_Grip::powerVoltage

Definition at line 395 of file PCB0031_Grip.h.