See v1.0.0 changelog
authorKevin Townsend <kevin@ktownsend.com>
Sat, 17 Mar 2012 15:37:22 +0000 (16:37 +0100)
committerKevin Townsend <kevin@ktownsend.com>
Sat, 17 Mar 2012 15:37:22 +0000 (16:37 +0100)
ChangeLog.txt
Makefile
core/cmd/cmd.c
core/libc/ctype.c [deleted file]
core/libc/stdio.c
drivers/displays/tft/dialogues/alphanumeric.c
drivers/displays/tft/drawing.c
drivers/displays/tft/drawing.h
drivers/displays/tft/hw/ssd1351.c
project/commands/drawing/cmd_button.c
sysinit.c

index 11a6ca0..4e95f7e 100644 (file)
@@ -5,6 +5,13 @@ v1.0.0 - Ongoing
 - *** Renamed '/drivers/spiflash' to '/drivers/storage/spiflash' ***
 - *** Renamed '/drivers/eeprom' to '/drivers/storage/eeprom' ***
 - *** Renamed '/drivers/lcd' to '/drivers/display' ***
+- Removed height parameter from drawButton.  It's now
+  calculated based on the font height, and centered.
+- Added bell to CLI when backspace is pressed beyond
+  the starting position (cosmetic, but still useful)
+- Removed dependency on /core/libc files in Crossworks
+  when redirecting printf (added printf replacement
+  to sysinit.c)
 - Added basic AS1115 driver for segment displays
 - Added driver for HX8340-B based LCDs
 - Added flag to projectconfig.h to disable the default
index c5ef352..9ded9b6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -124,10 +124,11 @@ OBJS += w25q16bv.o
 
 VPATH += core core/adc core/cmd core/cpu core/gpio core/i2c core/pmu
 VPATH += core/ssp core/systick core/timer16 core/timer32 core/uart
-VPATH += core/usbhid-rom core/libc core/wdt core/usbcdc core/pwm
-VPATH += core/iap
+VPATH += core/usbhid-rom core/wdt core/usbcdc core/pwm core/iap
+VPATH += core/libc
+OBJS += stdio.o string.o
 OBJS += adc.o cpu.o cmd.o gpio.o i2c.o pmu.o ssp.o systick.o timer16.o
-OBJS += timer32.o uart.o uart_buf.o usbconfig.o usbhid.o stdio.o string.o
+OBJS += timer32.o uart.o uart_buf.o usbconfig.o usbhid.o
 OBJS += wdt.o cdcuser.o cdc_buf.o usbcore.o usbdesc.o usbhw.o usbuser.o 
 OBJS += sysinit.o pwm.o iap.o
 
index 36c55fc..2277f07 100644 (file)
@@ -139,7 +139,12 @@ void cmdRx(uint8_t c)
         #if CFG_INTERFACE_SILENTMODE == 0
         printf("%c",c);
         #endif
-        if (msg_ptr > msg)
+        if (msg_ptr == msg)
+        {
+            // Send bell alert and space (to maintain position)
+            printf("\a ");
+        }
+        else if (msg_ptr > msg)
         {
             msg_ptr--;
         }
