Fix license issues and GOS issues in TDISP

ugfx_release_2.6
inmarket 2013-06-02 18:58:12 +10:00
parent 1c258a8273
commit e9f60dae38
8 changed files with 85 additions and 198 deletions

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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.c * @file drivers/tdisp/HD44780/tdisp_lld.c
@ -26,11 +13,9 @@
* @{ * @{
*/ */
#include "ch.h"
#include "hal.h"
#include "gfx.h" #include "gfx.h"
#if GFX_USE_TDISP || defined(__DOXYGEN__) #if GFX_USE_TDISP /*|| defined(__DOXYGEN__)*/
/* check first if the user has defined his/her own lowlevel-board file */ /* check first if the user has defined his/her own lowlevel-board file */
#if defined(TDISP_USE_CUSTOM_BOARD) && TDISP_USE_CUSTOM_BOARD #if defined(TDISP_USE_CUSTOM_BOARD) && TDISP_USE_CUSTOM_BOARD
@ -82,7 +67,7 @@ bool_t tdisp_lld_init(void) {
*/ */
/* Give the LCD a little time to wake up */ /* Give the LCD a little time to wake up */
chThdSleepMilliseconds(15); gfxSleepMilliseconds(15);
/* clear the RS-line to the display */ /* clear the RS-line to the display */
palClearPad(PORT_CTRL, PIN_RS); palClearPad(PORT_CTRL, PIN_RS);
@ -91,16 +76,16 @@ bool_t tdisp_lld_init(void) {
* with RS = low. * with RS = low.
*/ */
writeToLCD(0x03); // 1x writeToLCD(0x03); // 1x
chThdSleepMilliseconds(20); gfxSleepMilliseconds(20);
writeToLCD(0x03); // 2x writeToLCD(0x03); // 2x
// chThdSleepMilliseconds(20); // gfxSleepMilliseconds(20);
writeToLCD(0x03); // 3x writeToLCD(0x03); // 3x
// chThdSleepMilliseconds(20); // gfxSleepMilliseconds(20);
/* Put display in 4-bit mode by /* Put display in 4-bit mode by
* write 0x02 to display. * write 0x02 to display.
*/ */
writeToLCD(0x02); // 4bit-modus writeToLCD(0x02); // 4bit-modus
// chThdSleepMilliseconds(20); // gfxSleepMilliseconds(20);
// #else // #else
/* write three times 0x30 to display (8-bit mode only) /* write three times 0x30 to display (8-bit mode only)
* with RS = low. * with RS = low.
@ -118,14 +103,14 @@ bool_t tdisp_lld_init(void) {
/* 4-bit modus, 2 lines en 5x7 characters */ /* 4-bit modus, 2 lines en 5x7 characters */
write_cmd(0x28); write_cmd(0x28);
// chThdSleepMilliseconds(20); // gfxSleepMilliseconds(20);
/* set display on, cursor off and no blinking */ /* set display on, cursor off and no blinking */
write_cmd(0x0C); write_cmd(0x0C);
// chThdSleepMilliseconds(20); // gfxSleepMilliseconds(20);
/* set cursor increase and direction */ /* set cursor increase and direction */
write_cmd(0x06); write_cmd(0x06);
// chThdSleepMilliseconds(20); // gfxSleepMilliseconds(20);
displaycontrol = TDISP_DISPLAY_ON; displaycontrol = TDISP_DISPLAY_ON;
cursorcontrol = TDISP_CURSOR_INC; cursorcontrol = TDISP_CURSOR_INC;
@ -252,7 +237,7 @@ void tdisp_lld_scroll(uint16_t direction, uint16_t amount, uint16_t delay) {
for(i = 0; i < amount; i++) { for(i = 0; i < amount; i++) {
write_cmd(0x10 | scrollcontrol); write_cmd(0x10 | scrollcontrol);
chThdSleepMilliseconds(delay); gfxSleepMilliseconds(delay);
} }
} }

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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_example.h * @file drivers/tdisp/HD44780/tdisp_lld_board_example.h

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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_olimex_e407.h * @file drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h
@ -46,9 +33,9 @@ static void init_board(void) {
static void writeToLCD(uint8_t data) { static void writeToLCD(uint8_t data) {
palWritePort(PORT_DATA, data); palWritePort(PORT_DATA, data);
palSetPad(PORT_CTRL, PIN_EN); palSetPad(PORT_CTRL, PIN_EN);
chThdSleepMicroseconds(1); gfxSleepMicroseconds(1);
palClearPad(PORT_CTRL, PIN_EN); palClearPad(PORT_CTRL, PIN_EN);
chThdSleepMicroseconds(5); gfxSleepMicroseconds(5);
} }
static void write_cmd(uint8_t data) { static void write_cmd(uint8_t data) {

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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_st_stm32f4_discovery.h * @file drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h
@ -82,10 +69,10 @@ static void init_board(void) {
static void writeToLCD(uint8_t data) { static void writeToLCD(uint8_t data) {
palWritePort(PORT_DATA, data<<hardware_offset); palWritePort(PORT_DATA, data<<hardware_offset);
palSetPad(PORT_CTRL, PIN_EN); palSetPad(PORT_CTRL, PIN_EN);
chThdSleepMicroseconds(1); gfxSleepMicroseconds(1);
palClearPad(PORT_CTRL, PIN_EN); palClearPad(PORT_CTRL, PIN_EN);
/* wait a little while so that de display can process the data */ /* wait a little while so that de display can process the data */
chThdSleepMicroseconds(5); gfxSleepMicroseconds(5);
} }
/* Writes a command to the display. The /* Writes a command to the display. The

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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 include/tdisp/lld/tdisp_lld.h * @file include/tdisp/lld/tdisp_lld.h

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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 include/tdisp/options.h * @file include/tdisp/options.h

View File

@ -1,31 +1,18 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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 include/tdisp/tdisp.h * @file include/tdisp/tdisp.h
* @brief TDISP Graphic Driver subsystem header file. * @brief TDISP Graphic Driver subsystem header file.
* *
* @addtogroup TDISP * @addtogroup TDISP
* *
* @details The TDISP module provides high level abstraction to interface pixel oriented graphic displays. * @details The TDISP module provides high level abstraction to interface pixel oriented graphic displays.
* Due the TDISP module is completely encapsulated from the other modules, it's very fast and lightweight. * Due the TDISP module is completely encapsulated from the other modules, it's very fast and lightweight.
* *
* @pre GFX_USE_TDISP must be set to TRUE in gfxconf.h * @pre GFX_USE_TDISP must be set to TRUE in gfxconf.h
* *
@ -38,10 +25,9 @@
#include "gfx.h" #include "gfx.h"
#if GFX_USE_TDISP || defined(__DOXYGEN__) #if GFX_USE_TDISP || defined(__DOXYGEN__)
#include <sys/types.h>
/** /**
* @brief TDISP cursor shape definitions * @brief TDISP cursor shape definitions
*/ */
typedef enum cursorshape_e { typedef enum cursorshape_e {
cursorOff, cursorOff,
@ -124,7 +110,7 @@ typedef struct tdispStruct_t {
} tdispStruct; } tdispStruct;
/** /**
* @brief The TDISP structure * @brief The TDISP structure
*/ */
extern tdispStruct TDISP; extern tdispStruct TDISP;
@ -133,11 +119,11 @@ extern "C" {
#endif #endif
/** /**
* @brief TDISP driver initialisation * @brief TDISP driver initialisation
* @note This function is not implicitly invoked by @p halInit(). * @note This function is not implicitly invoked by @p halInit().
* It must be called manually. * It must be called manually.
* *
* @return TRUE if success, FALSE otherwise * @return TRUE if success, FALSE otherwise
* *
* @init * @init
*/ */
@ -151,12 +137,12 @@ bool_t tdispInit(void);
void tdispClear(void); void tdispClear(void);
/** /**
* @brief Sets the cursor to it's home position ( 0, 0 ) * @brief Sets the cursor to it's home position ( 0, 0 )
*/ */
void tdispHome(void); void tdispHome(void);
/** /**
* @brief Set cursor to a specified position * @brief Set cursor to a specified position
* *
* @param[in] col The column (x) * @param[in] col The column (x)
* @param[in] row The row (y) * @param[in] row The row (y)
@ -164,36 +150,36 @@ void tdispHome(void);
void tdispSetCursor(coord_t col, coord_t row); void tdispSetCursor(coord_t col, coord_t row);
/** /**
* @brief Store a custom character into the display * @brief Store a custom character into the display
* *
* @note This usually must be done after each power-up since most * @note This usually must be done after each power-up since most
* LCDs lose their RAM content. * LCDs lose their RAM content.
* *
* @param[in] address On which address to store the character from 0 up to (@p tdispGetNumCustomChars() - 1) * @param[in] address On which address to store the character from 0 up to (@p tdispGetNumCustomChars() - 1)
* @param[in] charmap The character to be stored. * @param[in] charmap The character to be stored.
* *
* @note The charmap is made up of @p tdispGetCharBitHieght() data values. Each data value is * @note The charmap is made up of @p tdispGetCharBitHieght() data values. Each data value is
* made up of @p tdispGetCharBitWidth() bits of data. Note that bits in multiple rows are not * made up of @p tdispGetCharBitWidth() bits of data. Note that bits in multiple rows are not
* packed. * packed.
*/ */
void tdispCreateChar(uint8_t address, uint8_t *charmap); void tdispCreateChar(uint8_t address, uint8_t *charmap);
/** /**
* @brief Draws a single character at the current cursor position and advances the cursor * @brief Draws a single character at the current cursor position and advances the cursor
* *
* @param[in] c The character to be drawn * @param[in] c The character to be drawn
* *
* @note Writing past the end of a row leaves the cursor in an undefined position. * @note Writing past the end of a row leaves the cursor in an undefined position.
*/ */
void tdispDrawChar(char c); void tdispDrawChar(char c);
/** /**
* @brief Draws a string at the current cursor position and advances the cursor * @brief Draws a string at the current cursor position and advances the cursor
* *
* @param[in] s The string to be drawn * @param[in] s The string to be drawn
* *
* @note Any characters written past the end of a row may or may not be displayed on * @note Any characters written past the end of a row may or may not be displayed on
* the next row. The cursor is also left in an undefined position. * the next row. The cursor is also left in an undefined position.
*/ */
void tdispDrawString(char *s); void tdispDrawString(char *s);

View File

@ -1,22 +1,9 @@
/* /*
ChibiOS/GFX - Copyright (C) 2012, 2013 * This file is subject to the terms of the GFX License, v1.0. If a copy of
Joel Bodenmann aka Tectu <joel@unormal.org> * the license was not distributed with this file, you can obtain one at:
*
This file is part of ChibiOS/GFX. * http://chibios-gfx.com/license.html
*/
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 src/tdisp/tdisp.c * @file src/tdisp/tdisp.c
@ -25,29 +12,23 @@
* @addtogroup TDISP * @addtogroup TDISP
* @{ * @{
*/ */
#include "ch.h"
#include "hal.h"
#include "gfx.h" #include "gfx.h"
#if GFX_USE_TDISP || defined(__DOXYGEN__) #if GFX_USE_TDISP || defined(__DOXYGEN__)
#include "../../include/tdisp/lld/tdisp_lld.h" #include "tdisp/lld/tdisp_lld.h"
/* cursor controllers */ /* cursor controllers */
#define CURSOR 1 #define TDISP_CURSOR 1
#define ON 0 #define TDISP_CURSOR_ON 0
#define OFF #define TDISP_CURSOR_OFF
#if TDISP_NEED_MULTITHREAD #if TDISP_NEED_MULTITHREAD
#if !CH_USE_MUTEXES static gfxMutex tdispMutex;
#error "TDISP: CH_USE_MUTEXES must be defined in chconf.h because TDISP_NEED_MULTITHREAD is defined"
#endif
static Mutex tdispMutex; #define MUTEX_INIT() gfxMutexInit(&tdispMutex)
#define MUTEX_ENTER() gfxMutexEnter(&tdispMutex)
#define MUTEX_INIT() chMtxInit(&tdispMutex) #define MUTEX_LEAVE() gfxMutexExit(&tdispMutex)
#define MUTEX_ENTER() chMtxLock(&tdispMutex)
#define MUTEX_LEAVE() chMtxUnlock()
#else #else