MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
Pulse Train Engine (PT)

This is the high level API for the pulse train engine. More...

Modules

 PT_Registers
 Registers, Bit Masks and Bit Positions for the PT Peripheral Module.
 

Data Structures

struct  pt_pt_cfg_t
 Structure type for pulse train mode configuration. More...
 

Enumerations

enum  sys_pt_en_t {
  ENABLE_PT0 = MXC_F_PTG_ENABLE_PT0,
  ENABLE_PT1 = MXC_F_PTG_ENABLE_PT1,
  ENABLE_PT2 = MXC_F_PTG_ENABLE_PT2,
  ENABLE_PT3 = MXC_F_PTG_ENABLE_PT3,
  ENABLE_PT4 = MXC_F_PTG_ENABLE_PT4,
  ENABLE_PT5 = MXC_F_PTG_ENABLE_PT5,
  ENABLE_PT6 = MXC_F_PTG_ENABLE_PT6,
  ENABLE_PT7 = MXC_F_PTG_ENABLE_PT7,
  ENABLE_PT8 = MXC_F_PTG_ENABLE_PT8,
  ENABLE_PT9 = MXC_F_PTG_ENABLE_PT9,
  ENABLE_PT10 = MXC_F_PTG_ENABLE_PT10,
  ENABLE_PT11 = MXC_F_PTG_ENABLE_PT11,
  ENABLE_PT12 = MXC_F_PTG_ENABLE_PT12,
  ENABLE_PT13 = MXC_F_PTG_ENABLE_PT13,
  ENABLE_PT14 = MXC_F_PTG_ENABLE_PT14,
  ENABLE_PT15 = MXC_F_PTG_ENABLE_PT15
}
 Pulse Train ENable enumeration. More...
 
enum  sys_pt_resync_t {
  RESYNC_PT0 = MXC_F_PTG_RESYNC_PT0,
  RESYNC_PT1 = MXC_F_PTG_RESYNC_PT1,
  RESYNC_PT2 = MXC_F_PTG_RESYNC_PT2,
  RESYNC_PT3 = MXC_F_PTG_RESYNC_PT3,
  RESYNC_PT4 = MXC_F_PTG_RESYNC_PT4,
  RESYNC_PT5 = MXC_F_PTG_RESYNC_PT5,
  RESYNC_PT6 = MXC_F_PTG_RESYNC_PT6,
  RESYNC_PT7 = MXC_F_PTG_RESYNC_PT7,
  RESYNC_PT8 = MXC_F_PTG_RESYNC_PT8,
  RESYNC_PT9 = MXC_F_PTG_RESYNC_PT9,
  RESYNC_PT10 = MXC_F_PTG_RESYNC_PT10,
  RESYNC_PT11 = MXC_F_PTG_RESYNC_PT11,
  RESYNC_PT12 = MXC_F_PTG_RESYNC_PT12,
  RESYNC_PT13 = MXC_F_PTG_RESYNC_PT13,
  RESYNC_PT14 = MXC_F_PTG_RESYNC_PT14,
  RESYNC_PT15 = MXC_F_PTG_RESYNC_PT15
}
 Pulse Train Resync enumeration. More...
 

Functions

void PT_Init (mxc_ptg_regs_t *ptg, const sys_cfg_ptg_t *sys_cfg)
 This function initializes the pulse trains to a known stopped state and sets the global PT clock scale. More...
 
int PT_PTConfig (mxc_pt_regs_t *pt, pt_pt_cfg_t *cfg, const sys_cfg_pt_t *sysCfg)
 Configures the pulse train in the specified mode. More...
 
int PT_SqrWaveConfig (mxc_pt_regs_t *pt, uint32_t freq, const sys_cfg_pt_t *sysCfg)
 Configures the pulse train in the square wave mode. More...
 
void PT_Start (mxc_pt_regs_t *pt)
 Starts the pulse train specified. More...
 
void PT_StartMulti (mxc_ptg_regs_t *ptg, uint32_t pts)
 Start multiple pulse train modules together. More...
 
void PT_Stop (mxc_pt_regs_t *pt)
 Stops a pulse train. More...
 
void PT_StopMulti (mxc_ptg_regs_t *ptg, uint32_t pts)
 Stop multiple pulse trains together. More...
 
uint32_t PT_IsActive (mxc_pt_regs_t *pt)
 Determines if the pulse train is running. More...
 
uint32_t PT_IsActiveMulti (mxc_ptg_regs_t *ptg, uint32_t pts)
 Determines if the pulse trains selected are running. More...
 
