MAX32680 Peripheral Driver API
Peripheral Driver API for the MAX32680
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
pt.h
1
6/******************************************************************************
7 *
8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9 * Analog Devices, Inc.),
10 * Copyright (C) 2023-2024 Analog Devices, Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 ******************************************************************************/
25
26/* Define to prevent redundant inclusion */
27#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_PT_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_PT_H_
29
30/* **** Includes **** */
31
32#include <stdio.h>
33#include "pt.h"
34#include "gcr_regs.h"
35#include "pt_regs.h"
36#include "ptg_regs.h"
37#include "mxc_device.h"
38#include "mxc_errors.h"
39#include "mxc_assert.h"
40#include "mxc_sys.h"
41#include "mcr_regs.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
58typedef struct {
59 unsigned channel;
60 uint32_t bps;
61 uint32_t pattern;
62 uint8_t
64 uint16_t loop;
65 uint16_t
71typedef enum {
72 MXC_PT_CLK_DIV1,
73 MXC_PT_CLK_DIV2,
74 MXC_PT_CLK_DIV4,
75 MXC_PT_CLK_DIV8,
76 MXC_PT_CLK_DIV16,
77 MXC_PT_CLK_DIV32,
78 MXC_PT_CLK_DIV64,
79 MXC_PT_CLK_DIV128,
81
88
96void MXC_PT_Shutdown(uint32_t pts);
97
111
122int MXC_PT_SqrWaveConfig(unsigned channel, uint32_t freq);
123
129void MXC_PT_Start(unsigned pts);
130
136void MXC_PT_Stop(unsigned pts);
137
147uint32_t MXC_PT_IsActive(uint32_t pts);
148
156void MXC_PT_SetPattern(unsigned pts, uint32_t pattern);
157
166void MXC_PT_EnableInt(uint32_t pts);
167
176void MXC_PT_DisableInt(uint32_t pts);
177
184uint32_t MXC_PT_GetFlags(void);
185
191void MXC_PT_ClearFlags(uint32_t flags);
192
202void MXC_PT_EnableRestart(unsigned start, unsigned stop, uint8_t restartIndex);
203
210void MXC_PT_DisableRestart(unsigned channel, uint8_t restartIndex);
211
219void MXC_PT_Resync(uint32_t pts);
222#ifdef __cplusplus
223}
224#endif
225
226#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_PT_H_
Registers, Bit Masks and Bit Positions for the GCR Peripheral Module.
uint8_t ptLength
Definition: pt.h:63
uint16_t loopDelay
Definition: pt.h:66
uint32_t bps
Definition: pt.h:60
unsigned channel
Definition: pt.h:59
uint32_t pattern
Definition: pt.h:61
uint16_t loop
Definition: pt.h:64
void MXC_PT_EnableInt(uint32_t pts)
Enable interrupts for the pulse trains selected.
void MXC_PT_DisableRestart(unsigned channel, uint8_t restartIndex)
Disable the restart for the specified pulse train.
void MXC_PT_ClearFlags(uint32_t flags)
Clears the pulse train's interrupt flag.
void MXC_PT_EnableRestart(unsigned start, unsigned stop, uint8_t restartIndex)
Setup and enables a pulse train to restart after another pulse train has exited its loop....
void MXC_PT_Init(mxc_clk_scale_t clk_scale)
This function initializes the pulse trains to a known stopped state and sets the global PT clock scal...
uint32_t MXC_PT_IsActive(uint32_t pts)
Determines if the pulse trains selected are running.
int MXC_PT_SqrWaveConfig(unsigned channel, uint32_t freq)
Configures the pulse train in the square wave mode.
void MXC_PT_Start(unsigned pts)
Starts the pulse trains specified.
int MXC_PT_Config(mxc_pt_cfg_t *cfg)
Configures the pulse train in the specified mode.
mxc_clk_scale_t
Definition: pt.h:71
void MXC_PT_DisableInt(uint32_t pts)
Disable interrupts for the pulse trains selected.
void MXC_PT_Shutdown(uint32_t pts)
Shutdown the pulse train channel/channels.
uint32_t MXC_PT_GetFlags(void)
Gets the pulse trains's interrupt flags.
void MXC_PT_Resync(uint32_t pts)
Resynchronize individual pulse trains together. Resync will stop those resync_pts; others will be sti...
void MXC_PT_SetPattern(unsigned pts, uint32_t pattern)
Sets the pattern of the pulse train.
void MXC_PT_Stop(unsigned pts)
Stops pulse trains.
Definition: pt.h:58
Registers, Bit Masks and Bit Positions for the MCR Peripheral Module.
Registers, Bit Masks and Bit Positions for the PT Peripheral Module.
Registers, Bit Masks and Bit Positions for the PTG Peripheral Module.