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.

Committer:
<>
Date:
Thu Oct 27 16:45:56 2016 +0100
Revision:
128:9bcdf88f62b0
Parent:
113:f141b2784e32
Child:
139:856d2700e60b
Release 128 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

2966: Add kw24 support https://github.com/ARMmbed/mbed-os/pull/2966
3068: MultiTech mDot - clean up PeripheralPins.c and add new pin names https://github.com/ARMmbed/mbed-os/pull/3068
3089: Kinetis HAL: Remove clock initialization code from serial and ticker https://github.com/ARMmbed/mbed-os/pull/3089
2943: [NRF5] NVIC_SetVector functionality https://github.com/ARMmbed/mbed-os/pull/2943
2938: InterruptIn changes in NCS36510 HAL. https://github.com/ARMmbed/mbed-os/pull/2938
3108: Fix sleep function for NRF52. https://github.com/ARMmbed/mbed-os/pull/3108
3076: STM32F1: Correct timer master value reading https://github.com/ARMmbed/mbed-os/pull/3076
3085: Add LOWPOWERTIMER capability for NUCLEO_F303ZE https://github.com/ARMmbed/mbed-os/pull/3085
3046: [BEETLE] Update BLE stack on Beetle board https://github.com/ARMmbed/mbed-os/pull/3046
3122: [Silicon Labs] Update of Silicon Labs HAL https://github.com/ARMmbed/mbed-os/pull/3122
3022: OnSemi RAM usage fix https://github.com/ARMmbed/mbed-os/pull/3022
3121: STM32F3: Correct UART4 and UART5 defines when using DEVICE_SERIAL_ASYNCH https://github.com/ARMmbed/mbed-os/pull/3121
3142: Targets- NUMAKER_PFM_NUC47216 remove mbed 2 https://github.com/ARMmbed/mbed-os/pull/3142

Who changed what in which revision?

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