From 77cc273fa1bf010e78b0d1a0582748808cb66473 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Mon, 2 Dec 2024 13:56:21 +0100 Subject: [PATCH] docs/psoc6/quickref.rst: Minor fix in machine.freq args call. Signed-off-by: enriquezgarc --- docs/psoc6/quickref.rst | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/psoc6/quickref.rst b/docs/psoc6/quickref.rst index 2b28ffa94547..bde56b243e4b 100644 --- a/docs/psoc6/quickref.rst +++ b/docs/psoc6/quickref.rst @@ -42,13 +42,13 @@ The :mod:`machine` module:: import machine - machine.freq() # get the current frequency of the Core M4 - machine.freq(CM4, freq) # set the frequency of the Core M4 sourced by PLL to freq. Value of freq can be upto 150 MHz - machine.freq(CM4_FLL, freq) # set the frequency of the Core M4 sourced by FLL to freq. Value of freq can be upto 48 MHz - machine.freq(AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz - machine.freq(AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz - machine.freq(AUDIO_PDM_24_576_000_HZ) # set the frequency of the I2S clock to 24576000 HZ - machine.freq(AUDIO_PDM_22_579_200_HZ) # set the frequency of the I2S clock to 22579200 HZ + machine.freq() # get the current frequency of the Core M4 + machine.freq(machine.CM4, freq) # set the frequency of the Core M4 sourced by PLL to freq. Value of freq can be upto 150 MHz + machine.freq(machine.CM4_FLL, freq) # set the frequency of the Core M4 sourced by FLL to freq. Value of freq can be upto 48 MHz + machine.freq(machine.AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz + machine.freq(machine.AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz + machine.freq(machine.AUDIO_PDM_24_576_000_HZ) # set the frequency of the I2S clock to 24576000 HZ + machine.freq(machine.AUDIO_PDM_22_579_200_HZ) # set the frequency of the I2S clock to 22579200 HZ Delay and timing ---------------- @@ -558,8 +558,8 @@ Before using the I2S bus, the I2S clock frequency needs to be set. The I2S clock :: - machine.freq(AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz. For sample rates: 8KHz / 16 KHz / 32 KHz / 48 KHz - machine.freq(AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz. For sample rates: 22.05 KHz / 44.1 KHz + machine.freq(machine.AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz. For sample rates: 8KHz / 16 KHz / 32 KHz / 48 KHz + machine.freq(machine.AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz. For sample rates: 22.05 KHz / 44.1 KHz Constructor ^^^^^^^^^^^^ @@ -581,15 +581,15 @@ Constructor :: - from machine import I2S, Pin + from machine import I2S, Pin, AUDIO_I2S_90_MHZ import array + buf=bytearray(10) #Initialise buffer with required values for transmission & as empty buffer for reception machine.freq(AUDIO_I2S_90_MHZ) #set the frequency of the I2S clock to 90 MHz. audio_out = I2S(0, sck="P13_1", ws="P13_2", sd="P13_3", mode=I2S.TX, bits=16, format=I2S.STEREO, rate=22050, ibuf=20000) #create I2S object num_written = audio_out.write(buf) # write buffer of audio samples to I2S device - audio_in = I2S(0, sck="P5_4", ws="P5_5", sd="P5_6", mode=I2S.RX, bits=16, format=I2S.STEREO, rate=22050, ibuf=20000) # create I2S object num_read = audio_in.readinto(buf)# fill buffer with audio samples from I2S device @@ -609,14 +609,13 @@ Before using the PDM-PCM bus, the clock frequency needs to be set. The PDM-PCM c :: - machine.freq(AUDIO_PDM_24_576_000_HZ) # set the frequency of the clock to 24.576 MHz. For sample rates: 8 / 16 / 48 kHz - machine.freq(AUDIO_PDM_22_579_000_HZ) # set the frequency of the clock to 22.579 MHz. For sample rates: 22.05 / 44.1 KHz + machine.freq(machine.AUDIO_PDM_24_576_000_HZ) # set the frequency of the clock to 24.576 MHz. For sample rates: 8 / 16 / 48 kHz + machine.freq(machine.AUDIO_PDM_22_579_000_HZ) # set the frequency of the clock to 22.579 MHz. For sample rates: 22.05 / 44.1 KHz PDM-PCM objects can be created and initialized using:: - from machine import PDM_PCM - from machine import Pin + from machine import PDM_PCM, Pin, AUDIO_PDM_24_576_000_HZ clk_pin = "P10_4" data_pin = "P10_5"