Files
servo2350/test_code/drivers/multiplexer/cd74hc4067/cd74hc4067.h
T
2026-06-17 13:07:58 +03:00

46 lines
1023 B
C

#ifndef SERVO2350_DRIVERS_MULTIPLEXER_CD74HC4067_H_
#define SERVO2350_DRIVERS_MULTIPLEXER_CD74HC4067_H_
#include <stdint.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#ifdef __cplusplus
extern "C" {
#endif
// struct cd74hc4067_api {
// int (*enable)(const struct device *dev);
// int (*disable)(const struct device *dev);
// int (*select_channel)(const struct device *dev, uint8_t channel);
// };
struct cd74hc4067_data {
struct k_mutex lock;
uint8_t current_channel;
bool enabled;
};
#define CD74HC4067_SELECT_CHANNEL_COUNT 16U
#define CD74HC4067_SELECT_PIN_COUNT 4U
struct cd74hc4067_cfg {
struct gpio_dt_spec select[CD74HC4067_SELECT_PIN_COUNT];
struct gpio_dt_spec enable;
bool has_enable;
};
int cd74hc4067_enable(const struct device *dev);
int cd74hc4067_disable(const struct device *dev);
int cd74hc4067_select_channel(const struct device *dev, uint8_t channel);
#ifdef __cplusplus
}
#endif
#endif /* SERVO2350_DRIVERS_MULTIPLEXER_CD74HC4067_H_ */