89 #include <stm32f4xx.h>
134 { CARME_IO1_BUTTON0_PORT, CARME_IO1_BUTTON0_PIN,
GPIO_Mode_IN },
135 { CARME_IO1_BUTTON1_PORT, CARME_IO1_BUTTON1_PIN,
GPIO_Mode_IN },
136 { CARME_IO1_BUTTON2_PORT, CARME_IO1_BUTTON2_PIN,
GPIO_Mode_IN },
137 { CARME_IO1_BUTTON3_PORT, CARME_IO1_BUTTON3_PIN,
GPIO_Mode_IN },
186 for (i = 0; i < 8; i++) {
188 if (mask & (1 << i)) {
190 if (write & (1 << i)) {
191 LED_Value |= (1 << i);
194 LED_Value &= ~(1 << i);
237 uint32_t agpio_state;
238 uint8_t button_state = 0;
245 *pStatus = button_state;
261 if (state == ENABLE) {
276 EXTI_InitStruct.
EXTI_Mode = EXTI_Mode_Interrupt;
300 EXTI_InitStruct.
EXTI_Mode = EXTI_Mode_Interrupt;
335 PortC_Value |= (0xF & data);
340 PortC_Value |= ((0xF & data) << 4);
370 *data = ((tmp & 0xF0) >> 4);
389 PortA_Value |= (1 << pio);
395 PortC_Value |= (1 << pio);
416 PortA_Value &= ~(1 << pio);
422 PortC_Value &= ~(1 << pio);
441 uint8_t PIO_Controlword = 0x80;
444 PIO_Controlword |= 0x10;
447 PIO_Controlword &= ~0x10;
450 PIO_Controlword |= 0x09;
453 PIO_Controlword &= ~0x09;
456 PIO_Controlword |= 0x01;
459 PIO_Controlword &= ~0x01;
462 PIO_Controlword |= 0x08;
465 PIO_Controlword &= ~0x08;
468 *PIO_Control = PIO_Controlword;
void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex)
Selects the GPIO pin used as EXTI Line.
void NVIC_Init(NVIC_InitTypeDef *NVIC_InitStruct)
Initializes the NVIC peripheral according to the specified parameters in the NVIC_InitStruct.
static __IO uint8_t LED_Value
CARME IO1 current led value.
uint8_t NVIC_IRQChannelPreemptionPriority
#define CARME_AGPIO_PIN_103
static __IO uint8_t * PIO_Control
Pointer to the register which controls the CARME IO1 PIO Control Value.
EXTIMode_TypeDef EXTI_Mode
enum _CARME_IO1_PIO_PORT CARME_IO1_PIO_PORT
This enum contains all available Ports of the PIO device.
#define FSMC_CARME_EXTENSION1_BASE
void CARME_IO1_BUTTON_Get(uint8_t *pStatus)
Get the CARME IO1 button status.
void EXTI_Init(EXTI_InitTypeDef *EXTI_InitStruct)
Initializes the EXTI peripheral according to the specified parameters in the EXTI_InitStruct.
void CARME_IO1_PIO_Read(CARME_IO1_PIO_PORT port, uint8_t *data)
Read the PIO value.
void CARME_IO1_PIO_Clear(CARME_IO1_PIO_PORT port, uint8_t pio)
Clears the PIO on the position of the input value. For example the input value 0x4 clears the pin nu...
void CARME_GPIO_Init(CARME_Port_Pin_t *pPortPinAssociation, GPIO_InitTypeDef *pGPIO_InitStruct, uint8_t size)
Initialize GPIO ports with a CARME_Port_Pin_t table.
enum _CARME_IO1_PIO_CONTROL CARME_IO1_PIO_CONTROL
This contains all possible commands for the PIO device.
NVIC Init Structure definition.
#define CARME_AGPIO_PIN_102
static CARME_Port_Pin_t CARME_IO1_Port_Pin[]
CARME IO1 Port and Pin association.
void CARME_IO1_PIO_Write(CARME_IO1_PIO_PORT port, uint8_t data)
Sets the PIOs in order with the input-value.
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
Fills each GPIO_InitStruct member with its default value.
void CARME_IO1_LED_Set(uint8_t write, uint8_t mask)
Set a byte to the CARME IO1 LEDs.
FunctionalState NVIC_IRQChannelCmd
CARME port and pin association structure.
EXTI Init Structure definition.
#define CARME_GPIO_TO_EXTIPINSOURCE(GPIO_PIN)
Get EXTI_PinSourcex from GPIO_Pin_x.
void CARME_IO1_SWITCH_Get(uint8_t *pStatus)
Get the CARME IO1 switch status.
uint8_t NVIC_IRQChannelSubPriority
#define CARME_AGPIO_PIN_101
static __IO uint8_t PortA_Value
CARME IO1 current PortA value.
#define CARME_AGPIO_PIN_99
GPIO Init structure definition.
static __IO uint8_t * LED_Port
Pointer to the register which controls the CARME IO1 LEDs.
void CARME_IO1_PIO_Set(CARME_IO1_PIO_PORT port, uint8_t pio)
Sets the PIO on the position of the input value. For example the input value 0x4 sets the pin number...
void CARME_IO1_BUTTON_Interrupt(FunctionalState NewState)
Set the CARME IO1 interrupt enable/disable.
void CARME_IO1_PIO_Control(CARME_IO1_PIO_CONTROL cmd)
Sets the PIO Control Register. This function must be called to change the Port direction.
static __IO uint8_t * PIO_PortA
Pointer to the register which controls the CARME IO1 PIO PortA Value.
static __IO uint8_t PortC_Value
CARME IO1 current PortC value.
EXTITrigger_TypeDef EXTI_Trigger
CARME IO1 extension module board support package.
#define CARME_GPIO_TO_EXTILINE(GPIO_PIN)
Get EXTI_Linex from GPIO_Pin_x.
static __IO uint8_t * Switch_Port
Pointer to the register which controls the CARME IO1 Switchs.
static __IO uint8_t * PIO_PortC
Pointer to the register which controls the CARME IO1 PIO PortB Value.
void CARME_AGPIO_Get(uint32_t *pStatus)
Get the AGPIO state.
FunctionalState EXTI_LineCmd
void CARME_IO1_Init(void)
CARME IO1 initialization.
#define CARME_GPIO_TO_EXTIPORTSOURCE(GPIO_PORT)
Get EXTI_PortSourceGPIOx from GPIOx.
void CARME_IO1_LED_Get(uint8_t *pStatus)
Get the CARME IO1 LED status.