123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef UDA1380_H__
- #define UDA1380_H__
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdint.h>
- #include "nrf_drv_twi.h"
- #define UDA1380_REG_CLK 0x00
- #define UDA1380_REG_I2S 0x01
- #define UDA1380_REG_PWR 0x02
- #define UDA1380_REG_AMIX 0x03
- #define UDA1380_REG_HPA 0x04
- #define UDA1380_REG_VOL 0x10
- #define UDA1380_REG_MIX_VOL 0x11
- #define UDA1380_REG_PPROC 0x12
- #define UDA1380_REG_DEEMP 0x13
- #define UDA1380_REG_MIXER 0x14
- #define UDA1380_REG_RESET 0x7F
- #define UDA1380_DEFAULT_TWI_CONFIG(scl_pin, sda_pin) { \
- .scl = scl_pin, \
- .sda = sda_pin, \
- .frequency = NRF_DRV_TWI_FREQ_100K, \
- .interrupt_priority = APP_IRQ_PRIORITY_HIGH, \
- .clear_bus_init = false, \
- .hold_bus_uninit = false \
- }
- typedef struct {
- uint8_t addr;
- uint8_t val[2];
- } uda1380_reg_t;
- #define UDA1380_REG_INIT(address, value) { \
- .addr = address, \
- .val = {(value) / 256, (value) & 0xFF}, \
- }
- #define UDA1380_TWI_ADDRESS (0x18)
- typedef struct {
- nrf_drv_twi_t twi;
- nrf_drv_twi_config_t twi_cfg;
- uint8_t twi_addr;
- } uda1380_iface_t;
- ret_code_t uda1380_init(uda1380_iface_t const * p_iface,
- uda1380_reg_t const * p_reg_config,
- size_t reg_size);
- ret_code_t uda1380_enable(uda1380_iface_t const * p_iface);
- ret_code_t uda1380_disable(uda1380_iface_t const * p_iface);
- #ifdef __cplusplus
- }
- #endif
- #endif
|