42#define CHIP_NAME "NXP TEA5767"
43#define MANUFACTURER_NAME "NXP"
44#define SUPPLY_VOLTAGE_MIN 2.5f
45#define SUPPLY_VOLTAGE_MAX 5.0f
46#define MAX_CURRENT 10.5f
47#define TEMPERATURE_MIN -10.0f
48#define TEMPERATURE_MAX 75.0f
49#define DRIVER_VERSION 1000
54#define TEA5767_ADDRESS 0xC0
66static uint8_t a_tea5767_iic_read(
tea5767_handle_t *handle, uint8_t *data, uint16_t len)
88static uint8_t a_tea5767_iic_write(
tea5767_handle_t *handle, uint8_t *data, uint16_t len)
122 handle->
debug_print(
"tea5767: iic_init is null.\n");
128 handle->
debug_print(
"tea5767: iic_deinit is null.\n");
134 handle->
debug_print(
"tea5767: iic_read_cmd is null.\n");
140 handle->
debug_print(
"tea5767: iic_write_cmd is null.\n");
146 handle->
debug_print(
"tea5767: delay_ms is null.\n");
153 handle->
debug_print(
"tea5767: iic init failed.\n");
187 res = a_tea5767_iic_write(handle, handle->
conf_up, 5);
190 handle->
debug_print(
"tea5767: write conf failed.\n");
197 handle->
debug_print(
"tea5767: iic deinit failed.\n");
229 res = a_tea5767_iic_write(handle, handle->
conf_up, 5);
232 handle->
debug_print(
"tea5767: write conf failed.\n");
263 res = a_tea5767_iic_read(handle, handle->
conf_down, 5);
266 handle->
debug_print(
"tea5767: read conf failed.\n");
295 memcpy(handle->
conf_up, conf, 5);
321 handle->
conf_up[0] &= ~(1 << 7);
322 handle->
conf_up[0] |= enable << 7;
374 handle->
conf_up[0] &= ~(1 << 6);
375 handle->
conf_up[0] |= mode << 6;
437 buf[0] = (pll >> 8) & 0x3F;
471 *pll = (((uint16_t)(buf[0] & 0x3F)) << 8) | buf[1];
497 handle->
conf_up[2] &= ~(1 << 7);
498 handle->
conf_up[2] |= mode << 7;
550 handle->
conf_up[2] &= ~(3 << 5);
551 handle->
conf_up[2] |= level << 5;
603 handle->
conf_up[2] &= ~(1 << 4);
604 handle->
conf_up[2] |= side << 4;
656 handle->
conf_up[2] &= ~(1 << 3);
657 handle->
conf_up[2] |= channel << 3;
709 handle->
conf_up[2] &= ~(1 << 2);
710 handle->
conf_up[2] |= enable << 2;
762 handle->
conf_up[2] &= ~(1 << 1);
763 handle->
conf_up[2] |= enable << 1;
815 handle->
conf_up[2] &= ~(1 << 0);
816 handle->
conf_up[2] |= level << 0;
868 handle->
conf_up[3] &= ~(1 << 7);
869 handle->
conf_up[3] |= level << 7;
921 handle->
conf_up[3] &= ~(1 << 6);
922 handle->
conf_up[3] |= enable << 6;
974 handle->
conf_up[3] &= ~(1 << 5);
975 handle->
conf_up[3] |= band << 5;
1027 handle->
conf_up[3] &= ~(1 << 3);
1028 handle->
conf_up[3] |= enable << 3;
1080 handle->
conf_up[3] &= ~(1 << 2);
1081 handle->
conf_up[3] |= enable << 2;
1133 handle->
conf_up[3] &= ~(1 << 1);
1134 handle->
conf_up[3] |= enable << 1;
1186 handle->
conf_up[3] &= ~(1 << 0);
1187 handle->
conf_up[3] |= enable << 0;
1239 handle->
conf_up[4] &= ~(1 << 6);
1240 handle->
conf_up[4] |= emphasis << 6;
1292 handle->
conf_up[3] &= ~(1 << 4);
1293 handle->
conf_up[4] &= ~(1 << 7);
1294 handle->
conf_up[3] |= ((clk >> 0)& 0x01) << 4;
1295 handle->
conf_up[4] |= ((clk >> 1)& 0x01) << 7;
1477 *output = (handle->
conf_down[3] >> 4) & 0xF;
1509 hlsi = (handle->
conf_up[2] >> 4) & 0x01;
1510 clk = ((handle->
conf_up[4] >> 7) & 0x01) << 1
1511 | ((handle->
conf_up[3] >> 4) & 0x01);
1516 else if (clk == 0x01)
1520 else if (clk == 0x02)
1526 handle->
debug_print(
"tea5767: clock is invalid.\n");
1533 *pll = (uint16_t)((4.0f * (mhz * 1000.0f + 225.0f)) / f);
1537 *pll = (uint16_t)((4.0f * (mhz * 1000.0f - 225.0f)) / f);
1570 hlsi = (handle->
conf_up[2] >> 4) & 0x01;
1571 clk = ((handle->
conf_up[4] >> 7) & 0x01) << 1
1572 | ((handle->
conf_up[3] >> 4) & 0x01);
1577 else if (clk == 0x01)
1581 else if (clk == 0x02)
1587 handle->
debug_print(
"tea5767: clock is invalid.\n");
1594 *mhz = (pll * f / 4.0f - 255.0f) / 1000.0f;
1598 *mhz = (pll * f / 4.0f + 255.0f) / 1000.0f;
1627 return a_tea5767_iic_write(handle, buf, len);
1653 return a_tea5767_iic_read(handle, buf, len);
#define SUPPLY_VOLTAGE_MAX
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define TEA5767_ADDRESS
chip address definition
#define CHIP_NAME
chip information definition
driver tea5767 header file
uint8_t tea5767_get_ready_flag(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the ready flag
uint8_t tea5767_deinit(tea5767_handle_t *handle)
close the chip
uint8_t tea5767_get_reception(tea5767_handle_t *handle, tea5767_reception_t *reception)
get the reception
uint8_t tea5767_set_right_mute(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable right mute
uint8_t tea5767_set_pll(tea5767_handle_t *handle, uint16_t pll)
set the pll
uint8_t tea5767_get_right_mute(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the right mute status
uint8_t tea5767_get_band(tea5767_handle_t *handle, tea5767_band_t *band)
get the band
tea5767_mode_t
tea5767 mode enumeration definition
uint8_t tea5767_set_search_stop_level(tea5767_handle_t *handle, tea5767_search_stop_level_t level)
set the search stop level
uint8_t tea5767_write_conf(tea5767_handle_t *handle)
write the conf
uint8_t tea5767_get_pll(tea5767_handle_t *handle, uint16_t *pll)
get the pll
uint8_t tea5767_get_port1(tea5767_handle_t *handle, tea5767_level_t *level)
get the port1 level
uint8_t tea5767_get_side_injection(tea5767_handle_t *handle, tea5767_side_injection_t *side)
get the side injection
uint8_t tea5767_set_high_cut_control(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable high cut control
uint8_t tea5767_get_searched_pll(tea5767_handle_t *handle, uint16_t *pll)
get the searched pll
uint8_t tea5767_get_search_mode(tea5767_handle_t *handle, tea5767_search_mode_t *mode)
get the search mode
tea5767_channel_t
tea5767 channel enumeration definition
uint8_t tea5767_set_search_mode(tea5767_handle_t *handle, tea5767_search_mode_t mode)
set the search mode
uint8_t tea5767_set_side_injection(tea5767_handle_t *handle, tea5767_side_injection_t side)
set the side injection
uint8_t tea5767_get_search_stop_level(tea5767_handle_t *handle, tea5767_search_stop_level_t *level)
get the search stop level
uint8_t tea5767_get_mode(tea5767_handle_t *handle, tea5767_mode_t *mode)
get the chip mode
uint8_t tea5767_set_mode(tea5767_handle_t *handle, tea5767_mode_t mode)
set the chip mode
tea5767_de_emphasis_t
tea5767 de-emphasis enumeration definition
tea5767_clock_t
tea5767 clock enumeration definition
tea5767_reception_t
tea5767 reception enumeration definition
uint8_t tea5767_get_clock(tea5767_handle_t *handle, tea5767_clock_t *clk)
get the clock
tea5767_side_injection_t
tea5767 side injection enumeration definition
uint8_t tea5767_get_port1_as_search_indicator(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the port1 as search indicator status
uint8_t tea5767_get_channel(tea5767_handle_t *handle, tea5767_channel_t *channel)
get the sound channel
tea5767_search_stop_level_t
tea5767 search stop level enumeration definition
uint8_t tea5767_set_port1_as_search_indicator(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable port1 as search indicator
uint8_t tea5767_get_de_emphasis(tea5767_handle_t *handle, tea5767_de_emphasis_t *emphasis)
get the de emphasis status
uint8_t tea5767_get_if(tea5767_handle_t *handle, uint8_t *if_out)
get the if
struct tea5767_info_s tea5767_info_t
tea5767 information structure definition
uint8_t tea5767_set_port1(tea5767_handle_t *handle, tea5767_level_t level)
set the port1 level
tea5767_bool_t
tea5767 bool enumeration definition
uint8_t tea5767_get_level_adc_output(tea5767_handle_t *handle, uint8_t *output)
get the level adc output
uint8_t tea5767_get_soft_mute(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the soft mute status
uint8_t tea5767_set_mute(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable the mute
uint8_t tea5767_set_de_emphasis(tea5767_handle_t *handle, tea5767_de_emphasis_t emphasis)
set the de emphasis
uint8_t tea5767_frequency_convert_to_register(tea5767_handle_t *handle, float mhz, uint16_t *pll)
convert the frequency to the register raw data
uint8_t tea5767_get_band_limit_flag(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the band limit flag
uint8_t tea5767_set_soft_mute(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable soft mute
struct tea5767_handle_s tea5767_handle_t
tea5767 handle structure definition
uint8_t tea5767_init(tea5767_handle_t *handle)
initialize the chip
uint8_t tea5767_set_channel(tea5767_handle_t *handle, tea5767_channel_t channel)
set the sound channel
uint8_t tea5767_set_clock(tea5767_handle_t *handle, tea5767_clock_t clk)
set the clock
tea5767_level_t
tea5767 level enumeration definition
uint8_t tea5767_get_left_mute(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the left mute status
uint8_t tea5767_get_high_cut_control(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the high cut control status
uint8_t tea5767_get_mute(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the mute status
uint8_t tea5767_get_stereo_noise_cancelling(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the stereo noise cancelling status
uint8_t tea5767_get_standby(tea5767_handle_t *handle, tea5767_bool_t *enable)
get the standby status
tea5767_search_mode_t
tea5767 search mode enumeration definition
uint8_t tea5767_set_stereo_noise_cancelling(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable stereo noise cancelling
uint8_t tea5767_read_conf(tea5767_handle_t *handle)
read the conf
uint8_t tea5767_get_port2(tea5767_handle_t *handle, tea5767_level_t *level)
get the port2 level
tea5767_band_t
tea5767 band enumeration definition
uint8_t tea5767_info(tea5767_info_t *info)
get chip's information
uint8_t tea5767_frequency_convert_to_data(tea5767_handle_t *handle, uint16_t pll, float *mhz)
convert the register raw data to the frequency
uint8_t tea5767_update_conf(tea5767_handle_t *handle, uint8_t conf[5])
update the conf
uint8_t tea5767_set_band(tea5767_handle_t *handle, tea5767_band_t band)
set the band
uint8_t tea5767_set_left_mute(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable left mute
uint8_t tea5767_set_port2(tea5767_handle_t *handle, tea5767_level_t level)
set the port2 level
uint8_t tea5767_set_standby(tea5767_handle_t *handle, tea5767_bool_t enable)
enable or disable standby
uint8_t tea5767_set_reg(tea5767_handle_t *handle, uint8_t *buf, uint16_t len)
set the chip register
uint8_t tea5767_get_reg(tea5767_handle_t *handle, uint8_t *buf, uint16_t len)
get the chip register
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
uint8_t(* iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v