diff --git a/core/libc/ctype.c b/core/libc/ctype.c
deleted file mode 100644 (file)
index 086065e..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * This file is part of the libpayload project.
- *
- * Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-int isalpha(int c)
-{
-       return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
-}
-
-int isascii(int c)
-{
-       return (c >= 0 && c <= 127);
-}
-
-int isblank(int c)
-{
-       return (c == ' ' || c == '\t');
-}
-
-int iscntrl(int c)
-{
-       return (c <= 31 || c == 127);
-}
-
-int isdigit(int c)
-{
-       return (c >= '0' && c <= '9');
-}
-
-int isalnum(int c)
-{
-       return isalpha(c) || isdigit(c);
-}
-
-int isgraph(int c)
-{
-       return (c >= 33 && c <= 126);
-}
-
-int islower(int c)
-{
-       return (c >= 'a' && c <= 'z');
-}
-
-int isprint(int c)
-{
-       return (c >= 32 && c <= 126);
-}
-
-
-int isspace(int c)
-{
-       return (c == ' ' || (c >= '\t' || c <= '\r'));
-}
-
-int isupper(int c)
-{
-       return (c >= 'A' && c <= 'Z');
-}
-
-int tolower(int c)
-{
-       return (c >= 'A' && c <= 'Z') ? (c + 32) : c;
-}
-
-int toupper(int c)
-{
-       return (c >= 'a' && c <= 'z') ? (c - 32) : c;
-}
-
-int isxdigit(int c)
-{
-       return isdigit(c) || (tolower(c) >= 'a' && tolower(c) <= 'z');
-}
-
-int ispunct(int c)
-{
-       return isprint(c) && !isspace(c) && !isalnum(c);
-}
index 84d7db8..a8a2347 100644 (file)
 #include <stdarg.h>
 #include <stdint.h>
 
-//------------------------------------------------------------------------------
-//         Local Definitions
-//------------------------------------------------------------------------------
-
-// Maximum string size allowed (in bytes).
-#define MAX_STRING_SIZE         255
+#include "projectconfig.h" // For CFG_PRINTF_MAXSTRINGSIZE
 
 //------------------------------------------------------------------------------
 //         Global Variables
@@ -412,7 +407,7 @@ signed int snprintf(char *pString, size_t length, const char *pFormat, ...)
 //------------------------------------------------------------------------------
 signed int vsprintf(char *pString, const char *pFormat, va_list ap)
 {
-    return vsnprintf(pString, MAX_STRING_SIZE, pFormat, ap);
+    return vsnprintf(pString, CFG_PRINTF_MAXSTRINGSIZE, pFormat, ap);
 }
 
 //------------------------------------------------------------------------------
@@ -423,14 +418,14 @@ signed int vsprintf(char *pString, const char *pFormat, va_list ap)
 //------------------------------------------------------------------------------
 signed int vprintf(const char *pFormat, va_list ap)
 {
-  char pStr[MAX_STRING_SIZE];
-  char pError[] = "stdio.c: increase MAX_STRING_SIZE\r\n";
+  char pStr[CFG_PRINTF_MAXSTRINGSIZE];
+  char pError[] = "stdio.c: increase CFG_PRINTF_MAXSTRINGSIZE\r\n";
   
   // Write formatted string in buffer
-  if (vsprintf(pStr, pFormat, ap) >= MAX_STRING_SIZE) {
+  if (vsprintf(pStr, pFormat, ap) >= CFG_PRINTF_MAXSTRINGSIZE) {
     
     puts(pError);
-    while (1); // Increase MAX_STRING_SIZE
+    while (1); // Increase CFG_PRINTF_MAXSTRINGSIZE
   }
   
   // Display string
index f2f5d5c..1912779 100644 (file)
@@ -172,21 +172,21 @@ void alphaRenderButton(uint8_t alphaPage, uint8_t col, uint8_t row, bool selecte
   {
     case '<':
       // Backspace
-      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, border, fill, font, NULL); 
+      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, &dejaVuSans9ptFontInfo, 7, border, fill, font, NULL); 
       drawArrow (alphaBtnX[col] + ALPHA_BTN_WIDTH / 2 - 3, alphaBtnY[row] + ALPHA_BTN_HEIGHT / 2, 7, DRAW_DIRECTION_LEFT, font);
       break;
     case '*':
       // Page Shift
-      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, border, fill, font, NULL); 
+      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, &dejaVuSans9ptFontInfo, 7, border, fill, font, NULL); 
       drawArrow (alphaBtnX[col] + ALPHA_BTN_WIDTH / 2, (alphaBtnY[row] + ALPHA_BTN_HEIGHT / 2) - 3, 7, DRAW_DIRECTION_UP, font);
       break;
     case '>':
       // OK
