1 #if defined (BOARD_STM32F4_DISCOVERY)
7 #include "stm32/usb/usb_core.h"
10 static void bsp_pwm_leds_init(uint32_t frequency, uint32_t steps, uint32_t initial)
12 const struct gpio_t pins[] =
24 RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
27 RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE);
28 RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE);
40 TIM4->PSC = (((
SystemClock.timer)/steps)/frequency) - 1;
45 TIM4->ARR = steps - 1;
69 void bsp_led_set_pwm(uint32_t
nr, uint32_t value)
73 volatile uint32_t *addr[] =
87 bsp_led_set_pwm(nr, value > 0 ? 255 : 0);
94 volatile uint32_t *addr[] =
118 static status_e bsp_buttons_init(
void)
127 return &bsp_buttons[0];
140 status = bsp_buttons_init();
159 #if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
163 void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev, uint8_t state)
168 void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
172 USB_OTG_BSP_DriveVBUS (pdev, 0);
This file contains all the functions prototypes for the RCC firmware library.
BSP - Board Support Package.
uint8_t nr
Pin number (0 for GPIOx0, ... , 3 for GPIOx3, ...)
void delay_wait_ms(uint32_t ms)
Wait for at least that time.
#define BSP_BUTTON_NR
Number of buttons.
libheivs configuration file
static void gpio_set(const struct gpio_t *gpio, uint32_t value)
Set a gpio.
static uint32_t gpio_get(const struct gpio_t *gpio)
Get gpio level.
#define DEF_GPIOA(__PIN, __MODE)
Helper for defining a pin.
void bsp_led_set(uint32_t nr, uint32_t value)
Set a led (ON or OFF)
void bsp_led_toggle(uint32_t nr)
toggle a led
#define BSP_PWM_LED_STEPS
Lightness correction.
#define DEF_GPIOC(__PIN, __MODE)
same as DEF_GPIOA for port C
struct system_clock_t SystemClock
status_e gpio_setup_list(const struct gpio_t gpio[], size_t len)
Setup an array of gpio.
status_e gpio_setup(const struct gpio_t *gpio)
Setup a gpio.
#define ARRAY_SIZE(x)
Number of elements in the array.
const struct gpio_t * bsp_button_gpios(void)
get buttons gpios
status_e bsp_init(void)
Initialize the whole board.
uint32_t bsp_button_get(uint32_t nr)
Get a button.