void PT_SetPattern (mxc_pt_regs_t *pt, uint32_t pattern)
 Sets the pattern of the pulse train. More...
 
float PT_GetBPS (mxc_pt_regs_t *pt)
 Sets the pattern of the pulse train. More...
 
void PT_EnableINT (mxc_pt_regs_t *pt)
 Enable pulse train interrupt. More...
 
void PT_EnableINTMulti (mxc_ptg_regs_t *ptg, uint32_t pts)
 Enable interrupts for the pulse trains selected. More...
 
void PT_DisableINT (mxc_pt_regs_t *pt)
 Disable pulse train interrupt. More...
 
void PT_DisableINTMulti (mxc_ptg_regs_t *ptg, uint32_t pts)
 Disable interrupts for the pulse trains selected. More...
 
uint32_t PT_GetFlags (mxc_ptg_regs_t *ptg)
 Gets the pulse trains' interrupt flags. More...
 
void PT_ClearFlags (mxc_ptg_regs_t *ptg, uint32_t mask)
 Clears the pulse trains' interrupt flag. More...
 
void PT_SetRestart (mxc_pt_regs_t *ptToRestart, mxc_pt_regs_t *ptStop, uint8_t restartIndex)
 Setup and enables a pulse train to restart after another pulse train has exited its loop. More...
 
void PT_RestartDisable (mxc_pt_regs_t *ptToRestart, uint8_t restartIndex)
 Disable the restart for the specified pulse train. More...
 
void PT_Resync (mxc_ptg_regs_t *ptg, uint32_t resyncPts)
 Resynchronize individual pulse trains together. More...
 

Detailed Description

Enumeration Type Documentation

◆ sys_pt_en_t

Enumerator
ENABLE_PT0 

Enable PT0.

ENABLE_PT1 

Enable PT1.

ENABLE_PT2 

Enable PT2.

ENABLE_PT3 

Enable PT3.

ENABLE_PT4 

Enable PT4.

ENABLE_PT5 

Enable PT5.

ENABLE_PT6 

Enable PT6.

ENABLE_PT7 

Enable PT7.

ENABLE_PT8 

Enable PT8.

ENABLE_PT9 

Enable PT9.

ENABLE_PT10 

Enable PT10.

ENABLE_PT11 

Enable PT11.

ENABLE_PT12 

Enable PT12.

ENABLE_PT13 

Enable PT13.

ENABLE_PT14 

Enable PT14.

ENABLE_PT15 

Enable PT15.

◆ sys_pt_resync_t

Enumerator
RESYNC_PT0 

Resync PT0.

RESYNC_PT1 

Resync PT1.

RESYNC_PT2 

Resync PT2.

RESYNC_PT3 

Resync PT3.

RESYNC_PT4 

Resync PT4.

RESYNC_PT5 

Resync PT5.

RESYNC_PT6 

Resync PT6.

RESYNC_PT7 

Resync PT7.

RESYNC_PT8 

Resync PT8.

RESYNC_PT9 

Resync PT9.

RESYNC_PT10 

Resync PT10.

RESYNC_PT11 

Resync PT11.

RESYNC_PT12 

Resync PT12.

RESYNC_PT13 

Resync PT13.

RESYNC_PT14 

Resync PT14.

RESYNC_PT15 

Resync PT15.

Function Documentation

◆ PT_Init()

void PT_Init ( mxc_ptg_regs_t *  ptg,
const sys_cfg_ptg_t *  sys_cfg 
)
Parameters
ptgPulse train global registers based on bus
sys_cfgSystem configuration object

◆ PT_PTConfig()

int PT_PTConfig ( mxc_pt_regs_t pt,
pt_pt_cfg_t cfg,
const sys_cfg_pt_t sysCfg 
)

The parameters in the config structure must be set before calling this function. This function should be used for configuring pulse train mode only.

Note
The pulse train cannot be running when this function is called.
Parameters
ptPulse train to operate on.
cfgPointer to pulse train configuration.
sysCfgPointer to pulse train system GPIO configuration.
Returns
E_NO_ERROR if everything is successful, error if unsuccessful.

◆ PT_SqrWaveConfig()

int PT_SqrWaveConfig ( mxc_pt_regs_t pt,
uint32_t  freq,
const sys_cfg_pt_t sysCfg 
)

This function should be used for configuring square wave mode only.

Note
The pulse train cannot be running when this function is called
Parameters
ptpulse train to operate on
freqsquare wave output frequency in Hz
sysCfgpointer to pulse train system GPIO configuration
Returns
E_NO_ERROR if everything is successful, error if unsuccessful.

