Dependents:   DiscoLogger DISCO_L476VG_GlassLCD DISCO_L476VG_MicrophoneRecorder DISCO_L476VG_UART ... more

Committer:
Jerome Coutant
Date:
Wed Jul 05 10:51:49 2017 +0200
Revision:
1:917af0ca86df
Child:
5:4943b15cce9f
Update with STM32Cube_FW_L4_V1.8.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 1:917af0ca86df 1 /**
Jerome Coutant 1:917af0ca86df 2 ******************************************************************************
Jerome Coutant 1:917af0ca86df 3 * @file mfxstm32l152.h
Jerome Coutant 1:917af0ca86df 4 * @author MCD Application Team
Jerome Coutant 1:917af0ca86df 5 * @version V2.0.0
Jerome Coutant 1:917af0ca86df 6 * @date 24-June-2015
Jerome Coutant 1:917af0ca86df 7 * @brief This file contains all the functions prototypes for the
Jerome Coutant 1:917af0ca86df 8 * mfxstm32l152.c IO expander driver.
Jerome Coutant 1:917af0ca86df 9 ******************************************************************************
Jerome Coutant 1:917af0ca86df 10 * @attention
Jerome Coutant 1:917af0ca86df 11 *
Jerome Coutant 1:917af0ca86df 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Jerome Coutant 1:917af0ca86df 13 *
Jerome Coutant 1:917af0ca86df 14 * Redistribution and use in source and binary forms, with or without modification,
Jerome Coutant 1:917af0ca86df 15 * are permitted provided that the following conditions are met:
Jerome Coutant 1:917af0ca86df 16 * 1. Redistributions of source code must retain the above copyright notice,
Jerome Coutant 1:917af0ca86df 17 * this list of conditions and the following disclaimer.
Jerome Coutant 1:917af0ca86df 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Jerome Coutant 1:917af0ca86df 19 * this list of conditions and the following disclaimer in the documentation
Jerome Coutant 1:917af0ca86df 20 * and/or other materials provided with the distribution.
Jerome Coutant 1:917af0ca86df 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Jerome Coutant 1:917af0ca86df 22 * may be used to endorse or promote products derived from this software
Jerome Coutant 1:917af0ca86df 23 * without specific prior written permission.
Jerome Coutant 1:917af0ca86df 24 *
Jerome Coutant 1:917af0ca86df 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jerome Coutant 1:917af0ca86df 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Jerome Coutant 1:917af0ca86df 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Jerome Coutant 1:917af0ca86df 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Jerome Coutant 1:917af0ca86df 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Jerome Coutant 1:917af0ca86df 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Jerome Coutant 1:917af0ca86df 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Jerome Coutant 1:917af0ca86df 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Jerome Coutant 1:917af0ca86df 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Jerome Coutant 1:917af0ca86df 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Jerome Coutant 1:917af0ca86df 35 *
Jerome Coutant 1:917af0ca86df 36 ******************************************************************************
Jerome Coutant 1:917af0ca86df 37 */
Jerome Coutant 1:917af0ca86df 38
Jerome Coutant 1:917af0ca86df 39 /* Define to prevent recursive inclusion -------------------------------------*/
Jerome Coutant 1:917af0ca86df 40 #ifndef __MFXSTM32L152_H
Jerome Coutant 1:917af0ca86df 41 #define __MFXSTM32L152_H
Jerome Coutant 1:917af0ca86df 42
Jerome Coutant 1:917af0ca86df 43 #ifdef __cplusplus
Jerome Coutant 1:917af0ca86df 44 extern "C" {
Jerome Coutant 1:917af0ca86df 45 #endif
Jerome Coutant 1:917af0ca86df 46
Jerome Coutant 1:917af0ca86df 47 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 1:917af0ca86df 48 #include "../Common/ts.h"
Jerome Coutant 1:917af0ca86df 49 #include "../Common/io.h"
Jerome Coutant 1:917af0ca86df 50 #include "../Common/idd.h"
Jerome Coutant 1:917af0ca86df 51
Jerome Coutant 1:917af0ca86df 52 /** @addtogroup BSP
Jerome Coutant 1:917af0ca86df 53 * @{
Jerome Coutant 1:917af0ca86df 54 */
Jerome Coutant 1:917af0ca86df 55
Jerome Coutant 1:917af0ca86df 56 /** @addtogroup Component
Jerome Coutant 1:917af0ca86df 57 * @{
Jerome Coutant 1:917af0ca86df 58 */
Jerome Coutant 1:917af0ca86df 59
Jerome Coutant 1:917af0ca86df 60 /** @defgroup MFXSTM32L152
Jerome Coutant 1:917af0ca86df 61 * @{
Jerome Coutant 1:917af0ca86df 62 */
Jerome Coutant 1:917af0ca86df 63
Jerome Coutant 1:917af0ca86df 64 /* Exported types ------------------------------------------------------------*/
Jerome Coutant 1:917af0ca86df 65
Jerome Coutant 1:917af0ca86df 66 /** @defgroup MFXSTM32L152_Exported_Types
Jerome Coutant 1:917af0ca86df 67 * @{
Jerome Coutant 1:917af0ca86df 68 */
Jerome Coutant 1:917af0ca86df 69 typedef struct
Jerome Coutant 1:917af0ca86df 70 {
Jerome Coutant 1:917af0ca86df 71 uint8_t SYS_CTRL;
Jerome Coutant 1:917af0ca86df 72 uint8_t ERROR_SRC;
Jerome Coutant 1:917af0ca86df 73 uint8_t ERROR_MSG;
Jerome Coutant 1:917af0ca86df 74 uint8_t IRQ_OUT;
Jerome Coutant 1:917af0ca86df 75 uint8_t IRQ_SRC_EN;
Jerome Coutant 1:917af0ca86df 76 uint8_t IRQ_PENDING;
Jerome Coutant 1:917af0ca86df 77 uint8_t IDD_CTRL;
Jerome Coutant 1:917af0ca86df 78 uint8_t IDD_PRE_DELAY;
Jerome Coutant 1:917af0ca86df 79 uint8_t IDD_SHUNT0_MSB;
Jerome Coutant 1:917af0ca86df 80 uint8_t IDD_SHUNT0_LSB;
Jerome Coutant 1:917af0ca86df 81 uint8_t IDD_SHUNT1_MSB;
Jerome Coutant 1:917af0ca86df 82 uint8_t IDD_SHUNT1_LSB;
Jerome Coutant 1:917af0ca86df 83 uint8_t IDD_SHUNT2_MSB;
Jerome Coutant 1:917af0ca86df 84 uint8_t IDD_SHUNT2_LSB;
Jerome Coutant 1:917af0ca86df 85 uint8_t IDD_SHUNT3_MSB;
Jerome Coutant 1:917af0ca86df 86 uint8_t IDD_SHUNT3_LSB;
Jerome Coutant 1:917af0ca86df 87 uint8_t IDD_SHUNT4_MSB;
Jerome Coutant 1:917af0ca86df 88 uint8_t IDD_SHUNT4_LSB;
Jerome Coutant 1:917af0ca86df 89 uint8_t IDD_GAIN_MSB;
Jerome Coutant 1:917af0ca86df 90 uint8_t IDD_GAIN_LSB;
Jerome Coutant 1:917af0ca86df 91 uint8_t IDD_VDD_MIN_MSB;
Jerome Coutant 1:917af0ca86df 92 uint8_t IDD_VDD_MIN_LSB;
Jerome Coutant 1:917af0ca86df 93 uint8_t IDD_VALUE_MSB;
Jerome Coutant 1:917af0ca86df 94 uint8_t IDD_VALUE_MID;
Jerome Coutant 1:917af0ca86df 95 uint8_t IDD_VALUE_LSB;
Jerome Coutant 1:917af0ca86df 96 uint8_t IDD_CAL_OFFSET_MSB;
Jerome Coutant 1:917af0ca86df 97 uint8_t IDD_CAL_OFFSET_LSB;
Jerome Coutant 1:917af0ca86df 98 uint8_t IDD_SHUNT_USED;
Jerome Coutant 1:917af0ca86df 99 }IDD_dbgTypeDef;
Jerome Coutant 1:917af0ca86df 100
Jerome Coutant 1:917af0ca86df 101 /**
Jerome Coutant 1:917af0ca86df 102 * @}
Jerome Coutant 1:917af0ca86df 103 */
Jerome Coutant 1:917af0ca86df 104
Jerome Coutant 1:917af0ca86df 105 /* Exported constants --------------------------------------------------------*/
Jerome Coutant 1:917af0ca86df 106
Jerome Coutant 1:917af0ca86df 107 /** @defgroup MFXSTM32L152_Exported_Constants
Jerome Coutant 1:917af0ca86df 108 * @{
Jerome Coutant 1:917af0ca86df 109 */
Jerome Coutant 1:917af0ca86df 110
Jerome Coutant 1:917af0ca86df 111 /**
Jerome Coutant 1:917af0ca86df 112 * @brief MFX COMMON defines
Jerome Coutant 1:917af0ca86df 113 */
Jerome Coutant 1:917af0ca86df 114
Jerome Coutant 1:917af0ca86df 115 /**
Jerome Coutant 1:917af0ca86df 116 * @brief Register address: chip IDs (R)
Jerome Coutant 1:917af0ca86df 117 */
Jerome Coutant 1:917af0ca86df 118 #define MFXSTM32L152_REG_ADR_ID ((uint8_t)0x00)
Jerome Coutant 1:917af0ca86df 119 /**
Jerome Coutant 1:917af0ca86df 120 * @brief Register address: chip FW_VERSION (R)
Jerome Coutant 1:917af0ca86df 121 */
Jerome Coutant 1:917af0ca86df 122 #define MFXSTM32L152_REG_ADR_FW_VERSION_MSB ((uint8_t)0x01)
Jerome Coutant 1:917af0ca86df 123 #define MFXSTM32L152_REG_ADR_FW_VERSION_LSB ((uint8_t)0x00)
Jerome Coutant 1:917af0ca86df 124 /**
Jerome Coutant 1:917af0ca86df 125 * @brief Register address: System Control Register (R/W)
Jerome Coutant 1:917af0ca86df 126 */
Jerome Coutant 1:917af0ca86df 127 #define MFXSTM32L152_REG_ADR_SYS_CTRL ((uint8_t)0x40)
Jerome Coutant 1:917af0ca86df 128 /**
Jerome Coutant 1:917af0ca86df 129 * @brief Register address: Vdd monitoring (R)
Jerome Coutant 1:917af0ca86df 130 */
Jerome Coutant 1:917af0ca86df 131 #define MFXSTM32L152_REG_ADR_VDD_REF_MSB ((uint8_t)0x06)
Jerome Coutant 1:917af0ca86df 132 #define MFXSTM32L152_REG_ADR_VDD_REF_LSB ((uint8_t)0x07)
Jerome Coutant 1:917af0ca86df 133 /**
Jerome Coutant 1:917af0ca86df 134 * @brief Register address: Error source
Jerome Coutant 1:917af0ca86df 135 */
Jerome Coutant 1:917af0ca86df 136 #define MFXSTM32L152_REG_ADR_ERROR_SRC ((uint8_t)0x03)
Jerome Coutant 1:917af0ca86df 137 /**
Jerome Coutant 1:917af0ca86df 138 * @brief Register address: Error Message
Jerome Coutant 1:917af0ca86df 139 */
Jerome Coutant 1:917af0ca86df 140 #define MFXSTM32L152_REG_ADR_ERROR_MSG ((uint8_t)0x04)
Jerome Coutant 1:917af0ca86df 141
Jerome Coutant 1:917af0ca86df 142 /**
Jerome Coutant 1:917af0ca86df 143 * @brief Reg Addr IRQs: to config the pin that informs Main MCU that MFX events appear
Jerome Coutant 1:917af0ca86df 144 */
Jerome Coutant 1:917af0ca86df 145 #define MFXSTM32L152_REG_ADR_MFX_IRQ_OUT ((uint8_t)0x41)
Jerome Coutant 1:917af0ca86df 146 /**
Jerome Coutant 1:917af0ca86df 147 * @brief Reg Addr IRQs: to select the events which activate the MFXSTM32L152_IRQ_OUT signal
Jerome Coutant 1:917af0ca86df 148 */
Jerome Coutant 1:917af0ca86df 149 #define MFXSTM32L152_REG_ADR_IRQ_SRC_EN ((uint8_t)0x42)
Jerome Coutant 1:917af0ca86df 150 /**
Jerome Coutant 1:917af0ca86df 151 * @brief Reg Addr IRQs: the Main MCU must read the IRQ_PENDING register to know the interrupt reason
Jerome Coutant 1:917af0ca86df 152 */
Jerome Coutant 1:917af0ca86df 153 #define MFXSTM32L152_REG_ADR_IRQ_PENDING ((uint8_t)0x08)
Jerome Coutant 1:917af0ca86df 154 /**
Jerome Coutant 1:917af0ca86df 155 * @brief Reg Addr IRQs: the Main MCU must acknowledge it thanks to a writing access to the IRQ_ACK register
Jerome Coutant 1:917af0ca86df 156 */
Jerome Coutant 1:917af0ca86df 157 #define MFXSTM32L152_REG_ADR_IRQ_ACK ((uint8_t)0x44)
Jerome Coutant 1:917af0ca86df 158
Jerome Coutant 1:917af0ca86df 159 /**
Jerome Coutant 1:917af0ca86df 160 * @brief MFXSTM32L152_REG_ADR_ID choices
Jerome Coutant 1:917af0ca86df 161 */
Jerome Coutant 1:917af0ca86df 162 #define MFXSTM32L152_ID_1 ((uint8_t)0x7B)
Jerome Coutant 1:917af0ca86df 163 #define MFXSTM32L152_ID_2 ((uint8_t)0x79)
Jerome Coutant 1:917af0ca86df 164
Jerome Coutant 1:917af0ca86df 165 /**
Jerome Coutant 1:917af0ca86df 166 * @brief MFXSTM32L152_REG_ADR_SYS_CTRL choices
Jerome Coutant 1:917af0ca86df 167 */
Jerome Coutant 1:917af0ca86df 168 #define MFXSTM32L152_SWRST ((uint8_t)0x80)
Jerome Coutant 1:917af0ca86df 169 #define MFXSTM32L152_STANDBY ((uint8_t)0x40)
Jerome Coutant 1:917af0ca86df 170 #define MFXSTM32L152_ALTERNATE_GPIO_EN ((uint8_t)0x08) /* by the way if IDD and TS are enabled they take automatically the AF pins*/
Jerome Coutant 1:917af0ca86df 171 #define MFXSTM32L152_IDD_EN ((uint8_t)0x04)
Jerome Coutant 1:917af0ca86df 172 #define MFXSTM32L152_TS_EN ((uint8_t)0x02)
Jerome Coutant 1:917af0ca86df 173 #define MFXSTM32L152_GPIO_EN ((uint8_t)0x01)
Jerome Coutant 1:917af0ca86df 174
Jerome Coutant 1:917af0ca86df 175 /**
Jerome Coutant 1:917af0ca86df 176 * @brief MFXSTM32L152_REG_ADR_ERROR_SRC choices
Jerome Coutant 1:917af0ca86df 177 */
Jerome Coutant 1:917af0ca86df 178 #define MFXSTM32L152_IDD_ERROR_SRC ((uint8_t)0x04) /* Error raised by Idd */
Jerome Coutant 1:917af0ca86df 179 #define MFXSTM32L152_TS_ERROR_SRC ((uint8_t)0x02) /* Error raised by Touch Screen */
Jerome Coutant 1:917af0ca86df 180 #define MFXSTM32L152_GPIO_ERROR_SRC ((uint8_t)0x01) /* Error raised by Gpio */
Jerome Coutant 1:917af0ca86df 181
Jerome Coutant 1:917af0ca86df 182 /**
Jerome Coutant 1:917af0ca86df 183 * @brief MFXSTM32L152_REG_ADR_MFX_IRQ_OUT choices
Jerome Coutant 1:917af0ca86df 184 */
Jerome Coutant 1:917af0ca86df 185 #define MFXSTM32L152_OUT_PIN_TYPE_OPENDRAIN ((uint8_t)0x00)
Jerome Coutant 1:917af0ca86df 186 #define MFXSTM32L152_OUT_PIN_TYPE_PUSHPULL ((uint8_t)0x01)
Jerome Coutant 1:917af0ca86df 187 #define MFXSTM32L152_OUT_PIN_POLARITY_LOW ((uint8_t)0x00)
Jerome Coutant 1:917af0ca86df 188 #define MFXSTM32L152_OUT_PIN_POLARITY_HIGH ((uint8_t)0x02)
Jerome Coutant 1:917af0ca86df 189
Jerome Coutant 1:917af0ca86df 190 /**
Jerome Coutant 1:917af0ca86df 191 * @brief REG_ADR_IRQ_SRC_EN, REG_ADR_IRQ_PENDING & REG_ADR_IRQ_ACK choices
Jerome Coutant 1:917af0ca86df 192 */
Jerome Coutant 1:917af0ca86df 193 #define MFXSTM32L152_IRQ_TS_OVF ((uint8_t)0x80) /* TouchScreen FIFO Overflow irq*/
Jerome Coutant 1:917af0ca86df 194 #define MFXSTM32L152_IRQ_TS_FULL ((uint8_t)0x40) /* TouchScreen FIFO Full irq*/
Jerome Coutant 1:917af0ca86df 195 #define MFXSTM32L152_IRQ_TS_TH ((uint8_t)0x20) /* TouchScreen FIFO threshold triggered irq*/
Jerome Coutant 1:917af0ca86df 196 #define MFXSTM32L152_IRQ_TS_NE ((uint8_t)0x10) /* TouchScreen FIFO Not Empty irq*/
Jerome Coutant 1:917af0ca86df 197 #define MFXSTM32L152_IRQ_TS_DET ((uint8_t)0x08) /* TouchScreen Detect irq*/
Jerome Coutant 1:917af0ca86df 198 #define MFXSTM32L152_IRQ_ERROR ((uint8_t)0x04) /* Error message from MFXSTM32L152 firmware irq */
Jerome Coutant 1:917af0ca86df 199 #define MFXSTM32L152_IRQ_IDD ((uint8_t)0x02) /* IDD function irq */
Jerome Coutant 1:917af0ca86df 200 #define MFXSTM32L152_IRQ_GPIO ((uint8_t)0x01) /* General GPIO irq (only for SRC_EN and PENDING) */
Jerome Coutant 1:917af0ca86df 201 #define MFXSTM32L152_IRQ_ALL ((uint8_t)0xFF) /* All global interrupts */
Jerome Coutant 1:917af0ca86df 202 #define MFXSTM32L152_IRQ_TS (MFXSTM32L152_IRQ_TS_DET | MFXSTM32L152_IRQ_TS_NE | MFXSTM32L152_IRQ_TS_TH | MFXSTM32L152_IRQ_TS_FULL | MFXSTM32L152_IRQ_TS_OVF )
Jerome Coutant 1:917af0ca86df 203
Jerome Coutant 1:917af0ca86df 204
Jerome Coutant 1:917af0ca86df 205 /**
Jerome Coutant 1:917af0ca86df 206 * @brief GPIO: 24 programmable input/output called MFXSTM32L152_GPIO[23:0] are provided
Jerome Coutant 1:917af0ca86df 207 */
Jerome Coutant 1:917af0ca86df 208
Jerome Coutant 1:917af0ca86df 209 /**
Jerome Coutant 1:917af0ca86df 210 * @brief Reg addr: GPIO DIRECTION (R/W): GPIO pins direction: (0) input, (1) output.
Jerome Coutant 1:917af0ca86df 211 */
Jerome Coutant 1:917af0ca86df 212 #define MFXSTM32L152_REG_ADR_GPIO_DIR1 ((uint8_t)0x60) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 213 #define MFXSTM32L152_REG_ADR_GPIO_DIR2 ((uint8_t)0x61) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 214 #define MFXSTM32L152_REG_ADR_GPIO_DIR3 ((uint8_t)0x62) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 215 /**
Jerome Coutant 1:917af0ca86df 216 * @brief Reg addr: GPIO TYPE (R/W): If GPIO in output: (0) output push pull, (1) output open drain.
Jerome Coutant 1:917af0ca86df 217 * If GPIO in input: (0) input without pull resistor, (1) input with pull resistor.
Jerome Coutant 1:917af0ca86df 218 */
Jerome Coutant 1:917af0ca86df 219 #define MFXSTM32L152_REG_ADR_GPIO_TYPE1 ((uint8_t)0x64) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 220 #define MFXSTM32L152_REG_ADR_GPIO_TYPE2 ((uint8_t)0x65) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 221 #define MFXSTM32L152_REG_ADR_GPIO_TYPE3 ((uint8_t)0x66) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 222 /**
Jerome Coutant 1:917af0ca86df 223 * @brief Reg addr: GPIO PULL_UP_PULL_DOWN (R/W): discussion open with Jean Claude
Jerome Coutant 1:917af0ca86df 224 */
Jerome Coutant 1:917af0ca86df 225 #define MFXSTM32L152_REG_ADR_GPIO_PUPD1 ((uint8_t)0x68) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 226 #define MFXSTM32L152_REG_ADR_GPIO_PUPD2 ((uint8_t)0x69) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 227 #define MFXSTM32L152_REG_ADR_GPIO_PUPD3 ((uint8_t)0x6A) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 228 /**
Jerome Coutant 1:917af0ca86df 229 * @brief Reg addr: GPIO SET (W): When GPIO is in output mode, write (1) puts the corresponding GPO in High level.
Jerome Coutant 1:917af0ca86df 230 */
Jerome Coutant 1:917af0ca86df 231 #define MFXSTM32L152_REG_ADR_GPO_SET1 ((uint8_t)0x6C) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 232 #define MFXSTM32L152_REG_ADR_GPO_SET2 ((uint8_t)0x6D) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 233 #define MFXSTM32L152_REG_ADR_GPO_SET3 ((uint8_t)0x6E) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 234 /**
Jerome Coutant 1:917af0ca86df 235 * @brief Reg addr: GPIO CLEAR (W): When GPIO is in output mode, write (1) puts the corresponding GPO in Low level.
Jerome Coutant 1:917af0ca86df 236 */
Jerome Coutant 1:917af0ca86df 237 #define MFXSTM32L152_REG_ADR_GPO_CLR1 ((uint8_t)0x70) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 238 #define MFXSTM32L152_REG_ADR_GPO_CLR2 ((uint8_t)0x71) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 239 #define MFXSTM32L152_REG_ADR_GPO_CLR3 ((uint8_t)0x72) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 240 /**
Jerome Coutant 1:917af0ca86df 241 * @brief Reg addr: GPIO STATE (R): Give state of the GPIO pin.
Jerome Coutant 1:917af0ca86df 242 */
Jerome Coutant 1:917af0ca86df 243 #define MFXSTM32L152_REG_ADR_GPIO_STATE1 ((uint8_t)0x10) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 244 #define MFXSTM32L152_REG_ADR_GPIO_STATE2 ((uint8_t)0x11) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 245 #define MFXSTM32L152_REG_ADR_GPIO_STATE3 ((uint8_t)0x12) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 246
Jerome Coutant 1:917af0ca86df 247 /**
Jerome Coutant 1:917af0ca86df 248 * @brief GPIO IRQ_GPIs
Jerome Coutant 1:917af0ca86df 249 */
Jerome Coutant 1:917af0ca86df 250 /* GPIOs can INDIVIDUALLY generate interruption to the Main MCU thanks to the MFXSTM32L152_IRQ_OUT signal */
Jerome Coutant 1:917af0ca86df 251 /* the general MFXSTM32L152_IRQ_GPIO_SRC_EN shall be enabled too */
Jerome Coutant 1:917af0ca86df 252 /**
Jerome Coutant 1:917af0ca86df 253 * @brief GPIO IRQ_GPI_SRC1/2/3 (R/W): registers enable or not the feature to generate irq
Jerome Coutant 1:917af0ca86df 254 */
Jerome Coutant 1:917af0ca86df 255 #define MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1 ((uint8_t)0x48) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 256 #define MFXSTM32L152_REG_ADR_IRQ_GPI_SRC2 ((uint8_t)0x49) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 257 #define MFXSTM32L152_REG_ADR_IRQ_GPI_SRC3 ((uint8_t)0x4A) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 258 /**
Jerome Coutant 1:917af0ca86df 259 * @brief GPIO IRQ_GPI_EVT1/2/3 (R/W): Irq generated on level (0) or edge (1).
Jerome Coutant 1:917af0ca86df 260 */
Jerome Coutant 1:917af0ca86df 261 #define MFXSTM32L152_REG_ADR_IRQ_GPI_EVT1 ((uint8_t)0x4C) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 262 #define MFXSTM32L152_REG_ADR_IRQ_GPI_EVT2 ((uint8_t)0x4D) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 263 #define MFXSTM32L152_REG_ADR_IRQ_GPI_EVT3 ((uint8_t)0x4E) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 264 /**
Jerome Coutant 1:917af0ca86df 265 * @brief GPIO IRQ_GPI_TYPE1/2/3 (R/W): Irq generated on (0) : Low level or Falling edge. (1) : High level or Rising edge.
Jerome Coutant 1:917af0ca86df 266 */
Jerome Coutant 1:917af0ca86df 267 #define MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE1 ((uint8_t)0x50) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 268 #define MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE2 ((uint8_t)0x51) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 269 #define MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE3 ((uint8_t)0x52) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 270 /**
Jerome Coutant 1:917af0ca86df 271 * @brief GPIO IRQ_GPI_PENDING1/2/3 (R): irq occurs
Jerome Coutant 1:917af0ca86df 272 */
Jerome Coutant 1:917af0ca86df 273 #define MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING1 ((uint8_t)0x0C) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 274 #define MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING2 ((uint8_t)0x0D) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 275 #define MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING3 ((uint8_t)0x0E) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 276 /**
Jerome Coutant 1:917af0ca86df 277 * @brief GPIO IRQ_GPI_ACK1/2/3 (W): Write (1) to acknowledge IRQ event
Jerome Coutant 1:917af0ca86df 278 */
Jerome Coutant 1:917af0ca86df 279 #define MFXSTM32L152_REG_ADR_IRQ_GPI_ACK1 ((uint8_t)0x54) /* gpio [0:7] */
Jerome Coutant 1:917af0ca86df 280 #define MFXSTM32L152_REG_ADR_IRQ_GPI_ACK2 ((uint8_t)0x55) /* gpio [8:15] */
Jerome Coutant 1:917af0ca86df 281 #define MFXSTM32L152_REG_ADR_IRQ_GPI_ACK3 ((uint8_t)0x56) /* agpio [0:7] */
Jerome Coutant 1:917af0ca86df 282
Jerome Coutant 1:917af0ca86df 283
Jerome Coutant 1:917af0ca86df 284 /**
Jerome Coutant 1:917af0ca86df 285 * @brief GPIO: IO Pins definition
Jerome Coutant 1:917af0ca86df 286 */
Jerome Coutant 1:917af0ca86df 287 #define MFXSTM32L152_GPIO_PIN_0 ((uint32_t)0x0001)
Jerome Coutant 1:917af0ca86df 288 #define MFXSTM32L152_GPIO_PIN_1 ((uint32_t)0x0002)
Jerome Coutant 1:917af0ca86df 289 #define MFXSTM32L152_GPIO_PIN_2 ((uint32_t)0x0004)
Jerome Coutant 1:917af0ca86df 290 #define MFXSTM32L152_GPIO_PIN_3 ((uint32_t)0x0008)
Jerome Coutant 1:917af0ca86df 291 #define MFXSTM32L152_GPIO_PIN_4 ((uint32_t)0x0010)
Jerome Coutant 1:917af0ca86df 292 #define MFXSTM32L152_GPIO_PIN_5 ((uint32_t)0x0020)
Jerome Coutant 1:917af0ca86df 293 #define MFXSTM32L152_GPIO_PIN_6 ((uint32_t)0x0040)
Jerome Coutant 1:917af0ca86df 294 #define MFXSTM32L152_GPIO_PIN_7 ((uint32_t)0x0080)
Jerome Coutant 1:917af0ca86df 295
Jerome Coutant 1:917af0ca86df 296 #define MFXSTM32L152_GPIO_PIN_8 ((uint32_t)0x0100)
Jerome Coutant 1:917af0ca86df 297 #define MFXSTM32L152_GPIO_PIN_9 ((uint32_t)0x0200)
Jerome Coutant 1:917af0ca86df 298 #define MFXSTM32L152_GPIO_PIN_10 ((uint32_t)0x0400)
Jerome Coutant 1:917af0ca86df 299 #define MFXSTM32L152_GPIO_PIN_11 ((uint32_t)0x0800)
Jerome Coutant 1:917af0ca86df 300 #define MFXSTM32L152_GPIO_PIN_12 ((uint32_t)0x1000)
Jerome Coutant 1:917af0ca86df 301 #define MFXSTM32L152_GPIO_PIN_13 ((uint32_t)0x2000)
Jerome Coutant 1:917af0ca86df 302 #define MFXSTM32L152_GPIO_PIN_14 ((uint32_t)0x4000)
Jerome Coutant 1:917af0ca86df 303 #define MFXSTM32L152_GPIO_PIN_15 ((uint32_t)0x8000)
Jerome Coutant 1:917af0ca86df 304
Jerome Coutant 1:917af0ca86df 305 #define MFXSTM32L152_GPIO_PIN_16 ((uint32_t)0x010000)
Jerome Coutant 1:917af0ca86df 306 #define MFXSTM32L152_GPIO_PIN_17 ((uint32_t)0x020000)
Jerome Coutant 1:917af0ca86df 307 #define MFXSTM32L152_GPIO_PIN_18 ((uint32_t)0x040000)
Jerome Coutant 1:917af0ca86df 308 #define MFXSTM32L152_GPIO_PIN_19 ((uint32_t)0x080000)
Jerome Coutant 1:917af0ca86df 309 #define MFXSTM32L152_GPIO_PIN_20 ((uint32_t)0x100000)
Jerome Coutant 1:917af0ca86df 310 #define MFXSTM32L152_GPIO_PIN_21 ((uint32_t)0x200000)
Jerome Coutant 1:917af0ca86df 311 #define MFXSTM32L152_GPIO_PIN_22 ((uint32_t)0x400000)
Jerome Coutant 1:917af0ca86df 312 #define MFXSTM32L152_GPIO_PIN_23 ((uint32_t)0x800000)
Jerome Coutant 1:917af0ca86df 313
Jerome Coutant 1:917af0ca86df 314 #define MFXSTM32L152_AGPIO_PIN_0 MFXSTM32L152_GPIO_PIN_16
Jerome Coutant 1:917af0ca86df 315 #define MFXSTM32L152_AGPIO_PIN_1 MFXSTM32L152_GPIO_PIN_17
Jerome Coutant 1:917af0ca86df 316 #define MFXSTM32L152_AGPIO_PIN_2 MFXSTM32L152_GPIO_PIN_18
Jerome Coutant 1:917af0ca86df 317 #define MFXSTM32L152_AGPIO_PIN_3 MFXSTM32L152_GPIO_PIN_19
Jerome Coutant 1:917af0ca86df 318 #define MFXSTM32L152_AGPIO_PIN_4 MFXSTM32L152_GPIO_PIN_20
Jerome Coutant 1:917af0ca86df 319 #define MFXSTM32L152_AGPIO_PIN_5 MFXSTM32L152_GPIO_PIN_21
Jerome Coutant 1:917af0ca86df 320 #define MFXSTM32L152_AGPIO_PIN_6 MFXSTM32L152_GPIO_PIN_22
Jerome Coutant 1:917af0ca86df 321 #define MFXSTM32L152_AGPIO_PIN_7 MFXSTM32L152_GPIO_PIN_23
Jerome Coutant 1:917af0ca86df 322
Jerome Coutant 1:917af0ca86df 323 #define MFXSTM32L152_GPIO_PINS_ALL ((uint32_t)0xFFFFFF)
Jerome Coutant 1:917af0ca86df 324
Jerome Coutant 1:917af0ca86df 325 /**
Jerome Coutant 1:917af0ca86df 326 * @brief GPIO: constant
Jerome Coutant 1:917af0ca86df 327 */
Jerome Coutant 1:917af0ca86df 328 #define MFXSTM32L152_GPIO_DIR_IN ((uint8_t)0x0)
Jerome Coutant 1:917af0ca86df 329 #define MFXSTM32L152_GPIO_DIR_OUT ((uint8_t)0x1)
Jerome Coutant 1:917af0ca86df 330 #define MFXSTM32L152_IRQ_GPI_EVT_LEVEL ((uint8_t)0x0)
Jerome Coutant 1:917af0ca86df 331 #define MFXSTM32L152_IRQ_GPI_EVT_EDGE ((uint8_t)0x1)
Jerome Coutant 1:917af0ca86df 332 #define MFXSTM32L152_IRQ_GPI_TYPE_LLFE ((uint8_t)0x0) /* Low Level Falling Edge */
Jerome Coutant 1:917af0ca86df 333 #define MFXSTM32L152_IRQ_GPI_TYPE_HLRE ((uint8_t)0x1) /*High Level Raising Edge */
Jerome Coutant 1:917af0ca86df 334 #define MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR ((uint8_t)0x0)
Jerome Coutant 1:917af0ca86df 335 #define MFXSTM32L152_GPI_WITH_PULL_RESISTOR ((uint8_t)0x1)
Jerome Coutant 1:917af0ca86df 336 #define MFXSTM32L152_GPO_PUSH_PULL ((uint8_t)0x0)
Jerome Coutant 1:917af0ca86df 337 #define MFXSTM32L152_GPO_OPEN_DRAIN ((uint8_t)0x1)
Jerome Coutant 1:917af0ca86df 338 #define MFXSTM32L152_GPIO_PULL_DOWN ((uint8_t)0x0)
Jerome Coutant 1:917af0ca86df 339 #define MFXSTM32L152_GPIO_PULL_UP ((uint8_t)0x1)
Jerome Coutant 1:917af0ca86df 340
Jerome Coutant 1:917af0ca86df 341
Jerome Coutant 1:917af0ca86df 342 /**
Jerome Coutant 1:917af0ca86df 343 * @brief TOUCH SCREEN Registers
Jerome Coutant 1:917af0ca86df 344 */
Jerome Coutant 1:917af0ca86df 345
Jerome Coutant 1:917af0ca86df 346 /**
Jerome Coutant 1:917af0ca86df 347 * @brief Touch Screen Registers
Jerome Coutant 1:917af0ca86df 348 */
Jerome Coutant 1:917af0ca86df 349 #define MFXSTM32L152_TS_SETTLING ((uint8_t)0xA0)
Jerome Coutant 1:917af0ca86df 350 #define MFXSTM32L152_TS_TOUCH_DET_DELAY ((uint8_t)0xA1)
Jerome Coutant 1:917af0ca86df 351 #define MFXSTM32L152_TS_AVE ((uint8_t)0xA2)
Jerome Coutant 1:917af0ca86df 352 #define MFXSTM32L152_TS_TRACK ((uint8_t)0xA3)
Jerome Coutant 1:917af0ca86df 353 #define MFXSTM32L152_TS_FIFO_TH ((uint8_t)0xA4)
Jerome Coutant 1:917af0ca86df 354 #define MFXSTM32L152_TS_FIFO_STA ((uint8_t)0x20)
Jerome Coutant 1:917af0ca86df 355 #define MFXSTM32L152_TS_FIFO_LEVEL ((uint8_t)0x21)
Jerome Coutant 1:917af0ca86df 356 #define MFXSTM32L152_TS_XY_DATA ((uint8_t)0x24)
Jerome Coutant 1:917af0ca86df 357
Jerome Coutant 1:917af0ca86df 358 /**
Jerome Coutant 1:917af0ca86df 359 * @brief TS registers masks
Jerome Coutant 1:917af0ca86df 360 */
Jerome Coutant 1:917af0ca86df 361 #define MFXSTM32L152_TS_CTRL_STATUS ((uint8_t)0x08)
Jerome Coutant 1:917af0ca86df 362 #define MFXSTM32L152_TS_CLEAR_FIFO ((uint8_t)0x80)
Jerome Coutant 1:917af0ca86df 363
Jerome Coutant 1:917af0ca86df 364
Jerome Coutant 1:917af0ca86df 365 /**
Jerome Coutant 1:917af0ca86df 366 * @brief Register address: Idd control register (R/W)
Jerome Coutant 1:917af0ca86df 367 */
Jerome Coutant 1:917af0ca86df 368 #define MFXSTM32L152_REG_ADR_IDD_CTRL ((uint8_t)0x80)
Jerome Coutant 1:917af0ca86df 369
Jerome Coutant 1:917af0ca86df 370 /**
Jerome Coutant 1:917af0ca86df 371 * @brief Register address: Idd pre delay register (R/W)
Jerome Coutant 1:917af0ca86df 372 */
Jerome Coutant 1:917af0ca86df 373 #define MFXSTM32L152_REG_ADR_IDD_PRE_DELAY ((uint8_t)0x81)
Jerome Coutant 1:917af0ca86df 374
Jerome Coutant 1:917af0ca86df 375 /**
Jerome Coutant 1:917af0ca86df 376 * @brief Register address: Idd Shunt registers (R/W)
Jerome Coutant 1:917af0ca86df 377 */
Jerome Coutant 1:917af0ca86df 378 #define MFXSTM32L152_REG_ADR_IDD_SHUNT0_MSB ((uint8_t)0x82)
Jerome Coutant 1:917af0ca86df 379 #define MFXSTM32L152_REG_ADR_IDD_SHUNT0_LSB ((uint8_t)0x83)
Jerome Coutant 1:917af0ca86df 380 #define MFXSTM32L152_REG_ADR_IDD_SHUNT1_MSB ((uint8_t)0x84)
Jerome Coutant 1:917af0ca86df 381 #define MFXSTM32L152_REG_ADR_IDD_SHUNT1_LSB ((uint8_t)0x85)
Jerome Coutant 1:917af0ca86df 382 #define MFXSTM32L152_REG_ADR_IDD_SHUNT2_MSB ((uint8_t)0x86)
Jerome Coutant 1:917af0ca86df 383 #define MFXSTM32L152_REG_ADR_IDD_SHUNT2_LSB ((uint8_t)0x87)
Jerome Coutant 1:917af0ca86df 384 #define MFXSTM32L152_REG_ADR_IDD_SHUNT3_MSB ((uint8_t)0x88)
Jerome Coutant 1:917af0ca86df 385 #define MFXSTM32L152_REG_ADR_IDD_SHUNT3_LSB ((uint8_t)0x89)
Jerome Coutant 1:917af0ca86df 386 #define MFXSTM32L152_REG_ADR_IDD_SHUNT4_MSB ((uint8_t)0x8A)
Jerome Coutant 1:917af0ca86df 387 #define MFXSTM32L152_REG_ADR_IDD_SHUNT4_LSB ((uint8_t)0x8B)
Jerome Coutant 1:917af0ca86df 388
Jerome Coutant 1:917af0ca86df 389 /**
Jerome Coutant 1:917af0ca86df 390 * @brief Register address: Idd ampli gain register (R/W)
Jerome Coutant 1:917af0ca86df 391 */
Jerome Coutant 1:917af0ca86df 392 #define MFXSTM32L152_REG_ADR_IDD_GAIN_MSB ((uint8_t)0x8C)
Jerome Coutant 1:917af0ca86df 393 #define MFXSTM32L152_REG_ADR_IDD_GAIN_LSB ((uint8_t)0x8D)
Jerome Coutant 1:917af0ca86df 394
Jerome Coutant 1:917af0ca86df 395 /**
Jerome Coutant 1:917af0ca86df 396 * @brief Register address: Idd VDD min register (R/W)
Jerome Coutant 1:917af0ca86df 397 */
Jerome Coutant 1:917af0ca86df 398 #define MFXSTM32L152_REG_ADR_IDD_VDD_MIN_MSB ((uint8_t)0x8E)
Jerome Coutant 1:917af0ca86df 399 #define MFXSTM32L152_REG_ADR_IDD_VDD_MIN_LSB ((uint8_t)0x8F)
Jerome Coutant 1:917af0ca86df 400
Jerome Coutant 1:917af0ca86df 401 /**
Jerome Coutant 1:917af0ca86df 402 * @brief Register address: Idd value register (R)
Jerome Coutant 1:917af0ca86df 403 */
Jerome Coutant 1:917af0ca86df 404 #define MFXSTM32L152_REG_ADR_IDD_VALUE_MSB ((uint8_t)0x14)
Jerome Coutant 1:917af0ca86df 405 #define MFXSTM32L152_REG_ADR_IDD_VALUE_MID ((uint8_t)0x15)
Jerome Coutant 1:917af0ca86df 406 #define MFXSTM32L152_REG_ADR_IDD_VALUE_LSB ((uint8_t)0x16)
Jerome Coutant 1:917af0ca86df 407
Jerome Coutant 1:917af0ca86df 408 /**
Jerome Coutant 1:917af0ca86df 409 * @brief Register address: Idd calibration offset register (R)
Jerome Coutant 1:917af0ca86df 410 */
Jerome Coutant 1:917af0ca86df 411 #define MFXSTM32L152_REG_ADR_IDD_CAL_OFFSET_MSB ((uint8_t)0x18)
Jerome Coutant 1:917af0ca86df 412 #define MFXSTM32L152_REG_ADR_IDD_CAL_OFFSET_LSB ((uint8_t)0x19)
Jerome Coutant 1:917af0ca86df 413
Jerome Coutant 1:917af0ca86df 414 /**
Jerome Coutant 1:917af0ca86df 415 * @brief Register address: Idd shunt used offset register (R)
Jerome Coutant 1:917af0ca86df 416 */
Jerome Coutant 1:917af0ca86df 417 #define MFXSTM32L152_REG_ADR_IDD_SHUNT_USED ((uint8_t)0x1A)
Jerome Coutant 1:917af0ca86df 418
Jerome Coutant 1:917af0ca86df 419 /**
Jerome Coutant 1:917af0ca86df 420 * @brief Register address: shunt stabilisation delay registers (R/W)
Jerome Coutant 1:917af0ca86df 421 */
Jerome Coutant 1:917af0ca86df 422 #define MFXSTM32L152_REG_ADR_IDD_SH0_STABILIZATION ((uint8_t)0x90)
Jerome Coutant 1:917af0ca86df 423 #define MFXSTM32L152_REG_ADR_IDD_SH1_STABILIZATION ((uint8_t)0x91)
Jerome Coutant 1:917af0ca86df 424 #define MFXSTM32L152_REG_ADR_IDD_SH2_STABILIZATION ((uint8_t)0x92)
Jerome Coutant 1:917af0ca86df 425 #define MFXSTM32L152_REG_ADR_IDD_SH3_STABILIZATION ((uint8_t)0x93)
Jerome Coutant 1:917af0ca86df 426 #define MFXSTM32L152_REG_ADR_IDD_SH4_STABILIZATION ((uint8_t)0x94)
Jerome Coutant 1:917af0ca86df 427
Jerome Coutant 1:917af0ca86df 428 /**
Jerome Coutant 1:917af0ca86df 429 * @brief Register address: Idd number of measurements register (R/W)
Jerome Coutant 1:917af0ca86df 430 */
Jerome Coutant 1:917af0ca86df 431 #define MFXSTM32L152_REG_ADR_IDD_NBR_OF_MEAS ((uint8_t)0x96)
Jerome Coutant 1:917af0ca86df 432
Jerome Coutant 1:917af0ca86df 433 /**
Jerome Coutant 1:917af0ca86df 434 * @brief Register address: Idd delta delay between 2 measurements register (R/W)
Jerome Coutant 1:917af0ca86df 435 */
Jerome Coutant 1:917af0ca86df 436 #define MFXSTM32L152_REG_ADR_IDD_MEAS_DELTA_DELAY ((uint8_t)0x97)
Jerome Coutant 1:917af0ca86df 437
Jerome Coutant 1:917af0ca86df 438 /**
Jerome Coutant 1:917af0ca86df 439 * @brief Register address: Idd number of shunt on board register (R/W)
Jerome Coutant 1:917af0ca86df 440 */
Jerome Coutant 1:917af0ca86df 441 #define MFXSTM32L152_REG_ADR_IDD_SHUNTS_ON_BOARD ((uint8_t)0x98)
Jerome Coutant 1:917af0ca86df 442
Jerome Coutant 1:917af0ca86df 443
Jerome Coutant 1:917af0ca86df 444
Jerome Coutant 1:917af0ca86df 445 /** @defgroup IDD_Control_Register_Defines IDD Control Register Defines
Jerome Coutant 1:917af0ca86df 446 * @{
Jerome Coutant 1:917af0ca86df 447 */
Jerome Coutant 1:917af0ca86df 448 /**
Jerome Coutant 1:917af0ca86df 449 * @brief IDD control register masks
Jerome Coutant 1:917af0ca86df 450 */
Jerome Coutant 1:917af0ca86df 451 #define MFXSTM32L152_IDD_CTRL_REQ ((uint8_t)0x01)
Jerome Coutant 1:917af0ca86df 452 #define MFXSTM32L152_IDD_CTRL_SHUNT_NB ((uint8_t)0x0E)
Jerome Coutant 1:917af0ca86df 453 #define MFXSTM32L152_IDD_CTRL_VREF_DIS ((uint8_t)0x40)
Jerome Coutant 1:917af0ca86df 454 #define MFXSTM32L152_IDD_CTRL_CAL_DIS ((uint8_t)0x80)
Jerome Coutant 1:917af0ca86df 455
Jerome Coutant 1:917af0ca86df 456 /**
Jerome Coutant 1:917af0ca86df 457 * @brief IDD Shunt Number
Jerome Coutant 1:917af0ca86df 458 */
Jerome Coutant 1:917af0ca86df 459 #define MFXSTM32L152_IDD_SHUNT_NB_1 ((uint8_t) 0x01)
Jerome Coutant 1:917af0ca86df 460 #define MFXSTM32L152_IDD_SHUNT_NB_2 ((uint8_t) 0x02)
Jerome Coutant 1:917af0ca86df 461 #define MFXSTM32L152_IDD_SHUNT_NB_3 ((uint8_t) 0x03)
Jerome Coutant 1:917af0ca86df 462 #define MFXSTM32L152_IDD_SHUNT_NB_4 ((uint8_t) 0x04)
Jerome Coutant 1:917af0ca86df 463 #define MFXSTM32L152_IDD_SHUNT_NB_5 ((uint8_t) 0x05)
Jerome Coutant 1:917af0ca86df 464
Jerome Coutant 1:917af0ca86df 465 /**
Jerome Coutant 1:917af0ca86df 466 * @brief Vref Measurement
Jerome Coutant 1:917af0ca86df 467 */
Jerome Coutant 1:917af0ca86df 468 #define MFXSTM32L152_IDD_VREF_AUTO_MEASUREMENT_ENABLE ((uint8_t) 0x00)
Jerome Coutant 1:917af0ca86df 469 #define MFXSTM32L152_IDD_VREF_AUTO_MEASUREMENT_DISABLE ((uint8_t) 0x70)
Jerome Coutant 1:917af0ca86df 470
Jerome Coutant 1:917af0ca86df 471 /**
Jerome Coutant 1:917af0ca86df 472 * @brief IDD Calibration
Jerome Coutant 1:917af0ca86df 473 */
Jerome Coutant 1:917af0ca86df 474 #define MFXSTM32L152_IDD_AUTO_CALIBRATION_ENABLE ((uint8_t) 0x00)
Jerome Coutant 1:917af0ca86df 475 #define MFXSTM32L152_IDD_AUTO_CALIBRATION_DISABLE ((uint8_t) 0x80)
Jerome Coutant 1:917af0ca86df 476 /**
Jerome Coutant 1:917af0ca86df 477 * @}
Jerome Coutant 1:917af0ca86df 478 */
Jerome Coutant 1:917af0ca86df 479
Jerome Coutant 1:917af0ca86df 480 /** @defgroup IDD_PreDelay_Defines IDD PreDelay Defines
Jerome Coutant 1:917af0ca86df 481 * @{
Jerome Coutant 1:917af0ca86df 482 */
Jerome Coutant 1:917af0ca86df 483 /**
Jerome Coutant 1:917af0ca86df 484 * @brief IDD PreDelay masks
Jerome Coutant 1:917af0ca86df 485 */
Jerome Coutant 1:917af0ca86df 486 #define MFXSTM32L152_IDD_PREDELAY_UNIT ((uint8_t) 0x80)
Jerome Coutant 1:917af0ca86df 487 #define MFXSTM32L152_IDD_PREDELAY_VALUE ((uint8_t) 0x7F)
Jerome Coutant 1:917af0ca86df 488
Jerome Coutant 1:917af0ca86df 489
Jerome Coutant 1:917af0ca86df 490 /**
Jerome Coutant 1:917af0ca86df 491 * @brief IDD PreDelay unit
Jerome Coutant 1:917af0ca86df 492 */
Jerome Coutant 1:917af0ca86df 493 #define MFXSTM32L152_IDD_PREDELAY_0_5_MS ((uint8_t) 0x00)
Jerome Coutant 1:917af0ca86df 494 #define MFXSTM32L152_IDD_PREDELAY_20_MS ((uint8_t) 0x80)
Jerome Coutant 1:917af0ca86df 495 /**
Jerome Coutant 1:917af0ca86df 496 * @}
Jerome Coutant 1:917af0ca86df 497 */
Jerome Coutant 1:917af0ca86df 498
Jerome Coutant 1:917af0ca86df 499 /** @defgroup IDD_DeltaDelay_Defines IDD Delta DElay Defines
Jerome Coutant 1:917af0ca86df 500 * @{
Jerome Coutant 1:917af0ca86df 501 */
Jerome Coutant 1:917af0ca86df 502 /**
Jerome Coutant 1:917af0ca86df 503 * @brief IDD Delta Delay masks
Jerome Coutant 1:917af0ca86df 504 */
Jerome Coutant 1:917af0ca86df 505 #define MFXSTM32L152_IDD_DELTADELAY_UNIT ((uint8_t) 0x80)
Jerome Coutant 1:917af0ca86df 506 #define MFXSTM32L152_IDD_DELTADELAY_VALUE ((uint8_t) 0x7F)
Jerome Coutant 1:917af0ca86df 507
Jerome Coutant 1:917af0ca86df 508
Jerome Coutant 1:917af0ca86df 509 /**
Jerome Coutant 1:917af0ca86df 510 * @brief IDD Delta Delay unit
Jerome Coutant 1:917af0ca86df 511 */
Jerome Coutant 1:917af0ca86df 512 #define MFXSTM32L152_IDD_DELTADELAY_0_5_MS ((uint8_t) 0x00)
Jerome Coutant 1:917af0ca86df 513 #define MFXSTM32L152_IDD_DELTADELAY_20_MS ((uint8_t) 0x80)
Jerome Coutant 1:917af0ca86df 514
Jerome Coutant 1:917af0ca86df 515
Jerome Coutant 1:917af0ca86df 516 /**
Jerome Coutant 1:917af0ca86df 517 * @}
Jerome Coutant 1:917af0ca86df 518 */
Jerome Coutant 1:917af0ca86df 519
Jerome Coutant 1:917af0ca86df 520 /**
Jerome Coutant 1:917af0ca86df 521 * @}
Jerome Coutant 1:917af0ca86df 522 */
Jerome Coutant 1:917af0ca86df 523
Jerome Coutant 1:917af0ca86df 524
Jerome Coutant 1:917af0ca86df 525 /* Exported macro ------------------------------------------------------------*/
Jerome Coutant 1:917af0ca86df 526
Jerome Coutant 1:917af0ca86df 527 /** @defgroup MFXSTM32L152_Exported_Macros
Jerome Coutant 1:917af0ca86df 528 * @{
Jerome Coutant 1:917af0ca86df 529 */
Jerome Coutant 1:917af0ca86df 530
Jerome Coutant 1:917af0ca86df 531 /**
Jerome Coutant 1:917af0ca86df 532 * @}
Jerome Coutant 1:917af0ca86df 533 */
Jerome Coutant 1:917af0ca86df 534
Jerome Coutant 1:917af0ca86df 535 /* Exported functions --------------------------------------------------------*/
Jerome Coutant 1:917af0ca86df 536
Jerome Coutant 1:917af0ca86df 537 /** @defgroup MFXSTM32L152_Exported_Functions
Jerome Coutant 1:917af0ca86df 538 * @{
Jerome Coutant 1:917af0ca86df 539 */
Jerome Coutant 1:917af0ca86df 540
Jerome Coutant 1:917af0ca86df 541 /**
Jerome Coutant 1:917af0ca86df 542 * @brief MFXSTM32L152 Control functions
Jerome Coutant 1:917af0ca86df 543 */
Jerome Coutant 1:917af0ca86df 544 void mfxstm32l152_Init(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 545 void mfxstm32l152_DeInit(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 546 void mfxstm32l152_Reset(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 547 uint16_t mfxstm32l152_ReadID(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 548 uint16_t mfxstm32l152_ReadFwVersion(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 549 void mfxstm32l152_LowPower(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 550 void mfxstm32l152_WakeUp(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 551
Jerome Coutant 1:917af0ca86df 552 void mfxstm32l152_EnableITSource(uint16_t DeviceAddr, uint8_t Source);
Jerome Coutant 1:917af0ca86df 553 void mfxstm32l152_DisableITSource(uint16_t DeviceAddr, uint8_t Source);
Jerome Coutant 1:917af0ca86df 554 uint8_t mfxstm32l152_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source);
Jerome Coutant 1:917af0ca86df 555 void mfxstm32l152_ClearGlobalIT(uint16_t DeviceAddr, uint8_t Source);
Jerome Coutant 1:917af0ca86df 556
Jerome Coutant 1:917af0ca86df 557 void mfxstm32l152_SetIrqOutPinPolarity(uint16_t DeviceAddr, uint8_t Polarity);
Jerome Coutant 1:917af0ca86df 558 void mfxstm32l152_SetIrqOutPinType(uint16_t DeviceAddr, uint8_t Type);
Jerome Coutant 1:917af0ca86df 559
Jerome Coutant 1:917af0ca86df 560
Jerome Coutant 1:917af0ca86df 561 /**
Jerome Coutant 1:917af0ca86df 562 * @brief MFXSTM32L152 IO functionalities functions
Jerome Coutant 1:917af0ca86df 563 */
Jerome Coutant 1:917af0ca86df 564 void mfxstm32l152_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin);
Jerome Coutant 1:917af0ca86df 565 uint8_t mfxstm32l152_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode);
Jerome Coutant 1:917af0ca86df 566 void mfxstm32l152_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState);
Jerome Coutant 1:917af0ca86df 567 uint32_t mfxstm32l152_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin);
Jerome Coutant 1:917af0ca86df 568 void mfxstm32l152_IO_EnableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 569 void mfxstm32l152_IO_DisableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 570 uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin);
Jerome Coutant 1:917af0ca86df 571 void mfxstm32l152_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin);
Jerome Coutant 1:917af0ca86df 572
Jerome Coutant 1:917af0ca86df 573 void mfxstm32l152_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction);
Jerome Coutant 1:917af0ca86df 574 void mfxstm32l152_IO_EnableAF(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 575 void mfxstm32l152_IO_DisableAF(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 576 void mfxstm32l152_IO_SetIrqTypeMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Type);
Jerome Coutant 1:917af0ca86df 577 void mfxstm32l152_IO_SetIrqEvtMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Evt);
Jerome Coutant 1:917af0ca86df 578 void mfxstm32l152_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
Jerome Coutant 1:917af0ca86df 579 void mfxstm32l152_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
Jerome Coutant 1:917af0ca86df 580
Jerome Coutant 1:917af0ca86df 581 /**
Jerome Coutant 1:917af0ca86df 582 * @brief MFXSTM32L152 Touch screen functionalities functions
Jerome Coutant 1:917af0ca86df 583 */
Jerome Coutant 1:917af0ca86df 584 void mfxstm32l152_TS_Start(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 585 uint8_t mfxstm32l152_TS_DetectTouch(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 586 void mfxstm32l152_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
Jerome Coutant 1:917af0ca86df 587 void mfxstm32l152_TS_EnableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 588 void mfxstm32l152_TS_DisableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 589 uint8_t mfxstm32l152_TS_ITStatus (uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 590 void mfxstm32l152_TS_ClearIT (uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 591
Jerome Coutant 1:917af0ca86df 592 /**
Jerome Coutant 1:917af0ca86df 593 * @brief MFXSTM32L152 IDD current measurement functionalities functions
Jerome Coutant 1:917af0ca86df 594 */
Jerome Coutant 1:917af0ca86df 595 void mfxstm32l152_IDD_Start(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 596 void mfxstm32l152_IDD_Config(uint16_t DeviceAddr, IDD_ConfigTypeDef MfxIddConfig);
Jerome Coutant 1:917af0ca86df 597 void mfxstm32l152_IDD_ConfigShuntNbLimit(uint16_t DeviceAddr, uint8_t ShuntNbLimit);
Jerome Coutant 1:917af0ca86df 598 void mfxstm32l152_IDD_GetValue(uint16_t DeviceAddr, uint32_t *ReadValue);
Jerome Coutant 1:917af0ca86df 599 uint8_t mfxstm32l152_IDD_GetShuntUsed(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 600 void mfxstm32l152_IDD_EnableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 601 void mfxstm32l152_IDD_ClearIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 602 uint8_t mfxstm32l152_IDD_GetITStatus(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 603 void mfxstm32l152_IDD_DisableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 604
Jerome Coutant 1:917af0ca86df 605 /**
Jerome Coutant 1:917af0ca86df 606 * @brief MFXSTM32L152 Error management functions
Jerome Coutant 1:917af0ca86df 607 */
Jerome Coutant 1:917af0ca86df 608 uint8_t mfxstm32l152_Error_ReadSrc(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 609 uint8_t mfxstm32l152_Error_ReadMsg(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 610 void mfxstm32l152_Error_EnableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 611 void mfxstm32l152_Error_ClearIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 612 uint8_t mfxstm32l152_Error_GetITStatus(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 613 void mfxstm32l152_Error_DisableIT(uint16_t DeviceAddr);
Jerome Coutant 1:917af0ca86df 614
Jerome Coutant 1:917af0ca86df 615 uint8_t mfxstm32l152_ReadReg(uint16_t DeviceAddr, uint8_t RegAddr);
Jerome Coutant 1:917af0ca86df 616 void mfxstm32l152_WriteReg(uint16_t DeviceAddr, uint8_t RegAddr, uint8_t Value);
Jerome Coutant 1:917af0ca86df 617
Jerome Coutant 1:917af0ca86df 618
Jerome Coutant 1:917af0ca86df 619
Jerome Coutant 1:917af0ca86df 620 /**
Jerome Coutant 1:917af0ca86df 621 * @brief iobus prototypes (they should be defined in common/stm32_iobus.h)
Jerome Coutant 1:917af0ca86df 622 */
Jerome Coutant 1:917af0ca86df 623 void MFX_IO_Init(void);
Jerome Coutant 1:917af0ca86df 624 void MFX_IO_DeInit(void);
Jerome Coutant 1:917af0ca86df 625 void MFX_IO_ITConfig (void);
Jerome Coutant 1:917af0ca86df 626 void MFX_IO_EnableWakeupPin(void);
Jerome Coutant 1:917af0ca86df 627 void MFX_IO_Wakeup(void);
Jerome Coutant 1:917af0ca86df 628 void MFX_IO_Delay(uint32_t delay);
Jerome Coutant 1:917af0ca86df 629 void MFX_IO_Write(uint16_t addr, uint8_t reg, uint8_t value);
Jerome Coutant 1:917af0ca86df 630 uint8_t MFX_IO_Read(uint16_t addr, uint8_t reg);
Jerome Coutant 1:917af0ca86df 631 uint16_t MFX_IO_ReadMultiple(uint16_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
Jerome Coutant 1:917af0ca86df 632
Jerome Coutant 1:917af0ca86df 633 /**
Jerome Coutant 1:917af0ca86df 634 * @}
Jerome Coutant 1:917af0ca86df 635 */
Jerome Coutant 1:917af0ca86df 636
Jerome Coutant 1:917af0ca86df 637 /* Touch screen driver structure */
Jerome Coutant 1:917af0ca86df 638 extern TS_DrvTypeDef mfxstm32l152_ts_drv;
Jerome Coutant 1:917af0ca86df 639
Jerome Coutant 1:917af0ca86df 640 /* IO driver structure */
Jerome Coutant 1:917af0ca86df 641 extern IO_DrvTypeDef mfxstm32l152_io_drv;
Jerome Coutant 1:917af0ca86df 642
Jerome Coutant 1:917af0ca86df 643 /* IDD driver structure */
Jerome Coutant 1:917af0ca86df 644 extern IDD_DrvTypeDef mfxstm32l152_idd_drv;
Jerome Coutant 1:917af0ca86df 645
Jerome Coutant 1:917af0ca86df 646
Jerome Coutant 1:917af0ca86df 647 #ifdef __cplusplus
Jerome Coutant 1:917af0ca86df 648 }
Jerome Coutant 1:917af0ca86df 649 #endif
Jerome Coutant 1:917af0ca86df 650 #endif /* __MFXSTM32L152_H */
Jerome Coutant 1:917af0ca86df 651
Jerome Coutant 1:917af0ca86df 652
Jerome Coutant 1:917af0ca86df 653 /**
Jerome Coutant 1:917af0ca86df 654 * @}
Jerome Coutant 1:917af0ca86df 655 */
Jerome Coutant 1:917af0ca86df 656
Jerome Coutant 1:917af0ca86df 657 /**
Jerome Coutant 1:917af0ca86df 658 * @}
Jerome Coutant 1:917af0ca86df 659 */
Jerome Coutant 1:917af0ca86df 660
Jerome Coutant 1:917af0ca86df 661 /**
Jerome Coutant 1:917af0ca86df 662 * @}
Jerome Coutant 1:917af0ca86df 663 */
Jerome Coutant 1:917af0ca86df 664
Jerome Coutant 1:917af0ca86df 665 /**
Jerome Coutant 1:917af0ca86df 666 * @}
Jerome Coutant 1:917af0ca86df 667 */
Jerome Coutant 1:917af0ca86df 668 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/