LPCXpresso55S69_SPO2/lib/afe44x0/include/afe44x0.h

70 lines
2.7 KiB
C

#ifndef AFE44X0_H
#define AFE44X0_H
#include <stdint.h>
typedef enum {
AFE44_RET_SUCCESS,
AFE44_RET_FAIL,
} afe44x0_ret_t;
typedef enum {
AFE44_LED_MODE_H_BRIDGE,
AFE44_LED_MODE_COMMON_ANODE,
} afe44x0_led_driver_mode;
typedef enum {
AFE44_TIMING_LED2STC = 0x01U, /* Sample LED2 start */
AFE44_TIMING_LED2ENDC = 0x02U, /* Sample LED2 end */
AFE44_TIMING_LED2LEDSTC = 0x03U, /* Drive LED2 start */
AFE44_TIMING_LED2LEDENDC = 0x04U, /* Drive LED2 end */
AFE44_TIMING_ALED2STC = 0x05U, /* Sample LED2 ambient start */
AFE44_TIMING_ALED2ENDC = 0x06U, /* Sample LED2 ambient end */
AFE44_TIMING_LED1STC = 0x07U, /* Sample LED1 start */
AFE44_TIMING_LED1ENDC = 0x08U, /* Sample LED1 end */
AFE44_TIMING_LED1LEDSTC = 0x09U, /* Drive LED1 start */
AFE44_TIMING_LED1LEDENDC = 0x0AU, /* Drive LED1 end */
AFE44_TIMING_ALED1STC = 0x0BU, /* Sample LED1 ambient start */
AFE44_TIMING_ALED1ENDC = 0x0CU, /* Sample LED1 ambient end */
AFE44_TIMING_LED2CONVST = 0x0DU, /* Convert LED2 start */
AFE44_TIMING_LED2CONVEND = 0x0EU, /* Convert LED2 end */
AFE44_TIMING_ALED2CONVST = 0x0FU, /* Convert LED2 ambient start */
AFE44_TIMING_ALED2CONVEND = 0x10U, /* Convert LED2 ambient end */
AFE44_TIMING_LED1CONVST = 0x11U, /* Convert LED1 start */
AFE44_TIMING_LED1CONVEND = 0x12U, /* Convert LED1 end */
AFE44_TIMING_ALED1CONVST = 0x13U, /* Convert LED1 ambient start */
AFE44_TIMING_ALED1CONVEND = 0x14U, /* Convert LED1 ambient end */
AFE44_TIMING_ADCRSTSTCT0 = 0x15U, /* ADC reset 0 start */
AFE44_TIMING_ADCRSTENDCT0 = 0x16U, /* ADC reset 0 end */
AFE44_TIMING_ADCRSTSTCT1 = 0x17U, /* ADC reset 1 start */
AFE44_TIMING_ADCRSTENDCT1 = 0x18U, /* ADC reset 1 end */
AFE44_TIMING_ADCRSTSTCT2 = 0x19U, /* ADC reset 2 start */
AFE44_TIMING_ADCRSTENDCT2 = 0x1AU, /* ADC reset 2 end */
AFE44_TIMING_ADCRSTSTCT3 = 0x1BU, /* ADC reset 3 start */
AFE44_TIMING_ADCRSTENDCT3 = 0x1CU, /* ADC reset 3 end */
AFE44_TIMING_PRPCOUNT = 0x1DU, /* PRP count */
} afe44x0_timing_param_t;
typedef afe44x0_ret_t (*afe44x0_ops_transfer_t)(void *handle, uint8_t *tx_data, uint8_t *rx_data, uint16_t len);
typedef afe44x0_ret_t (*afe44x0_ops_reset_t)(void *handle);
typedef struct {
afe44x0_ops_transfer_t transfer;
afe44x0_ops_reset_t reset;
} afe44x0_ops_t;
typedef struct {
afe44x0_timing_param_t param;
uint16_t value;
} afe44x0_timing_t;
typedef struct {
afe44x0_ops_t ops;
void *user_data;
} afe44x0_t;
afe44x0_ret_t afe44x0_init(afe44x0_t *afe);
afe44x0_ret_t afe44x0_apply_timings(afe44x0_t *afe, const afe44x0_timing_t *timings, uint8_t num_timings);
#endif // AFE44X0_H