universal driver access module

This commit is contained in:
tkl
2016-07-27 16:00:08 +02:00
parent 37214bf716
commit cdb315da32
6 changed files with 200 additions and 29 deletions

View File

@@ -11,6 +11,7 @@
#include <stddef.h>
#include <stdint.h>
#include "driver.h"
#include "gpio.h"
#include "uart.h"
#include "ringbuffer.h"
@@ -19,10 +20,6 @@
#include "stm32f4_uart.h"
#include "stm32_sys_tick.h"
#if 0
#include "usb_vport.h"
#endif
// SYSTEM TICK
static const enum stm32_sys_tick_time_base stm23_sys_tick_time_base =
STM32_SYS_TICK_TIME_BASE_MS;
@@ -37,16 +34,6 @@ static const struct loki_timer timer_1 = {
&timer_fp
};
#if 0
// USB
static const stm32_usb_vport_t stm32_usb_vport;
static const struct uart uart_0 = {
&stm32_usb_vport,
&usb_vport_fp,
&console_buffer
};
#endif
static char console_linear_buffer[80];
static struct ringbuffer console_buffer = {
console_linear_buffer,
@@ -91,15 +78,16 @@ static const struct stm32f4_uart stm32f4_uart1 = {
};
static const struct uart uart_1 = {
static const struct uart __uart_1 = {
&stm32f4_uart1,
&stm32f4_uart_fp,
&console_buffer,
};
// STATUS LED
//! \brief Status Led is forwarded to led 4.
#define led_1 led_4
static const struct driver uart_1 = {
DRIVER_TYPE_UART,
&__uart_1,
};
// LED 3
static const GPIO_InitTypeDef stm32_f4_discovery_led_3_gpio = {
@@ -119,11 +107,16 @@ static const struct stm32f4_gpio stm32_f4_discovery_led_3 = {
NULL
};
static const struct gpio led_3 = {
static const struct gpio __led_3 = {
(void*)&stm32_f4_discovery_led_3,
&gpio_fp
};
static const struct driver led_3 = {
DRIVER_TYPE_GPIO,
&__led_3,
};
// LED 4
static const GPIO_InitTypeDef stm32_f4_discovery_led_4_gpio = {
GPIO_Pin_13,
@@ -142,11 +135,16 @@ static const struct stm32f4_gpio stm32_f4_discovery_led_4 = {
NULL
};
static const struct gpio led_4 = {
static const struct gpio __led_4 = {
(void*)&stm32_f4_discovery_led_4,
&gpio_fp
};
static const struct driver led_4 = {
DRIVER_TYPE_GPIO,
&__led_4,
};
// LED 5
static const GPIO_InitTypeDef stm32_f4_discovery_led_5_gpio = {
GPIO_Pin_14,
@@ -165,11 +163,16 @@ static const struct stm32f4_gpio stm32_f4_discovery_led_5 = {
NULL
};
static const struct gpio led_5 = {
static const struct gpio __led_5 = {
(void*)&stm32_f4_discovery_led_5,
&gpio_fp
};
static const struct driver led_5 = {
DRIVER_TYPE_GPIO,
&__led_5,
};
// LED 6
static const GPIO_InitTypeDef stm32_f4_discovery_led_6_gpio = {
GPIO_Pin_15,
@@ -188,11 +191,16 @@ static const struct stm32f4_gpio stm32_f4_discovery_led_6 = {
NULL
};
static const struct gpio led_6 = {
static const struct gpio __led_6 = {
(void*)&stm32_f4_discovery_led_6,
&gpio_fp
};
static const struct driver led_6 = {
DRIVER_TYPE_GPIO,
&__led_6,
};
// BUTTON
static const GPIO_InitTypeDef stm32_f4_discovery_user_button_gpio = {
GPIO_Pin_0,

View File

@@ -8,6 +8,7 @@
#ifndef SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_UART_STM32_UART_H_
#define SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_UART_STM32_UART_H_
#include "driver.h"
#include "uart.h"
//! \brief Stm32f4 uart device.