stm3210c_eval_ioe.h File Reference

This file contains all the functions prototypes for the IO Expander firmware driver. More...

#include "stm32f10x.h"

Go to the source code of this file.

Data Structures

struct  TS_STATE
 Touch Screen Information structure. More...

Defines

#define _delay_   delay
 Uncomment the line below to enable verfying each written byte in write operation.
#define ALL_IT   0xFF
#define AUDIO_RESET_PIN   IO_Pin_2 /* IO_Exapnader_2 */
 Eval Board IO Pins definition.
#define Direction_IN   0x00
 IO Pin directions.
#define Direction_OUT   0x01
#define EDGE_FALLING   0x01
 Edge detection value.
#define EDGE_RISING   0x02
#define IO1_IN_ALL_PINS   (uint32_t)(MEMS_INT1_PIN | MEMS_INT2_PIN)
 Eval Board both IO Exapanders Pins definition.
#define IO1_OUT_ALL_PINS   (uint32_t)(VBAT_DIV_PIN)
#define IO2_IN_ALL_PINS   (uint32_t)(JOY_IO_PINS)
#define IO2_OUT_ALL_PINS   (uint32_t)(AUDIO_RESET_PIN | MII_INT_PIN)
#define IO_IT_0   0x01
 IO Interrupts.
#define IO_IT_1   0x02
#define IO_IT_2   0x04
#define IO_IT_3   0x08
#define IO_IT_4   0x10
#define IO_IT_5   0x20
#define IO_IT_6   0x40
#define IO_IT_7   0x80
#define IO_Pin_0   0x01
 IO Pins.
#define IO_Pin_1   0x02
#define IO_Pin_2   0x04
#define IO_Pin_3   0x08
#define IO_Pin_4   0x10
#define IO_Pin_5   0x20
#define IO_Pin_6   0x40
#define IO_Pin_7   0x80
#define IO_Pin_ALL   0xFF
#define IOE_1_ADDR   0x82
 The 7 bits IO Expanders adresses and chip IDs.
#define IOE_2_ADDR   0x88
#define IOE_ADC_FCT   0x01
 IO Expander Functionalities definitions.
#define IOE_DMA   DMA1
 IOE DMA definitions.
#define IOE_DMA_CLK   RCC_AHBPeriph_DMA1
#define IOE_DMA_RX_CHANNEL   DMA1_Channel7
#define IOE_DMA_RX_TCFLAG   DMA1_FLAG_TC7
#define IOE_DMA_TX_CHANNEL   DMA1_Channel6
#define IOE_DMA_TX_TCFLAG   DMA1_FLAG_TC6
#define IOE_GIT_ADC   0x40
#define IOE_GIT_EN   0x01
 Global interrupt Enable bit.
#define IOE_GIT_FE   0x10
#define IOE_GIT_FF   0x08
#define IOE_GIT_FOV   0x04
#define IOE_GIT_FTH   0x02
#define IOE_GIT_GPIO   0x80
 Glaobal Interrupts definitions.
#define IOE_GIT_TEMP   0x20
#define IOE_GIT_TOUCH   0x01
#define IOE_I2C   I2C1
 I2C port definitions.
#define IOE_I2C_CLK   RCC_APB1Periph_I2C1
#define IOE_I2C_DR   ((uint32_t)0x40005410)
#define IOE_I2C_SCL_GPIO_CLK   RCC_APB2Periph_GPIOB
#define IOE_I2C_SCL_GPIO_PORT   GPIOB
#define IOE_I2C_SCL_PIN   GPIO_Pin_6
#define IOE_I2C_SDA_GPIO_CLK   RCC_APB2Periph_GPIOB
#define IOE_I2C_SDA_GPIO_PORT   GPIOB
#define IOE_I2C_SDA_PIN   GPIO_Pin_7
#define IOE_I2C_SPEED   300000
#define IOE_INMEMS_IT   (uint8_t)(IO_IT_2 | IO_IT_3)
#define IOE_IO_FCT   0x04
#define IOE_IT_EXTI_IRQn   EXTI15_10_IRQn
#define IOE_IT_EXTI_LINE   EXTI_Line14
#define IOE_IT_EXTI_PIN_SOURCE   GPIO_PinSource14
#define IOE_IT_EXTI_PORT_SOURCE   GPIO_PortSourceGPIOB
#define IOE_IT_GPIO_CLK   RCC_APB2Periph_GPIOB
#define IOE_IT_GPIO_PORT   GPIOB
#define IOE_IT_PIN   GPIO_Pin_14
 IO Expander Interrupt line on EXTI.
