- folder structure reordered
- unnecessary drivers removed
This commit is contained in:
49
source/firmware/arch/stm32f4xx/driver/include/stm32_sys_tick.h
Executable file
49
source/firmware/arch/stm32f4xx/driver/include/stm32_sys_tick.h
Executable file
@@ -0,0 +1,49 @@
|
||||
//! \file stm32_sys_tick.h
|
||||
//! \author tkl
|
||||
//! \date Feb 15, 2012
|
||||
//! \brief Header file of the stm32f10x architecture dependent sys tick timer implementation.
|
||||
#ifndef STM32_SYS_TICK_H_
|
||||
#define STM32_SYS_TICK_H_
|
||||
|
||||
#include "timer.h"
|
||||
|
||||
typedef void* (*stm32_sys_tick_cb_t)(void*); //!< callback for the external interrupt
|
||||
|
||||
//! \brief Type of sys tick base time.
|
||||
enum stm32_sys_tick_time_base {
|
||||
STM32_SYS_TICK_TIME_BASE_NONE = 0, //!< Not init
|
||||
STM32_SYS_TICK_TIME_BASE_US, //!< Tick time = 1 us.
|
||||
STM32_SYS_TICK_TIME_BASE_MS //!< Tick time = 1 ms.
|
||||
};
|
||||
|
||||
//! \brief The sys tick device.
|
||||
struct stm32_sys_tick {
|
||||
const enum stm32_sys_tick_time_base *tick_time_base; //!< time base for the system tick
|
||||
stm32_sys_tick_cb_t sys_tick_cb; //!< callback for the sys tick interrupt
|
||||
void *sys_tick_cb_param; //!< parameter for the callback
|
||||
};
|
||||
|
||||
//! \brief Open a sys tick timer.
|
||||
//! \param sys_tick The sys tick to open. Must be of type const stm32_sys_tick_t*.
|
||||
//! \return -1 in error case.
|
||||
int stm32_sys_tick_open(const void *sys_tick);
|
||||
|
||||
//! \brief Close a sys tick timer.
|
||||
//! \param sys_tick The sys tick to close. Must be of type const stm32_sys_tick_t*.
|
||||
//! \return -1 in error case.
|
||||
int stm32_sys_tick_close(const void *sys_tick);
|
||||
|
||||
//! \brief Set the call back for a sys tick timer.
|
||||
//! \param sys_tick The sys tick to open. Mus be of type const stm32_sys_tick_t*.
|
||||
//! \param callback The function pointer of the call back function.
|
||||
//! \param param The parameter for the call back function.
|
||||
//! \return -1 in error case.
|
||||
int stm32_sys_tick_set_cb(const void *sys_tick, const void *callback, const void *param);
|
||||
|
||||
static const struct timer_fp timer_fp = {
|
||||
stm32_sys_tick_open,
|
||||
stm32_sys_tick_close,
|
||||
stm32_sys_tick_set_cb
|
||||
};
|
||||
|
||||
#endif /* STM32_SYS_TICK_H_ */
|
62
source/firmware/arch/stm32f4xx/driver/include/stm32f4_gpio.h
Executable file
62
source/firmware/arch/stm32f4xx/driver/include/stm32f4_gpio.h
Executable file
@@ -0,0 +1,62 @@
|
||||
//! \file stm32f4_gpio.h
|
||||
//! \author tkl
|
||||
//! \date Mai 8, 2012
|
||||
//! \brief Header file of the stm32f4xx architecture dependent gpio driver.
|
||||
#ifndef STM32F4_GPIO_H_
|
||||
#define STM32F4_GPIO_H_
|
||||
|
||||
//! callback for the external interrupt
|
||||
typedef void* (*gpio_ext_it_cb_t)(void*);
|
||||
|
||||
//! \brief stm32f4 gpio device
|
||||
struct stm32f4_gpio {
|
||||
GPIO_TypeDef *port; //!< Gpio port
|
||||
const GPIO_InitTypeDef *pin; //!< Gpio pin
|
||||
const EXTI_InitTypeDef *exti; //!< Gpio exit it (could be NULL)
|
||||
const NVIC_InitTypeDef *nvic; //!< Gpio nvic (could be NULL)
|
||||
gpio_ext_it_cb_t ext_it_cb; //!< Gpio ext it callback (could be NULL)
|
||||
void *param; //!< Parameter for the callback
|
||||
};
|
||||
|
||||
//! \brief Open a gpio.
|
||||
//! \param gpio The gpio to open. Must be of type stm32f4_gpio_t.
|
||||
//! \retval -1 in error case.
|
||||
int stm32f4_gpio_open(const void *gpio);
|
||||
|
||||
//! \brief Close a gpio.
|
||||
//! \param gpio The gpio to close. Must be of type stm32f4_gpio_t.
|
||||
//! \retval -1 in error case.
|
||||
int stm32f4_gpio_close(const void *gpio);
|
||||
|
||||
//! \brief Read a gpio.
|
||||
//! \param gpio The gpio to read. Must be of type stm32f4_gpio_t.
|
||||
//! \return read out value.
|
||||
char stm32f4_gpio_read(const void *gpio);
|
||||
|
||||
//! \brief Write to a gpio.
|
||||
//! \param gpio The gpio to write. Must be of type stm32f4_gpio_t.
|
||||
//! \param byte The data to write.
|
||||
void stm32f4_gpio_write(const void *gpio, char byte);
|
||||
|
||||
//! \brief Toggle a gpio.
|
||||
//! \param gpio The gpio to read. Must be of type stm32f4_gpio_t.
|
||||
void stm32f4_gpio_toggle(const void *gpio);
|
||||
|
||||
//! \brief Set the callback for a gpio pin external interrupt.
|
||||
//! \param gpio The gpio to set call back for. Must be of type stm32f4_gpio_t.
|
||||
//! \param callback The function pointer to call back.
|
||||
//! \param param The parameter for the call back.
|
||||
//! \retval -1 in error case.
|
||||
int stm32f4_gpio_set_exti_callback(const void *gpio, const void *callback,
|
||||
const void *param);
|
||||
|
||||
static const struct gpio_fp gpio_fp = {
|
||||
stm32f4_gpio_open,
|
||||
stm32f4_gpio_close,
|
||||
stm32f4_gpio_read,
|
||||
stm32f4_gpio_write,
|
||||
stm32f4_gpio_toggle,
|
||||
stm32f4_gpio_set_exti_callback
|
||||
};
|
||||
|
||||
#endif /* STM32F4_GPIO_H_ */
|
64
source/firmware/arch/stm32f4xx/driver/include/stm32f4_uart.h
Normal file
64
source/firmware/arch/stm32f4xx/driver/include/stm32f4_uart.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* stm32_uart.h
|
||||
*
|
||||
* Created on: Jul 24, 2016
|
||||
* Author: tkl
|
||||
*/
|
||||
|
||||
#ifndef SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_UART_STM32_UART_H_
|
||||
#define SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_UART_STM32_UART_H_
|
||||
|
||||
#include "uart.h"
|
||||
|
||||
//! \brief Stm32f4 uart device.
|
||||
struct stm32f4_uart {
|
||||
const GPIO_InitTypeDef *gpio_init;
|
||||
GPIO_TypeDef *gpio_port;
|
||||
uint8_t pin_src_rx;
|
||||
uint8_t pin_src_tx;
|
||||
const USART_InitTypeDef *usart_init;
|
||||
USART_TypeDef *usart_port;
|
||||
uint16_t usart_it_select;
|
||||
const NVIC_InitTypeDef *nvic_init;
|
||||
};
|
||||
|
||||
//! \brief Open an uart device.
|
||||
//! \param this The uart to open.
|
||||
//! \retval -1 in error case.
|
||||
int stm32f4_uart_open(const void *this);
|
||||
|
||||
//! \brief Close an uart device.
|
||||
//! \param this The uart to close.
|
||||
//! \retval -1 in error case.
|
||||
int stm32f4_uart_close(const void *this);
|
||||
|
||||
//! \brief Read from an uart device.
|
||||
//! \param this The uart to read from.
|
||||
//! \param buffer The buffer to read to.
|
||||
//! \param len The length of the buffer.
|
||||
//! \retval -1 in error case, otherwise number of read characters.
|
||||
int stm32f4_uart_read(const void *this, char *buffer, int len);
|
||||
|
||||
//! \brief Write to an uart device.
|
||||
//! \param this The uart to write to.
|
||||
//! \param buffer The buffer to write.
|
||||
//! \param len The number of characters to write.
|
||||
//! \retval -1 in error case, otherwise number of written characters.
|
||||
int stm32f4_uart_write(const void *this, const char *buffer, int len);
|
||||
|
||||
//! \brief Set a callback for interrupt handling of the uart.
|
||||
//! \param this The uart.
|
||||
//! \param callback The callback to execute in interrupt case.
|
||||
//! \param param The argument for the callback.
|
||||
//! \retval -1 in error case.
|
||||
int stm32f4_uart_set_cb(const void *this, const void *callback, const void *param);
|
||||
|
||||
static const struct uart_fp stm32f4_uart_fp = {
|
||||
stm32f4_uart_open,
|
||||
stm32f4_uart_close,
|
||||
stm32f4_uart_read,
|
||||
stm32f4_uart_write,
|
||||
stm32f4_uart_set_cb
|
||||
};
|
||||
|
||||
#endif /* SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_UART_STM32_UART_H_ */
|
Reference in New Issue
Block a user