![](/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_KL43Z/drivers/fsl_sim.h@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
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_SIM_H_ |
kadonotakashi | 0:8fdf9a60065b | 32 | #define _FSL_SIM_H_ |
kadonotakashi | 0:8fdf9a60065b | 33 | |
kadonotakashi | 0:8fdf9a60065b | 34 | #include "fsl_common.h" |
kadonotakashi | 0:8fdf9a60065b | 35 | |
kadonotakashi | 0:8fdf9a60065b | 36 | /*! @addtogroup sim */ |
kadonotakashi | 0:8fdf9a60065b | 37 | /*! @{*/ |
kadonotakashi | 0:8fdf9a60065b | 38 | |
kadonotakashi | 0:8fdf9a60065b | 39 | /*! @file */ |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 42 | * Definitions |
kadonotakashi | 0:8fdf9a60065b | 43 | *******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 44 | |
kadonotakashi | 0:8fdf9a60065b | 45 | /*! @name Driver version */ |
kadonotakashi | 0:8fdf9a60065b | 46 | /*@{*/ |
kadonotakashi | 0:8fdf9a60065b | 47 | #define FSL_SIM_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Driver version 2.0.0 */ |
kadonotakashi | 0:8fdf9a60065b | 48 | /*@}*/ |
kadonotakashi | 0:8fdf9a60065b | 49 | |
kadonotakashi | 0:8fdf9a60065b | 50 | #if (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) |
kadonotakashi | 0:8fdf9a60065b | 51 | /*!@brief USB voltage regulator enable setting. */ |
kadonotakashi | 0:8fdf9a60065b | 52 | enum _sim_usb_volt_reg_enable_mode |
kadonotakashi | 0:8fdf9a60065b | 53 | { |
kadonotakashi | 0:8fdf9a60065b | 54 | kSIM_UsbVoltRegEnable = SIM_SOPT1_USBREGEN_MASK, /*!< Enable voltage regulator. */ |
kadonotakashi | 0:8fdf9a60065b | 55 | kSIM_UsbVoltRegEnableInLowPower = SIM_SOPT1_USBVSTBY_MASK, /*!< Enable voltage regulator in VLPR/VLPW modes. */ |
kadonotakashi | 0:8fdf9a60065b | 56 | kSIM_UsbVoltRegEnableInStop = SIM_SOPT1_USBSSTBY_MASK, /*!< Enable voltage regulator in STOP/VLPS/LLS/VLLS modes. */ |
kadonotakashi | 0:8fdf9a60065b | 57 | kSIM_UsbVoltRegEnableInAllModes = SIM_SOPT1_USBREGEN_MASK | SIM_SOPT1_USBSSTBY_MASK | |
kadonotakashi | 0:8fdf9a60065b | 58 | SIM_SOPT1_USBVSTBY_MASK /*!< Enable voltage regulator in all power modes. */ |
kadonotakashi | 0:8fdf9a60065b | 59 | }; |
kadonotakashi | 0:8fdf9a60065b | 60 | #endif /* (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) */ |
kadonotakashi | 0:8fdf9a60065b | 61 | |
kadonotakashi | 0:8fdf9a60065b | 62 | /*!@brief Unique ID. */ |
kadonotakashi | 0:8fdf9a60065b | 63 | typedef struct _sim_uid |
kadonotakashi | 0:8fdf9a60065b | 64 | { |
kadonotakashi | 0:8fdf9a60065b | 65 | #if defined(SIM_UIDH) |
kadonotakashi | 0:8fdf9a60065b | 66 | uint32_t H; /*!< UIDH. */ |
kadonotakashi | 0:8fdf9a60065b | 67 | #endif |
kadonotakashi | 0:8fdf9a60065b | 68 | uint32_t MH; /*!< UIDMH. */ |
kadonotakashi | 0:8fdf9a60065b | 69 | uint32_t ML; /*!< UIDML. */ |
kadonotakashi | 0:8fdf9a60065b | 70 | uint32_t L; /*!< UIDL. */ |
kadonotakashi | 0:8fdf9a60065b | 71 | } sim_uid_t; |
kadonotakashi | 0:8fdf9a60065b | 72 | |
kadonotakashi | 0:8fdf9a60065b | 73 | /*!@brief Flash enable mode. */ |
kadonotakashi | 0:8fdf9a60065b | 74 | enum _sim_flash_mode |
kadonotakashi | 0:8fdf9a60065b | 75 | { |
kadonotakashi | 0:8fdf9a60065b | 76 | kSIM_FlashDisableInWait = SIM_FCFG1_FLASHDOZE_MASK, /*!< Disable flash in wait mode. */ |
kadonotakashi | 0:8fdf9a60065b | 77 | kSIM_FlashDisable = SIM_FCFG1_FLASHDIS_MASK /*!< Disable flash in normal mode. */ |
kadonotakashi | 0:8fdf9a60065b | 78 | }; |
kadonotakashi | 0:8fdf9a60065b | 79 | |
kadonotakashi | 0:8fdf9a60065b | 80 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 81 | * API |
kadonotakashi | 0:8fdf9a60065b | 82 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 83 | |
kadonotakashi | 0:8fdf9a60065b | 84 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 85 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 86 | #endif /* __cplusplus*/ |
kadonotakashi | 0:8fdf9a60065b | 87 | |
kadonotakashi | 0:8fdf9a60065b | 88 | #if (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) |
kadonotakashi | 0:8fdf9a60065b | 89 | /*! |
kadonotakashi | 0:8fdf9a60065b | 90 | * @brief Sets the USB voltage regulator setting. |
kadonotakashi | 0:8fdf9a60065b | 91 | * |
kadonotakashi | 0:8fdf9a60065b | 92 | * This function configures whether the USB voltage regulator is enabled in |
kadonotakashi | 0:8fdf9a60065b | 93 | * normal RUN mode, STOP/VLPS/LLS/VLLS modes and VLPR/VLPW modes. The configurations |
kadonotakashi | 0:8fdf9a60065b | 94 | * are passed in as mask value of \ref _sim_usb_volt_reg_enable_mode. For example, enable |
kadonotakashi | 0:8fdf9a60065b | 95 | * USB voltage regulator in RUN/VLPR/VLPW modes and disable in STOP/VLPS/LLS/VLLS mode, |
kadonotakashi | 0:8fdf9a60065b | 96 | * please use: |
kadonotakashi | 0:8fdf9a60065b | 97 | * |
kadonotakashi | 0:8fdf9a60065b | 98 | * SIM_SetUsbVoltRegulatorEnableMode(kSIM_UsbVoltRegEnable | kSIM_UsbVoltRegEnableInLowPower); |
kadonotakashi | 0:8fdf9a60065b | 99 | * |
kadonotakashi | 0:8fdf9a60065b | 100 | * @param mask USB voltage regulator enable setting. |
kadonotakashi | 0:8fdf9a60065b | 101 | */ |
kadonotakashi | 0:8fdf9a60065b | 102 | void SIM_SetUsbVoltRegulatorEnableMode(uint32_t mask); |
kadonotakashi | 0:8fdf9a60065b | 103 | #endif /* FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR */ |
kadonotakashi | 0:8fdf9a60065b | 104 | |
kadonotakashi | 0:8fdf9a60065b | 105 | /*! |
kadonotakashi | 0:8fdf9a60065b | 106 | * @brief Get the unique identification register value. |
kadonotakashi | 0:8fdf9a60065b | 107 | * |
kadonotakashi | 0:8fdf9a60065b | 108 | * @param uid Pointer to the structure to save the UID value. |
kadonotakashi | 0:8fdf9a60065b | 109 | */ |
kadonotakashi | 0:8fdf9a60065b | 110 | void SIM_GetUniqueId(sim_uid_t *uid); |
kadonotakashi | 0:8fdf9a60065b | 111 | |
kadonotakashi | 0:8fdf9a60065b | 112 | /*! |
kadonotakashi | 0:8fdf9a60065b | 113 | * @brief Set the flash enable mode. |
kadonotakashi | 0:8fdf9a60065b | 114 | * |
kadonotakashi | 0:8fdf9a60065b | 115 | * @param mode The mode to set, see \ref _sim_flash_mode for mode details. |
kadonotakashi | 0:8fdf9a60065b | 116 | */ |
kadonotakashi | 0:8fdf9a60065b | 117 | static inline void SIM_SetFlashMode(uint8_t mode) |
kadonotakashi | 0:8fdf9a60065b | 118 | { |
kadonotakashi | 0:8fdf9a60065b | 119 | SIM->FCFG1 = mode; |
kadonotakashi | 0:8fdf9a60065b | 120 | } |
kadonotakashi | 0:8fdf9a60065b | 121 | |
kadonotakashi | 0:8fdf9a60065b | 122 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 123 | } |
kadonotakashi | 0:8fdf9a60065b | 124 | #endif /* __cplusplus*/ |
kadonotakashi | 0:8fdf9a60065b | 125 | |
kadonotakashi | 0:8fdf9a60065b | 126 | /*! @}*/ |
kadonotakashi | 0:8fdf9a60065b | 127 | |
kadonotakashi | 0:8fdf9a60065b | 128 | #endif /* _FSL_SIM_H_ */ |