STM32H750VB_DAC_AzureRTOS/lib/tpa6130a2/include/tpa6130a2.h

32 lines
830 B
C

#ifndef TPA6130A2_H
#define TPA6130A2_H
#include <stdint.h>
typedef enum {
TPA6130_OK,
TPA6130_FAIL,
} tpa6130_ret_t;
typedef enum {
TPA6130_CH_NONE = 0U,
TPA6130_CH_L = 0x80U,
TPA6130_CH_R = 0x40U,
} tpa6130_ch_t;
typedef struct {
tpa6130_ret_t (*read_reg_cb)(void *handle, uint8_t slaveaddr, uint8_t reg, uint8_t *value);
tpa6130_ret_t (*write_reg_cb)(void *handle, uint8_t slaveaddr, uint8_t reg, uint8_t value);
} tpa6130_cb_t;
typedef struct {
void *user_data;
tpa6130_cb_t cb;
} tpa6130_t;
tpa6130_ret_t tpa6130a2_revision(tpa6130_t *tpa, uint8_t *rev);
tpa6130_ret_t tpa6130a2_enable_channel(tpa6130_t *tpa, tpa6130_ch_t ch);
tpa6130_ret_t tpa6130a2_set_volume(tpa6130_t *tpa, uint8_t volume);
tpa6130_ret_t tpa6130a2_set_mute(tpa6130_t *tpa, tpa6130_ch_t ch);
#endif