gpio toggle works

This commit is contained in:
tkl
2016-08-15 22:25:35 +02:00
parent 067dd1d3e5
commit 073f5093dd
16 changed files with 99 additions and 593 deletions

View File

@@ -6,25 +6,48 @@
#ifndef BSP_STM32F4_DISCOVERY_H_
#define BSP_STM32F4_DISCOVERY_H_
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#include <stddef.h>
#include <stdint.h>
#include "driver.h"
#include "gpio.h"
#if 0
#include "../../../../../kernel/include/sys_tick.h"
#include "../../../driver/include/stm32_sys_tick.h"
#include "../../../driver/include/stm32f4_pwm.h"
#include "../../../driver/include/stm32f4_uart.h"
#include "pwm.h"
#include "timer.h"
#include "uart.h"
#include "ringbuffer.h"
#include "sys_tick.h"
#endif
#include "stm32f4xx.h"
#include "gpio.h"
#include "stm32f4_gpio.h"
#include "stm32f4_pwm.h"
#include "stm32f4_uart.h"
#include "stm32_sys_tick.h"
#include "driver.h"
// GPIO_D12
static const GPIO_InitTypeDef port_cfg_d12 = {
.Pin = GPIO_PIN_12,
.Mode = GPIO_MODE_OUTPUT_PP,
.Speed = GPIO_SPEED_FREQ_HIGH,
.Pull = GPIO_PULLUP,
};
static const struct stm32f4_gpio stm32_f4_gpio_d12 = {
.port = GPIOD,
.pin = &port_cfg_d12,
};
static const struct gpio __gpio_d12 = {
(void*)&stm32_f4_gpio_d12,
&gpio_fp
};
const struct driver gpio_d12 = {
DRIVER_TYPE_GPIO,
&__gpio_d12,
};
#if 0
// SYSTEM TICK
static const enum stm32_sys_tick_time_base stm23_sys_tick_time_base =
STM32_SYS_TICK_TIME_BASE_MS;
@@ -38,7 +61,8 @@ static const struct loki_timer timer_1 = {
(void*)&stm32_sys_tick,
&timer_fp
};
#endif
#if 0
// PWM CHANNEL 4
/* apb1 clock = 84MHz */
/* period_reg = src_clk / presc / cnt_clk */
@@ -93,7 +117,8 @@ const struct driver pwm_4 = {
DRIVER_TYPE_PWM,
&pwm_ch4,
};
#endif
#if 0
// PWM Channel 3
static const GPIO_InitTypeDef port_cfg_D14 = {
.GPIO_Pin = GPIO_Pin_14,
@@ -126,7 +151,8 @@ const struct driver pwm_3 = {
DRIVER_TYPE_PWM,
&pwm_ch3,
};
#endif
#if 0
// PWM Channel 2
static const GPIO_InitTypeDef port_cfg_D13 = {
.GPIO_Pin = GPIO_Pin_13,
@@ -159,7 +185,8 @@ const struct driver pwm_2 = {
DRIVER_TYPE_PWM,
&pwm_ch2,
};
#endif
#if 0
// PWM Channel 1
static const GPIO_InitTypeDef port_cfg_D12 = {
.GPIO_Pin = GPIO_Pin_12,
@@ -192,7 +219,8 @@ const struct driver pwm_1 = {
DRIVER_TYPE_PWM,
&pwm_ch1,
};
#endif
#if 0
// UART 1
static char console_linear_buffer[80];
static struct ringbuffer console_buffer = {
@@ -252,7 +280,8 @@ const struct driver uart_1 = {
DRIVER_TYPE_UART,
&__uart_1,
};
#endif
#if 0
// GPIOC0
static const GPIO_InitTypeDef port_cfg_C0 = {
GPIO_Pin_0,
@@ -284,7 +313,8 @@ const struct driver gpio_c0 = {
DRIVER_TYPE_GPIO,
&__gpio_c0,
};
#endif
#if 0
// GPIO_C1
static const GPIO_InitTypeDef port_cfg_C1 = {
GPIO_Pin_1,
@@ -316,7 +346,8 @@ const struct driver gpio_c1 = {
DRIVER_TYPE_GPIO,
&__gpio_c1,
};
#endif
#if 0
// GPIO_C2
static const GPIO_InitTypeDef port_cfg_C2 = {
GPIO_Pin_2,
@@ -348,7 +379,8 @@ const struct driver gpio_c2 = {
DRIVER_TYPE_GPIO,
&__gpio_c2,
};
#endif
#if 0
// GPIO_C3
static const GPIO_InitTypeDef port_cfg_C3 = {
GPIO_Pin_3,
@@ -380,7 +412,7 @@ const struct driver gpio_c3 = {
DRIVER_TYPE_GPIO,
&__gpio_c3,
};
#endif
//! \brief Setup the hardware of the stm32f4-discovery board.
void board_init(void);