TDISP update
This commit is contained in:
parent
bdf79ec9ad
commit
100d686f94
5 changed files with 85 additions and 13 deletions
|
@ -33,14 +33,12 @@
|
||||||
#if GFX_USE_TDISP /*|| defined(__DOXYGEN__)*/
|
#if GFX_USE_TDISP /*|| defined(__DOXYGEN__)*/
|
||||||
|
|
||||||
/* Include the hardware interface details */
|
/* Include the hardware interface details */
|
||||||
#if defined(TDISP_USE_CUSTOM_BOARD) && TDISP_USE_CUSTOM_BOARD
|
#if defined(BOARD_OLIMEX_STM32_E407)
|
||||||
/* Include the user supplied board definitions */
|
#include "tdisp_lld_board_olimex_e407.h"
|
||||||
#include "tdisp_lld_board.h"
|
#elif defined(BOARD_ST_STM32F4_DISCOVERY)
|
||||||
#elif defined(BOARD_UNKNOWN)
|
#include "tdisp_lld_board_st_stm32f4_discovery.h"
|
||||||
#include "gdisp_lld_board_unknown.h"
|
|
||||||
#else
|
#else
|
||||||
/* Include the user supplied board definitions */
|
#include "tdisp_lld_board_example.h"
|
||||||
#include "gdisp_lld_board.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The user may override the default display size */
|
/* The user may override the default display size */
|
||||||
|
@ -58,10 +56,10 @@
|
||||||
|
|
||||||
/* Define the properties of our controller */
|
/* Define the properties of our controller */
|
||||||
tdispStruct TDISP = {
|
tdispStruct TDISP = {
|
||||||
TDISP_COLUMNS, TDISP_ROWS, /* cols, rows */
|
TDISP_COLUMNS, TDISP_ROWS, /* cols, rows */
|
||||||
CUSTOM_CHAR_XBITS, CUSTOM_CHAR_YBITS, /* charBitsX, charBitsY */
|
CUSTOM_CHAR_XBITS, CUSTOM_CHAR_YBITS, /* charBitsX, charBitsY */
|
||||||
CUSTOM_CHAR_COUNT /* maxCustomChars */
|
CUSTOM_CHAR_COUNT /* maxCustomChars */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Our display control */
|
/* Our display control */
|
||||||
#define DISPLAY_ON 0x04
|
#define DISPLAY_ON 0x04
|
||||||
|
|
|
@ -59,3 +59,4 @@ static void write_data(uint8_t data) {
|
||||||
|
|
||||||
#endif /* _TDISP_LLD_BOARD_H */
|
#endif /* _TDISP_LLD_BOARD_H */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -69,3 +69,4 @@ static void write_data(uint8_t data) {
|
||||||
|
|
||||||
#endif /* _TDISP_LLD_BOARD_H */
|
#endif /* _TDISP_LLD_BOARD_H */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
72
drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
Normal file
72
drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
||||||
|
ChibiOS/GFX is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/GFX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file drivers/tdisp/HD44780/tdisp_lld_board_unknown.h
|
||||||
|
* @brief TDISP driver subsystem board interface for the HD44780 display
|
||||||
|
*
|
||||||
|
* @addtogroup TDISP
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TDISP_LLD_BOARD_H
|
||||||
|
#define _TDISP_LLD_BOARD_H
|
||||||
|
|
||||||
|
/* Configure these to match the hardware connections on your board */
|
||||||
|
#define BUS_4BITS FALSE
|
||||||
|
#define PORT_DATA GPIOG
|
||||||
|
#define PORT_CTRL GPIOE
|
||||||
|
#define PIN_RS 0
|
||||||
|
#define PIN_RW 1
|
||||||
|
#define PIN_EN 2
|
||||||
|
|
||||||
|
static void init_board(void) {
|
||||||
|
palSetGroupMode(PORT_CTRL, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetGroupMode(PORT_DATA, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palClearPad(PORT_CTRL, PIN_RW);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void writeToLCD(uint8_t data) {
|
||||||
|
palWritePort(PORT_DATA, data);
|
||||||
|
palSetPad(PORT_CTRL, PIN_EN);
|
||||||
|
chThdSleepMicroseconds(1);
|
||||||
|
palClearPad(PORT_CTRL, PIN_EN);
|
||||||
|
chThdSleepMicroseconds(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_cmd(uint8_t data) {
|
||||||
|
palClearPad(PORT_CTRL, PIN_RS);
|
||||||
|
#if BUS_4BITS
|
||||||
|
writeToLCD(data>>4);
|
||||||
|
#endif
|
||||||
|
writeToLCD(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_data(uint8_t data) {
|
||||||
|
palSetPad(PORT_CTRL, PIN_RS);
|
||||||
|
#if BUS_4BITS
|
||||||
|
writeToLCD(data>>4);
|
||||||
|
#endif
|
||||||
|
writeToLCD(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _TDISP_LLD_BOARD_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -50,7 +50,7 @@ typedef enum cursorshape_e {
|
||||||
cursorBlinkingUnderline,
|
cursorBlinkingUnderline,
|
||||||
cursorBar,
|
cursorBar,
|
||||||
cursorBlinkingBar,
|
cursorBlinkingBar,
|
||||||
} cursorshape;
|
} cursorshape;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name TDISP control values
|
* @name TDISP control values
|
||||||
|
@ -68,7 +68,7 @@ typedef struct tdispStruct_t {
|
||||||
coord_t columns, rows;
|
coord_t columns, rows;
|
||||||
coord_t charBitsX, charBitsY;
|
coord_t charBitsX, charBitsY;
|
||||||
uint16_t maxCustomChars;
|
uint16_t maxCustomChars;
|
||||||
} tdispStruct;
|
} tdispStruct;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The TDISP structure
|
* @brief The TDISP structure
|
||||||
|
|
Loading…
Add table
Reference in a new issue