#pragma once #include "inttypes.h" #include "spi_cs_if.h" #include "spi.h" typedef enum { AD_8BIT = 4, AD_10BIT = 2, AD_12BIT = 0, } ad5303_res_t; typedef enum { AD_DAC1, AD_DAC2, } ad5303_dac_t; typedef enum { AD_GAIN_X1, AD_GAIN_X2, } ad5303_gain_t; typedef enum { AD_NORAMAL, AD_LOWZ, AD_HIGHZ, AD_OFF } ad5303_mode_t; typedef struct { uint16_t _regCtl; SPI_HandleTypeDef *hspi; cs_handle_t *hcs; ad5303_res_t res; } ad5303_handle_t; void ad5303_init(ad5303_handle_t *hdac, SPI_HandleTypeDef *hspi, cs_handle_t *hcs, ad5303_res_t res); void ad5303_set_value(ad5303_handle_t *hdac, uint16_t value, ad5303_dac_t dac); void ad5303_mode(ad5303_handle_t *hdac, ad5303_mode_t mode); void ad5303_gain(ad5303_handle_t *hdac, ad5303_gain_t gain);