From f20dbfa8df442b99e956223218537bb3aab3ddf6 Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Fri, 30 Aug 2024 12:27:07 +0530 Subject: [PATCH] docs/psoc6/quickref.rst: Would be supported PDM API's. Signed-off-by: NikhitaR-IFX --- docs/psoc6/quickref.rst | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/docs/psoc6/quickref.rst b/docs/psoc6/quickref.rst index 55bcefcb7ac54..57bbb55f67e2d 100644 --- a/docs/psoc6/quickref.rst +++ b/docs/psoc6/quickref.rst @@ -579,6 +579,101 @@ Constructor 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 +PDM_PCM bus +------------ +class PDM -- PDM/PCM protocol +======================================== + +PDM/PCM is a asynchronous operation serial used to connect digital audio devices. +At the physical level, a bus consists of 2 lines: SCK, SD. + +PDM objects can be created and initialized using:: + + from machine import PDM_PCM + from machine import Pin + + sck_pin = Pin('P10_4') # Serial clock output + data_pin = Pin('P10_5') # Serial data output + + pdm_pcm_rx = PDM_PCM(2, + sck=sck_pin, data=data_pin, + mode=PDM_PCM.RX, + bits=16, + format=PDM_PCM.MONO, + rate=44100, + ibuf=20000) + +2 modes of operation are supported: + - blocking + - non-blocking + + +Constructor +----------- + +.. class:: PDM_PCM(id, *, sck, data, mode, bits, format, rate, ibuf) + + Construct an I2S object of the given id: + + - ``id`` identifies a particular I2S bus; it is board and port specific + + Keyword-only parameters that are supported on all ports: + + - ``sck`` is a pin object for the serial clock line + - ``data`` is a pin object for the data line + - ``mode`` only receive is supported in psoc6 + - ``rate`` specifies audio sampling rate (Hz) + - ``decimation_rate`` is PDM decimation rate + - ``format`` specifies channel format, STEREO, MONO_LEFT or MONO_RIGHT + - ``word_length`` specifies word length (bits), 16, 18, 20, 24 + - ``left_gain`` is PGA in 0.5 dB increment + - ``right_gain`` is PGA in 0.5 dB increment + - ``ibuf`` specifies internal buffer length (bytes) + +Methods +------- + +.. method:: PDM_PCM.init(sck, ...) + +.. method:: PDM_PCM.deinit() + +.. method:: PDM_PCM.readinto(buf) + +.. method:: PDM_PCM.irq(handler) + +.. method:: PDM_PCM.gain(gain_left, gain_right) + +.. method:: PDM_PCM.start() + +.. method:: PDM_PCM.stop() + +Constants +--------- + +.. data:: PDM.RX + + for setting mode to receive + +.. data:: PDM.STEREO + + for initialising the PDM_PCM ``format`` to stereo + +.. data:: PDM.MONO_LEFT + + for initialising the PDM_PCM ``format`` to mono-left + +.. data:: PDM.MONO_RIGHT + + for initialising the PDM_PCM ``format`` to mono-right + +.. data:: PDM.MONO_RIGHT + + for initialising the PDM_PCM ``format`` to mono-right + +.. data:: PDM.MONO_RIGHT + + for initialising the PDM_PCM ``format`` to mono-right + UART ----