Fixed misplacement of prototypes in ll_tft.h and implemented a propper init function.

This commit is contained in:
id101010
2015-04-27 21:26:20 +02:00
parent f0a6c3b4eb
commit 0b61f21e7b
3 changed files with 33 additions and 20 deletions

View File

@@ -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
@@ -70,7 +84,25 @@
* ---------------------- init functions ----------------------------------------------------------
*/
bool ll_tft_init()
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);