Skip to content

Commit

Permalink
docs/psoc6/quickref.rst: Would be supported PDM API's.
Browse files Browse the repository at this point in the history
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
  • Loading branch information
NikhitaR-IFX committed Aug 30, 2024
1 parent 12853f8 commit f20dbfa
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions docs/psoc6/quickref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----
Expand Down

0 comments on commit f20dbfa

Please sign in to comment.