Skip to content

Commit

Permalink
Update TEA5767.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alankrantas authored Jul 7, 2023
1 parent a182806 commit 132e85d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TEA5767.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Radio:
TEA5767 FM radio driver class.
Initialize:
radio = TEA5767.Radio(i2c, [addr=0x60, freq=99.7, band='US', stereo=True,
radio = TEA5767.Radio(i2c, [addr=0x60, freq=106.7, band='US', stereo=True,
soft_mute=True, noise_cancel=True, high_cut=True])
"""

Expand All @@ -42,7 +42,7 @@ class Radio:

__slot__ = ['_i2c', '_address', 'frequency', 'band_limits', 'standby_mode', 'mute_mode', 'soft_mute_mode',
'search_mode', 'search_direction', 'search_adc_level', 'stereo_mode', 'stereo_noise_cancelling_mode',
'high_cut_mode', 'is_ready', 'is_stereo', 'is_stereo', 'signal_adc_level']
'high_cut_mode', 'is_ready', 'is_stereo', 'signal_adc_level']

def __init__(self, i2c, addr=0x60, freq=0.0, band='US', stereo=True,
soft_mute=True, noise_cancel=True, high_cut=True):
Expand Down Expand Up @@ -114,7 +114,7 @@ def update(self):
buf[3] += self.soft_mute_mode << 3 | self.high_cut_mode << 2 | self.stereo_noise_cancelling_mode << 1
buf[4] = 0
self._i2c.writeto(self._address, buf)
time.sleep_ms(50)
time.sleep_ms(1) # i2c bus has max delay of 400 us
self.read()


Expand All @@ -123,7 +123,7 @@ def update(self):
from machine import Pin, SoftI2C
i2c = SoftI2C(scl=Pin(5), sda=Pin(4), freq=400000)

radio = Radio(i2c, freq=99.7)
radio = Radio(i2c, freq=106.7)
print('Frequency: FM {}\nReady: {}\nStereo: {}\nADC level: {}'.format(
radio.frequency, radio.is_ready, radio.is_stereo, radio.signal_adc_level
))

0 comments on commit 132e85d

Please sign in to comment.