◆ PT_Start()

void PT_Start ( mxc_pt_regs_t pt)
Parameters
ptPulse train to operate on.

◆ PT_StartMulti()

void PT_StartMulti ( mxc_ptg_regs_t *  ptg,
uint32_t  pts 
)
Parameters
ptgPulse train global registers based on bus
ptsSet the bits of pulse trains to start Bit0->pt0, Bit1->pt1... etc.

◆ PT_Stop()

void PT_Stop ( mxc_pt_regs_t pt)
Parameters
ptPulse train to operate on.

◆ PT_StopMulti()

void PT_StopMulti ( mxc_ptg_regs_t *  ptg,
uint32_t  pts 
)
Parameters
ptgPulse train global registers based on bus
ptsSet the bits of pulse trains to stop Bit0->pt0, Bit1->pt1... etc.

◆ PT_IsActive()

uint32_t PT_IsActive ( mxc_pt_regs_t pt)
Parameters
ptPulse train to operate on.
Returns
0 Pulse train is off.
>0 Pulse train is on.

◆ PT_IsActiveMulti()

uint32_t PT_IsActiveMulti ( mxc_ptg_regs_t *  ptg,
uint32_t  pts 
)
Parameters
ptgPulse train global registers based on bus
ptsSet the bits of pulse trains to check Bit0->pt0, Bit1->pt1... etc.
Returns
0 All pulse trains are off.
>0 At least one pulse train is on.

◆ PT_SetPattern()

void PT_SetPattern ( mxc_pt_regs_t pt,
uint32_t  pattern 
)
Parameters
ptPointer to pulse train to operate on
patternOutput pattern.

◆ PT_GetBPS()

float PT_GetBPS ( mxc_pt_regs_t pt)
Parameters
ptPointer to pulse train to operate on
Returns
Pulsetrain rate

◆ PT_EnableINT()

void PT_EnableINT ( mxc_pt_regs_t pt)
Parameters
ptPointer to pulse train to operate on.

◆ PT_EnableINTMulti()

void PT_EnableINTMulti ( mxc_ptg_regs_t *  ptg,
uint32_t  pts 
)
Parameters
ptgPulse train global registers based on bus
ptsBit mask of which pulse trains to enable. Set the bit position of each pulse train to enable it. Bit0->pt0, Bit1->pt1... etc, 1 will enable the interrupt, 0 to leave a PT channel in its current state.

◆ PT_DisableINT()

void PT_DisableINT ( mxc_pt_regs_t pt)
Parameters
ptpulse train to operate on.

◆ PT_DisableINTMulti()

void PT_DisableINTMulti ( mxc_ptg_regs_t *  ptg,
uint32_t  pts 
)
Parameters
ptgPulse train global registers based on bus
ptsBit mask of what pulse trains to disable. Set the bit position of each pulse train to disable it. Bit0->pt0, Bit1->pt1... etc, 1 will disable the interrupt, 0 to leave a PT channel in its current state.

◆ PT_GetFlags()

uint32_t PT_GetFlags ( mxc_ptg_regs_t *  ptg)
Parameters
ptgPulse train global registers based on bus
Returns
The Pulse Train Interrupt Flags, PT_INTFL Register for details.

◆ PT_ClearFlags()

void PT_ClearFlags ( mxc_ptg_regs_t *  ptg,
uint32_t  mask 
)
Parameters
ptgPulse train global registers based on bus
maskbits to clear, see PT_INTFL Register for details.

◆ PT_SetRestart()

void PT_SetRestart ( mxc_pt_regs_t ptToRestart,
mxc_pt_regs_t ptStop,
uint8_t  restartIndex 
)

Each pulse train can have up to two restart triggers.

Parameters
ptToRestartpulse train to restart after ptStop ends.
ptStoppulse train that stops and triggers ptToRestart to begin.
restartIndexselects which restart trigger to set (0 or 1).

◆ PT_RestartDisable()

void PT_RestartDisable ( mxc_pt_regs_t ptToRestart,
uint8_t  restartIndex 
)
Parameters
ptToRestartpulse train to disable the restart
restartIndexselects which restart trigger to disable (0 or 1)

◆ PT_Resync()

void PT_Resync ( mxc_ptg_regs_t *  ptg,
uint32_t  resyncPts 
)

Resync will stop those resync_pts; others will be still running

Parameters
ptgPulse train global registers based on bus
resyncPtspulse train modules that need to be re-synced by bit number. Bit0->pt0, Bit1->pt1... etc.