1 /**************************************************************************/
8 Software License Agreement (BSD License)
10 Copyright (c) 2012, K. Townsend.
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /**************************************************************************/
40 #include "projectconfig.h"
42 #define TEA5767_FMBANDSTART_US_EUROPE (87500000) // 87.5 MHz to 108 MHz
43 #define TEA5767_FMBANDSTART_JAPAN (76000000) // 76 MHz to 91 MHz plus TV audio at 108 MHz
45 /*=========================================================================
47 -----------------------------------------------------------------------*/
48 #define TEA5767_ADDRESS (0xC0) // 1100000x
49 #define TEA5767_READ (0x01)
50 /*=========================================================================*/
52 /*=========================================================================
54 MUTE | SEARCHMODE | PLL13 | PLL12 | PLL11 | PLL10 | PLL9 | PLL8
55 -----------------------------------------------------------------------*/
56 #define TEA5767_WBYTE1_MUTE (1<<7) // 1 = mute, 0 = output enabled (mute enabled after reset)
57 #define TEA5767_WBYTE1_SEARCHMODE (1<<6) // 1 = Search mode enabled
58 /*=========================================================================*/
60 /*=========================================================================
62 PLL7 | PLL6 | PLL5 | PLL4 | PLL3 | PLL2 | PLL1 | PLL0
63 -----------------------------------------------------------------------*/
65 /*=========================================================================*/
67 /*=========================================================================
69 SUD | SSL1 | SSL0 | HLSI | MS | MR | ML | SWP1
70 -----------------------------------------------------------------------*/
71 #define TEA5767_WBYTE3_SEARCHUPDOWN (1<<7) // 1 = search up, 0 = search down
72 #define TEA5767_WBYTE3_SEARCHSTOPLEVEL1 (1<<6) // 10 = mid level (ADC = 7), 11 = high level (ADC = 10)
73 #define TEA5767_WBYTE3_SEARCHSTOPLEVEL0 (1<<5) // 00 = invalid, 01 = low level (ADC = 5)
74 #define TEA5767_WBYTE3_SEARCHSTOPLEVELMASK (3<<5)
75 #define TEA5767_WBYTE3_HLSI (1<<4) // 1 = high side LO injection, 0 = low side LO injection
76 #define TEA5767_WBYTE3_MONOTOSTEREO (1<<3) // 1 = force mono, 0 = stereo on
77 #define TEA5767_WBYTE3_MUTERIGHT (1<<2) // 1 = mute right audio, 0 = enabled
78 #define TEA5767_WBYTE3_MUTELEFT (1<<1) // 1 = mute left audio, 0 = enabled
79 /*---------------------------------------------------------------------*/
80 #define TEA5767_WBYTE3_SEARCHSTOPLEVEL_LOW (0x20) // ADC output = 5 (bit: 01)
81 #define TEA5767_WBYTE3_SEARCHSTOPLEVEL_MID (0x40) // ADC output = 7 (bit: 10)
82 #define TEA5767_WBYTE3_SEARCHSTOPLEVEL_HIGH (0x60) // ADC output = 10 (bit: 11)
83 /*=========================================================================*/
85 /*=========================================================================
87 SWP2 | STBY | BL | XTAL | SMUTE | HCC | SNC | SI
88 -----------------------------------------------------------------------*/
89 #define TEA5767_WBYTE4_STANDBY (1<<6) // 1 = standby mode
90 #define TEA5767_WBYTE4_BANDLIMITS (1<<5) // 1 = Japanese FM band, 0 = US/Europe
91 #define TEA5767_WBYTE4_XTAL (1<<4) // Combined with PLLREF in byte 5 (set to 1 for 32.768kHz crystal)
92 #define TEA5767_WBYTE4_SOFTMUTE (1<<3) // 1 = soft mute enabled
93 #define TEA5767_WBYTE4_HIGHCUTCONTROL (1<<2) // 1 = HCC enabled
94 #define TEA5767_WBYTE4_STEREONOISECANCEL (1<<1) // 1 = stereo noise cancelling enabled
95 /*=========================================================================*/
97 /*=========================================================================
99 PLLREF | DTC | - | - | - | - | - | -
100 -----------------------------------------------------------------------*/
101 #define TEA5767_WBYTE5_PLLREF (1<<7) // 1 = 6.5MHz PLL ref freq. enabled (set to 0 for 32.768kHz crystal)
102 #define TEA5767_WBYTE5_DEEMPHASISTIMECONST (1<<6) // 1 = DTC is 75µs, 0 = 50µs
103 /*=========================================================================*/
106 /*=========================================================================
108 RF | BLF | PLL13 | PLL12 | PLL11 | PLL 10 | PLL9 | PLL8
109 -----------------------------------------------------------------------*/
110 #define TEA5767_RBYTE1_READYFLAG (1<<7) // 1 = station found or band-limit reached, 0 = no station found
111 #define TEA5767_RBYTE1_BANDLIMITFLAG (1<<6) // 1 = band limit has been reached, 0 = band limit not reached
112 /*=========================================================================*/
114 /*=========================================================================
116 PLL7 | PLL6 | PLL5 | PLL4 | PLL3 | PLL2 | PLL1 | PLL0
117 -----------------------------------------------------------------------*/
119 /*=========================================================================*/
121 /*=========================================================================
123 STEREO | IF6 | IF5 | IF4 | IF3 | IF2 | IF1 | IF0
124 -----------------------------------------------------------------------*/
125 #define TEA5767_RBYTE3_STEREOINDICATOR (1<<7) // 1 = stereo reception, 0 = mono reception
126 /*=========================================================================*/
128 /*=========================================================================
130 LEV3 | LEV2 | LEV1 | LEV0 | CI3 | CI2 | CI1 | -
131 -----------------------------------------------------------------------*/
132 #define TEA5767_RBYTE4_ADCLEVELOUTPUTMASK (0xF0) // ADC output level
133 #define TEA5767_RBYTE4_CHIPIDMASK (0x0F) // These bits must be set to 0!
134 /*=========================================================================*/
136 /*=========================================================================
138 - | - | - | - | - | - | - | -
139 -----------------------------------------------------------------------*/
141 /*=========================================================================*/
143 uint32_t tea5767Init( void );
144 void tea5767SetFrequency( uint32_t );
145 uint32_t tea5767GetFrequency( void );
146 void tea5767Scan( uint8_t );
147 void tea5767Mute( bool );
This page took 0.074487 seconds and 5 git commands to generate.