diff options
author | Joel Bodenmann <joel@unormal.org> | 2012-10-13 02:04:20 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2012-10-13 02:04:20 +0200 |
commit | 166d78c97aa237a076b2f003dc51b535722d58c3 (patch) | |
tree | 7cd54637c21e332c733c74217c5b8e4c12d0643e | |
parent | da4369c12571916632d806655a507d21a18c2934 (diff) | |
download | uGFX-166d78c97aa237a076b2f003dc51b535722d58c3.tar.gz uGFX-166d78c97aa237a076b2f003dc51b535722d58c3.tar.bz2 uGFX-166d78c97aa237a076b2f003dc51b535722d58c3.zip |
console updates
-rw-r--r-- | demos/console/main.c | 18 | ||||
-rw-r--r-- | docs/configure.txt | 3 | ||||
-rw-r--r-- | include/console.h | 33 | ||||
-rw-r--r-- | src/console.c | 37 |
4 files changed, 47 insertions, 44 deletions
diff --git a/demos/console/main.c b/demos/console/main.c index 7dc90f79..ea27c727 100644 --- a/demos/console/main.c +++ b/demos/console/main.c @@ -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());
diff --git a/docs/configure.txt b/docs/configure.txt index f108afcb..15380e16 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -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:
diff --git a/include/console.h b/include/console.h index 7b543013..d154d9d0 100644 --- a/include/console.h +++ b/include/console.h @@ -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 */
+
diff --git a/src/console.c b/src/console.c index 4739c53c..b13f27f6 100644 --- a/src/console.c +++ b/src/console.c @@ -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 */
-
|