A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.

Dependencies:   C12832

Committer:
tushki7
Date:
Sun Apr 12 15:45:52 2015 +0000
Revision:
1:eb68c94a8ee5
Parent:
0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tushki7 0:60d829a0353a 1 /**
tushki7 0:60d829a0353a 2 ******************************************************************************
tushki7 0:60d829a0353a 3 * @file stm32f4xx_hal_pwr_ex.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V1.1.0
tushki7 0:60d829a0353a 6 * @date 19-June-2014
tushki7 0:60d829a0353a 7 * @brief Header file of PWR HAL Extension module.
tushki7 0:60d829a0353a 8 ******************************************************************************
tushki7 0:60d829a0353a 9 * @attention
tushki7 0:60d829a0353a 10 *
tushki7 0:60d829a0353a 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
tushki7 0:60d829a0353a 12 *
tushki7 0:60d829a0353a 13 * Redistribution and use in source and binary forms, with or without modification,
tushki7 0:60d829a0353a 14 * are permitted provided that the following conditions are met:
tushki7 0:60d829a0353a 15 * 1. Redistributions of source code must retain the above copyright notice,
tushki7 0:60d829a0353a 16 * this list of conditions and the following disclaimer.
tushki7 0:60d829a0353a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
tushki7 0:60d829a0353a 18 * this list of conditions and the following disclaimer in the documentation
tushki7 0:60d829a0353a 19 * and/or other materials provided with the distribution.
tushki7 0:60d829a0353a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
tushki7 0:60d829a0353a 21 * may be used to endorse or promote products derived from this software
tushki7 0:60d829a0353a 22 * without specific prior written permission.
tushki7 0:60d829a0353a 23 *
tushki7 0:60d829a0353a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
tushki7 0:60d829a0353a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
tushki7 0:60d829a0353a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
tushki7 0:60d829a0353a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
tushki7 0:60d829a0353a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
tushki7 0:60d829a0353a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
tushki7 0:60d829a0353a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
tushki7 0:60d829a0353a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
tushki7 0:60d829a0353a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
tushki7 0:60d829a0353a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tushki7 0:60d829a0353a 34 *
tushki7 0:60d829a0353a 35 ******************************************************************************
tushki7 0:60d829a0353a 36 */
tushki7 0:60d829a0353a 37
tushki7 0:60d829a0353a 38 /* Define to prevent recursive inclusion -------------------------------------*/
tushki7 0:60d829a0353a 39 #ifndef __STM32F4xx_HAL_PWR_EX_H
tushki7 0:60d829a0353a 40 #define __STM32F4xx_HAL_PWR_EX_H
tushki7 0:60d829a0353a 41
tushki7 0:60d829a0353a 42 #ifdef __cplusplus
tushki7 0:60d829a0353a 43 extern "C" {
tushki7 0:60d829a0353a 44 #endif
tushki7 0:60d829a0353a 45
tushki7 0:60d829a0353a 46 /* Includes ------------------------------------------------------------------*/
tushki7 0:60d829a0353a 47 #include "stm32f4xx_hal_def.h"
tushki7 0:60d829a0353a 48
tushki7 0:60d829a0353a 49 /** @addtogroup STM32F4xx_HAL_Driver
tushki7 0:60d829a0353a 50 * @{
tushki7 0:60d829a0353a 51 */
tushki7 0:60d829a0353a 52
tushki7 0:60d829a0353a 53 /** @addtogroup PWREx
tushki7 0:60d829a0353a 54 * @{
tushki7 0:60d829a0353a 55 */
tushki7 0:60d829a0353a 56
tushki7 0:60d829a0353a 57 /* Exported types ------------------------------------------------------------*/
tushki7 0:60d829a0353a 58 /* Exported constants --------------------------------------------------------*/
tushki7 0:60d829a0353a 59 /* ------------- PWR registers bit address in the alias region ---------------*/
tushki7 0:60d829a0353a 60 /* --- CR Register ---*/
tushki7 0:60d829a0353a 61 /* Alias word address of FPDS bit */
tushki7 0:60d829a0353a 62 #define FPDS_BitNumber 0x09
tushki7 0:60d829a0353a 63 #define CR_FPDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (FPDS_BitNumber * 4))
tushki7 0:60d829a0353a 64
tushki7 0:60d829a0353a 65 /* Alias word address of ODEN bit */
tushki7 0:60d829a0353a 66 #define ODEN_BitNumber 0x10
tushki7 0:60d829a0353a 67 #define CR_ODEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODEN_BitNumber * 4))
tushki7 0:60d829a0353a 68
tushki7 0:60d829a0353a 69 /* Alias word address of ODSWEN bit */
tushki7 0:60d829a0353a 70 #define ODSWEN_BitNumber 0x11
tushki7 0:60d829a0353a 71 #define CR_ODSWEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODSWEN_BitNumber * 4))
tushki7 0:60d829a0353a 72
tushki7 0:60d829a0353a 73 /* Alias word address of MRLVDS bit */
tushki7 0:60d829a0353a 74 #define MRLVDS_BitNumber 0x0B
tushki7 0:60d829a0353a 75 #define CR_MRLVDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (MRLVDS_BitNumber * 4))
tushki7 0:60d829a0353a 76
tushki7 0:60d829a0353a 77 /* Alias word address of LPLVDS bit */
tushki7 0:60d829a0353a 78 #define LPLVDS_BitNumber 0x0A
tushki7 0:60d829a0353a 79 #define CR_LPLVDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (LPLVDS_BitNumber * 4))
tushki7 0:60d829a0353a 80
tushki7 0:60d829a0353a 81 /* --- CSR Register ---*/
tushki7 0:60d829a0353a 82 /* Alias word address of BRE bit */
tushki7 0:60d829a0353a 83 #define BRE_BitNumber 0x09
tushki7 0:60d829a0353a 84 #define CSR_BRE_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (BRE_BitNumber * 4))
tushki7 0:60d829a0353a 85
tushki7 0:60d829a0353a 86 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
tushki7 0:60d829a0353a 87
tushki7 0:60d829a0353a 88 /** @defgroup PWREx_Regulator_state_in_UnderDrive_mode
tushki7 0:60d829a0353a 89 * @{
tushki7 0:60d829a0353a 90 */
tushki7 0:60d829a0353a 91 #define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
tushki7 0:60d829a0353a 92 #define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
tushki7 0:60d829a0353a 93
tushki7 0:60d829a0353a 94 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
tushki7 0:60d829a0353a 95 ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
tushki7 0:60d829a0353a 96 /**
tushki7 0:60d829a0353a 97 * @}
tushki7 0:60d829a0353a 98 */
tushki7 0:60d829a0353a 99
tushki7 0:60d829a0353a 100 /** @defgroup PWREx_Over_Under_Drive_Flag
tushki7 0:60d829a0353a 101 * @{
tushki7 0:60d829a0353a 102 */
tushki7 0:60d829a0353a 103 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
tushki7 0:60d829a0353a 104 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
tushki7 0:60d829a0353a 105 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
tushki7 0:60d829a0353a 106 /**
tushki7 0:60d829a0353a 107 * @}
tushki7 0:60d829a0353a 108 */
tushki7 0:60d829a0353a 109 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
tushki7 0:60d829a0353a 110 /**
tushki7 0:60d829a0353a 111 * @}
tushki7 0:60d829a0353a 112 */
tushki7 0:60d829a0353a 113
tushki7 0:60d829a0353a 114 /* Exported macro ------------------------------------------------------------*/
tushki7 0:60d829a0353a 115
tushki7 0:60d829a0353a 116 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
tushki7 0:60d829a0353a 117 /** @brief Macros to enable or disable the Over drive mode.
tushki7 0:60d829a0353a 118 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
tushki7 0:60d829a0353a 119 */
tushki7 0:60d829a0353a 120 #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
tushki7 0:60d829a0353a 121 #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
tushki7 0:60d829a0353a 122
tushki7 0:60d829a0353a 123 /** @brief Macros to enable or disable the Over drive switching.
tushki7 0:60d829a0353a 124 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
tushki7 0:60d829a0353a 125 */
tushki7 0:60d829a0353a 126 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
tushki7 0:60d829a0353a 127 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
tushki7 0:60d829a0353a 128
tushki7 0:60d829a0353a 129 /** @brief Macros to enable or disable the Under drive mode.
tushki7 0:60d829a0353a 130 * @note This mode is enabled only with STOP low power mode.
tushki7 0:60d829a0353a 131 * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
tushki7 0:60d829a0353a 132 * mode is only available when the main regulator or the low power regulator
tushki7 0:60d829a0353a 133 * is in low voltage mode.
tushki7 0:60d829a0353a 134 * @note If the Under-drive mode was enabled, it is automatically disabled after
tushki7 0:60d829a0353a 135 * exiting Stop mode.
tushki7 0:60d829a0353a 136 * When the voltage regulator operates in Under-drive mode, an additional
tushki7 0:60d829a0353a 137 * startup delay is induced when waking up from Stop mode.
tushki7 0:60d829a0353a 138 */
tushki7 0:60d829a0353a 139 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
tushki7 0:60d829a0353a 140 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
tushki7 0:60d829a0353a 141
tushki7 0:60d829a0353a 142 /** @brief Check PWR flag is set or not.
tushki7 0:60d829a0353a 143 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
tushki7 0:60d829a0353a 144 * @param __FLAG__: specifies the flag to check.
tushki7 0:60d829a0353a 145 * This parameter can be one of the following values:
tushki7 0:60d829a0353a 146 * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode
tushki7 0:60d829a0353a 147 * is ready
tushki7 0:60d829a0353a 148 * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode
tushki7 0:60d829a0353a 149 * switching is ready
tushki7 0:60d829a0353a 150 * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode
tushki7 0:60d829a0353a 151 * is enabled in Stop mode
tushki7 0:60d829a0353a 152 * @retval The new state of __FLAG__ (TRUE or FALSE).
tushki7 0:60d829a0353a 153 */
tushki7 0:60d829a0353a 154 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
tushki7 0:60d829a0353a 155
tushki7 0:60d829a0353a 156 /** @brief Clear the Under-Drive Ready flag.
tushki7 0:60d829a0353a 157 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
tushki7 0:60d829a0353a 158 */
tushki7 0:60d829a0353a 159 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
tushki7 0:60d829a0353a 160
tushki7 0:60d829a0353a 161 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
tushki7 0:60d829a0353a 162
tushki7 0:60d829a0353a 163 /* Exported functions --------------------------------------------------------*/
tushki7 0:60d829a0353a 164 void HAL_PWREx_EnableFlashPowerDown(void);
tushki7 0:60d829a0353a 165 void HAL_PWREx_DisableFlashPowerDown(void);
tushki7 0:60d829a0353a 166 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
tushki7 0:60d829a0353a 167 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
tushki7 0:60d829a0353a 168
tushki7 0:60d829a0353a 169 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
tushki7 0:60d829a0353a 170 void HAL_PWREx_EnableMainRegulatorLowVoltage(void);
tushki7 0:60d829a0353a 171 void HAL_PWREx_DisableMainRegulatorLowVoltage(void);
tushki7 0:60d829a0353a 172 void HAL_PWREx_EnableLowRegulatorLowVoltage(void);
tushki7 0:60d829a0353a 173 void HAL_PWREx_DisableLowRegulatorLowVoltage(void);
tushki7 0:60d829a0353a 174 #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
tushki7 0:60d829a0353a 175
tushki7 0:60d829a0353a 176 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
tushki7 0:60d829a0353a 177 HAL_StatusTypeDef HAL_PWREx_ActivateOverDrive(void);
tushki7 0:60d829a0353a 178 HAL_StatusTypeDef HAL_PWREx_DeactivateOverDrive(void);
tushki7 0:60d829a0353a 179 HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
tushki7 0:60d829a0353a 180 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
tushki7 0:60d829a0353a 181
tushki7 0:60d829a0353a 182 /**
tushki7 0:60d829a0353a 183 * @}
tushki7 0:60d829a0353a 184 */
tushki7 0:60d829a0353a 185
tushki7 0:60d829a0353a 186 /**
tushki7 0:60d829a0353a 187 * @}
tushki7 0:60d829a0353a 188 */
tushki7 0:60d829a0353a 189
tushki7 0:60d829a0353a 190 #ifdef __cplusplus
tushki7 0:60d829a0353a 191 }
tushki7 0:60d829a0353a 192 #endif
tushki7 0:60d829a0353a 193
tushki7 0:60d829a0353a 194
tushki7 0:60d829a0353a 195 #endif /* __STM32F4xx_HAL_PWR_EX_H */
tushki7 0:60d829a0353a 196
tushki7 0:60d829a0353a 197 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/