#define IOE_ITSRC_INMEMS   0x02
#define IOE_ITSRC_JOYSTICK   0x04
#define IOE_ITSRC_TEMPSENS   0x08
#define IOE_ITSRC_TSC   0x01
 Interrupt source configuration definitons.
#define IOE_JOY_IT   (uint8_t)(IO_IT_3 | IO_IT_4 | IO_IT_5 | IO_IT_6 | IO_IT_7)
#define IOE_REG_ADC_CAPT   0x22
#define IOE_REG_ADC_CTRL1   0x20
#define IOE_REG_ADC_CTRL2   0x21
#define IOE_REG_ADC_DATA_CH0   0x30
#define IOE_REG_ADC_DATA_CH1   0x32
#define IOE_REG_ADC_DATA_CH2   0x34
#define IOE_REG_ADC_DATA_CH3   0x36
#define IOE_REG_ADC_DATA_CH4   0x38
#define IOE_REG_ADC_DATA_CH5   0x3A
#define IOE_REG_ADC_DATA_CH6   0x3B
#define IOE_REG_ADC_DATA_CH7   0x3C
#define IOE_REG_ADC_INT_EN   0x0E
 ADC Registers.
#define IOE_REG_ADC_INT_STA   0x0F
#define IOE_REG_CHP_ID   0x00
 Identification registers.
#define IOE_REG_FIFO_SIZE   0x4C
#define IOE_REG_FIFO_STA   0x4B
#define IOE_REG_FIFO_TH   0x4A
#define IOE_REG_GPIO_AF   0x17
#define IOE_REG_GPIO_CLR_PIN   0x11
#define IOE_REG_GPIO_DIR   0x13
#define IOE_REG_GPIO_ED   0x14
#define IOE_REG_GPIO_FE   0x16
#define IOE_REG_GPIO_INT_EN   0x0C
#define IOE_REG_GPIO_INT_STA   0x0D
#define IOE_REG_GPIO_MP_STA   0x12
#define IOE_REG_GPIO_RE   0x15
#define IOE_REG_GPIO_SET_PIN   0x10
 GPIO Registers.
#define IOE_REG_ID_VER   0x02
#define IOE_REG_INT_CTRL   0x09
 Interrupt Control register.
#define IOE_REG_INT_EN   0x0A
#define IOE_REG_INT_STA   0x0B
#define IOE_REG_SPI_CFG   0x08
#define IOE_REG_SYS_CTRL1   0x03
 General Control Registers.
#define IOE_REG_SYS_CTRL2   0x04
#define IOE_REG_TEMP_CTRL   0x60
 Temperature Sensor registers.
#define IOE_REG_TEMP_DATA   0x61
#define IOE_REG_TEMP_TH   0x62
#define IOE_REG_TSC_CFG   0x41
#define IOE_REG_TSC_CTRL   0x40
 TouchScreen Registers.
