audioMux/firmware/Include/bd3491.h

37 lines
1019 B
C
Raw Permalink Normal View History

// BD3491 driver
// author : Julian Daube
#ifndef __AUDIO_MUX_BD3491_H__
#define __AUDIO_MUX_BD3491_H__
#include "stm32f1xx_hal.h"
#define BD_INPUT_MUTE (1<<4)
#define BD_INPUT_ALL (1<<5)
// number can either be 0-5 (meaning CHANNEL1 to CHANNEL 6)
// or BD_INPUT_MUTE or BD_INPUT_SHORT
void bd_set_input(I2C_HandleTypeDef * handle, uint8_t number);
#define BD_MAX_GAIN 20 // gain in db
int bd_set_gain(I2C_HandleTypeDef * handle, uint8_t gain_in_db);
#define BD_INF_ATTENUATION 0xFF
uint8_t bd_set_attenuation(I2C_HandleTypeDef * handle, uint8_t right_channel, uint8_t attenuation_in_db);
// when gain == 0, cut bass boost
void bd_set_bass_boost(I2C_HandleTypeDef * handle, uint8_t gain);
// when gain == 0, cut treble boost
void bd_set_treble_boost(I2C_HandleTypeDef * handle, uint8_t gain);
enum BD_SOURROUND_GAIN {
BD_SOURROUND_OFF = 0,
BD_SOURROUND_LOW = 5,
BD_SOURROUND_MIDDLE = 10,
BD_SOURROUND_HIGH = 15,
};
void bd_set_sourround(I2C_HandleTypeDef * handle, enum BD_SOURROUND_GAIN gain);
#endif