|
M5Unit-EXTIO 0.1.0 git rev:7d9bfd8
|
Extend I/O Unit2. More...
#include <unit_ExtIO2.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Member Functions | |
| UnitExtIO2 (const uint8_t addr=DEFAULT_ADDRESS) | |
| virtual bool | begin () override |
Settings for begin | |
| config_t | config () |
| Gets the configration. | |
| void | config (const config_t &cfg) |
| Set the configration. | |
Firmware version | |
| uint8_t | firmwareVersion () const |
| Gets the inner firmware version. | |
| bool | readFirmwareVersion (uint8_t &version) |
| Read the firmware version. | |
Mode | |
| extio2::Mode | mode (const uint8_t pin) |
| Gets the inner mode. | |
| bool | readMode (extio2::Mode &mode, const uint8_t pin) |
| Read the mode of the specified pin. | |
| bool | readAllMode (extio2::Mode mode[NUMBER_OF_PINS]) |
| Read the mode of all pins. | |
| bool | writeMode (const uint8_t pin, const extio2::Mode mode) |
| Write the mode of the specified pin. | |
| bool | writePinBitsMode (const uint8_t pin_bits, const extio2::Mode mode) |
| Write the mode of the specified pin bits. | |
| bool | writeAllMode (const extio2::Mode mode) |
| Write the mode of all pins. | |
| bool | writeAllMode (const extio2::Mode mode[NUMBER_OF_PINS]) |
| Write the mode of all pins. | |
Digiat input | |
| bool | readDigitalInput (bool &high, const uint8_t pin) |
| Read the digital input from the specified pin. | |
| bool | readPinBitsDigitalInput (uint8_t &high_bits, const uint8_t pin_bits) |
| Read the digital input from the specified pin bits. | |
| bool | readAllDigitalInput (uint8_t &high_bits) |
| Read the digital input from all pins. | |
Digital output | |
| bool | writeDigitalOutput (const uint8_t pin, const bool high) |
| Write the digital output to the specified pin. | |
| bool | writeDigitalOutputHigh (const uint8_t pin) |
| Write the digital output HIGH to the specified pin. | |
| bool | writeDigitalOutputLow (const uint8_t pin) |
| Write the digital output LOW to the specified pin. | |
| template<typename T , typename std::enable_if< std::is_same< T, bool >::value, std::nullptr_t >::type = nullptr> | |
| bool | writePinBitsDigitalOutput (const uint8_t pin_bits, const T high) |
| Write the digital output to the specified pin bits. | |
| template<typename T , typename std::enable_if<!std::is_same< T, bool >::value &&std::is_integral< T >::value, std::nullptr_t >::type = nullptr> | |
| bool | writePinBitsDigitalOutput (const uint8_t pin_bits, const T high_bits) |
| Write the digital output to the specified pin bits. | |
| bool | writePinBitsDigitalOutputHigh (const uint8_t pin_bits) |
| Write the digital output HIGH to the specified pin bits. | |
| bool | writePinBitsDigitalOutputLow (const uint8_t pin_bits) |
| Write the digital output LOW to the specified pin bits. | |
| bool | writeAllDigitalOutput (const bool high) |
| Write the digital output to all pins. | |
| bool | writeAllDigitalOutputHigh () |
| Write the digital output HIGH to all pins. | |
| bool | writeAllDigitalOutputLow () |
| Write the digital output LOW to all pins. | |
Analog input | |
| |
| bool | readAnalogInput (uint16_t &value, const uint8_t pin, const extio2::AnalogMode amode) |
| Read the analog input from the specified pin. | |
| bool | readAnalogInput8 (uint16_t &value, const uint8_t pin) |
| Read the analog input 8 bits from the specified pin. | |
| bool | readAnalogInput12 (uint16_t &value, const uint8_t pin) |
| Read the analog input 12 bits from the specified pin. | |
| bool | readPinBitsAnalogInput (uint16_t values[NUMBER_OF_PINS], const uint8_t pin_bits, const extio2::AnalogMode amode) |
| Read the analog input from the specified pin bits. | |
| bool | readPinBitsAnalogInput8 (uint16_t values[NUMBER_OF_PINS], const uint8_t pin_bits) |
| Read the analog input 8 bits from the specified pin bits. | |
| bool | readPinBitsAnalogInput12 (uint16_t values[NUMBER_OF_PINS], const uint8_t pin_bits) |
| Read the analog input 12 bits from the specified pin bits. | |
| bool | readAllAnalogInput (uint16_t values[NUMBER_OF_PINS], const extio2::AnalogMode amode) |
| Read the analog input from all pins. | |
| bool | readAllAnalogInput8 (uint16_t values[NUMBER_OF_PINS]) |
| Read the analog input 8 bits from all pins. | |
| bool | readAllAnalogInput12 (uint16_t values[NUMBER_OF_PINS]) |
| Read the analog input 12 bits from all pins. | |
Servo control | |
| |
| bool | readServoAngle (uint8_t °ree, const uint8_t pin) |
| Read the servo angle from the specified pin. | |
| bool | readPinBitsServoAngle (uint8_t degrees[NUMBER_OF_PINS], const uint8_t pin_bits) |
| Read the servo angle from the specified pin. | |
| bool | readAllServoAngle (uint8_t degrees[NUMBER_OF_PINS]) |
| Read the servo angle from all pins. | |
| bool | writeServoAngle (const uint8_t pin, const uint8_t degree) |
| Write the servo angle to the specified pin. | |
| bool | writePinBitsServoAngle (const uint8_t pin_bits, const uint8_t degree) |
| Write the servo angle to the specified pin bits. | |
| bool | writeAllServoAngle (const uint8_t degree) |
| Write the servo angle to all pins. | |
| bool | readServoPulse (uint16_t &pulse, const uint8_t pin) |
| Read the servo pulse from the specified pin. | |
| bool | readPinBitsServoPulse (uint16_t pulses[NUMBER_OF_PINS], const uint8_t pin_bits) |
| Read the servo pulse from the specified pin. | |
| bool | readAllServoPulse (uint16_t pulses[NUMBER_OF_PINS]) |
| Read the servo pulse from all pins. | |
| bool | writeServoPulse (const uint8_t pin, const uint16_t pulse) |
| Write the servo pulse to the specified pin. | |
| bool | writePinBitsServoPulse (const uint8_t pin_bits, const uint16_t pulse) |
| Write the servo pulse to the specified pin bits. | |
| bool | writeAllServoPulse (const uint16_t pulse) |
| Write the servo pulse to all pins. | |
LED control | |
| bool | readLEDColor (uint32_t &rgb888, const uint8_t pin) |
| Read the LED RGB888 from the specified pin. | |
| bool | readPinBitsLEDColor (uint32_t rgb888[NUMBER_OF_PINS], const uint8_t pin_bits) |
| Read the LED RGB888 from the specified pin. | |
| bool | readAllLEDColor (uint32_t rgb888[NUMBER_OF_PINS]) |
| Read the LED RGB888 from all pins. | |
| bool | writeLEDColor (const uint8_t pin, const uint32_t rgb888) |
| Write the LED RGB888 to the specified pin. | |
| bool | writeLEDColor (const uint8_t pin, const uint8_t r, const uint8_t g, const uint8_t b) |
| Write the LED RGB888 to the specified pin. | |
| bool | writePinBitsLEDColor (const uint8_t pin_bits, const uint32_t rgb888) |
| Write the LED RGB888 to the specified pin bits. | |
| bool | writePinBitsLEDColor (const uint8_t pin_bits, const uint8_t r, const uint8_t g, const uint8_t b) |
| Write the LED RGB888 to the specified pin. | |
| bool | writeAllLEDColor (const uint32_t rgb888) |
| Write the LED RGB888 to all pins. | |
| bool | writeAllLEDColor (const uint8_t r, const uint8_t g, const uint8_t b) |
| Write the LED RGB888 to all pins. | |
I2C Address | |
| |
| bool | changeI2CAddress (const uint8_t i2c_address) |
| Change device I2C address. | |
| bool | readI2CAddress (uint8_t &i2c_address) |
| Read device I2C address. | |
Static Protected Attributes | |
| static constexpr uint8_t | FIRMWARE_VERSION_CAN_PWM_CONTROL {0x03} |
Extend I/O Unit2.
| bool m5::unit::UnitExtIO2::changeI2CAddress | ( | const uint8_t | i2c_address | ) |
Change device I2C address.
| i2c_address | I2C address |
|
inline |
Gets the inner firmware version.
|
inline |
Gets the inner mode.
| pin | Pin number |
|
inline |
Read the analog input from all pins.
| [out] | values | Value array |
| amode | Data width |
| bool m5::unit::UnitExtIO2::readAllDigitalInput | ( | uint8_t & | high_bits | ) |
Read the digital input from all pins.
| [out] | high_bits | Pin status 0-7 as bits of uint8_t |
|
inline |
Read the LED RGB888 from all pins.
| [out] | rgb888 | RGB888 array |
| bool m5::unit::UnitExtIO2::readAllMode | ( | extio2::Mode | mode[NUMBER_OF_PINS] | ) |
Read the mode of all pins.
| [out] | mode | Mode array |
| pin | Pin number |
|
inline |
Read the servo angle from all pins.
| [out] | degree | Angle |
| pin | Pin number |
|
inline |
Read the servo pulse from all pins.
| [out] | pulses | Pulse array |
| bool m5::unit::UnitExtIO2::readAnalogInput | ( | uint16_t & | value, |
| const uint8_t | pin, | ||
| const extio2::AnalogMode | amode ) |
Read the analog input from the specified pin.
| [out] | value | Value |
| pin | Pin number | |
| amode | Data width |
| bool m5::unit::UnitExtIO2::readDigitalInput | ( | bool & | high, |
| const uint8_t | pin ) |
Read the digital input from the specified pin.
| [out] | high | True if HIGH |
| pin | Pin number |
| bool m5::unit::UnitExtIO2::readFirmwareVersion | ( | uint8_t & | version | ) |
Read the firmware version.
| [out] | version | Version |
| bool m5::unit::UnitExtIO2::readI2CAddress | ( | uint8_t & | i2c_address | ) |
Read device I2C address.
| [out] | i2c_address | I2C address |
| bool m5::unit::UnitExtIO2::readLEDColor | ( | uint32_t & | rgb888, |
| const uint8_t | pin ) |
Read the LED RGB888 from the specified pin.
| [out] | rgb888 | RGB888 |
| pin | Pin number |
| bool m5::unit::UnitExtIO2::readMode | ( | extio2::Mode & | mode, |
| const uint8_t | pin ) |
Read the mode of the specified pin.
| [out] | mode | Mode |
| pin | Pin number |
| bool m5::unit::UnitExtIO2::readPinBitsAnalogInput | ( | uint16_t | values[NUMBER_OF_PINS], |
| const uint8_t | pin_bits, | ||
| const extio2::AnalogMode | amode ) |
Read the analog input from the specified pin bits.
| [out] | values | Value array |
| pin_bits | Bits of the target pin | |
| amode | Data width |
| bool m5::unit::UnitExtIO2::readPinBitsDigitalInput | ( | uint8_t & | high_bits, |
| const uint8_t | pin_bits ) |
Read the digital input from the specified pin bits.
| [out] | high_bits | Pin status 0-7 as bits of uint8_t |
| pin_bits | Bits of the target pin |
| bool m5::unit::UnitExtIO2::readPinBitsLEDColor | ( | uint32_t | rgb888[NUMBER_OF_PINS], |
| const uint8_t | pin_bits ) |
Read the LED RGB888 from the specified pin.
| [out] | rgb888 | RGB888 array |
| pin_bits | Bits of the target pin |
| bool m5::unit::UnitExtIO2::readPinBitsServoAngle | ( | uint8_t | degrees[NUMBER_OF_PINS], |
| const uint8_t | pin_bits ) |
Read the servo angle from the specified pin.
| [out] | degree | Angle |
| pin | Pin number |
| bool m5::unit::UnitExtIO2::readPinBitsServoPulse | ( | uint16_t | pulses[NUMBER_OF_PINS], |
| const uint8_t | pin_bits ) |
Read the servo pulse from the specified pin.
| [out] | pulses | Pulse array |
| pin_bits | Bits of the target pin |
| bool m5::unit::UnitExtIO2::readServoAngle | ( | uint8_t & | degree, |
| const uint8_t | pin ) |
Read the servo angle from the specified pin.
| [out] | degree | Angle |
| pin | Pin number |
| bool m5::unit::UnitExtIO2::readServoPulse | ( | uint16_t & | pulse, |
| const uint8_t | pin ) |
Read the servo pulse from the specified pin.
| [out] | pulse | Pulse (us) |
| pin | Pin number |
|
inline |
Write the digital output to all pins.
| high | HIGH if true, LOW if false |
|
inline |
Write the digital output HIGH to all pins.
| high | HIGH if true, LOW if false |
|
inline |
Write the digital output LOW to all pins.
| high | HIGH if true, LOW if false |
|
inline |
Write the LED RGB888 to all pins.
| rgb888 | RGB888 |
|
inline |
Write the LED RGB888 to all pins.
| r | Red |
| g | Green |
| b | Blue |
| bool m5::unit::UnitExtIO2::writeAllMode | ( | const extio2::Mode | mode | ) |
Write the mode of all pins.
| mode | Mode |
| bool m5::unit::UnitExtIO2::writeAllMode | ( | const extio2::Mode | mode[NUMBER_OF_PINS] | ) |
Write the mode of all pins.
| mode | Mode array |
|
inline |
Write the servo angle to all pins.
| degree | Angle |
|
inline |
Write the servo pulse to all pins.
| pulse | Pulse |
| bool m5::unit::UnitExtIO2::writeDigitalOutput | ( | const uint8_t | pin, |
| const bool | high ) |
Write the digital output to the specified pin.
| pin | Pin number |
| high | HIGH if true, LOW if false |
|
inline |
Write the digital output HIGH to the specified pin.
| pin | Pin number |
|
inline |
Write the digital output LOW to the specified pin.
| pin | Pin number |
|
inline |
Write the LED RGB888 to the specified pin.
| pin | Pin number |
| rgb888 | RGB888 |
| bool m5::unit::UnitExtIO2::writeLEDColor | ( | const uint8_t | pin, |
| const uint8_t | r, | ||
| const uint8_t | g, | ||
| const uint8_t | b ) |
Write the LED RGB888 to the specified pin.
| pin | Pin number |
| r | Red |
| g | Green |
| b | Blue |
| bool m5::unit::UnitExtIO2::writeMode | ( | const uint8_t | pin, |
| const extio2::Mode | mode ) |
Write the mode of the specified pin.
| pin | Pin number |
| mode | Mode |
|
inline |
Write the digital output to the specified pin bits.
| pin_bits | Bits of the target pin |
| high | HIGH if true, LOW if false |
|
inline |
Write the digital output to the specified pin bits.
| pin_bits | Bits of the target pin |
| high_bits | Pin bits to be set HIGH |
|
inline |
Write the digital output HIGH to the specified pin bits.
| pin_bits | Bits of the target pin |
|
inline |
Write the digital output LOW to the specified pin bits.
| pin_bits | Bits of the target pin |
|
inline |
Write the LED RGB888 to the specified pin bits.
| pin_bits | Bits of the target pin |
| rgb888 | RGB888 |
| bool m5::unit::UnitExtIO2::writePinBitsLEDColor | ( | const uint8_t | pin_bits, |
| const uint8_t | r, | ||
| const uint8_t | g, | ||
| const uint8_t | b ) |
Write the LED RGB888 to the specified pin.
| pin_bits | Bits of the target pin |
| r | Red |
| g | Green |
| b | Blue |
| bool m5::unit::UnitExtIO2::writePinBitsMode | ( | const uint8_t | pin_bits, |
| const extio2::Mode | mode ) |
Write the mode of the specified pin bits.
| pin_bits | Bits of the target pin |
| mode | Mode |
| bool m5::unit::UnitExtIO2::writePinBitsServoAngle | ( | const uint8_t | pin_bits, |
| const uint8_t | degree ) |
Write the servo angle to the specified pin bits.
| pin_bits | Bits of the target pin |
| degree | Angle |
| bool m5::unit::UnitExtIO2::writePinBitsServoPulse | ( | const uint8_t | pin_bits, |
| const uint16_t | pulse ) |
Write the servo pulse to the specified pin bits.
| pin_bits | Bits of the target pin |
| pulse | Pulse |
| bool m5::unit::UnitExtIO2::writeServoAngle | ( | const uint8_t | pin, |
| const uint8_t | degree ) |
Write the servo angle to the specified pin.
| pin | Pin number |
| degree | Angle |
| bool m5::unit::UnitExtIO2::writeServoPulse | ( | const uint8_t | pin, |
| const uint16_t | pulse ) |
Write the servo pulse to the specified pin.
| pin | Pin number |
| pulse | Pulse |