Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_Silicon_Labs/TARGET_EFM32/emlib/inc/em_prs.h@149:156823d33999, 2016-10-28 (annotated)
- Committer:
- <>
- Date:
- Fri Oct 28 11:17:30 2016 +0100
- Revision:
- 149:156823d33999
- Parent:
- targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/emlib/inc/em_prs.h@144:ef7eb2e8f9f7
- Child:
- 150:02e0a0aed4ec
This updates the lib to the mbed lib v128
NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| <> | 144:ef7eb2e8f9f7 | 1 | /***************************************************************************//** |
| <> | 144:ef7eb2e8f9f7 | 2 | * @file em_prs.h |
| <> | 144:ef7eb2e8f9f7 | 3 | * @brief Peripheral Reflex System (PRS) peripheral API |
| <> | 144:ef7eb2e8f9f7 | 4 | * @version 4.2.1 |
| <> | 144:ef7eb2e8f9f7 | 5 | ******************************************************************************* |
| <> | 144:ef7eb2e8f9f7 | 6 | * @section License |
| <> | 144:ef7eb2e8f9f7 | 7 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
| <> | 144:ef7eb2e8f9f7 | 8 | ******************************************************************************* |
| <> | 144:ef7eb2e8f9f7 | 9 | * |
| <> | 144:ef7eb2e8f9f7 | 10 | * Permission is granted to anyone to use this software for any purpose, |
| <> | 144:ef7eb2e8f9f7 | 11 | * including commercial applications, and to alter it and redistribute it |
| <> | 144:ef7eb2e8f9f7 | 12 | * freely, subject to the following restrictions: |
| <> | 144:ef7eb2e8f9f7 | 13 | * |
| <> | 144:ef7eb2e8f9f7 | 14 | * 1. The origin of this software must not be misrepresented; you must not |
| <> | 144:ef7eb2e8f9f7 | 15 | * claim that you wrote the original software. |
| <> | 144:ef7eb2e8f9f7 | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
| <> | 144:ef7eb2e8f9f7 | 17 | * misrepresented as being the original software. |
| <> | 144:ef7eb2e8f9f7 | 18 | * 3. This notice may not be removed or altered from any source distribution. |
| <> | 144:ef7eb2e8f9f7 | 19 | * |
| <> | 144:ef7eb2e8f9f7 | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
| <> | 144:ef7eb2e8f9f7 | 21 | * obligation to support this Software. Silicon Labs is providing the |
| <> | 144:ef7eb2e8f9f7 | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
| <> | 144:ef7eb2e8f9f7 | 23 | * including, but not limited to, any implied warranties of merchantability |
| <> | 144:ef7eb2e8f9f7 | 24 | * or fitness for any particular purpose or warranties against infringement |
| <> | 144:ef7eb2e8f9f7 | 25 | * of any proprietary rights of a third party. |
| <> | 144:ef7eb2e8f9f7 | 26 | * |
| <> | 144:ef7eb2e8f9f7 | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
| <> | 144:ef7eb2e8f9f7 | 28 | * special damages, or any other relief, or for any claim by any third party, |
| <> | 144:ef7eb2e8f9f7 | 29 | * arising from your use of this Software. |
| <> | 144:ef7eb2e8f9f7 | 30 | * |
| <> | 144:ef7eb2e8f9f7 | 31 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 32 | |
| <> | 144:ef7eb2e8f9f7 | 33 | #ifndef __SILICON_LABS_EM_PRS_H__ |
| <> | 144:ef7eb2e8f9f7 | 34 | #define __SILICON_LABS_EM_PRS_H__ |
| <> | 144:ef7eb2e8f9f7 | 35 | |
| <> | 144:ef7eb2e8f9f7 | 36 | #include "em_device.h" |
| <> | 144:ef7eb2e8f9f7 | 37 | #if defined(PRS_COUNT) && (PRS_COUNT > 0) |
| <> | 144:ef7eb2e8f9f7 | 38 | |
| <> | 144:ef7eb2e8f9f7 | 39 | #ifdef __cplusplus |
| <> | 144:ef7eb2e8f9f7 | 40 | extern "C" { |
| <> | 144:ef7eb2e8f9f7 | 41 | #endif |
| <> | 144:ef7eb2e8f9f7 | 42 | |
| <> | 144:ef7eb2e8f9f7 | 43 | /***************************************************************************//** |
| <> | 144:ef7eb2e8f9f7 | 44 | * @addtogroup EM_Library |
| <> | 144:ef7eb2e8f9f7 | 45 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 46 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 47 | |
| <> | 144:ef7eb2e8f9f7 | 48 | /***************************************************************************//** |
| <> | 144:ef7eb2e8f9f7 | 49 | * @addtogroup PRS |
| <> | 144:ef7eb2e8f9f7 | 50 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 51 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 52 | |
| <> | 144:ef7eb2e8f9f7 | 53 | /******************************************************************************* |
| <> | 144:ef7eb2e8f9f7 | 54 | ******************************** ENUMS ************************************ |
| <> | 144:ef7eb2e8f9f7 | 55 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 56 | |
| <> | 144:ef7eb2e8f9f7 | 57 | /** Edge detection type. */ |
| <> | 144:ef7eb2e8f9f7 | 58 | typedef enum |
| <> | 144:ef7eb2e8f9f7 | 59 | { |
| <> | 144:ef7eb2e8f9f7 | 60 | prsEdgeOff = PRS_CH_CTRL_EDSEL_OFF, /**< Leave signal as is. */ |
| <> | 144:ef7eb2e8f9f7 | 61 | prsEdgePos = PRS_CH_CTRL_EDSEL_POSEDGE, /**< Generate pules on positive edge. */ |
| <> | 144:ef7eb2e8f9f7 | 62 | prsEdgeNeg = PRS_CH_CTRL_EDSEL_NEGEDGE, /**< Generate pules on negative edge. */ |
| <> | 144:ef7eb2e8f9f7 | 63 | prsEdgeBoth = PRS_CH_CTRL_EDSEL_BOTHEDGES /**< Generate pules on both edges. */ |
| <> | 144:ef7eb2e8f9f7 | 64 | } PRS_Edge_TypeDef; |
| <> | 144:ef7eb2e8f9f7 | 65 | |
| <> | 144:ef7eb2e8f9f7 | 66 | /******************************************************************************* |
| <> | 144:ef7eb2e8f9f7 | 67 | ***************************** PROTOTYPES ********************************** |
| <> | 144:ef7eb2e8f9f7 | 68 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 69 | |
| <> | 144:ef7eb2e8f9f7 | 70 | /***************************************************************************//** |
| <> | 144:ef7eb2e8f9f7 | 71 | * @brief |
| <> | 144:ef7eb2e8f9f7 | 72 | * Set level control bit for one or more channels. |
| <> | 144:ef7eb2e8f9f7 | 73 | * |
| <> | 144:ef7eb2e8f9f7 | 74 | * @details |
| <> | 144:ef7eb2e8f9f7 | 75 | * The level value for a channel is XORed with both the pulse possible issued |
| <> | 144:ef7eb2e8f9f7 | 76 | * by PRS_PulseTrigger() and the PRS input signal selected for the channel(s). |
| <> | 144:ef7eb2e8f9f7 | 77 | * |
| <> | 144:ef7eb2e8f9f7 | 78 | * @param[in] level |
| <> | 144:ef7eb2e8f9f7 | 79 | * Level to use for channels indicated by @p mask. Use logical OR combination |
| <> | 144:ef7eb2e8f9f7 | 80 | * of PRS_SWLEVEL_CHnLEVEL defines for channels to set high level, otherwise 0. |
| <> | 144:ef7eb2e8f9f7 | 81 | * |
| <> | 144:ef7eb2e8f9f7 | 82 | * @param[in] mask |
| <> | 144:ef7eb2e8f9f7 | 83 | * Mask indicating which channels to set level for. Use logical OR combination |
| <> | 144:ef7eb2e8f9f7 | 84 | * of PRS_SWLEVEL_CHnLEVEL defines. |
| <> | 144:ef7eb2e8f9f7 | 85 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 86 | __STATIC_INLINE void PRS_LevelSet(uint32_t level, uint32_t mask) |
| <> | 144:ef7eb2e8f9f7 | 87 | { |
| <> | 144:ef7eb2e8f9f7 | 88 | PRS->SWLEVEL = (PRS->SWLEVEL & ~mask) | (level & mask); |
| <> | 144:ef7eb2e8f9f7 | 89 | } |
| <> | 144:ef7eb2e8f9f7 | 90 | |
| <> | 144:ef7eb2e8f9f7 | 91 | |
| <> | 144:ef7eb2e8f9f7 | 92 | /***************************************************************************//** |
| <> | 144:ef7eb2e8f9f7 | 93 | * @brief |
| <> | 144:ef7eb2e8f9f7 | 94 | * Trigger a high pulse (one HFPERCLK) for one or more channels. |
| <> | 144:ef7eb2e8f9f7 | 95 | * |
| <> | 144:ef7eb2e8f9f7 | 96 | * @details |
| <> | 144:ef7eb2e8f9f7 | 97 | * Setting a bit for a channel causes the bit in the register to remain high |
| <> | 144:ef7eb2e8f9f7 | 98 | * for one HFPERCLK cycle. The pulse is XORed with both the corresponding bit |
| <> | 144:ef7eb2e8f9f7 | 99 | * in PRS SWLEVEL register and the PRS input signal selected for the |
| <> | 144:ef7eb2e8f9f7 | 100 | * channel(s). |
| <> | 144:ef7eb2e8f9f7 | 101 | * |
| <> | 144:ef7eb2e8f9f7 | 102 | * @param[in] channels |
| <> | 144:ef7eb2e8f9f7 | 103 | * Logical ORed combination of channels to trigger a pulse for. Use |
| <> | 144:ef7eb2e8f9f7 | 104 | * PRS_SWPULSE_CHnPULSE defines. |
| <> | 144:ef7eb2e8f9f7 | 105 | ******************************************************************************/ |
| <> | 144:ef7eb2e8f9f7 | 106 | __STATIC_INLINE void PRS_PulseTrigger(uint32_t channels) |
| <> | 144:ef7eb2e8f9f7 | 107 | { |
| <> | 144:ef7eb2e8f9f7 | 108 | PRS->SWPULSE = channels & _PRS_SWPULSE_MASK; |
| <> | 144:ef7eb2e8f9f7 | 109 | } |
| <> | 144:ef7eb2e8f9f7 | 110 | |
| <> | 144:ef7eb2e8f9f7 | 111 | void PRS_SourceSignalSet(unsigned int ch, |
| <> | 144:ef7eb2e8f9f7 | 112 | uint32_t source, |
| <> | 144:ef7eb2e8f9f7 | 113 | uint32_t signal, |
| <> | 144:ef7eb2e8f9f7 | 114 | PRS_Edge_TypeDef edge); |
| <> | 144:ef7eb2e8f9f7 | 115 | |
| <> | 144:ef7eb2e8f9f7 | 116 | #if defined( PRS_CH_CTRL_ASYNC ) |
| <> | 144:ef7eb2e8f9f7 | 117 | void PRS_SourceAsyncSignalSet(unsigned int ch, |
| <> | 144:ef7eb2e8f9f7 | 118 | uint32_t source, |
| <> | 144:ef7eb2e8f9f7 | 119 | uint32_t signal); |
| <> | 144:ef7eb2e8f9f7 | 120 | #endif |
| <> | 144:ef7eb2e8f9f7 | 121 | |
| <> | 144:ef7eb2e8f9f7 | 122 | /** @} (end addtogroup PRS) */ |
| <> | 144:ef7eb2e8f9f7 | 123 | /** @} (end addtogroup EM_Library) */ |
| <> | 144:ef7eb2e8f9f7 | 124 | |
| <> | 144:ef7eb2e8f9f7 | 125 | #ifdef __cplusplus |
| <> | 144:ef7eb2e8f9f7 | 126 | } |
| <> | 144:ef7eb2e8f9f7 | 127 | #endif |
| <> | 144:ef7eb2e8f9f7 | 128 | |
| <> | 144:ef7eb2e8f9f7 | 129 | #endif /* defined(PRS_COUNT) && (PRS_COUNT > 0) */ |
| <> | 144:ef7eb2e8f9f7 | 130 | #endif /* __SILICON_LABS_EM_PRS_H__ */ |


