Class Kit2GoBoardSupport

Nested Relationships

Nested Types

Class Documentation

class Kit2GoBoardSupport

The Kit2GoBoardSupport class used for custom board bring up, for control of SPI slave select lines and for controlling address lines for extended addressing of certain devices.

Public Functions

Kit2GoBoardSupport()

Default constructor with no parameters.

Create a new Kit2GoBoardSupport object with initialised data structures of type PinCtrl to hold parameters for powerPins, selectPins and addressPins.

~Kit2GoBoardSupport()

Destructor of the Kit2GoBoardSupport class.

void init(bool isEnablePower = true, bool isEnableSelect = false, bool isEnableExtendedAddress = false)

The function init sets/resets the board pin modes and/or values based on the values of the data structures set in the main code.

Parameters:
  • enablePower[in] Whether to power up the board using this class. In this case the board 3V3 is routed through a GPIO of the host MCU.

  • enableSelect[in] Whether SPI slaves SELECT lines need to be controlled using this class. A particular slave is selected by pulling its corresponding SELECT line low.

  • enableExtendedAddress[in] (Only relevant for Generation 1, A1B6 devices) Whether to use extended addressing feature. In this case, the pin stored in addressPins structure is activated and later isolated in a prescribed way to enable the 4 extended addresses of the said device.

void begin(bool enablePower = true, bool enableSelect = false, bool enableExtendedAddress = false)

The begin function recursively calls the init function of the same class.

Parameters:
  • enablePower[in] Whether to power up the board using this class. In this case the board 3V3 is routed through a GPIO of the host MCU.

  • enableSelect[in] Whether SPI slaves SELECT lines need to be controlled using this class. A particular slave is selected by pulling its corresponding SELECT line low.

  • enableExtendedAddress[in] (Only relevant for Generation 1, A1B6 devices) Whether to use extended addressing feature. In this case, the pin stored in addressPins structure is activated and later isolated in a prescribed way to enable the 4 extended addresses of the said device.

void deinit()

The deinit function sets all the pins to their disable value.

void end()

The end function recursively calls the deinit function of the same class.

void setPowerPin(uint8_t pinNumber, uint8_t pinDriveDirection, uint8_t pinTristateDirection, uint8_t pinEnableValue, uint8_t pinDisableValue, uint32_t delayAfterEnable = 0, uint32_t delayAfterDisable = 0)

The setPowerPin function is setter function to route pin parameters from the main code into the data structures/variables of this class.

Parameters:
  • pinNumber[in] Arduino pin number of the GPIO to be used as 3V3 POWER pin for the sensor.

  • pinDriveDirection[in] Direction of the Arduino pin to be used as the 3V3 POWER pin.

  • pinTristateDirection[in] Direction of the Arduino pin when in tristate.

  • pinEnableValue[in] Value of the pin in enabled state.

  • pinDisableValue[in] Value of the pin in disabled state.

  • delayAfterEnable[in] delay in ms after the pin is enabled. Needed to meet settling time constraints.

  • delayAfterDisable[in] delay in ms after the pin is disabled. Needed to meet settling time constraints.

void unsetPowerPin()

The unsetPowerPin function disables all actions on the pins set in powerPins that would otherwise be performed by the init function.

void setSelectPin(uint8_t pinNumber, uint8_t pinDriveDirection, uint8_t pinTristateDirection, uint8_t pinEnableValue, uint8_t pinDisableValue, uint32_t delayAfterEnable = 0, uint32_t delayAfterDisable = 0)

The setSelectPin function is setter function to route pin parameters from the main code into the data structures/variables of this class.

Parameters:
  • pinNumber[in] Arduino pin number of the GPIO to be used as SELECT pin for the sensor used as SPI slave.

  • pinDirection[in] Direction of the Arduino pin to be used as the select pin for the sensor used as SPI slave.

  • pinTristateDirection[in] Direction of the Arduino pin when in tristate.

  • pinEnableValue[in] Value of the pin in enabled state.

  • pinDisableValue[in] Value of the pin in disabled state.

  • delayAfterEnable[in] delay in ms after the pin is enabled. Needed to meet settling time constraints.

  • delayAfterDisable[in] delay in ms after the pin is disabled. Needed to meet settling time constraints.

void unsetSelectPin()

The unsetSelectPin function disables all actions on the pins set in selectPins that would otherwise be performed by the init function.

void setAddressPin(uint8_t pinNumber, uint8_t pinDriveDirection, uint8_t pinTristateDirection, uint8_t pinEnableValue, uint8_t pinDisableValue, uint32_t delayAfterEnable = 0, uint32_t delayAfterDisable = 0)

The setAddressPin function is setter function to route pin parameters from the main code into the data structures/variables of this class.

Parameters:
  • pinNumber[in] Arduino pin number of the GPIO to be used as the ADDR pin for the sensor used as SPI slave.

  • pinDirection[in] Direction of the Arduino pin to be used as the ADDR pin for the sensor used as SPI slave.

  • pinTristateDirection[in] Direction of the Arduino pin when in tristate.

  • pinEnableValue[in] Value of the pin in enabled state.

  • pinDisableValue[in] Value of the pin in disabled state.

  • delayAfterEnable[in] delay in ms after the pin is enabled. Needed to meet settling time constraints.

  • delayAfterDisable[in] delay in ms after the pin is disabled. Needed to meet settling time constraints.

void unsetAddressPin()

The unsetAddressPin function disables all actions on the pins set in selectPins that would otherwise be performed by the init function.

void enablePower(bool enable)

The enablePower function sets/resets the pins in powerPins based on argument.

Parameters:

enable[in] Sets pin to pinEnableValue if true, else to pinDisableValue.

void enableSelect(bool enable)

The enableSelect function sets/resets the pins in selectPins based on argument.

Parameters:

enable[in] Sets pin to pinEnableValue if true, else to pinDisableValue.

void enableAddress(bool enable)

The enableAddress function sets/resets the pins in selectPins based on argument.

Parameters:

enable – Sets pin to pinEnableValue if true, else to pinDisableValue.

void reset()

The reset function resets the power pin by going through a disable / enable cycle.