Fixed misplacement of prototypes in ll_tft.h and implemented a propper init function.
This commit is contained in:
@@ -3,16 +3,6 @@
|
||||
|
||||
// init functions
|
||||
bool ll_tft_init();
|
||||
bool ll_fsmc_init();
|
||||
bool ll_gpio_init();
|
||||
|
||||
// display control functions
|
||||
void ll_tft_write_reg(uint8_t reg_adr, uint16_t reg_value);
|
||||
uint16_t ll_tft_read_reg(uint8_t reg_adr);
|
||||
|
||||
// fsmc functions
|
||||
|
||||
// gpio functions
|
||||
|
||||
// draw functions
|
||||
void ll_tft_clear(uint16_t color);
|
||||
|
||||
@@ -8,14 +8,10 @@
|
||||
#include "usbh_core.h"
|
||||
#include "usbh_msc_core.h"
|
||||
|
||||
|
||||
|
||||
|
||||
USB_OTG_CORE_HANDLE USB_OTG_Core;
|
||||
USBH_HOST USB_Host;
|
||||
RCC_ClocksTypeDef RCC_Clocks;
|
||||
|
||||
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
USBH_LL_systick();
|
||||
@@ -26,13 +22,11 @@ void TIM2_IRQHandler(void)
|
||||
USB_OTG_BSP_TimerIRQ();
|
||||
}
|
||||
|
||||
|
||||
void OTG_FS_IRQHandler(void)
|
||||
{
|
||||
USBH_OTG_ISR_Handler(&USB_OTG_Core);
|
||||
}
|
||||
|
||||
|
||||
bool ll_system_init(void)
|
||||
{
|
||||
/* Initialize LEDS */
|
||||
@@ -59,13 +53,10 @@ void ll_system_process() {
|
||||
USBH_Process(&USB_OTG_Core, &USB_Host);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ll_system_delay(uint32_t msec) {
|
||||
USB_OTG_BSP_mDelay(msec);
|
||||
}
|
||||
|
||||
|
||||
void ll_system_toggle_led() {
|
||||
STM_EVAL_LEDToggle(LED6);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,23 @@
|
||||
#include "stm32f4xx_rcc.h"
|
||||
#include "stm32f4xx_fsmc.h"
|
||||
|
||||
/*
|
||||
* ---------------------- prototypes --------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// init functions
|
||||
bool ll_fsmc_init();
|
||||
bool ll_gpio_init();
|
||||
bool ll_display_init();
|
||||
|
||||
// display control functions
|
||||
void ll_tft_write_reg(uint8_t reg_adr, uint16_t reg_value);
|
||||
uint16_t ll_tft_read_reg(uint8_t reg_adr);
|
||||
|
||||
/*
|
||||
* ---------------------- defines and makros ------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Colors
|
||||
#define DISPLAY_COLOR_BLACK 0x0000
|
||||
#define DISPLAY_COLOR_BLUE 0x001F
|
||||
@@ -71,6 +85,24 @@
|
||||
*/
|
||||
|
||||
bool ll_tft_init()
|
||||
{
|
||||
bool gpio, fsmc, display;
|
||||
|
||||
// init gpio
|
||||
gpio = ll_gpio_init();
|
||||
// delay
|
||||
system_delay(TFT_INIT_TIMEOUT);
|
||||
// init fsmc
|
||||
fsmc = ll_fsmc_init();
|
||||
// delay
|
||||
system_delay(TFT_INIT_TIMEOUT);
|
||||
// init display
|
||||
display = ll_display_init();
|
||||
|
||||
return (gpio & fsmc & display);
|
||||
}
|
||||
|
||||
bool ll_display_init()
|
||||
{
|
||||
ll_tft_write_reg(0x0007,0x0021);
|
||||
system_delay(TFT_INIT_TIMEOUT);
|
||||
|
||||
Reference in New Issue
Block a user