mbed library sources. Supersedes mbed-src. Edited target satm32f446 for user USART3 pins

Dependents:   IGLOO_board

Fork of mbed-dev by mbed official

Committer:
ua1arn
Date:
Mon Jul 30 12:31:10 2018 +0000
Revision:
188:3f10722804f9
Parent:
186:707f6e361f3e
before add multi-configuration USB descriptors

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 186:707f6e361f3e 1 /**
Anna Bridge 186:707f6e361f3e 2 * @file
Anna Bridge 186:707f6e361f3e 3 * @brief Pulse Train data types, definitions and function prototypes.
Anna Bridge 186:707f6e361f3e 4 */
Anna Bridge 186:707f6e361f3e 5
Anna Bridge 186:707f6e361f3e 6 /* *****************************************************************************
Anna Bridge 186:707f6e361f3e 7 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Anna Bridge 186:707f6e361f3e 8 *
Anna Bridge 186:707f6e361f3e 9 * Permission is hereby granted, free of charge, to any person obtaining a
Anna Bridge 186:707f6e361f3e 10 * copy of this software and associated documentation files (the "Software"),
Anna Bridge 186:707f6e361f3e 11 * to deal in the Software without restriction, including without limitation
Anna Bridge 186:707f6e361f3e 12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Anna Bridge 186:707f6e361f3e 13 * and/or sell copies of the Software, and to permit persons to whom the
Anna Bridge 186:707f6e361f3e 14 * Software is furnished to do so, subject to the following conditions:
Anna Bridge 186:707f6e361f3e 15 *
Anna Bridge 186:707f6e361f3e 16 * The above copyright notice and this permission notice shall be included
Anna Bridge 186:707f6e361f3e 17 * in all copies or substantial portions of the Software.
Anna Bridge 186:707f6e361f3e 18 *
Anna Bridge 186:707f6e361f3e 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Anna Bridge 186:707f6e361f3e 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Anna Bridge 186:707f6e361f3e 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Anna Bridge 186:707f6e361f3e 22 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Anna Bridge 186:707f6e361f3e 23 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Anna Bridge 186:707f6e361f3e 24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Anna Bridge 186:707f6e361f3e 25 * OTHER DEALINGS IN THE SOFTWARE.
Anna Bridge 186:707f6e361f3e 26 *
Anna Bridge 186:707f6e361f3e 27 * Except as contained in this notice, the name of Maxim Integrated
Anna Bridge 186:707f6e361f3e 28 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Anna Bridge 186:707f6e361f3e 29 * Products, Inc. Branding Policy.
Anna Bridge 186:707f6e361f3e 30 *
Anna Bridge 186:707f6e361f3e 31 * The mere transfer of this software does not imply any licenses
Anna Bridge 186:707f6e361f3e 32 * of trade secrets, proprietary technology, copyrights, patents,
Anna Bridge 186:707f6e361f3e 33 * trademarks, maskwork rights, or any other form of intellectual
Anna Bridge 186:707f6e361f3e 34 * property whatsoever. Maxim Integrated Products, Inc. retains all
Anna Bridge 186:707f6e361f3e 35 * ownership rights.
Anna Bridge 186:707f6e361f3e 36 *
Anna Bridge 186:707f6e361f3e 37 * $Date: 2016-10-10 19:27:24 -0500 (Mon, 10 Oct 2016) $
Anna Bridge 186:707f6e361f3e 38 * $Revision: 24669 $
Anna Bridge 186:707f6e361f3e 39 *
Anna Bridge 186:707f6e361f3e 40 ***************************************************************************** */
Anna Bridge 186:707f6e361f3e 41
Anna Bridge 186:707f6e361f3e 42 /* Define to prevent redundant inclusion */
Anna Bridge 186:707f6e361f3e 43 #ifndef _PT_H_
Anna Bridge 186:707f6e361f3e 44 #define _PT_H_
Anna Bridge 186:707f6e361f3e 45
Anna Bridge 186:707f6e361f3e 46 /* **** Includes **** */
Anna Bridge 186:707f6e361f3e 47 #include "mxc_config.h"
Anna Bridge 186:707f6e361f3e 48 #include "pt_regs.h"
Anna Bridge 186:707f6e361f3e 49 #include "mxc_assert.h"
Anna Bridge 186:707f6e361f3e 50 #include "mxc_sys.h"
Anna Bridge 186:707f6e361f3e 51
Anna Bridge 186:707f6e361f3e 52 #ifdef __cplusplus
Anna Bridge 186:707f6e361f3e 53 extern "C" {
Anna Bridge 186:707f6e361f3e 54 #endif
Anna Bridge 186:707f6e361f3e 55
Anna Bridge 186:707f6e361f3e 56 /**
Anna Bridge 186:707f6e361f3e 57 * @ingroup periphlibs
Anna Bridge 186:707f6e361f3e 58 * @defgroup pulsetrain Pulse Train Engine
Anna Bridge 186:707f6e361f3e 59 * @brief This is the high level API for the pulse train engine.
Anna Bridge 186:707f6e361f3e 60 * @{
Anna Bridge 186:707f6e361f3e 61 */
Anna Bridge 186:707f6e361f3e 62
Anna Bridge 186:707f6e361f3e 63 /**
Anna Bridge 186:707f6e361f3e 64 * Structure type for pulse train mode configuration.
Anna Bridge 186:707f6e361f3e 65 * @note Do not use for square wave
Anna Bridge 186:707f6e361f3e 66 */
Anna Bridge 186:707f6e361f3e 67 typedef struct {
Anna Bridge 186:707f6e361f3e 68 uint32_t bps; /**< pulse train bit rate */
Anna Bridge 186:707f6e361f3e 69 uint32_t pattern; /**< Output pattern to shift out, starts at LSB */
Anna Bridge 186:707f6e361f3e 70 uint8_t ptLength; /**< Number of bits in pulse train, 0 = 32bits, 1 = non valid , 2 = 2 bits, ... */
Anna Bridge 186:707f6e361f3e 71 uint16_t loop; /**< Number of times to repeat the train, 0 = continuous */
Anna Bridge 186:707f6e361f3e 72 uint16_t loopDelay; /**< Delay between loops specified in bits Example: loopDelay = 4, delays time = time it takes to shift out 4 bits */
Anna Bridge 186:707f6e361f3e 73 } pt_pt_cfg_t;
Anna Bridge 186:707f6e361f3e 74
Anna Bridge 186:707f6e361f3e 75 /**
Anna Bridge 186:707f6e361f3e 76 * @brief This function initializes the pulse trains to a known stopped
Anna Bridge 186:707f6e361f3e 77 * state and sets the global PT clock scale.
Anna Bridge 186:707f6e361f3e 78 * @param clk_scale Scale the system clock for the global PT clock.
Anna Bridge 186:707f6e361f3e 79 */
Anna Bridge 186:707f6e361f3e 80 void PT_Init(sys_pt_clk_scale clk_scale);
Anna Bridge 186:707f6e361f3e 81
Anna Bridge 186:707f6e361f3e 82 /**
Anna Bridge 186:707f6e361f3e 83 * @brief Configures the pulse train in the specified mode.
Anna Bridge 186:707f6e361f3e 84 * @details The parameters in the config structure must be set before calling
Anna Bridge 186:707f6e361f3e 85 * this function. This function should be used for configuring pulse
Anna Bridge 186:707f6e361f3e 86 * train mode only.
Anna Bridge 186:707f6e361f3e 87 * @note The pulse train cannot be running when this function is called.
Anna Bridge 186:707f6e361f3e 88 *
Anna Bridge 186:707f6e361f3e 89 * @param pt Pulse train to operate on.
Anna Bridge 186:707f6e361f3e 90 * @param cfg Pointer to pulse train configuration.
Anna Bridge 186:707f6e361f3e 91 * @param sysCfg Pointer to pulse train system GPIO configuration.
Anna Bridge 186:707f6e361f3e 92 *
Anna Bridge 186:707f6e361f3e 93 * @return #E_NO_ERROR if everything is successful, @ref MXC_Error_Codes
Anna Bridge 186:707f6e361f3e 94 * "error" if unsuccessful.
Anna Bridge 186:707f6e361f3e 95 */
Anna Bridge 186:707f6e361f3e 96 int PT_PTConfig(mxc_pt_regs_t *pt, pt_pt_cfg_t *cfg, const sys_cfg_pt_t *sysCfg);
Anna Bridge 186:707f6e361f3e 97
Anna Bridge 186:707f6e361f3e 98 /**
Anna Bridge 186:707f6e361f3e 99 * @brief Configures the pulse train in the square wave mode.
Anna Bridge 186:707f6e361f3e 100 * @details This function should be used for configuring square wave mode only.
Anna Bridge 186:707f6e361f3e 101 * @note The pulse train cannot be running when this function is called
Anna Bridge 186:707f6e361f3e 102 *
Anna Bridge 186:707f6e361f3e 103 * @param pt pulse train to operate on
Anna Bridge 186:707f6e361f3e 104 * @param freq square wave output frequency in Hz
Anna Bridge 186:707f6e361f3e 105 * @param sysCfg pointer to pulse train system GPIO configuration
Anna Bridge 186:707f6e361f3e 106 *
Anna Bridge 186:707f6e361f3e 107 * @returns #E_NO_ERROR if everything is successful, \ref MXC_Error_Codes "error" if unsuccessful.
Anna Bridge 186:707f6e361f3e 108 */
Anna Bridge 186:707f6e361f3e 109 int PT_SqrWaveConfig(mxc_pt_regs_t *pt, uint32_t freq, const sys_cfg_pt_t *sysCfg);
Anna Bridge 186:707f6e361f3e 110
Anna Bridge 186:707f6e361f3e 111 /**
Anna Bridge 186:707f6e361f3e 112 * @brief Starts the pulse train specified.
Anna Bridge 186:707f6e361f3e 113 *
Anna Bridge 186:707f6e361f3e 114 * @param pt Pulse train to operate on.
Anna Bridge 186:707f6e361f3e 115 */
Anna Bridge 186:707f6e361f3e 116 __STATIC_INLINE void PT_Start(mxc_pt_regs_t *pt)
Anna Bridge 186:707f6e361f3e 117 {
Anna Bridge 186:707f6e361f3e 118 int ptIndex = MXC_PT_GET_IDX(pt);
Anna Bridge 186:707f6e361f3e 119
Anna Bridge 186:707f6e361f3e 120 MXC_PTG->enable |= (1 << ptIndex);
Anna Bridge 186:707f6e361f3e 121
Anna Bridge 186:707f6e361f3e 122 //wait for PT to start
Anna Bridge 186:707f6e361f3e 123 while( (MXC_PTG->enable & (1 << ptIndex)) == 0 );
Anna Bridge 186:707f6e361f3e 124 }
Anna Bridge 186:707f6e361f3e 125
Anna Bridge 186:707f6e361f3e 126 /**
Anna Bridge 186:707f6e361f3e 127 * @brief Start multiple pulse train modules together.
Anna Bridge 186:707f6e361f3e 128 *
Anna Bridge 186:707f6e361f3e 129 * @param pts Set the bits of pulse trains to start
Anna Bridge 186:707f6e361f3e 130 * Bit0-\>pt0, Bit1-\>pt1... etc.
Anna Bridge 186:707f6e361f3e 131 */
Anna Bridge 186:707f6e361f3e 132 __STATIC_INLINE void PT_StartMulti(uint32_t pts)
Anna Bridge 186:707f6e361f3e 133 {
Anna Bridge 186:707f6e361f3e 134 MXC_PTG->enable |= pts;
Anna Bridge 186:707f6e361f3e 135
Anna Bridge 186:707f6e361f3e 136 //wait for PTs to start
Anna Bridge 186:707f6e361f3e 137 while( (MXC_PTG->enable & pts) != pts );
Anna Bridge 186:707f6e361f3e 138 }
Anna Bridge 186:707f6e361f3e 139
Anna Bridge 186:707f6e361f3e 140 /**
Anna Bridge 186:707f6e361f3e 141 * @brief Stops a pulse train.
Anna Bridge 186:707f6e361f3e 142 *
Anna Bridge 186:707f6e361f3e 143 * @param pt Pulse train to operate on.
Anna Bridge 186:707f6e361f3e 144 */
Anna Bridge 186:707f6e361f3e 145 __STATIC_INLINE void PT_Stop(mxc_pt_regs_t *pt)
Anna Bridge 186:707f6e361f3e 146 {
Anna Bridge 186:707f6e361f3e 147 int ptIndex = MXC_PT_GET_IDX(pt);
Anna Bridge 186:707f6e361f3e 148
Anna Bridge 186:707f6e361f3e 149 MXC_PTG->enable &= ~(1 << ptIndex);
Anna Bridge 186:707f6e361f3e 150 }
Anna Bridge 186:707f6e361f3e 151
Anna Bridge 186:707f6e361f3e 152 /**
Anna Bridge 186:707f6e361f3e 153 * @brief Stop multiple pulse trains together
Anna Bridge 186:707f6e361f3e 154 *
Anna Bridge 186:707f6e361f3e 155 * @param pts Set the bits of pulse trains to stop
Anna Bridge 186:707f6e361f3e 156 * Bit0-\>pt0, Bit1-\>pt1... etc.
Anna Bridge 186:707f6e361f3e 157 */
Anna Bridge 186:707f6e361f3e 158 __STATIC_INLINE void PT_StopMulti(uint32_t pts)
Anna Bridge 186:707f6e361f3e 159 {
Anna Bridge 186:707f6e361f3e 160 MXC_PTG->enable &= ~(pts);
Anna Bridge 186:707f6e361f3e 161 }
Anna Bridge 186:707f6e361f3e 162
Anna Bridge 186:707f6e361f3e 163 /**
Anna Bridge 186:707f6e361f3e 164 * @brief Determines if the pulse train is running.
Anna Bridge 186:707f6e361f3e 165 *
Anna Bridge 186:707f6e361f3e 166 * @param pt Pulse train to operate on.
Anna Bridge 186:707f6e361f3e 167 *
Anna Bridge 186:707f6e361f3e 168 * @return 0 Pulse train is off.
Anna Bridge 186:707f6e361f3e 169 * @return \>0 Pulse train is on.
Anna Bridge 186:707f6e361f3e 170 */
Anna Bridge 186:707f6e361f3e 171 __STATIC_INLINE uint32_t PT_IsActive(mxc_pt_regs_t *pt)
Anna Bridge 186:707f6e361f3e 172 {
Anna Bridge 186:707f6e361f3e 173 int ptIndex = MXC_PT_GET_IDX(pt);
Anna Bridge 186:707f6e361f3e 174
Anna Bridge 186:707f6e361f3e 175 return (!!(MXC_PTG->enable & (1 << ptIndex)));
Anna Bridge 186:707f6e361f3e 176 }
Anna Bridge 186:707f6e361f3e 177
Anna Bridge 186:707f6e361f3e 178 /**
Anna Bridge 186:707f6e361f3e 179 * @brief Determines if the pulse trains selected are running
Anna Bridge 186:707f6e361f3e 180 *
Anna Bridge 186:707f6e361f3e 181 * @param pts Set the bits of pulse trains to check Bit0-\>pt0,
Anna Bridge 186:707f6e361f3e 182 * Bit1-\>pt1... etc.
Anna Bridge 186:707f6e361f3e 183 *
Anna Bridge 186:707f6e361f3e 184 * @return 0 All pulse trains are off.
Anna Bridge 186:707f6e361f3e 185 * @return \>0 At least one pulse train is on.
Anna Bridge 186:707f6e361f3e 186 */
Anna Bridge 186:707f6e361f3e 187 __STATIC_INLINE uint32_t PT_IsActiveMulti(uint32_t pts)
Anna Bridge 186:707f6e361f3e 188 {
Anna Bridge 186:707f6e361f3e 189 return (MXC_PTG->enable & pts);
Anna Bridge 186:707f6e361f3e 190 }
Anna Bridge 186:707f6e361f3e 191
Anna Bridge 186:707f6e361f3e 192 /**
Anna Bridge 186:707f6e361f3e 193 * @brief Sets the pattern of the pulse train
Anna Bridge 186:707f6e361f3e 194 *
Anna Bridge 186:707f6e361f3e 195 * @param pt Pointer to pulse train to operate on
Anna Bridge 186:707f6e361f3e 196 * @param pattern Output pattern.
Anna Bridge 186:707f6e361f3e 197 *
Anna Bridge 186:707f6e361f3e 198 */
Anna Bridge 186:707f6e361f3e 199 __STATIC_INLINE void PT_SetPattern(mxc_pt_regs_t *pt, uint32_t pattern)
Anna Bridge 186:707f6e361f3e 200 {
Anna Bridge 186:707f6e361f3e 201 pt->train = pattern;
Anna Bridge 186:707f6e361f3e 202 }
Anna Bridge 186:707f6e361f3e 203
Anna Bridge 186:707f6e361f3e 204 /**
Anna Bridge 186:707f6e361f3e 205 * @brief Enable pulse train interrupt.
Anna Bridge 186:707f6e361f3e 206 *
Anna Bridge 186:707f6e361f3e 207 * @param pt Pointer to pulse train to operate on.
Anna Bridge 186:707f6e361f3e 208 */
Anna Bridge 186:707f6e361f3e 209 __STATIC_INLINE void PT_EnableINT(mxc_pt_regs_t *pt)
Anna Bridge 186:707f6e361f3e 210 {
Anna Bridge 186:707f6e361f3e 211 int ptIndex = MXC_PT_GET_IDX(pt);
Anna Bridge 186:707f6e361f3e 212
Anna Bridge 186:707f6e361f3e 213 MXC_PTG->inten |= (1 << ptIndex);
Anna Bridge 186:707f6e361f3e 214 }
Anna Bridge 186:707f6e361f3e 215
Anna Bridge 186:707f6e361f3e 216 /**
Anna Bridge 186:707f6e361f3e 217 * @brief Enable interrupts for the pulse trains selected.
Anna Bridge 186:707f6e361f3e 218 *
Anna Bridge 186:707f6e361f3e 219 * @param pts Bit mask of which pulse trains to enable. Set the bit
Anna Bridge 186:707f6e361f3e 220 * position of each pulse train to enable it. Bit0-\>pt0,
Anna Bridge 186:707f6e361f3e 221 * Bit1-\>pt1... etc, 1 will enable the interrupt, 0 to leave
Anna Bridge 186:707f6e361f3e 222 * a PT channel in its current state.
Anna Bridge 186:707f6e361f3e 223 */
Anna Bridge 186:707f6e361f3e 224 __STATIC_INLINE void PT_EnableINTMulti(uint32_t pts)
Anna Bridge 186:707f6e361f3e 225 {
Anna Bridge 186:707f6e361f3e 226 MXC_PTG->inten |= pts;
Anna Bridge 186:707f6e361f3e 227 }
Anna Bridge 186:707f6e361f3e 228
Anna Bridge 186:707f6e361f3e 229 /**
Anna Bridge 186:707f6e361f3e 230 * @brief Disable pulse train interrupt.
Anna Bridge 186:707f6e361f3e 231 *
Anna Bridge 186:707f6e361f3e 232 * @param pt pulse train to operate on.
Anna Bridge 186:707f6e361f3e 233 */
Anna Bridge 186:707f6e361f3e 234 __STATIC_INLINE void PT_DisableINT(mxc_pt_regs_t *pt)
Anna Bridge 186:707f6e361f3e 235 {
Anna Bridge 186:707f6e361f3e 236 int ptIndex = MXC_PT_GET_IDX(pt);
Anna Bridge 186:707f6e361f3e 237
Anna Bridge 186:707f6e361f3e 238 MXC_PTG->inten &= ~(1 << ptIndex);
Anna Bridge 186:707f6e361f3e 239 }
Anna Bridge 186:707f6e361f3e 240
Anna Bridge 186:707f6e361f3e 241 /**
Anna Bridge 186:707f6e361f3e 242 * @brief Disable interrupts for the pulse trains selected.
Anna Bridge 186:707f6e361f3e 243 *
Anna Bridge 186:707f6e361f3e 244 * @param pts Bit mask of what pulse trains to disable. Set the bit
Anna Bridge 186:707f6e361f3e 245 * position of each pulse train to disable it. Bit0-\>pt0,
Anna Bridge 186:707f6e361f3e 246 * Bit1-\>pt1... etc, 1 will disable the interrupt, 0 to leave
Anna Bridge 186:707f6e361f3e 247 * a PT channel in its current state.
Anna Bridge 186:707f6e361f3e 248 */
Anna Bridge 186:707f6e361f3e 249 __STATIC_INLINE void PT_DisableINTMulti(uint32_t pts)
Anna Bridge 186:707f6e361f3e 250 {
Anna Bridge 186:707f6e361f3e 251 MXC_PTG->inten &= ~pts;
Anna Bridge 186:707f6e361f3e 252 }
Anna Bridge 186:707f6e361f3e 253 /**
Anna Bridge 186:707f6e361f3e 254 * @brief Gets the pulse trains's interrupt flags.
Anna Bridge 186:707f6e361f3e 255 *
Anna Bridge 186:707f6e361f3e 256 * @return The Pulse Train Interrupt Flags, \ref PT_INTFL_Register Register
Anna Bridge 186:707f6e361f3e 257 * for details.
Anna Bridge 186:707f6e361f3e 258 */
Anna Bridge 186:707f6e361f3e 259 __STATIC_INLINE uint32_t PT_GetFlags(void)
Anna Bridge 186:707f6e361f3e 260 {
Anna Bridge 186:707f6e361f3e 261 return MXC_PTG->intfl;
Anna Bridge 186:707f6e361f3e 262 }
Anna Bridge 186:707f6e361f3e 263
Anna Bridge 186:707f6e361f3e 264 /**
Anna Bridge 186:707f6e361f3e 265 * @brief Clears the pulse train's interrupt flag.
Anna Bridge 186:707f6e361f3e 266 *
Anna Bridge 186:707f6e361f3e 267 * @param mask bits to clear, see \ref PT_INTFL_Register Register for details.
Anna Bridge 186:707f6e361f3e 268 */
Anna Bridge 186:707f6e361f3e 269 __STATIC_INLINE void PT_ClearFlags(uint32_t mask)
Anna Bridge 186:707f6e361f3e 270 {
Anna Bridge 186:707f6e361f3e 271 MXC_PTG->intfl = mask;
Anna Bridge 186:707f6e361f3e 272 }
Anna Bridge 186:707f6e361f3e 273
Anna Bridge 186:707f6e361f3e 274 /**
Anna Bridge 186:707f6e361f3e 275 * @brief Setup and enables a pulse train to restart after another pulse
Anna Bridge 186:707f6e361f3e 276 * train has exited its loop. Each pulse train can have up to two
Anna Bridge 186:707f6e361f3e 277 * restart triggers.
Anna Bridge 186:707f6e361f3e 278 *
Anna Bridge 186:707f6e361f3e 279 * @param ptToRestart pulse train to restart after @c ptStop ends.
Anna Bridge 186:707f6e361f3e 280 * @param ptStop pulse train that stops and triggers @p ptToRestart
Anna Bridge 186:707f6e361f3e 281 * to begin.
Anna Bridge 186:707f6e361f3e 282 * @param restartIndex selects which restart trigger to set (0 or 1).
Anna Bridge 186:707f6e361f3e 283 */
Anna Bridge 186:707f6e361f3e 284 __STATIC_INLINE void PT_SetRestart(mxc_pt_regs_t *ptToRestart, mxc_pt_regs_t *ptStop, uint8_t restartIndex)
Anna Bridge 186:707f6e361f3e 285 {
Anna Bridge 186:707f6e361f3e 286 int ptStopIndex = MXC_PT_GET_IDX(ptStop);
Anna Bridge 186:707f6e361f3e 287
Anna Bridge 186:707f6e361f3e 288 MXC_ASSERT(ptStopIndex >= 0);
Anna Bridge 186:707f6e361f3e 289
Anna Bridge 186:707f6e361f3e 290 if(restartIndex) {
Anna Bridge 186:707f6e361f3e 291 ptToRestart->restart |= (ptStopIndex << MXC_F_PT_RESTART_PT_Y_SELECT_POS) |
Anna Bridge 186:707f6e361f3e 292 MXC_F_PT_RESTART_ON_PT_Y_LOOP_EXIT;
Anna Bridge 186:707f6e361f3e 293 } else {
Anna Bridge 186:707f6e361f3e 294 ptToRestart->restart |= (ptStopIndex << MXC_F_PT_RESTART_PT_X_SELECT_POS) |
Anna Bridge 186:707f6e361f3e 295 MXC_F_PT_RESTART_ON_PT_X_LOOP_EXIT;
Anna Bridge 186:707f6e361f3e 296 }
Anna Bridge 186:707f6e361f3e 297 }
Anna Bridge 186:707f6e361f3e 298
Anna Bridge 186:707f6e361f3e 299 /**
Anna Bridge 186:707f6e361f3e 300 * @brief Disable the restart for the specified pulse train
Anna Bridge 186:707f6e361f3e 301 *
Anna Bridge 186:707f6e361f3e 302 * @param ptToRestart pulse train to disable the restart
Anna Bridge 186:707f6e361f3e 303 * @param restartIndex selects which restart trigger to disable (0 or 1)
Anna Bridge 186:707f6e361f3e 304 */
Anna Bridge 186:707f6e361f3e 305 __STATIC_INLINE void PT_RestartDisable(mxc_pt_regs_t *ptToRestart, uint8_t restartIndex)
Anna Bridge 186:707f6e361f3e 306 {
Anna Bridge 186:707f6e361f3e 307 if(restartIndex)
Anna Bridge 186:707f6e361f3e 308 ptToRestart->restart &= ~MXC_F_PT_RESTART_ON_PT_Y_LOOP_EXIT;
Anna Bridge 186:707f6e361f3e 309 else
Anna Bridge 186:707f6e361f3e 310 ptToRestart->restart &= ~MXC_F_PT_RESTART_ON_PT_X_LOOP_EXIT;
Anna Bridge 186:707f6e361f3e 311 }
Anna Bridge 186:707f6e361f3e 312
Anna Bridge 186:707f6e361f3e 313 /**
Anna Bridge 186:707f6e361f3e 314 * @brief Resynchronize individual pulse trains together. Resync will stop
Anna Bridge 186:707f6e361f3e 315 * those resync_pts; others will be still running
Anna Bridge 186:707f6e361f3e 316 *
Anna Bridge 186:707f6e361f3e 317 * @param resyncPts pulse train modules that need to be re-synced by bit
Anna Bridge 186:707f6e361f3e 318 * number. Bit0-\>pt0, Bit1-\>pt1... etc.
Anna Bridge 186:707f6e361f3e 319 */
Anna Bridge 186:707f6e361f3e 320 __STATIC_INLINE void PT_Resync(uint32_t resyncPts)
Anna Bridge 186:707f6e361f3e 321 {
Anna Bridge 186:707f6e361f3e 322 MXC_PTG->resync = resyncPts;
Anna Bridge 186:707f6e361f3e 323 while(MXC_PTG->resync);
Anna Bridge 186:707f6e361f3e 324 }
Anna Bridge 186:707f6e361f3e 325 /**@} end of group pulsetrains*/
Anna Bridge 186:707f6e361f3e 326
Anna Bridge 186:707f6e361f3e 327 #ifdef __cplusplus
Anna Bridge 186:707f6e361f3e 328 }
Anna Bridge 186:707f6e361f3e 329 #endif
Anna Bridge 186:707f6e361f3e 330
Anna Bridge 186:707f6e361f3e 331 #endif /* _PT_H_ */