1 #if defined (BOARD_STM32F4_DISCOVERY_LCD)
7 #include "stm32/usb/usb_core.h"
13 static struct gpio_t sram_gpios[] =
55 GPIO_FSMC_NE1_FSMC_NCE2_PD7,
66 RCC_AHB3PeriphClockCmd(RCC_AHB3ENR_FSMCEN, ENABLE);
100 FSMC_NORSRAMInit(&fscm);
101 FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
106 static status_e bsp_pwm_leds_init(uint32_t frequency, uint32_t steps, uint32_t initial)
108 static void bsp_pwm_leds_init(uint32_t frequency, uint32_t steps, uint32_t initial)
111 const struct gpio_t pins[] =
123 RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
126 RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE);
127 RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE);
139 TIM4->PSC = (((
SystemClock.timer)/steps)/frequency) - 1;
144 TIM4->ARR = steps - 1;
147 TIM4->CCR1 = initial;
148 TIM4->CCR2 = initial;
149 TIM4->CCR3 = initial;
150 TIM4->CCR4 = initial;
168 void bsp_led_set_pwm(uint32_t
nr, uint32_t value)
172 volatile uint32_t *addr[] =
187 bsp_led_set_pwm(nr, value > 0 ? 255 : 0);
194 volatile uint32_t *addr[] =
218 static status_e bsp_buttons_init(
void)
225 static status_e bsp_lcd_backlight_init(uint32_t frequency, uint32_t steps, uint32_t initial)
227 const struct gpio_t pins[] =
236 RCC_APB2PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
248 TIM4->PSC = (((
SystemClock.timer)/steps)/frequency) - 1;
253 TIM4->ARR = steps - 1;
256 TIM4->CCR2 = steps-initial;
285 bsp_pwm_leds_init(50, 1000, 150);
302 status = bsp_buttons_init();
321 #if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
325 void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev, uint8_t state)
330 void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
334 USB_OTG_BSP_DriveVBUS (pdev, 0);
This file contains all the functions prototypes for the RCC firmware library.
uint32_t FSMC_DataSetupTime
uint32_t FSMC_WriteOperation
uint32_t FSMC_DataAddressMux
BSP - Board Support Package.
uint8_t nr
Pin number (0 for GPIOx0, ... , 3 for GPIOx3, ...)
Handle non-linearity in human eye brightness sensitivity.
uint32_t FSMC_WaitSignalActive
void delay_wait_ms(uint32_t ms)
Wait for at least that time.
#define BSP_BUTTON_NR
Number of buttons.
Timing parameters For NOR/SRAM Banks.
uint32_t FSMC_AsynchronousWait
void bsp_lcd_backlight_set(uint32_t value)
Set the brightness of the backlight.
FSMC NOR/SRAM Init structure definition.
libheivs configuration file
uint8_t lightness_to_pwm(uint8_t percentage)
PWM value for driving a LED expressed as perceived percentage.
FSMC_NORSRAMTimingInitTypeDef * FSMC_WriteTimingStruct
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.
uint32_t FSMC_AddressHoldTime
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
uint32_t FSMC_WaitSignalPolarity
FSMC_NORSRAMTimingInitTypeDef * FSMC_ReadWriteTimingStruct
uint32_t FSMC_CLKDivision
This file contains all the functions prototypes for the FSMC firmware library.
uint32_t FSMC_DataLatency
#define LIGHTNESS_PWM_STEP
Number a step for a pwm using lightness_to_pwm.
uint32_t FSMC_AddressSetupTime
uint32_t FSMC_BurstAccessMode
uint32_t FSMC_BusTurnAroundDuration
struct system_clock_t SystemClock
#define BSP_LED_NR
Number of LEDs.
uint32_t FSMC_MemoryDataWidth
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.
uint32_t FSMC_ExtendedMode
status_e bsp_init(void)
Initialize the whole board.
uint32_t bsp_button_get(uint32_t nr)
Get a button.