![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/drivers/fsl_vref.h@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
kadonotakashi | 0:8fdf9a60065b | 3 | * All rights reserved. |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
kadonotakashi | 0:8fdf9a60065b | 6 | * are permitted provided that the following conditions are met: |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
kadonotakashi | 0:8fdf9a60065b | 9 | * of conditions and the following disclaimer. |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
kadonotakashi | 0:8fdf9a60065b | 12 | * list of conditions and the following disclaimer in the documentation and/or |
kadonotakashi | 0:8fdf9a60065b | 13 | * other materials provided with the distribution. |
kadonotakashi | 0:8fdf9a60065b | 14 | * |
kadonotakashi | 0:8fdf9a60065b | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
kadonotakashi | 0:8fdf9a60065b | 16 | * contributors may be used to endorse or promote products derived from this |
kadonotakashi | 0:8fdf9a60065b | 17 | * software without specific prior written permission. |
kadonotakashi | 0:8fdf9a60065b | 18 | * |
kadonotakashi | 0:8fdf9a60065b | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
kadonotakashi | 0:8fdf9a60065b | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
kadonotakashi | 0:8fdf9a60065b | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
kadonotakashi | 0:8fdf9a60065b | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
kadonotakashi | 0:8fdf9a60065b | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
kadonotakashi | 0:8fdf9a60065b | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
kadonotakashi | 0:8fdf9a60065b | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
kadonotakashi | 0:8fdf9a60065b | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
kadonotakashi | 0:8fdf9a60065b | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
kadonotakashi | 0:8fdf9a60065b | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
kadonotakashi | 0:8fdf9a60065b | 29 | */ |
kadonotakashi | 0:8fdf9a60065b | 30 | |
kadonotakashi | 0:8fdf9a60065b | 31 | #ifndef _FSL_VREF_H_ |
kadonotakashi | 0:8fdf9a60065b | 32 | #define _FSL_VREF_H_ |
kadonotakashi | 0:8fdf9a60065b | 33 | |
kadonotakashi | 0:8fdf9a60065b | 34 | #include "fsl_common.h" |
kadonotakashi | 0:8fdf9a60065b | 35 | |
kadonotakashi | 0:8fdf9a60065b | 36 | /*! |
kadonotakashi | 0:8fdf9a60065b | 37 | * @addtogroup vref |
kadonotakashi | 0:8fdf9a60065b | 38 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 39 | */ |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | /****************************************************************************** |
kadonotakashi | 0:8fdf9a60065b | 43 | * Definitions |
kadonotakashi | 0:8fdf9a60065b | 44 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 45 | |
kadonotakashi | 0:8fdf9a60065b | 46 | /*! @name Driver version */ |
kadonotakashi | 0:8fdf9a60065b | 47 | /*@{*/ |
kadonotakashi | 0:8fdf9a60065b | 48 | #define FSL_VREF_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) /*!< Version 2.1.0. */ |
kadonotakashi | 0:8fdf9a60065b | 49 | /*@}*/ |
kadonotakashi | 0:8fdf9a60065b | 50 | |
kadonotakashi | 0:8fdf9a60065b | 51 | /* Those macros below defined to support SoC family which have VREFL (0.4V) reference */ |
kadonotakashi | 0:8fdf9a60065b | 52 | #if defined(FSL_FEATURE_VREF_HAS_LOW_REFERENCE) && FSL_FEATURE_VREF_HAS_LOW_REFERENCE |
kadonotakashi | 0:8fdf9a60065b | 53 | #define VREF_SC_MODE_LV VREF_VREFH_SC_MODE_LV |
kadonotakashi | 0:8fdf9a60065b | 54 | #define VREF_SC_REGEN VREF_VREFH_SC_REGEN |
kadonotakashi | 0:8fdf9a60065b | 55 | #define VREF_SC_VREFEN VREF_VREFH_SC_VREFEN |
kadonotakashi | 0:8fdf9a60065b | 56 | #define VREF_SC_ICOMPEN VREF_VREFH_SC_ICOMPEN |
kadonotakashi | 0:8fdf9a60065b | 57 | #define VREF_SC_REGEN_MASK VREF_VREFH_SC_REGEN_MASK |
kadonotakashi | 0:8fdf9a60065b | 58 | #define VREF_SC_VREFST_MASK VREF_VREFH_SC_VREFST_MASK |
kadonotakashi | 0:8fdf9a60065b | 59 | #define VREF_SC_VREFEN_MASK VREF_VREFH_SC_VREFEN_MASK |
kadonotakashi | 0:8fdf9a60065b | 60 | #define VREF_SC_MODE_LV_MASK VREF_VREFH_SC_MODE_LV_MASK |
kadonotakashi | 0:8fdf9a60065b | 61 | #define VREF_SC_ICOMPEN_MASK VREF_VREFH_SC_ICOMPEN_MASK |
kadonotakashi | 0:8fdf9a60065b | 62 | #define TRM VREFH_TRM |
kadonotakashi | 0:8fdf9a60065b | 63 | #define VREF_TRM_TRIM VREF_VREFH_TRM_TRIM |
kadonotakashi | 0:8fdf9a60065b | 64 | #define VREF_TRM_CHOPEN_MASK VREF_VREFH_TRM_CHOPEN_MASK |
kadonotakashi | 0:8fdf9a60065b | 65 | #define VREF_TRM_TRIM_MASK VREF_VREFH_TRM_TRIM_MASK |
kadonotakashi | 0:8fdf9a60065b | 66 | #define VREF_TRM_CHOPEN_SHIFT VREF_VREFH_TRM_CHOPEN_SHIFT |
kadonotakashi | 0:8fdf9a60065b | 67 | #define VREF_TRM_TRIM_SHIFT VREF_VREFH_TRM_TRIM_SHIFT |
kadonotakashi | 0:8fdf9a60065b | 68 | #define VREF_SC_MODE_LV_SHIFT VREF_VREFH_SC_MODE_LV_SHIFT |
kadonotakashi | 0:8fdf9a60065b | 69 | #define VREF_SC_REGEN_SHIFT VREF_VREFH_SC_REGEN_SHIFT |
kadonotakashi | 0:8fdf9a60065b | 70 | #define VREF_SC_VREFST_SHIFT VREF_VREFH_SC_VREFST_SHIFT |
kadonotakashi | 0:8fdf9a60065b | 71 | #define VREF_SC_ICOMPEN_SHIFT VREF_VREFH_SC_ICOMPEN_SHIFT |
kadonotakashi | 0:8fdf9a60065b | 72 | #endif /* FSL_FEATURE_VREF_HAS_LOW_REFERENCE */ |
kadonotakashi | 0:8fdf9a60065b | 73 | |
kadonotakashi | 0:8fdf9a60065b | 74 | /*! |
kadonotakashi | 0:8fdf9a60065b | 75 | * @brief VREF modes. |
kadonotakashi | 0:8fdf9a60065b | 76 | */ |
kadonotakashi | 0:8fdf9a60065b | 77 | typedef enum _vref_buffer_mode |
kadonotakashi | 0:8fdf9a60065b | 78 | { |
kadonotakashi | 0:8fdf9a60065b | 79 | kVREF_ModeBandgapOnly = 0U, /*!< Bandgap on only, for stabilization and startup */ |
kadonotakashi | 0:8fdf9a60065b | 80 | #if defined(FSL_FEATURE_VREF_MODE_LV_TYPE) && FSL_FEATURE_VREF_MODE_LV_TYPE |
kadonotakashi | 0:8fdf9a60065b | 81 | kVREF_ModeHighPowerBuffer = 1U, /*!< High-power buffer mode enabled */ |
kadonotakashi | 0:8fdf9a60065b | 82 | kVREF_ModeLowPowerBuffer = 2U /*!< Low-power buffer mode enabled */ |
kadonotakashi | 0:8fdf9a60065b | 83 | #else |
kadonotakashi | 0:8fdf9a60065b | 84 | kVREF_ModeTightRegulationBuffer = 2U /*!< Tight regulation buffer enabled */ |
kadonotakashi | 0:8fdf9a60065b | 85 | #endif /* FSL_FEATURE_VREF_MODE_LV_TYPE */ |
kadonotakashi | 0:8fdf9a60065b | 86 | } vref_buffer_mode_t; |
kadonotakashi | 0:8fdf9a60065b | 87 | |
kadonotakashi | 0:8fdf9a60065b | 88 | /*! |
kadonotakashi | 0:8fdf9a60065b | 89 | * @brief The description structure for the VREF module. |
kadonotakashi | 0:8fdf9a60065b | 90 | */ |
kadonotakashi | 0:8fdf9a60065b | 91 | typedef struct _vref_config |
kadonotakashi | 0:8fdf9a60065b | 92 | { |
kadonotakashi | 0:8fdf9a60065b | 93 | vref_buffer_mode_t bufferMode; /*!< Buffer mode selection */ |
kadonotakashi | 0:8fdf9a60065b | 94 | #if defined(FSL_FEATURE_VREF_HAS_LOW_REFERENCE) && FSL_FEATURE_VREF_HAS_LOW_REFERENCE |
kadonotakashi | 0:8fdf9a60065b | 95 | bool enableLowRef; /*!< Set VREFL (0.4 V) reference buffer enable or disable */ |
kadonotakashi | 0:8fdf9a60065b | 96 | bool enableExternalVoltRef; /*!< Select external voltage reference or not (internal) */ |
kadonotakashi | 0:8fdf9a60065b | 97 | #endif /* FSL_FEATURE_VREF_HAS_LOW_REFERENCE */ |
kadonotakashi | 0:8fdf9a60065b | 98 | #if defined(FSL_FEATURE_VREF_HAS_TRM4) && FSL_FEATURE_VREF_HAS_TRM4 |
kadonotakashi | 0:8fdf9a60065b | 99 | bool enable2V1VoltRef; /*!< Enable Internal Voltage Reference (2.1V) */ |
kadonotakashi | 0:8fdf9a60065b | 100 | #endif /* FSL_FEATURE_VREF_HAS_TRM4 */ |
kadonotakashi | 0:8fdf9a60065b | 101 | } vref_config_t; |
kadonotakashi | 0:8fdf9a60065b | 102 | |
kadonotakashi | 0:8fdf9a60065b | 103 | /****************************************************************************** |
kadonotakashi | 0:8fdf9a60065b | 104 | * API |
kadonotakashi | 0:8fdf9a60065b | 105 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 106 | |
kadonotakashi | 0:8fdf9a60065b | 107 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 108 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 109 | #endif /* __cplusplus */ |
kadonotakashi | 0:8fdf9a60065b | 110 | |
kadonotakashi | 0:8fdf9a60065b | 111 | /*! |
kadonotakashi | 0:8fdf9a60065b | 112 | * @name VREF functional operation |
kadonotakashi | 0:8fdf9a60065b | 113 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 114 | */ |
kadonotakashi | 0:8fdf9a60065b | 115 | |
kadonotakashi | 0:8fdf9a60065b | 116 | /*! |
kadonotakashi | 0:8fdf9a60065b | 117 | * @brief Enables the clock gate and configures the VREF module according to the configuration structure. |
kadonotakashi | 0:8fdf9a60065b | 118 | * |
kadonotakashi | 0:8fdf9a60065b | 119 | * This function must be called before calling all other VREF driver functions, |
kadonotakashi | 0:8fdf9a60065b | 120 | * read/write registers, and configurations with user-defined settings. |
kadonotakashi | 0:8fdf9a60065b | 121 | * The example below shows how to set up vref_config_t parameters and |
kadonotakashi | 0:8fdf9a60065b | 122 | * how to call the VREF_Init function by passing in these parameters. |
kadonotakashi | 0:8fdf9a60065b | 123 | * This is an example. |
kadonotakashi | 0:8fdf9a60065b | 124 | * @code |
kadonotakashi | 0:8fdf9a60065b | 125 | * vref_config_t vrefConfig; |
kadonotakashi | 0:8fdf9a60065b | 126 | * vrefConfig.bufferMode = kVREF_ModeHighPowerBuffer; |
kadonotakashi | 0:8fdf9a60065b | 127 | * vrefConfig.enableExternalVoltRef = false; |
kadonotakashi | 0:8fdf9a60065b | 128 | * vrefConfig.enableLowRef = false; |
kadonotakashi | 0:8fdf9a60065b | 129 | * VREF_Init(VREF, &vrefConfig); |
kadonotakashi | 0:8fdf9a60065b | 130 | * @endcode |
kadonotakashi | 0:8fdf9a60065b | 131 | * |
kadonotakashi | 0:8fdf9a60065b | 132 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 133 | * @param config Pointer to the configuration structure. |
kadonotakashi | 0:8fdf9a60065b | 134 | */ |
kadonotakashi | 0:8fdf9a60065b | 135 | void VREF_Init(VREF_Type *base, const vref_config_t *config); |
kadonotakashi | 0:8fdf9a60065b | 136 | |
kadonotakashi | 0:8fdf9a60065b | 137 | /*! |
kadonotakashi | 0:8fdf9a60065b | 138 | * @brief Stops and disables the clock for the VREF module. |
kadonotakashi | 0:8fdf9a60065b | 139 | * |
kadonotakashi | 0:8fdf9a60065b | 140 | * This function should be called to shut down the module. |
kadonotakashi | 0:8fdf9a60065b | 141 | * This is an example. |
kadonotakashi | 0:8fdf9a60065b | 142 | * @code |
kadonotakashi | 0:8fdf9a60065b | 143 | * vref_config_t vrefUserConfig; |
kadonotakashi | 0:8fdf9a60065b | 144 | * VREF_Init(VREF); |
kadonotakashi | 0:8fdf9a60065b | 145 | * VREF_GetDefaultConfig(&vrefUserConfig); |
kadonotakashi | 0:8fdf9a60065b | 146 | * ... |
kadonotakashi | 0:8fdf9a60065b | 147 | * VREF_Deinit(VREF); |
kadonotakashi | 0:8fdf9a60065b | 148 | * @endcode |
kadonotakashi | 0:8fdf9a60065b | 149 | * |
kadonotakashi | 0:8fdf9a60065b | 150 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 151 | */ |
kadonotakashi | 0:8fdf9a60065b | 152 | void VREF_Deinit(VREF_Type *base); |
kadonotakashi | 0:8fdf9a60065b | 153 | |
kadonotakashi | 0:8fdf9a60065b | 154 | /*! |
kadonotakashi | 0:8fdf9a60065b | 155 | * @brief Initializes the VREF configuration structure. |
kadonotakashi | 0:8fdf9a60065b | 156 | * |
kadonotakashi | 0:8fdf9a60065b | 157 | * This function initializes the VREF configuration structure to default values. |
kadonotakashi | 0:8fdf9a60065b | 158 | * This is an example. |
kadonotakashi | 0:8fdf9a60065b | 159 | * @code |
kadonotakashi | 0:8fdf9a60065b | 160 | * vrefConfig->bufferMode = kVREF_ModeHighPowerBuffer; |
kadonotakashi | 0:8fdf9a60065b | 161 | * vrefConfig->enableExternalVoltRef = false; |
kadonotakashi | 0:8fdf9a60065b | 162 | * vrefConfig->enableLowRef = false; |
kadonotakashi | 0:8fdf9a60065b | 163 | * @endcode |
kadonotakashi | 0:8fdf9a60065b | 164 | * |
kadonotakashi | 0:8fdf9a60065b | 165 | * @param config Pointer to the initialization structure. |
kadonotakashi | 0:8fdf9a60065b | 166 | */ |
kadonotakashi | 0:8fdf9a60065b | 167 | void VREF_GetDefaultConfig(vref_config_t *config); |
kadonotakashi | 0:8fdf9a60065b | 168 | |
kadonotakashi | 0:8fdf9a60065b | 169 | /*! |
kadonotakashi | 0:8fdf9a60065b | 170 | * @brief Sets a TRIM value for the reference voltage. |
kadonotakashi | 0:8fdf9a60065b | 171 | * |
kadonotakashi | 0:8fdf9a60065b | 172 | * This function sets a TRIM value for the reference voltage. |
kadonotakashi | 0:8fdf9a60065b | 173 | * Note that the TRIM value maximum is 0x3F. |
kadonotakashi | 0:8fdf9a60065b | 174 | * |
kadonotakashi | 0:8fdf9a60065b | 175 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 176 | * @param trimValue Value of the trim register to set the output reference voltage (maximum 0x3F (6-bit)). |
kadonotakashi | 0:8fdf9a60065b | 177 | */ |
kadonotakashi | 0:8fdf9a60065b | 178 | void VREF_SetTrimVal(VREF_Type *base, uint8_t trimValue); |
kadonotakashi | 0:8fdf9a60065b | 179 | |
kadonotakashi | 0:8fdf9a60065b | 180 | /*! |
kadonotakashi | 0:8fdf9a60065b | 181 | * @brief Reads the value of the TRIM meaning output voltage. |
kadonotakashi | 0:8fdf9a60065b | 182 | * |
kadonotakashi | 0:8fdf9a60065b | 183 | * This function gets the TRIM value from the TRM register. |
kadonotakashi | 0:8fdf9a60065b | 184 | * |
kadonotakashi | 0:8fdf9a60065b | 185 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 186 | * @return Six-bit value of trim setting. |
kadonotakashi | 0:8fdf9a60065b | 187 | */ |
kadonotakashi | 0:8fdf9a60065b | 188 | static inline uint8_t VREF_GetTrimVal(VREF_Type *base) |
kadonotakashi | 0:8fdf9a60065b | 189 | { |
kadonotakashi | 0:8fdf9a60065b | 190 | return (base->TRM & VREF_TRM_TRIM_MASK); |
kadonotakashi | 0:8fdf9a60065b | 191 | } |
kadonotakashi | 0:8fdf9a60065b | 192 | |
kadonotakashi | 0:8fdf9a60065b | 193 | #if defined(FSL_FEATURE_VREF_HAS_TRM4) && FSL_FEATURE_VREF_HAS_TRM4 |
kadonotakashi | 0:8fdf9a60065b | 194 | /*! |
kadonotakashi | 0:8fdf9a60065b | 195 | * @brief Sets a TRIM value for the reference voltage (2V1). |
kadonotakashi | 0:8fdf9a60065b | 196 | * |
kadonotakashi | 0:8fdf9a60065b | 197 | * This function sets a TRIM value for the reference voltage (2V1). |
kadonotakashi | 0:8fdf9a60065b | 198 | * Note that the TRIM value maximum is 0x3F. |
kadonotakashi | 0:8fdf9a60065b | 199 | * |
kadonotakashi | 0:8fdf9a60065b | 200 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 201 | * @param trimValue Value of the trim register to set the output reference voltage (maximum 0x3F (6-bit)). |
kadonotakashi | 0:8fdf9a60065b | 202 | */ |
kadonotakashi | 0:8fdf9a60065b | 203 | void VREF_SetTrim2V1Val(VREF_Type *base, uint8_t trimValue); |
kadonotakashi | 0:8fdf9a60065b | 204 | |
kadonotakashi | 0:8fdf9a60065b | 205 | /*! |
kadonotakashi | 0:8fdf9a60065b | 206 | * @brief Reads the value of the TRIM meaning output voltage (2V1). |
kadonotakashi | 0:8fdf9a60065b | 207 | * |
kadonotakashi | 0:8fdf9a60065b | 208 | * This function gets the TRIM value from the VREF_TRM4 register. |
kadonotakashi | 0:8fdf9a60065b | 209 | * |
kadonotakashi | 0:8fdf9a60065b | 210 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 211 | * @return Six-bit value of trim setting. |
kadonotakashi | 0:8fdf9a60065b | 212 | */ |
kadonotakashi | 0:8fdf9a60065b | 213 | static inline uint8_t VREF_GetTrim2V1Val(VREF_Type *base) |
kadonotakashi | 0:8fdf9a60065b | 214 | { |
kadonotakashi | 0:8fdf9a60065b | 215 | return (base->TRM4 & VREF_TRM4_TRIM2V1_MASK); |
kadonotakashi | 0:8fdf9a60065b | 216 | } |
kadonotakashi | 0:8fdf9a60065b | 217 | #endif /* FSL_FEATURE_VREF_HAS_TRM4 */ |
kadonotakashi | 0:8fdf9a60065b | 218 | |
kadonotakashi | 0:8fdf9a60065b | 219 | #if defined(FSL_FEATURE_VREF_HAS_LOW_REFERENCE) && FSL_FEATURE_VREF_HAS_LOW_REFERENCE |
kadonotakashi | 0:8fdf9a60065b | 220 | |
kadonotakashi | 0:8fdf9a60065b | 221 | /*! |
kadonotakashi | 0:8fdf9a60065b | 222 | * @brief Sets the TRIM value for the low voltage reference. |
kadonotakashi | 0:8fdf9a60065b | 223 | * |
kadonotakashi | 0:8fdf9a60065b | 224 | * This function sets the TRIM value for low reference voltage. |
kadonotakashi | 0:8fdf9a60065b | 225 | * Note the following. |
kadonotakashi | 0:8fdf9a60065b | 226 | * - The TRIM value maximum is 0x05U |
kadonotakashi | 0:8fdf9a60065b | 227 | * - The values 111b and 110b are not valid/allowed. |
kadonotakashi | 0:8fdf9a60065b | 228 | * |
kadonotakashi | 0:8fdf9a60065b | 229 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 230 | * @param trimValue Value of the trim register to set output low reference voltage (maximum 0x05U (3-bit)). |
kadonotakashi | 0:8fdf9a60065b | 231 | */ |
kadonotakashi | 0:8fdf9a60065b | 232 | void VREF_SetLowReferenceTrimVal(VREF_Type *base, uint8_t trimValue); |
kadonotakashi | 0:8fdf9a60065b | 233 | |
kadonotakashi | 0:8fdf9a60065b | 234 | /*! |
kadonotakashi | 0:8fdf9a60065b | 235 | * @brief Reads the value of the TRIM meaning output voltage. |
kadonotakashi | 0:8fdf9a60065b | 236 | * |
kadonotakashi | 0:8fdf9a60065b | 237 | * This function gets the TRIM value from the VREFL_TRM register. |
kadonotakashi | 0:8fdf9a60065b | 238 | * |
kadonotakashi | 0:8fdf9a60065b | 239 | * @param base VREF peripheral address. |
kadonotakashi | 0:8fdf9a60065b | 240 | * @return Three-bit value of the trim setting. |
kadonotakashi | 0:8fdf9a60065b | 241 | */ |
kadonotakashi | 0:8fdf9a60065b | 242 | static inline uint8_t VREF_GetLowReferenceTrimVal(VREF_Type *base) |
kadonotakashi | 0:8fdf9a60065b | 243 | { |
kadonotakashi | 0:8fdf9a60065b | 244 | return (base->VREFL_TRM & VREF_VREFL_TRM_VREFL_TRIM_MASK); |
kadonotakashi | 0:8fdf9a60065b | 245 | } |
kadonotakashi | 0:8fdf9a60065b | 246 | #endif /* FSL_FEATURE_VREF_HAS_LOW_REFERENCE */ |
kadonotakashi | 0:8fdf9a60065b | 247 | |
kadonotakashi | 0:8fdf9a60065b | 248 | /*@}*/ |
kadonotakashi | 0:8fdf9a60065b | 249 | |
kadonotakashi | 0:8fdf9a60065b | 250 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 251 | } |
kadonotakashi | 0:8fdf9a60065b | 252 | #endif /* __cplusplus */ |
kadonotakashi | 0:8fdf9a60065b | 253 | |
kadonotakashi | 0:8fdf9a60065b | 254 | /*! @}*/ |
kadonotakashi | 0:8fdf9a60065b | 255 | |
kadonotakashi | 0:8fdf9a60065b | 256 | #endif /* _FSL_VREF_H_ */ |