USB Device - Joystick/Mouse  1.0
Classes | Macros | Enumerations | Functions
stm324xg_eval_ioe.h File Reference

This file contains all the functions prototypes for the stm324xg_eval_ioe.c driver. More...

#include "stm324xg_eval.h"

Go to the source code of this file.

Classes

struct  TS_STATE
 Touch Screen Information structure. More...
 

Macros

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

Enumerations

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.
 
enum  IOE_Status_TypDef {
  IOE_OK = 0, IOE_FAILURE, IOE_TIMEOUT, PARAM_ERROR,
  IOE1_NOT_OPERATIONAL, IOE2_NOT_OPERATIONAL
}
 IO_Expander Error codes.
 
enum  IOE_BitValue_TypeDef { BitReset = 0, BitSet = 1 }
 IO bit values.
 
enum  IOE_DMADirection_TypeDef { IOE_DMA_TX = 0, IOE_DMA_RX = 1 }
 IOE DMA Direction.
 

Functions

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

Detailed Description

This file contains all the functions prototypes for the stm324xg_eval_ioe.c driver.

Author
MCD Application Team
Version
V1.0.2
Date
05-March-2012
Attention

© COPYRIGHT 2012 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.