-      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, border, fill, font, "OK"); 
+      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, &dejaVuSans9ptFontInfo, 7, border, fill, font, "OK"); 
       break;
     default:
       // Standard character
-      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, border, fill, font, key); 
+      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, &dejaVuSans9ptFontInfo, 7, border, fill, font, key); 
       break;
   }
 }
index 5e1f0e9..b7da3a3 100644 (file)
@@ -1259,8 +1259,6 @@ void drawProgressBar ( uint16_t x, uint16_t y, uint16_t width, uint16_t height,
                 Total height of the button in pixels
     @param[in]  fontInfo
                 Pointer to the FONT_INFO used to render the button text
-    @param[in]  fontHeight
-                The height in pixels of the font (used for centering)
     @param[in]  borderclr
                 The rgb565 border color
     @param[in]  fillclr
@@ -1278,13 +1276,13 @@ void drawProgressBar ( uint16_t x, uint16_t y, uint16_t width, uint16_t height,
     #include "drivers/displays/tft/fonts/dejavusans9.h"
 
     // Draw two buttons using Vera Sans Bold 9
-    drawButton(20, 195, 200, 35, &dejaVuSans9ptFontInfo, 7, COLOR_GRAY_80, COLOR_GRAY_80, COLOR_WHITE, "System Settings");
-    drawButton(20, 235, 200, 35, &dejaVuSans9ptFontInfo, 7, COLOR_THEME_LIMEGREEN_DARKER, COLOR_THEME_LIMEGREEN_BASE, COLOR_BLACK, "System Settings");
+    drawButton(20, 195, 200, 35, &dejaVuSans9ptFontInfo, COLOR_GRAY_80, COLOR_GRAY_80, COLOR_WHITE, "System Settings");
+    drawButton(20, 235, 200, 35, &dejaVuSans9ptFontInfo, COLOR_THEME_LIMEGREEN_DARKER, COLOR_THEME_LIMEGREEN_BASE, COLOR_BLACK, "System Settings");
 
     @endcode
 */
 /**************************************************************************/
-void drawButton(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const FONT_INFO *fontInfo, uint16_t fontHeight, uint16_t borderclr, uint16_t fillclr, uint16_t fontclr, char* text)
+void drawButton(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const FONT_INFO *fontInfo, uint16_t borderclr, uint16_t fillclr, uint16_t fontclr, char* text)
 {
   // Border
   drawRectangleRounded(x, y, x + width, y + height, borderclr, 5, DRAW_ROUNDEDCORNERS_ALL);
@@ -1296,7 +1294,7 @@ void drawButton(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const F
   {
     uint16_t textWidth = drawGetStringWidth(&*fontInfo, text);
     uint16_t xStart = x + (width / 2) - (textWidth / 2);
-    uint16_t yStart = y + (height / 2) - (fontHeight / 2) + 1;
+    uint16_t yStart = y + (height / 2) - (fontInfo->height / 2) + 1;
     drawString(xStart, yStart, fontclr, &*fontInfo, text);
   }
 }
index 188686a..5009d3b 100644 (file)
@@ -101,7 +101,7 @@ void      drawTriangleFilled   ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t
 void      drawString           ( uint16_t x, uint16_t y, uint16_t color, const FONT_INFO *fontInfo, char *str );
 uint16_t  drawGetStringWidth   ( const FONT_INFO *fontInfo, char *str );
 void      drawProgressBar      ( uint16_t x, uint16_t y, uint16_t width, uint16_t height, drawRoundedCorners_t borderCorners, drawRoundedCorners_t progressCorners, uint16_t borderColor, uint16_t borderFillColor, uint16_t progressBorderColor, uint16_t progressFillColor, uint8_t progress );
-void      drawButton           ( uint16_t x, uint16_t y, uint16_t width, uint16_t height, const FONT_INFO *fontInfo, uint16_t fontHeight, uint16_t borderclr, uint16_t fillclr, uint16_t fontclr, char* text );
+void      drawButton           ( uint16_t x, uint16_t y, uint16_t width, uint16_t height, const FONT_INFO *fontInfo, uint16_t borderclr, uint16_t fillclr, uint16_t fontclr, char* text );
 void      drawIcon16           ( uint16_t x, uint16_t y, uint16_t color, uint16_t icon[] );
 uint16_t  drawRGB24toRGB565    ( uint8_t r, uint8_t g, uint8_t b );
 uint32_t  drawRGB565toBGRA32   ( uint16_t color );
index bd9e6ac..261cd7e 100644 (file)
@@ -279,7 +279,7 @@ void lcdInit(void)
   //  DATA(0xBF);
 
   // Clear screen
-  lcdFillRGB(COLOR_RED);
+  lcdFillRGB(COLOR_BLACK);
 
   // Turn the display on
   CMD(SSD1351_CMD_SLEEPMODE_DISPLAYON);  
index a418e14..6dcd77c 100644 (file)
@@ -76,7 +76,7 @@ void cmd_button(uint8_t argc, char **argv)
   if (argc == 7)
   {
     // Render the button with no text
-    drawButton(x, y, w, h, &dejaVuSans9ptFontInfo, 7, (uint16_t)border, (uint16_t)fill, (uint16_t)font, NULL);
+    drawButton(x, y, w, h, &dejaVuSans9ptFontInfo, (uint16_t)border, (uint16_t)fill, (uint16_t)font, NULL);
   }
   else
   {
@@ -93,7 +93,7 @@ void cmd_button(uint8_t argc, char **argv)
     *data_ptr++ = '\0';
 
     // Render the button with text
-    drawButton(x, y, w, h, &dejaVuSans9ptFontInfo, 7, (uint16_t)border, (uint16_t)fill, (uint16_t)font, (char *)&data);
+    drawButton(x, y, w, h, &dejaVuSans9ptFontInfo, (uint16_t)border, (uint16_t)fill, (uint16_t)font, (char *)&data);
   }
 }
 
index 94784b6..6d8d385 100644 (file)
--- a/sysinit.c
+++ b/sysinit.c
@@ -39,6 +39,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "sysinit.h"
 
@@ -298,3 +299,61 @@ int puts(const char * str)
 
   return 0;
 }
+
+// Override printf here if we're using Crossworks for ARM
+// so that we can still use the custom libc libraries.
+// For Codelite and compiling from the makefile (Yagarto, etc.)
+// this is done in /core/libc
+
+#ifdef __CROSSWORKS_ARM
+
+/**************************************************************************/
+/*! 
+    @brief  Outputs a formatted string on the DBGU stream. Format arguments
+            are given in a va_list instance.
+
+    @param[in]  pFormat
+                Format string
+    @param[in]  ap
+                Argument list
+*/
+/**************************************************************************/
+signed int vprintf(const char *pFormat, va_list ap)
+{
+  char pStr[CFG_PRINTF_MAXSTRINGSIZE];
+  char pError[] = "stdio.c: increase CFG_PRINTF_MAXSTRINGSIZE\r\n";
+  
+  // Write formatted string in buffer
+  if (vsprintf(pStr, pFormat, ap) >= CFG_PRINTF_MAXSTRINGSIZE) {
+    
+    puts(pError);
+    while (1); // Increase CFG_PRINTF_MAXSTRINGSIZE
+  }
+  
+  // Display string
+  return puts(pStr);
+}
+
+/**************************************************************************/
+/*! 
+    @brief  Outputs a formatted string on the DBGU stream, using a 
+            variable number of arguments
+
+    @param[in]  pFormat
+                Format string
+*/
+/**************************************************************************/
+signed int printf(const char *pFormat, ...)
+{
+    va_list ap;
+    signed int result;
+
+    // Forward call to vprintf
+    va_start(ap, pFormat);
+    result = vprintf(pFormat, ap);
+    va_end(ap);
+
+    return result;
+}
+
+#endif
\ No newline at end of file
This page took 0.058281 seconds and 4 git commands to generate.