KETCube
Data Structures | Macros | Typedefs | Enumerations | Functions
ketCube_gpio.h File Reference

This file contains definitions for the ketCube GPIO driver. More...

#include "stm32l0xx_hal_gpio.h"
#include "ketCube_cfg.h"

Go to the source code of this file.

Data Structures

struct  ketCube_gpio_descriptor_t
 GPIO PIN descriptor. More...
 

Macros

#define KETCUBE_GPIO_NAME   "gpio_drv"
 GPIO driver name. More...
 
#define KETCUBE_GPIO_LED_PERIOD   500
 LED driver blink period in ms. More...
 

Typedefs

typedef void(* ketCube_GPIO_VoidFn_t) (void *context)
 Pointer to a IRQ Handler Function. More...
 

Enumerations

enum  ketCube_gpio_pin_t {
  KETCUBE_GPIO_NOPIN = 0, KETCUBE_GPIO_PIN_0 = GPIO_PIN_0, KETCUBE_GPIO_PIN_1 = GPIO_PIN_1, KETCUBE_GPIO_PIN_2 = GPIO_PIN_2,
  KETCUBE_GPIO_PIN_3 = GPIO_PIN_3, KETCUBE_GPIO_PIN_4 = GPIO_PIN_4, KETCUBE_GPIO_PIN_5 = GPIO_PIN_5, KETCUBE_GPIO_PIN_6 = GPIO_PIN_6,
  KETCUBE_GPIO_PIN_7 = GPIO_PIN_7, KETCUBE_GPIO_PIN_8 = GPIO_PIN_8, KETCUBE_GPIO_PIN_9 = GPIO_PIN_9, KETCUBE_GPIO_PIN_10 = GPIO_PIN_10,
  KETCUBE_GPIO_PIN_11 = GPIO_PIN_11, KETCUBE_GPIO_PIN_12 = GPIO_PIN_12, KETCUBE_GPIO_PIN_13 = GPIO_PIN_13, KETCUBE_GPIO_PIN_14 = GPIO_PIN_14,
  KETCUBE_GPIO_PIN_15 = GPIO_PIN_15
}
 List of GPIO PINs. More...
 
enum  ketCube_gpio_port_t {
  KETCUBE_GPIO_PA = GPIOA_BASE, KETCUBE_GPIO_PB = GPIOB_BASE, KETCUBE_GPIO_PC = GPIOC_BASE, KETCUBE_GPIO_PD = GPIOD_BASE,
  KETCUBE_GPIO_PE = GPIOE_BASE, KETCUBE_GPIO_PH = GPIOH_BASE
}
 GPIO Ports. More...
 
enum  ketCube_gpio_function_t { KETCUBE_GPIO_FUNCTION_GPIO = 0, KETCUBE_GPIO_FUNCTION_LED, KETCUBE_GPIO_FUNCTION_BUTTON }
 LED States. More...
 
enum  ketCube_gpio_polarity_t { KETCUBE_GPIO_POLARITY_ON = TRUE, KETCUBE_GPIO_POLARITY_OFF = FALSE }
 GPIO polarity. More...
 
enum  ketCube_gpio_LEDState_t { KETCUBE_GPIO_LED_OFF = 0, KETCUBE_GPIO_LED_ON, KETCUBE_GPIO_LED_BLINK_SINGLE, KETCUBE_GPIO_LED_BLINK_CONT }
 LED States. More...
 

Functions

void ketCube_GPIO_InitDriver (void)
 Initializes the GPIO driver. More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_SleepEnter (void)
 Set-UP GPIO befere sleep enter. More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_Init (ketCube_gpio_port_t port, uint16_t pin, GPIO_InitTypeDef *initStruct)
 Initializes the GPIO PIN(s) More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_InitLED (ketCube_gpio_port_t port, uint16_t pin, ketCube_gpio_polarity_t polarity)
 Initializes the GPIO PIN(s) as LEDs. More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_ReInit (ketCube_gpio_port_t port, uint16_t pin, GPIO_InitTypeDef *initStruct)
 Initializes the GPIO PIN(s) without usage checking. More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_Release (ketCube_gpio_port_t port, ketCube_gpio_pin_t pin)
 Release KETCube PIN - setup as input pin. More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_SetIrq (ketCube_gpio_port_t port, ketCube_gpio_pin_t pin, uint32_t prio, ketCube_GPIO_VoidFn_t irqHandler)
 Records the interrupt handler for the GPIO object. More...
 
ketCube_cfg_DrvError_t ketCube_GPIO_ClearIrq (ketCube_gpio_port_t port, ketCube_gpio_pin_t pin)
 Clear IRQ for the GPIO object. More...
 
void ketCube_GPIO_Write (ketCube_gpio_port_t port, ketCube_gpio_pin_t pin, bool bit)
 Writes the bit value to the GPIO PIN. More...
 
bool ketCube_GPIO_Read (ketCube_gpio_port_t port, ketCube_gpio_pin_t pin)
 Reads the current PIN value. More...
 
void ketCube_GPIO_SetLED (ketCube_gpio_port_t port, ketCube_gpio_pin_t pin, ketCube_gpio_LEDState_t state)
 Sets the LED state. More...
 
void EXTI0_1_IRQHandler (void)
 
void EXTI2_3_IRQHandler (void)
 
void EXTI4_15_IRQHandler (void)
 

Detailed Description

This file contains definitions for the ketCube GPIO driver.

Author
Jan Belohoubek
Version
0.2
Date
2018-10-30
Attention

© Copyright (c) 2018 University of West Bohemia in Pilsen All rights reserved.

Developed by: The SmartCampus Team Department of Technologies and Measurement www.smartcampus.cz | www.zcu.cz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.