Class Kit2GoBoardSupport
Defined in File Kit2GoBoardSupport.hpp
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
initsets/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
beginfunction recursively calls theinitfunction 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
deinitfunction sets all the pins to their disable value.
-
void end()
The
endfunction recursively calls thedeinitfunction 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
setPowerPinfunction 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
unsetPowerPinfunction disables all actions on the pins set in powerPins that would otherwise be performed by theinitfunction.
-
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
setSelectPinfunction 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
unsetSelectPinfunction disables all actions on the pins set in selectPins that would otherwise be performed by theinitfunction.
-
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
setAddressPinfunction 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
unsetAddressPinfunction disables all actions on the pins set in selectPins that would otherwise be performed by theinitfunction.
-
void enablePower(bool enable)
The
enablePowerfunction 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
enableSelectfunction 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
enableAddressfunction sets/resets the pins in selectPins based on argument.- Parameters:
enable – Sets pin to pinEnableValue if true, else to pinDisableValue.
-
void reset()
The
resetfunction resets the power pin by going through a disable / enable cycle.
-
Kit2GoBoardSupport()