LibDriver TEA5767
Loading...
Searching...
No Matches
driver_tea5767.h
Go to the documentation of this file.
1
36
37#ifndef DRIVER_TEA5767_H
38#define DRIVER_TEA5767_H
39
40#include <stdio.h>
41#include <stdint.h>
42#include <string.h>
43
44#ifdef __cplusplus
45extern "C"{
46#endif
47
53
58
62typedef enum
63{
67
71typedef enum
72{
76
80typedef enum
81{
85
94
103
112
122
131
140
150
159
163typedef struct tea5767_handle_s
164{
165 uint8_t (*iic_init)(void);
166 uint8_t (*iic_deinit)(void);
167 uint8_t (*iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len);
168 uint8_t (*iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len);
169 void (*delay_ms)(uint32_t ms);
170 void (*debug_print)(const char *const fmt, ...);
171 uint8_t inited;
172 uint8_t conf_up[5];
173 uint8_t conf_down[5];
175
191
195
202
209#define DRIVER_TEA5767_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
210
217#define DRIVER_TEA5767_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
218
225#define DRIVER_TEA5767_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
226
233#define DRIVER_TEA5767_LINK_IIC_READ_COMMAND(HANDLE, FUC) (HANDLE)->iic_read_cmd = FUC
234
241#define DRIVER_TEA5767_LINK_IIC_WRITE_COMMAND(HANDLE, FUC) (HANDLE)->iic_write_cmd = FUC
242
249#define DRIVER_TEA5767_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
250
257#define DRIVER_TEA5767_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
258
262
269
278uint8_t tea5767_info(tea5767_info_t *info);
279
290uint8_t tea5767_init(tea5767_handle_t *handle);
291
303uint8_t tea5767_deinit(tea5767_handle_t *handle);
304
315uint8_t tea5767_write_conf(tea5767_handle_t *handle);
316
327uint8_t tea5767_update_conf(tea5767_handle_t *handle, uint8_t conf[5]);
328
339uint8_t tea5767_read_conf(tea5767_handle_t *handle);
340
351uint8_t tea5767_set_mute(tea5767_handle_t *handle, tea5767_bool_t enable);
352
363uint8_t tea5767_get_mute(tea5767_handle_t *handle, tea5767_bool_t *enable);
364
376
387uint8_t tea5767_get_mode(tea5767_handle_t *handle, tea5767_mode_t *mode);
388
401uint8_t tea5767_set_pll(tea5767_handle_t *handle, uint16_t pll);
402
413uint8_t tea5767_get_pll(tea5767_handle_t *handle, uint16_t *pll);
414
426
438
450
462
474
486
498
510
522
534
546
558
570
581uint8_t tea5767_get_port1(tea5767_handle_t *handle, tea5767_level_t *level);
582
594
605uint8_t tea5767_get_port2(tea5767_handle_t *handle, tea5767_level_t *level);
606
618
629uint8_t tea5767_get_standby(tea5767_handle_t *handle, tea5767_bool_t *enable);
630
642
653uint8_t tea5767_get_band(tea5767_handle_t *handle, tea5767_band_t *band);
654
666
678
690
702
714
726
738
750
762
774
786
798
810
822
833uint8_t tea5767_get_searched_pll(tea5767_handle_t *handle, uint16_t *pll);
834
845uint8_t tea5767_get_if(tea5767_handle_t *handle, uint8_t *if_out);
846
858
869uint8_t tea5767_get_level_adc_output(tea5767_handle_t *handle, uint8_t *output);
870
883uint8_t tea5767_frequency_convert_to_register(tea5767_handle_t *handle, float mhz, uint16_t *pll);
884
897uint8_t tea5767_frequency_convert_to_data(tea5767_handle_t *handle, uint16_t pll, float *mhz);
898
902
909
922uint8_t tea5767_set_reg(tea5767_handle_t *handle, uint8_t *buf, uint16_t len);
923
936uint8_t tea5767_get_reg(tea5767_handle_t *handle, uint8_t *buf, uint16_t len);
937
941
945
946#ifdef __cplusplus
947}
948#endif
949
950#endif
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
@ TEA5767_MODE_SEARCH
@ TEA5767_MODE_NORMAL
@ TEA5767_CHANNEL_STEREO
@ TEA5767_CHANNEL_MONO
@ TEA5767_DE_EMPHASIS_75US
@ TEA5767_DE_EMPHASIS_50US
@ TEA5767_CLOCK_6P5_MHZ
@ TEA5767_CLOCK_32P768_KHZ
@ TEA5767_CLOCK_13_MHZ
@ TEA5767_RECEPTION_MONO
@ TEA5767_RECEPTION_STEREO
@ TEA5767_SIDE_INJECTION_LOW
@ TEA5767_SIDE_INJECTION_HIGH
@ TEA5767_SEARCH_STOP_LEVEL_HIGH
@ TEA5767_SEARCH_STOP_LEVEL_LOW
@ TEA5767_SEARCH_STOP_LEVEL_MID
@ TEA5767_BOOL_TRUE
@ TEA5767_BOOL_FALSE
@ TEA5767_LEVEL_HIGH
@ TEA5767_LEVEL_LOW
@ TEA5767_SEARCH_MODE_UP
@ TEA5767_SEARCH_MODE_DOWN
@ TEA5767_BAND_JAPANESE
@ TEA5767_BAND_US_EUROPE
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
tea5767 handle structure definition
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)
tea5767 information structure definition
uint32_t driver_version
char manufacturer_name[32]