#ifndef SERVO2350_DRIVERS_MULTIPLEXER_CD74HC4067_H_ #define SERVO2350_DRIVERS_MULTIPLEXER_CD74HC4067_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * @brief Select one of the 16 multiplexed channels. * * @param dev CD74HC4067 device instance. * @param channel Channel number to route (0-15). * * @retval 0 If the channel was selected. * @retval -EINVAL If the channel number is out of range. * @retval -ENODEV If one of the selection GPIOs is not ready. * @retval other Negative errno value from the GPIO driver. */ int cd74hc4067_select_channel(const struct device *dev, uint8_t channel); /** * @brief Enable the multiplexer output (drives the /EN pin low). * * If the instance does not provide an enable GPIO, this call is a no-op. * * @param dev CD74HC4067 device instance. * * @retval 0 On success. * @retval -ENODEV If the enable GPIO is not ready. * @retval negative errno on GPIO failures. */ int cd74hc4067_enable(const struct device *dev); /** * @brief Disable the multiplexer output (drives the /EN pin high). * * @param dev CD74HC4067 device instance. * * @retval 0 On success. * @retval -ENOTSUP If the instance does not expose an enable GPIO. * @retval -ENODEV If the enable GPIO is not ready. * @retval negative errno on GPIO failures. */ int cd74hc4067_disable(const struct device *dev); /** * @brief Return the last channel value written to the device. * * @param dev CD74HC4067 device instance. * * @return Channel number in the range [0, 15]. */ uint8_t cd74hc4067_get_current_channel(const struct device *dev); #ifdef __cplusplus } #endif #endif /* SERVO2350_DRIVERS_MULTIPLEXER_CD74HC4067_H_ */