+v1.1.2 - ongoing
+==============================================================================
+NEW FEATURES
+------------------------------------------------------------------------------
+- Added fastHLine and fastVLine to lcdProperties_t for all lcd drivers (to
+ known whether an accelerated vertical or horizontal line drawing function
+ is present in the driver or not).
+- Updated all LCD drivers to include the fastHLine and fastVLine flags.
+- Added PWM command to CLI (thanks Miceuz)
+- Added optional callback in 32-bit timer ISR (thanks again Miceuz)
+
+
v1.1.1 - 14 April 2012
==============================================================================
NEW FEATURES
<configuration Name="THUMB Flash Debug" build_exclude_from_build="Yes"/>
</file>
<file file_name="../../drivers/displays/tft/hw/ILI9328.c">
- <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="Yes"/>
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
</file>
<file file_name="../../drivers/displays/tft/hw/ssd1331.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="Yes"/>
</file>
<file file_name="../../drivers/displays/tft/hw/ssd1351.c">
- <configuration Name="THUMB Flash Release" build_exclude_from_build="Yes"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
<configuration Name="THUMB Flash Debug" build_exclude_from_build="Yes"/>
</file>
<file file_name="../../drivers/displays/tft/hw/st7735.c">
</folder>
<file file_name="../../project/commands/cmd_uart.c"/>
<file file_name="../../project/commands/cmd_reset.c"/>
+ <file file_name="../../project/commands/cmd_pwm.c"/>
</folder>
<file file_name="../../project/cmd_tbl.h"/>
</folder>
<ProjectSessionItem path="LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;displays" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;displays;bitmap" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;displays;bitmap;ssd1306" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;displays;tft" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;displays;tft;aafonts" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;core" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;core;timer32" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;project" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;project;commands" name="unnamed" />
</Project>
<Register1>
<RegisterWindow openNodes="GPIO2" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;CoreDebug;GPIO2" decimalNodes="" octalNodes="" asciiNodes="" />
</TraceWindow>
<Watch1>
<Watches active="1" update="Each Second" >
- <Watchpoint linenumber="155" radix="16" name="Tick" expression="Tick" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
- <Watchpoint linenumber="155" radix="-1" name="xTickCount" expression="xTickCount" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
- <Watchpoint linenumber="138" radix="16" name="timer32_0_counter" expression="timer32_0_counter" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/timer32/timer32.c" />
<Watchpoint linenumber="66" radix="10" name="msTicks" expression="msTicks" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/systick/systick.c" />
+ <Watchpoint linenumber="138" radix="16" name="timer32_0_counter" expression="timer32_0_counter" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/timer32/timer32.c" />
+ <Watchpoint linenumber="155" radix="-1" name="xTickCount" expression="xTickCount" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
+ <Watchpoint linenumber="155" radix="16" name="Tick" expression="Tick" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
</Watches>
</Watch1>
<Watch2>
<Watches active="0" update="Never" />
</Watch4>
<Files>
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="26" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="26" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="24" />
+ <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="33" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="61" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="28" />
</Files>
- <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\displays\tft" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
+ <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\project\commands" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
</session>
SSD1306_BUS_I2C Use HW I2C
-----------------------------------------------------------------------*/
- // #define SSD1306_BUS_SPI
- #define SSD1306_BUS_I2C
+ #define SSD1306_BUS_SPI
+ // #define SSD1306_BUS_I2C
#if defined SSD1306_BUS_SPI && defined SSD1306_BUS_I2C
#error "Only one SSD1306 bus interface can be specified at once in ssd1306.h"
/*=========================================================================
I2C Address - 011110+SA0+RW ... 0x78 for SA0 = 0, 0x7A for SA0 = 1
---------------------------------------------------------------------*/
- #define SSD1306_I2C_ADDRESS (0x78)
+ #define SSD1306_I2C_ADDRESS (0x7A)
#define SSD1306_I2C_READWRITE (0x01)
/*=========================================================================*/
#endif
{
uint8_t bit = 0x00;
bit = (column[xoffset] << (8 - (yoffset + 1))); // Shift current row bit left
- bit = (bit >> 7); // Shift current row but right (results in 0x01 for black, and 0x00 for white)
+ bit = (bit >> 7); // Shift current row bit right (results in 0x01 for black, and 0x00 for white)
if (bit)
{
drawPixel(x + xoffset, y + yoffset, color);
/**************************************************************************/
void drawLineDotted ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t empty, uint16_t solid, uint16_t color )
{
+ lcdProperties_t properties;
+
+ // Get the LCD properties (to check for HW acceleration in the driver)
+ properties = lcdGetProperties();
+
if (solid == 0)
{
return;
y1 = y1 > 65000 ? 0 : y1;
// Check if we can use the optimised horizontal line method
- if ((y0 == y1) && (empty == 0))
+ if ((y0 == y1) && (empty == 0) && properties.fastHLine)
{
lcdDrawHLine(x0, x1, y0, color);
return;
// Check if we can use the optimised vertical line method.
// This can make a huge difference in performance, but may
// not work properly on every LCD controller:
- if ((x0 == x1) && (empty == 0))
+ if ((x0 == x1) && (empty == 0) && properties.fastVLine)
{
// Warning: This may actually be slower than drawing individual pixels on
// short lines ... Set a minimum line size to use the 'optimised' method
// #define ILI9235_USE_INLINE_METHODS (1)
static lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t ili9325Properties = { 240, 320, TRUE, TRUE, TRUE };
+static lcdProperties_t ili9325Properties = { 240, 320, true, true, true, true, true };
/*************************************************/
/* Private Methods */
#define ILI9238_USE_INLINE_METHODS (1)
static volatile lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t ili9328Properties = { 240, 320, TRUE, TRUE, TRUE };
+static lcdProperties_t ili9328Properties = { 240, 320, true, true, true, true, true };
/*************************************************/
/* Private Methods */
#include "core/gpio/gpio.h"
static lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t hx8340bProperties = { 176, 220, FALSE, FALSE, FALSE };
+static lcdProperties_t hx8340bProperties = { 176, 220, false, false, false, true, true };
/*************************************************/
/* Private Methods */
#include "core/systick/systick.h"
static volatile lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t ssd1331Properties = { 96, 64, false, false, false };
+static lcdProperties_t ssd1331Properties = { 96, 64, false, false, false, true, true };
/*************************************************/
/* Private Methods */
}
}
-/**************************************************************************/
-/*!
- @brief Reads a 16-bit value from the 8-bit data bus
-*/
-/**************************************************************************/
-uint16_t ssd1331ReadData(void)
-{
- // ToDo
- return 0;
-}
-
-/**************************************************************************/
-/*!
- @brief Reads a 16-bit value
-*/
-/**************************************************************************/
-uint16_t ssd1331Read(uint16_t addr)
-{
- // ToDo
- return 0;
-}
-
/**************************************************************************/
/*!
@brief Sets the cursor to the specified X/Y position
/**************************************************************************/
void ssd1331DrawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint16_t color)
{
- uint16_t x, pixels;
+ uint16_t x;
if ((x1 >= ssd1331Properties.width) || (x2 >= ssd1331Properties.width) ||
(y1 >= ssd1331Properties.height) || (y2 >= ssd1331Properties.height)) {
#include "core/systick/systick.h"
static volatile lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t ssd1351Properties = { 128, 128, false, false, false };
+static lcdProperties_t ssd1351Properties = { 128, 128, false, false, false, true, false };
/*************************************************/
/* Private Methods */
/*************************************************/
#define CMD(c) do { SET_CS; CLR_CS; CLR_DC; ssd1351SendByte( c, 1 ); SET_CS; } while (0)
-#define DATA(c) do { SET_CS; CLR_CS; SET_DC; ssd1351SendByte( c, 0 ); SET_CS; } while (0);
-#define DELAY(mS) do { systickDelay( mS / CFG_SYSTICK_DELAY_IN_MS ); } while(0);
+#define DATA(c) do { SET_CS; CLR_CS; SET_DC; ssd1351SendByte( c, 0 ); SET_CS; } while (0)
+#define DELAY(mS) do { systickDelay( mS / CFG_SYSTICK_DELAY_IN_MS ); } while(0)
/**************************************************************************/
/*!
if ((x >= ssd1351Properties.width) || (y >= ssd1351Properties.height))
return;
- CMD(SSD1351_CMD_WRITERAM);
CMD(SSD1351_CMD_SETCOLUMNADDRESS);
DATA(x); // Start Address
DATA(ssd1351Properties.width-1); // End Address (0x7F)
CMD(SSD1351_CMD_SETROWADDRESS);
DATA(y); // Start Address
DATA(ssd1351Properties.height-1); // End Address (0x7F)
- CMD(SSD1351_CMD_WRITERAM);
+}
+
+/**************************************************************************/
+/*!
+ @brief Sets the cursor to 0, 0 and resets the window size
+*/
+/**************************************************************************/
+void ssd1351GoHome(void)
+{
+ ssd1351SetCursor(0, 0);
}
/*************************************************/
gpioSetDir(SSD1351_DC_PORT, SSD1351_DC_PIN, gpioDirection_Output);
#endif
+ // Make sure CS starts low
+ // CLR_CS;
+
// Reset the LCD
SET_RST;
DELAY(20);
SET_RST;
DELAY(20);
- // Disable pullups
+ // Disable internal pullup resistors
SSD1351_DISABLEPULLUPS();
CMD(SSD1351_CMD_SETCOMMANDLOCK);
DATA(0x12); // Unlocked to enter commands
+
CMD(SSD1351_CMD_SETCOMMANDLOCK);
DATA(0xB1); // Make all commands accessible
+
CMD(SSD1351_CMD_SLEEPMODE_DISPLAYOFF);
+
CMD(SSD1351_CMD_SETFRONTCLOCKDIV);
- DATA(0xF1);
+ DATA(0xF1); // 7:4 = Oscillator Frequency, 3:0 = CLK Div Ratio (A[3:0]+1 = 1..16)
+
CMD(SSD1351_CMD_SETMUXRRATIO);
DATA(0x7F);
+
CMD(SSD1351_CMD_COLORDEPTH);
DATA(0x74); // Bit 7:6 = 65,536 Colors, Bit 3 = BGR or RGB
+
CMD(SSD1351_CMD_SETCOLUMNADDRESS);
DATA(0x00);
DATA(0x7F);
+
CMD(SSD1351_CMD_SETROWADDRESS);
DATA(0x00);
DATA(0x7F);
+
CMD(SSD1351_CMD_SETDISPLAYSTARTLINE);
DATA(0x00);
+
CMD(SSD1351_CMD_SETDISPLAYOFFSET);
DATA(0x00);
+
CMD(SSD1351_CMD_SETGPIO);
DATA(0x00); // Disable GPIO pins
+
CMD(SSD1351_CMD_FUNCTIONSELECTION);
- DATA(0x01); // External VDD (0 = External, 1 = Internal)
+ DATA(0x01); // External VDD (1 = External bias using diode drop, 0 = internal)
+
CMD(SSD1351_CMD_SETPHASELENGTH);
DATA(0x32);
- CMD(SSD1351_CMD_SETSEGMENTLOWVOLTAGE);
- DATA(0xA0); // Enable External VSL
- DATA(0xB5);
- DATA(0x55);
+
CMD(SSD1351_CMD_SETPRECHARGEVOLTAGE);
- DATA(0x17);
+ DATA(0x32); // was 0x17
+
CMD(SSD1351_CMD_SETVCOMHVOLTAGE);
DATA(0x05);
+
+ CMD(SSD1351_CMD_SETDISPLAYMODE_RESET);
+
CMD(SSD1351_CMD_SETCONTRAST);
DATA(0xC8);
DATA(0x80);
DATA(0xC8);
+
CMD(SSD1351_CMD_MASTERCONTRAST);
DATA(0x0F); // Maximum contrast
+
+ CMD(SSD1351_CMD_SETSEGMENTLOWVOLTAGE);
+ DATA(0xA0); // Enable External VSL
+ DATA(0xB5);
+ DATA(0x55);
+
CMD(SSD1351_CMD_SETSECONDPRECHARGEPERIOD);
DATA(0x01);
- CMD(SSD1351_CMD_SETDISPLAYMODE_RESET);
// Use default grayscale for now to save flash space, but here are
// the values if someone wants to change them ...
{
uint16_t i;
ssd1351SetCursor(0, 0);
+ CMD(SSD1351_CMD_WRITERAM);
for (i=1; i<=((ssd1351Properties.width)*(ssd1351Properties.height)) * 2;i++)
{
DATA(data >> 8);
return;
ssd1351SetCursor((uint8_t)x, (uint8_t)y);
+ CMD(SSD1351_CMD_WRITERAM);
DATA(color >> 8);
DATA(color);
}
/**************************************************************************/
void lcdDrawHLine(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color)
{
- // ToDo
+ // Allows for slightly better performance than setting individual pixels
+ uint16_t x, pixels;
+
+ if (x1 < x0)
+ {
+ // Switch x1 and x0
+ x = x1;
+ x1 = x0;
+ x0 = x;
+ }
+
+ // Check limits
+ if (x1 >= ssd1351Properties.width)
+ {
+ x1 = ssd1351Properties.width - 1;
+ }
+ if (x0 >= ssd1351Properties.width)
+ {
+ x0 = ssd1351Properties.width - 1;
+ }
+
+ ssd1351SetCursor(x0, y);
+ CMD(SSD1351_CMD_WRITERAM);
+ for (pixels = 0; pixels < x1 - x0 + 1; pixels++)
+ {
+ DATA(color >> 8);
+ DATA(color);
+ }
+ ssd1351GoHome();
}
/**************************************************************************/
/**************************************************************************/
void lcdDrawVLine(uint16_t x, uint16_t y0, uint16_t y1, uint16_t color)
{
- // ToDo
+ // Not supported
}
/**************************************************************************/
/**************************************************************************/
uint16_t lcdGetPixel(uint16_t x, uint16_t y)
{
- // ToDo
+ // Not supported
return 0;
}
/**************************************************************************/
void lcdScroll(int16_t pixels, uint16_t fillColor)
{
- // ToDo
+ // Not Supported
}
/**************************************************************************/
#include "core/gpio/gpio.h"
static lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t st7735Properties = { 128, 160, FALSE, FALSE, FALSE };
+static lcdProperties_t st7735Properties = { 128, 160, false, false, false, true, true };
/*************************************************/
/* Private Methods */
#include "drivers/displays/tft/touchscreen.h"
static lcdOrientation_t lcdOrientation = LCD_ORIENTATION_PORTRAIT;
-static lcdProperties_t st7783Properties = { 240, 320, TRUE, TRUE, FALSE };
+static lcdProperties_t st7783Properties = { 240, 320, true, true, false, true, true};
/*************************************************/
/* Private Methods */
bool touchscreen; // Whether the LCD has a touch screen
bool orientation; // Whether the LCD orientation can be modified
bool hwscrolling; // Whether the LCD support HW scrolling
+ bool fastHLine; // Whether the driver contains an accelerated horizontal line function
+ bool fastVLine; // Whether the driver contains an accelerated vertical line function
} lcdProperties_t;
extern void lcdInit(void);