#define IOE_REG_TSC_DATA   0x57
#define IOE_REG_TSC_DATA_X   0x4D
#define IOE_REG_TSC_DATA_XYZ   0x52
#define IOE_REG_TSC_DATA_Y   0x4F
#define IOE_REG_TSC_DATA_Z   0x51
#define IOE_REG_TSC_FRACT_XYZ   0x56
#define IOE_REG_TSC_I_DRIVE   0x58
#define IOE_REG_TSC_SHIELD   0x59
#define IOE_REG_WDM_BL_X   0x46
#define IOE_REG_WDM_BL_Y   0x48
#define IOE_REG_WDM_TR_X   0x42
#define IOE_REG_WDM_TR_Y   0x44
#define IOE_TEMPSENS_FCT   0x08
#define IOE_TimeoutUserCallback()   IOE_TIMEOUT
 Timeout user callback function.
#define IOE_TS_FCT   0x02
#define IOE_TS_IT   (uint8_t)(IO_IT_0 | IO_IT_1 | IO_IT_2)
#define JOY_IO_DOWN   IO_Pin_6
#define JOY_IO_LEFT   IO_Pin_5
#define JOY_IO_NONE   JOY_IO_PINS
#define JOY_IO_PINS   (uint32_t)(IO_Pin_3 | IO_Pin_4 | IO_Pin_5 | IO_Pin_6 | IO_Pin_7)
#define JOY_IO_RIGHT   IO_Pin_4
#define JOY_IO_SEL   IO_Pin_7
 JOYSTICK Pins definition.
#define JOY_IO_UP   IO_Pin_3
#define MEMS_INT1_PIN   IO_Pin_3 /* IO_Exapnader_1 */
#define MEMS_INT2_PIN   IO_Pin_2 /* IO_Exapnader_1 */
#define MII_INT_PIN   IO_Pin_0 /* IO_Exapnader_2 */
#define Polarity_High   0x04
#define Polarity_Low   0x00
 Interrupt Line output parameters.
#define STMPE811_ID   0x0811
#define TOUCH_IO_ALL   (uint32_t)(IO_Pin_1 | IO_Pin_2 | IO_Pin_3 | IO_Pin_4)
#define TOUCH_XD   IO_Pin_2 /* IO_Exapnader_1 */
#define TOUCH_XU   IO_Pin_4 /* IO_Exapnader_1 */
#define TOUCH_YD   IO_Pin_1 /* IO_Exapnader_1 */
 Touch Screen Pins definition.
#define TOUCH_YU   IO_Pin_3 /* IO_Exapnader_1 */
#define Type_Edge   0x02
#define Type_Level   0x00
#define VBAT_DIV_PIN   IO_Pin_0 /* IO_Exapnader_1 */

Enumerations

enum  IOE_BitValue_TypeDef { BitReset = 0, BitSet = 1, BitReset = 0, BitSet = 1 }
 

IO bit values.

More...
enum  IOE_DMADirection_TypeDef { IOE_DMA_TX = 0, IOE_DMA_RX = 1, IOE_DMA_TX = 0, IOE_DMA_RX = 1 }
 

IOE DMA Direction.

More...
enum  IOE_Status_TypDef {
  IOE_OK = 0, IOE_FAILURE, IOE_TIMEOUT, PARAM_ERROR,
  IOE1_NOT_OPERATIONAL, IOE_OK = 0, IOE_FAILURE, IOE_TIMEOUT,
  PARAM_ERROR, IOE1_NOT_OPERATIONAL, IOE2_NOT_OPERATIONAL
}
 

IO_Expander Error codes.

More...
enum  JOYState_TypeDef {
  JOY_NONE = 0, JOY_SEL = 1, JOY_DOWN = 2, JOY_LEFT = 3,
  JOY_RIGHT = 4, JOY_UP = 5, JOY_NONE = 0, JOY_SEL = 1,
  JOY_DOWN = 2, JOY_LEFT = 3, JOY_RIGHT = 4, JOY_UP = 5
}
 

Joystick State definitions.

More...

Functions

uint16_t I2C_ReadDataBuffer (uint8_t DeviceAddr, uint32_t RegisterAddr)
 Reads a buffer of 2 bytes from the device registers.
