The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_EFM32WG_STK3800/TARGET_Silicon_Labs/TARGET_EFM32/emlib/inc/em_prs.h@159:7130f322cb7e, 2017-12-21 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Dec 21 18:20:02 2017 +0000
- Revision:
- 159:7130f322cb7e
- Parent:
- 156:ff21514d8981
mbed library version 157
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 156:ff21514d8981 | 1 | /***************************************************************************//** |
AnnaBridge | 156:ff21514d8981 | 2 | * @file em_prs.h |
AnnaBridge | 156:ff21514d8981 | 3 | * @brief Peripheral Reflex System (PRS) peripheral API |
mbed_official | 159:7130f322cb7e | 4 | * @version 5.3.3 |
AnnaBridge | 156:ff21514d8981 | 5 | ******************************************************************************* |
mbed_official | 159:7130f322cb7e | 6 | * # License |
AnnaBridge | 156:ff21514d8981 | 7 | * <b>Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com</b> |
AnnaBridge | 156:ff21514d8981 | 8 | ******************************************************************************* |
AnnaBridge | 156:ff21514d8981 | 9 | * |
AnnaBridge | 156:ff21514d8981 | 10 | * Permission is granted to anyone to use this software for any purpose, |
AnnaBridge | 156:ff21514d8981 | 11 | * including commercial applications, and to alter it and redistribute it |
AnnaBridge | 156:ff21514d8981 | 12 | * freely, subject to the following restrictions: |
AnnaBridge | 156:ff21514d8981 | 13 | * |
AnnaBridge | 156:ff21514d8981 | 14 | * 1. The origin of this software must not be misrepresented; you must not |
AnnaBridge | 156:ff21514d8981 | 15 | * claim that you wrote the original software. |
AnnaBridge | 156:ff21514d8981 | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
AnnaBridge | 156:ff21514d8981 | 17 | * misrepresented as being the original software. |
AnnaBridge | 156:ff21514d8981 | 18 | * 3. This notice may not be removed or altered from any source distribution. |
AnnaBridge | 156:ff21514d8981 | 19 | * |
AnnaBridge | 156:ff21514d8981 | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
AnnaBridge | 156:ff21514d8981 | 21 | * obligation to support this Software. Silicon Labs is providing the |
AnnaBridge | 156:ff21514d8981 | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
AnnaBridge | 156:ff21514d8981 | 23 | * including, but not limited to, any implied warranties of merchantability |
AnnaBridge | 156:ff21514d8981 | 24 | * or fitness for any particular purpose or warranties against infringement |
AnnaBridge | 156:ff21514d8981 | 25 | * of any proprietary rights of a third party. |
AnnaBridge | 156:ff21514d8981 | 26 | * |
AnnaBridge | 156:ff21514d8981 | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
AnnaBridge | 156:ff21514d8981 | 28 | * special damages, or any other relief, or for any claim by any third party, |
AnnaBridge | 156:ff21514d8981 | 29 | * arising from your use of this Software. |
AnnaBridge | 156:ff21514d8981 | 30 | * |
AnnaBridge | 156:ff21514d8981 | 31 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 32 | |
AnnaBridge | 156:ff21514d8981 | 33 | #ifndef EM_PRS_H |
AnnaBridge | 156:ff21514d8981 | 34 | #define EM_PRS_H |
AnnaBridge | 156:ff21514d8981 | 35 | |
AnnaBridge | 156:ff21514d8981 | 36 | #include "em_device.h" |
AnnaBridge | 156:ff21514d8981 | 37 | #if defined(PRS_COUNT) && (PRS_COUNT > 0) |
AnnaBridge | 156:ff21514d8981 | 38 | |
AnnaBridge | 156:ff21514d8981 | 39 | #ifdef __cplusplus |
AnnaBridge | 156:ff21514d8981 | 40 | extern "C" { |
AnnaBridge | 156:ff21514d8981 | 41 | #endif |
AnnaBridge | 156:ff21514d8981 | 42 | |
AnnaBridge | 156:ff21514d8981 | 43 | /***************************************************************************//** |
AnnaBridge | 156:ff21514d8981 | 44 | * @addtogroup emlib |
AnnaBridge | 156:ff21514d8981 | 45 | * @{ |
AnnaBridge | 156:ff21514d8981 | 46 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 47 | |
AnnaBridge | 156:ff21514d8981 | 48 | /***************************************************************************//** |
AnnaBridge | 156:ff21514d8981 | 49 | * @addtogroup PRS |
AnnaBridge | 156:ff21514d8981 | 50 | * @{ |
AnnaBridge | 156:ff21514d8981 | 51 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 52 | |
AnnaBridge | 156:ff21514d8981 | 53 | /******************************************************************************* |
AnnaBridge | 156:ff21514d8981 | 54 | ******************************** ENUMS ************************************ |
AnnaBridge | 156:ff21514d8981 | 55 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 56 | |
AnnaBridge | 156:ff21514d8981 | 57 | /** Edge detection type. */ |
mbed_official | 159:7130f322cb7e | 58 | typedef enum { |
AnnaBridge | 156:ff21514d8981 | 59 | prsEdgeOff = PRS_CH_CTRL_EDSEL_OFF, /**< Leave signal as is. */ |
AnnaBridge | 156:ff21514d8981 | 60 | prsEdgePos = PRS_CH_CTRL_EDSEL_POSEDGE, /**< Generate pules on positive edge. */ |
AnnaBridge | 156:ff21514d8981 | 61 | prsEdgeNeg = PRS_CH_CTRL_EDSEL_NEGEDGE, /**< Generate pules on negative edge. */ |
AnnaBridge | 156:ff21514d8981 | 62 | prsEdgeBoth = PRS_CH_CTRL_EDSEL_BOTHEDGES /**< Generate pules on both edges. */ |
AnnaBridge | 156:ff21514d8981 | 63 | } PRS_Edge_TypeDef; |
AnnaBridge | 156:ff21514d8981 | 64 | |
AnnaBridge | 156:ff21514d8981 | 65 | /******************************************************************************* |
AnnaBridge | 156:ff21514d8981 | 66 | ***************************** PROTOTYPES ********************************** |
AnnaBridge | 156:ff21514d8981 | 67 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 68 | |
AnnaBridge | 156:ff21514d8981 | 69 | /***************************************************************************//** |
AnnaBridge | 156:ff21514d8981 | 70 | * @brief |
AnnaBridge | 156:ff21514d8981 | 71 | * Set level control bit for one or more channels. |
AnnaBridge | 156:ff21514d8981 | 72 | * |
AnnaBridge | 156:ff21514d8981 | 73 | * @details |
AnnaBridge | 156:ff21514d8981 | 74 | * The level value for a channel is XORed with both the pulse possible issued |
AnnaBridge | 156:ff21514d8981 | 75 | * by PRS_PulseTrigger() and the PRS input signal selected for the channel(s). |
AnnaBridge | 156:ff21514d8981 | 76 | * |
AnnaBridge | 156:ff21514d8981 | 77 | * @param[in] level |
AnnaBridge | 156:ff21514d8981 | 78 | * Level to use for channels indicated by @p mask. Use logical OR combination |
AnnaBridge | 156:ff21514d8981 | 79 | * of PRS_SWLEVEL_CHnLEVEL defines for channels to set high level, otherwise 0. |
AnnaBridge | 156:ff21514d8981 | 80 | * |
AnnaBridge | 156:ff21514d8981 | 81 | * @param[in] mask |
AnnaBridge | 156:ff21514d8981 | 82 | * Mask indicating which channels to set level for. Use logical OR combination |
AnnaBridge | 156:ff21514d8981 | 83 | * of PRS_SWLEVEL_CHnLEVEL defines. |
AnnaBridge | 156:ff21514d8981 | 84 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 85 | __STATIC_INLINE void PRS_LevelSet(uint32_t level, uint32_t mask) |
AnnaBridge | 156:ff21514d8981 | 86 | { |
AnnaBridge | 156:ff21514d8981 | 87 | PRS->SWLEVEL = (PRS->SWLEVEL & ~mask) | (level & mask); |
AnnaBridge | 156:ff21514d8981 | 88 | } |
AnnaBridge | 156:ff21514d8981 | 89 | |
AnnaBridge | 156:ff21514d8981 | 90 | /***************************************************************************//** |
AnnaBridge | 156:ff21514d8981 | 91 | * @brief |
AnnaBridge | 156:ff21514d8981 | 92 | * Trigger a high pulse (one HFPERCLK) for one or more channels. |
AnnaBridge | 156:ff21514d8981 | 93 | * |
AnnaBridge | 156:ff21514d8981 | 94 | * @details |
AnnaBridge | 156:ff21514d8981 | 95 | * Setting a bit for a channel causes the bit in the register to remain high |
AnnaBridge | 156:ff21514d8981 | 96 | * for one HFPERCLK cycle. The pulse is XORed with both the corresponding bit |
AnnaBridge | 156:ff21514d8981 | 97 | * in PRS SWLEVEL register and the PRS input signal selected for the |
AnnaBridge | 156:ff21514d8981 | 98 | * channel(s). |
AnnaBridge | 156:ff21514d8981 | 99 | * |
AnnaBridge | 156:ff21514d8981 | 100 | * @param[in] channels |
AnnaBridge | 156:ff21514d8981 | 101 | * Logical ORed combination of channels to trigger a pulse for. Use |
AnnaBridge | 156:ff21514d8981 | 102 | * PRS_SWPULSE_CHnPULSE defines. |
AnnaBridge | 156:ff21514d8981 | 103 | ******************************************************************************/ |
AnnaBridge | 156:ff21514d8981 | 104 | __STATIC_INLINE void PRS_PulseTrigger(uint32_t channels) |
AnnaBridge | 156:ff21514d8981 | 105 | { |
AnnaBridge | 156:ff21514d8981 | 106 | PRS->SWPULSE = channels & _PRS_SWPULSE_MASK; |
AnnaBridge | 156:ff21514d8981 | 107 | } |
AnnaBridge | 156:ff21514d8981 | 108 | |
AnnaBridge | 156:ff21514d8981 | 109 | void PRS_SourceSignalSet(unsigned int ch, |
AnnaBridge | 156:ff21514d8981 | 110 | uint32_t source, |
AnnaBridge | 156:ff21514d8981 | 111 | uint32_t signal, |
AnnaBridge | 156:ff21514d8981 | 112 | PRS_Edge_TypeDef edge); |
AnnaBridge | 156:ff21514d8981 | 113 | |
mbed_official | 159:7130f322cb7e | 114 | #if defined(PRS_CH_CTRL_ASYNC) |
AnnaBridge | 156:ff21514d8981 | 115 | void PRS_SourceAsyncSignalSet(unsigned int ch, |
AnnaBridge | 156:ff21514d8981 | 116 | uint32_t source, |
AnnaBridge | 156:ff21514d8981 | 117 | uint32_t signal); |
AnnaBridge | 156:ff21514d8981 | 118 | #endif |
AnnaBridge | 156:ff21514d8981 | 119 | |
AnnaBridge | 156:ff21514d8981 | 120 | /** @} (end addtogroup PRS) */ |
AnnaBridge | 156:ff21514d8981 | 121 | /** @} (end addtogroup emlib) */ |
AnnaBridge | 156:ff21514d8981 | 122 | |
AnnaBridge | 156:ff21514d8981 | 123 | #ifdef __cplusplus |
AnnaBridge | 156:ff21514d8981 | 124 | } |
AnnaBridge | 156:ff21514d8981 | 125 | #endif |
AnnaBridge | 156:ff21514d8981 | 126 | |
AnnaBridge | 156:ff21514d8981 | 127 | #endif /* defined(PRS_COUNT) && (PRS_COUNT > 0) */ |
AnnaBridge | 156:ff21514d8981 | 128 | #endif /* EM_PRS_H */ |