console updates

ugfx_release_2.6
Joel Bodenmann 2012-10-13 02:04:20 +02:00
parent da4369c125
commit 166d78c97a
4 changed files with 47 additions and 44 deletions

View File

@ -18,13 +18,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* !!! IMPORTANT !!!
*
* This example dosen't compile yet, there's a problem in the console source.
* This issue will be fixed soon.
*/
/*
* Please add the following to your halconf.h
*
* #define GDISP_NEED_CONSOLE TRUE
* #define GDISP_NEED_SCROLL TRUE
*/
#include "ch.h"
#include "hal.h"
#include "gdisp.h"
#include "chprintf.h"
#include "console.h"
static GLCDConsole CON1;
static GConsole CON1;
int main(void) {
halInit();
@ -34,8 +48,6 @@ int main(void) {
gdispClear(Lime);
lcdConsoleInit(&CON1, 0, 0, gdispGetWidth(), gdispGetHeight(), &fontLarger, Black, White);
chprintf((BaseSequentialStream *)&CON1, "Hello the time is %d\nGoodbye.", chTimeNow());

View File

@ -25,8 +25,9 @@ GDISP macors:
#define GDISP_NEED_TEXT // for font rendering support
#define GDISP_NEED_PIXELREAD // to read a pixels color value back
#define GDISP_NEED_SCROLL // is scrolling is needed (pixel shift)
#define GDISPI_NEED_QUERY // to make certain queries to the LCD controller
#define GDISP_NEED_QUERY // to make certain queries to the LCD controller
#define GDISP_NEED_CONSOLE // for the console abstraction
TouchPad macros:

View File

@ -21,10 +21,8 @@
#ifndef CONSOLE_H
#define CONSOLE_H
#ifdef HAL_USE_GDISP
#ifndef GDISP_NEED_CONSOLE
#define GDISP_NEED_CONSOLE FALSE
#define GDISP_NEED_CONSOLE FALSE
#endif
#if GDISP_NEED_CONSOLE
@ -32,8 +30,32 @@
#include "gdisp.h"
/**
* @brief Structure representing a GConsole driver.
* @extends BaseAsynchronousChannel
*
* @brief GConsole class.
* @details This class extends @p BaseAsynchronousChannel by adding physical
* I/O queues.
*/
typedef struct _GConsole {
/** @brief Virtual Methods Table.*/
const struct GConsoleVMT *vmt;
_base_asynchronous_channel_data
/* WARNING: Do not add any data to this struct above this comment, only below */
/* font */
font_t font;
/* lcd area to use */
coord_t x0,y0;
/* current cursor position, in pixels */
coord_t cx,cy;
/* console size in pixels */
coord_t sx,sy;
/* foreground and background colour */
color_t bkcolor, color;
/* font size in pixels */
uint8_t fy;
/* font inter-character padding in pixels */
uint8_t fp;
} GConsole;
#ifdef __cplusplus
extern "C" {
@ -48,5 +70,6 @@ msg_t lcdConsoleWrite(GConsole *console, const uint8_t *bp, size_t n);
#endif
#endif /* GDISP_NEED_CONSOLE */
#endif /* HAL_USE_GDISP */
#endif /* CONSOLE_H */

View File

@ -18,11 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if GDISP_NEED_CONSOLE
#include "ch.h"
#include "hal.h"
#include "console.h"
/**
@ -34,34 +31,6 @@ struct GConsoleVMT {
_base_asynchronous_channel_methods
};
/**
* @extends BaseAsynchronousChannel
*
* @brief GConsole class.
* @details This class extends @p BaseAsynchronousChannel by adding physical
* I/O queues.
*/
typedef struct _GConsole {
/** @brief Virtual Methods Table.*/
const struct GConsoleVMT *vmt;
_base_asynchronous_channel_data
/* WARNING: Do not add any data to this struct above this comment, only below */
/* font */
font_t font;
/* lcd area to use */
coord_t x0,y0;
/* current cursor position, in pixels */
coord_t cx,cy;
/* console size in pixels */
coord_t sx,sy;
/* foreground and background colour */
color_t bkcolor, color;
/* font size in pixels */
uint8_t fy;
/* font inter-character padding in pixels */
uint8_t fp;
} GConsole;
/*
* Interface implementation. The interface is write only
*/
@ -154,7 +123,7 @@ msg_t lcdConsoleInit(GConsole *console, coord_t x0, coord_t y0, coord_t width, c
return RDY_OK;
}
msg_t lcdConsolePut(GLCDConsole *console, char c) {
msg_t lcdConsolePut(GConsole *console, char c) {
uint8_t width;
if(c == '\n') {
@ -208,7 +177,7 @@ msg_t lcdConsolePut(GLCDConsole *console, char c) {
return RDY_OK;
}
msg_t lcdConsoleWrite(GLCDConsole *console, const uint8_t *bp, size_t n) {
msg_t lcdConsoleWrite(GConsole *console, const uint8_t *bp, size_t n) {
size_t i;
for(i = 0; i < n; i++)
lcdConsolePut(console, bp[i]);
@ -216,5 +185,3 @@ msg_t lcdConsoleWrite(GLCDConsole *console, const uint8_t *bp, size_t n) {
return RDY_OK;
}
#endif /* GDISP_NEED_CONSOLE */