uint8_t I2C_ReadDeviceRegister (uint8_t DeviceAddr, uint8_t RegisterAddr)
 Reads a register of the device through I2C.
uint8_t I2C_WriteDeviceRegister (uint8_t DeviceAddr, uint8_t RegisterAddr, uint8_t RegisterValue)
 Writes a value in a register of the device through I2C.
uint8_t IOE_ClearGITPending (uint8_t DeviceAddr, uint8_t IO_IT)
 Clears the selected Global interrupt pending bit(s).
uint8_t IOE_ClearIOITPending (uint8_t DeviceAddr, uint8_t IO_IT)
 Clears the selected IO interrupt pending bit(s).
uint8_t IOE_Config (void)
 Configuration and initialization functions.
uint8_t IOE_FnctCmd (uint8_t DeviceAddr, uint8_t Fct, FunctionalState NewState)
 Configures the selcted IO Expander functionalities.
FlagStatus IOE_GetGITStatus (uint8_t DeviceAddr, uint8_t Global_IT)
 Interrupts Mangement functions.
FlagStatus IOE_GetIOITStatus (uint8_t DeviceAddr, uint8_t IO_IT)
 Checks the status of the selected IO interrupt pending bit.
uint8_t IOE_GITCmd (uint8_t DeviceAddr, FunctionalState NewState)
 Enables or disables the Global interrupt.
uint8_t IOE_GITConfig (uint8_t DeviceAddr, uint8_t Global_IT, FunctionalState NewState)
 Configures the selected source to generate or not a global interrupt.
uint8_t IOE_IOAFConfig (uint8_t DeviceAddr, uint8_t IO_Pin, FunctionalState NewState)
 Configures the selected pin to be in Alternate function or not.
uint8_t IOE_IOEdgeConfig (uint8_t DeviceAddr, uint8_t IO_Pin, uint8_t Edge)
 Configures the Edge for which a transition is detectable for the the selected pin.
uint8_t IOE_IOITConfig (uint8_t DeviceAddr, uint8_t IO_IT, FunctionalState NewState)
 Configures the selected pins to generate an interrupt or not.
uint8_t IOE_IOPinConfig (uint8_t DeviceAddr, uint8_t IO_Pin, uint8_t Direction)
 Configures the selected pin direction (to be an input or an output).
uint8_t IOE_IsOperational (uint8_t DeviceAddr)
 IO-Expander Control functions.
uint8_t IOE_ITConfig (uint32_t IOE_ITSRC_Source)
 Configures The selected interrupts on the IO Expanders.
uint8_t IOE_ITOutConfig (uint8_t Polarity, uint8_t Type)
 Configures the Interrupt line active state and format (level/edge).
JOYState_TypeDef IOE_JoyStickGetState (void)
 Returns the current Joystick status.
uint16_t IOE_ReadID (uint8_t DeviceAddr)
 Reads the selected device's ID.
uint8_t IOE_ReadIOPin (uint32_t IO_Pin)
 Returns the status of the selected input IO pin.
uint8_t IOE_Reset (uint8_t DeviceAddr)
 Resets the IO Expander by Software (SYS_CTRL1, RESET bit).
uint8_t IOE_TempSens_Config (void)
 Configures and enables the Temperature sensor module.
uint32_t IOE_TempSens_GetData (void)
 Temperature Sensor functions.
uint8_t IOE_TS_Config (void)
 Low Layer functions.
TS_STATEIOE_TS_GetState (void)
 Touch Screen controller functions.
uint8_t IOE_WriteIOPin (uint8_t IO_Pin, IOE_BitValue_TypeDef BitVal)
 IO pins control functions.

Detailed Description

This file contains all the functions prototypes for the IO Expander firmware driver.

Author:
MCD Application Team
Version:
V4.3.0
Date:
10/15/2010

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics

Definition in file stm3210c_eval_ioe.h.

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32