Minor edits prior to tagging V8.1.0.
parent
d33a14b5fb
commit
7d49c2190c
@ -0,0 +1,101 @@
|
|||||||
|
;
|
||||||
|
; Windows USB CDC Driver Setup File for ATMEL AT91SAM products
|
||||||
|
;
|
||||||
|
; On Windows 7, right click to update driver software. It may take a while to
|
||||||
|
; get this option, even if you cancel the auto driver search.
|
||||||
|
; choose "browse my computer for driver software",
|
||||||
|
; choose "let me pick from a list of device drivers on my computer",
|
||||||
|
; Click "have disk" and browse to this .inf file
|
||||||
|
; If there is a problem, right click and uninstall, checking delete driver software.
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
[Version]
|
||||||
|
Signature="$Windows NT$"
|
||||||
|
Class=Ports
|
||||||
|
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
||||||
|
Provider=%ATMEL%
|
||||||
|
LayoutFile=layout.inf
|
||||||
|
|
||||||
|
DriverVer= 03/09/2011,2.0.0.0
|
||||||
|
|
||||||
|
[Manufacturer]
|
||||||
|
%ATMEL%=DeviceList,NTamd64
|
||||||
|
|
||||||
|
[DestinationDirs]
|
||||||
|
DefaultDestDir=12
|
||||||
|
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Windows 2000/XP/Vista32 Support
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
[DriverInstall.nt]
|
||||||
|
include=mdmcpq.inf
|
||||||
|
CopyFiles=DriverCopyFiles.nt
|
||||||
|
AddReg=DriverInstall.nt.AddReg
|
||||||
|
|
||||||
|
[DriverCopyFiles.nt]
|
||||||
|
usbser.sys,,,0x20
|
||||||
|
|
||||||
|
[DriverInstall.nt.AddReg]
|
||||||
|
HKR,,DevLoader,,*ntkern
|
||||||
|
HKR,,NTMPDriver,,usbser.sys
|
||||||
|
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||||
|
|
||||||
|
[DriverInstall.nt.Services]
|
||||||
|
AddService=usbser, 0x00000002, DriverService.nt
|
||||||
|
|
||||||
|
[DriverService.nt]
|
||||||
|
DisplayName=%USBtoSerialConverter%
|
||||||
|
ServiceType=1
|
||||||
|
StartType=3
|
||||||
|
ErrorControl=1
|
||||||
|
ServiceBinary=%12%\usbser.sys
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Windows Vista64 Support
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
[DriverInstall.NTamd64]
|
||||||
|
include=mdmcpq.inf
|
||||||
|
CopyFiles=DriverCopyFiles.NTamd64
|
||||||
|
AddReg=DriverInstall.NTamd64.AddReg
|
||||||
|
|
||||||
|
[DriverCopyFiles.NTamd64]
|
||||||
|
usbser.sys,,,0x20
|
||||||
|
|
||||||
|
[DriverInstall.NTamd64.AddReg]
|
||||||
|
HKR,,DevLoader,,*ntkern
|
||||||
|
HKR,,NTMPDriver,,usbser.sys
|
||||||
|
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||||
|
|
||||||
|
|
||||||
|
[DriverInstall.NTamd64.Services]
|
||||||
|
AddService=usbser, 0x00000002, DriverService.NTamd64
|
||||||
|
|
||||||
|
[DriverService.NTamd64]
|
||||||
|
DisplayName=%USBtoSerialConverter%
|
||||||
|
ServiceType=1
|
||||||
|
StartType=3
|
||||||
|
ErrorControl=1
|
||||||
|
ServiceBinary=%12%\usbser.sys
|
||||||
|
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VID/PID Settings
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
[SourceDisksFiles]
|
||||||
|
[SourceDisksNames]
|
||||||
|
[DeviceList]
|
||||||
|
%USBtoSerialConverter%=DriverInstall, USB\VID_03EB&PID_6119
|
||||||
|
|
||||||
|
[DeviceList.NTamd64]
|
||||||
|
%USBtoSerialConverter%=DriverInstall, USB\VID_03EB&PID_6119
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; String Definitions
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
[Strings]
|
||||||
|
|
||||||
|
ATMEL="ATMEL Corp." ; String value for the ATMEL symbol
|
||||||
|
USBtoSerialConverter="AT91 USB to Serial Converter" ; String value for the USBtoSerialConverter symbol
|
@ -1,33 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// +--+
|
|
||||||
// | ++----+
|
|
||||||
// +-++ |
|
|
||||||
// | |
|
|
||||||
// +-+--+ |
|
|
||||||
// | +--+--+
|
|
||||||
// +----+ Copyright (c) 2009 Code Red Technologies Ltd.
|
|
||||||
//
|
|
||||||
// font.h - header file for font data contained in system_fixed_be_8_15.c
|
|
||||||
//
|
|
||||||
// Software License Agreement
|
|
||||||
//
|
|
||||||
// The software is owned by Code Red Technologies and/or its suppliers, and is
|
|
||||||
// protected under applicable copyright laws. All rights are reserved. Any
|
|
||||||
// use in violation of the foregoing restrictions may subject the user to criminal
|
|
||||||
// sanctions under applicable laws, as well as to civil liability for the breach
|
|
||||||
// of the terms and conditions of this license.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
||||||
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
||||||
// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
|
|
||||||
// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
|
|
||||||
// CODE RED TECHNOLOGIES LTD.
|
|
||||||
|
|
||||||
#ifndef FONT_H_
|
|
||||||
#define FONT_H_
|
|
||||||
|
|
||||||
extern const unsigned char font_data_table[];
|
|
||||||
extern const unsigned char font_index_table[];
|
|
||||||
|
|
||||||
#endif /*FONT_H_*/
|
|
@ -1,308 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// +--+
|
|
||||||
// | ++----+
|
|
||||||
// +-++ |
|
|
||||||
// | |
|
|
||||||
// +-+--+ |
|
|
||||||
// | +--+--+
|
|
||||||
// +----+ Copyright (c) 2009 Code Red Technologies Ltd.
|
|
||||||
//
|
|
||||||
// lcd.c contains various routines to plot to the LCD display on the RDB1768
|
|
||||||
// development board.
|
|
||||||
//
|
|
||||||
// Software License Agreement
|
|
||||||
//
|
|
||||||
// The software is owned by Code Red Technologies and/or its suppliers, and is
|
|
||||||
// protected under applicable copyright laws. All rights are reserved. Any
|
|
||||||
// use in violation of the foregoing restrictions may subject the user to criminal
|
|
||||||
// sanctions under applicable laws, as well as to civil liability for the breach
|
|
||||||
// of the terms and conditions of this license.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
||||||
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
||||||
// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
|
|
||||||
// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
|
|
||||||
// CODE RED TECHNOLOGIES LTD.
|
|
||||||
|
|
||||||
#include "lcd_commands.h"
|
|
||||||
#include "lcd.h"
|
|
||||||
#include "lcd_driver.h"
|
|
||||||
#include "font.h"
|
|
||||||
|
|
||||||
#include <stdlib.h> // to provice abs() function
|
|
||||||
|
|
||||||
// Routine to draw a filled rectangle to the LCD.
|
|
||||||
// Two corners of rectangle are at (xmin,ymin) and (xmax,ymax).
|
|
||||||
// The Rectangle is filled with the RGB565 color specified
|
|
||||||
void LCD_FilledRect(int xmin,int xmax,int ymin,int ymax,int color)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Specify to LCD controller coordinates we are writing to...
|
|
||||||
LCDdriver_WriteCom(DD_CASET); // Set the column address
|
|
||||||
LCDdriver_WriteData(xmin); // min address
|
|
||||||
LCDdriver_WriteData(xmax); // max address
|
|
||||||
LCDdriver_WriteCom(DD_RASET); // Set the row address
|
|
||||||
LCDdriver_WriteData(ymin + 1); // min address
|
|
||||||
LCDdriver_WriteData(ymax + 1); // max address
|
|
||||||
LCDdriver_WriteCom(DD_RAMWR); // RAM Write command
|
|
||||||
|
|
||||||
// Plot the color data to the LCD buffer
|
|
||||||
for(i = ((xmax - xmin + 1) * (ymax - ymin + 1)); i > 0; i--)
|
|
||||||
{
|
|
||||||
LCDdriver_WriteData(color >> 8); // top 8 bits of RGB565 color
|
|
||||||
LCDdriver_WriteData(color); // bottom 8 bits of RGB565 color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Routine to draw an unfilled rectangle to the LCD.
|
|
||||||
// Two corners of rectangle are at (xmin,ymin) and (xmax,ymax).
|
|
||||||
// The Rectangle is drawn in the RGB565 color specified
|
|
||||||
void LCD_Rect(int xmin,int xmax,int ymin,int ymax,int color)
|
|
||||||
{
|
|
||||||
// Draw 4 lines of rectange as 4 filled rectanges, each of 1 pixel wide
|
|
||||||
LCD_FilledRect(xmin,xmin,ymin,ymax,color);
|
|
||||||
LCD_FilledRect(xmax,xmax,ymin,ymax,color);
|
|
||||||
LCD_FilledRect(xmin,xmax,ymin,ymin,color);
|
|
||||||
LCD_FilledRect(xmin,xmax,ymax,ymax,color);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Plot a point on the screen in the 6:5:6 color format
|
|
||||||
void LCD_PlotPoint(int x,int y,int color)
|
|
||||||
{
|
|
||||||
LCDdriver_WriteCom(DD_CASET); // Set the column address
|
|
||||||
LCDdriver_WriteData(x); // min address
|
|
||||||
LCDdriver_WriteData(x); // max address
|
|
||||||
LCDdriver_WriteCom(DD_RASET); // Set the row address
|
|
||||||
LCDdriver_WriteData(y + 1); // min address
|
|
||||||
LCDdriver_WriteData(y + 1); // max address
|
|
||||||
LCDdriver_WriteCom(DD_RAMWR); // RAM Write command
|
|
||||||
LCDdriver_WriteData(color >> 8); // top 8 bits of RGB565 color
|
|
||||||
LCDdriver_WriteData(color); // top 8 bits of RGB565 color
|
|
||||||
}
|
|
||||||
|
|
||||||
// Routine to draw a filled circle to the LCD.
|
|
||||||
// The centre of the circle is at (x0,y0) and the circle has the
|
|
||||||
// specifed radius. The circle is filled with the RGB565 color
|
|
||||||
// The circle is drawn using the "Midpoint circle algorithm",
|
|
||||||
// also known as "Bresenham's circle algorithm". In order to fill
|
|
||||||
// the circle, the algorithm has been modifed to draw a line between
|
|
||||||
// each two points, rather than plotting the two points individually.
|
|
||||||
void LCD_FilledCircle (int x0, int y0, int radius, int color)
|
|
||||||
{
|
|
||||||
int f = 1 - radius;
|
|
||||||
int ddF_x = 1;
|
|
||||||
int ddF_y = -2 * radius;
|
|
||||||
int x = 0;
|
|
||||||
int y = radius;
|
|
||||||
|
|
||||||
LCD_FilledRect(x0, x0 ,y0 - radius,y0 + radius, color);
|
|
||||||
LCD_FilledRect(x0 - radius, x0 + radius ,y0,y0, color);
|
|
||||||
|
|
||||||
while(x < y)
|
|
||||||
{
|
|
||||||
if(f >= 0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
ddF_y += 2;
|
|
||||||
f += ddF_y;
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
ddF_x += 2;
|
|
||||||
f += ddF_x;
|
|
||||||
|
|
||||||
LCD_FilledRect(x0-x, x0+x ,y0 +y, y0 + y, color);
|
|
||||||
LCD_FilledRect(x0-x, x0+x ,y0 - y, y0 - y, color);
|
|
||||||
LCD_FilledRect(x0-y, x0+y ,y0 + x, y0 + x, color);
|
|
||||||
LCD_FilledRect(x0-y, x0+y ,y0 - x, y0 - x, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Routine to draw an unfilled circle to the LCD.
|
|
||||||
// The centre of the circle is at (x0,y0) and the circle has the
|
|
||||||
// specifed radius. The circle is drawn in the RGB565 color
|
|
||||||
// The circle is drawn using the "Midpoint circle algorithm",
|
|
||||||
// also known as "Bresenham's circle algorithm".
|
|
||||||
void LCD_Circle (int x0, int y0, int radius, int color)
|
|
||||||
{
|
|
||||||
int f = 1 - radius;
|
|
||||||
int ddF_x = 1;
|
|
||||||
int ddF_y = -2 * radius;
|
|
||||||
int x = 0;
|
|
||||||
int y = radius;
|
|
||||||
|
|
||||||
LCD_PlotPoint(x0, y0 + radius, color);
|
|
||||||
LCD_PlotPoint(x0, y0 - radius, color);
|
|
||||||
LCD_PlotPoint(x0 + radius, y0, color);
|
|
||||||
LCD_PlotPoint(x0 - radius, y0, color);
|
|
||||||
|
|
||||||
while(x < y)
|
|
||||||
{
|
|
||||||
if(f >= 0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
ddF_y += 2;
|
|
||||||
f += ddF_y;
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
ddF_x += 2;
|
|
||||||
f += ddF_x;
|
|
||||||
LCD_PlotPoint(x0 + x, y0 + y, color);
|
|
||||||
LCD_PlotPoint(x0 - x, y0 + y, color);
|
|
||||||
LCD_PlotPoint(x0 + x, y0 - y, color);
|
|
||||||
LCD_PlotPoint(x0 - x, y0 - y, color);
|
|
||||||
LCD_PlotPoint(x0 + y, y0 + x, color);
|
|
||||||
LCD_PlotPoint(x0 - y, y0 + x, color);
|
|
||||||
LCD_PlotPoint(x0 + y, y0 - x, color);
|
|
||||||
LCD_PlotPoint(x0 - y, y0 - x, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Routine to draw a line in the RGB565 color to the LCD.
|
|
||||||
// The line is drawn from (xmin,ymin) to (xmax,ymax).
|
|
||||||
// The algorithm used to draw the line is "Bresenham's line
|
|
||||||
// algorithm".
|
|
||||||
#define SWAP(a, b) a ^= b; b ^= a; a ^= b;
|
|
||||||
|
|
||||||
void LCD_Line (int xmin,int xmax,int ymin,int ymax,int color)
|
|
||||||
{
|
|
||||||
int Dx = xmax - xmin;
|
|
||||||
int Dy = ymax - ymin;
|
|
||||||
int steep = (abs(Dy) >= abs(Dx));
|
|
||||||
if (steep) {
|
|
||||||
SWAP(xmin, ymin);
|
|
||||||
SWAP(xmax, ymax);
|
|
||||||
// recompute Dx, Dy after swap
|
|
||||||
Dx = xmax - xmin;
|
|
||||||
Dy = ymax - ymin;
|
|
||||||
}
|
|
||||||
int xstep = 1;
|
|
||||||
if (Dx < 0) {
|
|
||||||
xstep = -1;
|
|
||||||
Dx = -Dx;
|
|
||||||
}
|
|
||||||
int ystep = 1;
|
|
||||||
if (Dy < 0) {
|
|
||||||
ystep = -1;
|
|
||||||
Dy = -Dy;
|
|
||||||
}
|
|
||||||
int TwoDy = 2*Dy;
|
|
||||||
int TwoDyTwoDx = TwoDy - 2*Dx; // 2*Dy - 2*Dx
|
|
||||||
int E = TwoDy - Dx; //2*Dy - Dx
|
|
||||||
int y = ymin;
|
|
||||||
int xDraw, yDraw;
|
|
||||||
int x;
|
|
||||||
for (x = xmin; x != xmax; x += xstep) {
|
|
||||||
if (steep) {
|
|
||||||
xDraw = y;
|
|
||||||
yDraw = x;
|
|
||||||
} else {
|
|
||||||
xDraw = x;
|
|
||||||
yDraw = y;
|
|
||||||
}
|
|
||||||
// plot
|
|
||||||
LCD_PlotPoint(xDraw, yDraw, color);
|
|
||||||
// next
|
|
||||||
if (E > 0) {
|
|
||||||
E += TwoDyTwoDx; //E += 2*Dy - 2*Dx;
|
|
||||||
y = y + ystep;
|
|
||||||
} else {
|
|
||||||
E += TwoDy; //E += 2*Dy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Routine to clear the LCD.
|
|
||||||
// Implemented by drawing a black rectangle across the whole screen
|
|
||||||
void LCD_ClearScreen(void)
|
|
||||||
{
|
|
||||||
LCD_FilledRect (0,LCD_MAX_X,0 , LCD_MAX_Y, COLOR_BLACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Routine to write a single character to screen in the font pointed
|
|
||||||
// to by pBitMap. This routine is intended to be used via the
|
|
||||||
// LCD_PrintChar() and LCD_PrintString() routines, rather than called
|
|
||||||
// directly from user code.
|
|
||||||
void LCD_WriteBitMap8x15(int x, int y, int height, int width, unsigned char *pBitMap, int color)
|
|
||||||
{
|
|
||||||
int xmax = x + width - 1; // start at zero
|
|
||||||
int ymax = y + height - 1; // start at zero
|
|
||||||
int iRow, iCol;
|
|
||||||
unsigned char ucRowData;
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_CASET); // Column address set
|
|
||||||
LCDdriver_WriteData(x); // Start column
|
|
||||||
LCDdriver_WriteData(xmax); // End column
|
|
||||||
LCDdriver_WriteCom(DD_RASET); // Row address set
|
|
||||||
LCDdriver_WriteData(y); // Start row
|
|
||||||
LCDdriver_WriteData(ymax); // End row
|
|
||||||
LCDdriver_WriteCom(DD_RAMWR); // Memory write
|
|
||||||
|
|
||||||
|
|
||||||
for(iRow=0;iRow<height;iRow++)
|
|
||||||
{
|
|
||||||
ucRowData = *pBitMap++;
|
|
||||||
|
|
||||||
for(iCol=0;iCol<width;iCol++)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Look at each input bitmap bit
|
|
||||||
// and write as a black-pixel or
|
|
||||||
// a color-pixel.
|
|
||||||
|
|
||||||
if(ucRowData & 0x80) // 'color pixel'
|
|
||||||
{
|
|
||||||
LCDdriver_WriteData(color >> 8);
|
|
||||||
LCDdriver_WriteData(color);
|
|
||||||
}
|
|
||||||
else // black pixel
|
|
||||||
{
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
}
|
|
||||||
|
|
||||||
ucRowData = ucRowData<<1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Prints the character 'c' to the LCD in the appropriate color.
|
|
||||||
void LCD_PrintChar(int x, int y, unsigned char c, int color )
|
|
||||||
{
|
|
||||||
const unsigned char index = font_index_table[c];
|
|
||||||
const unsigned int offset = index * 15;
|
|
||||||
unsigned char *pData = (unsigned char *)&font_data_table[offset];
|
|
||||||
|
|
||||||
LCD_WriteBitMap8x15(x, y, 15, 8, pData, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prints the string to the LCD in the appropriate color.
|
|
||||||
void LCD_PrintString(int x, int y, char *pcString, int iStrLen, int color)
|
|
||||||
{
|
|
||||||
unsigned char index;
|
|
||||||
unsigned int offset;
|
|
||||||
unsigned char *pData;
|
|
||||||
unsigned char c;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<iStrLen;i++)
|
|
||||||
{
|
|
||||||
c = pcString[i];
|
|
||||||
if(c==0)
|
|
||||||
break;
|
|
||||||
index = font_index_table[c];
|
|
||||||
offset = index * 15;
|
|
||||||
pData = (unsigned char *)&font_data_table[offset];
|
|
||||||
|
|
||||||
LCD_WriteBitMap8x15(x, y, 15, 8, pData, color);
|
|
||||||
x += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// +--+
|
|
||||||
// | ++----+
|
|
||||||
// +-++ |
|
|
||||||
// | |
|
|
||||||
// +-+--+ |
|
|
||||||
// | +--+--+
|
|
||||||
// +----+ Copyright (c) 2009 Code Red Technologies Ltd.
|
|
||||||
//
|
|
||||||
// lcd.h - Routines containing primitives for writing to the LCD
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Software License Agreement
|
|
||||||
//
|
|
||||||
// The software is owned by Code Red Technologies and/or its suppliers, and is
|
|
||||||
// protected under applicable copyright laws. All rights are reserved. Any
|
|
||||||
// use in violation of the foregoing restrictions may subject the user to criminal
|
|
||||||
// sanctions under applicable laws, as well as to civil liability for the breach
|
|
||||||
// of the terms and conditions of this license.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
||||||
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
||||||
// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
|
|
||||||
// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
|
|
||||||
// CODE RED TECHNOLOGIES LTD.
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LCD_H_
|
|
||||||
#define LCD_H_
|
|
||||||
|
|
||||||
// Define size of LCD screen.
|
|
||||||
|
|
||||||
#define LCD_MAX_X 128
|
|
||||||
#define LCD_MAX_Y 128
|
|
||||||
|
|
||||||
// Translates a 24-bit RGB color to RGB565
|
|
||||||
#define TRANSLATE24BIT_TO_RGB565(c) ((((c) & 0x00ff0000) >> 19) | \
|
|
||||||
((((c) & 0x0000ff00) >> 5) & 0x000007e0) | \
|
|
||||||
((((c) & 0x000000ff) << 8) & 0x0000f800))
|
|
||||||
|
|
||||||
// Define a basic set of 24bit colors, based on the standard "websafe" set
|
|
||||||
#define COLOR24_AQUA 0x00FFFF
|
|
||||||
#define COLOR24_GREY 0x808080
|
|
||||||
#define COLOR24_NAVY 0x000080
|
|
||||||
#define COLOR24_SILVER 0xC0C0C0
|
|
||||||
#define COLOR24_BLACK 0x000000
|
|
||||||
#define COLOR24_GREEN 0x008000
|
|
||||||
#define COLOR24_OLIVE 0x808000
|
|
||||||
#define COLOR24_TEAL 0x008080
|
|
||||||
#define COLOR24_BLUE 0x0000FF
|
|
||||||
#define COLOR24_LIME 0x00FF00
|
|
||||||
#define COLOR24_PURPLE 0x800080
|
|
||||||
#define COLOR24_WHITE 0xFFFFFF
|
|
||||||
#define COLOR24_FUCHSIA 0xFF00FF
|
|
||||||
#define COLOR24_MAROON 0x800000
|
|
||||||
#define COLOR24_RED 0xFF0000
|
|
||||||
#define COLOR24_YELLOW 0xFFFF00
|
|
||||||
|
|
||||||
// Create a set of RGB565 colors that can be used directly within code
|
|
||||||
#define COLOR_AQUA TRANSLATE24BIT_TO_RGB565(COLOR24_AQUA)
|
|
||||||
#define COLOR_GREY TRANSLATE24BIT_TO_RGB565(COLOR24_GREY)
|
|
||||||
#define COLOR_NAVY TRANSLATE24BIT_TO_RGB565(COLOR24_NAVY)
|
|
||||||
#define COLOR_SILVER TRANSLATE24BIT_TO_RGB565(COLOR24_SILVER)
|
|
||||||
#define COLOR_BLACK TRANSLATE24BIT_TO_RGB565(COLOR24_BLACK)
|
|
||||||
#define COLOR_GREEN TRANSLATE24BIT_TO_RGB565(COLOR24_GREEN)
|
|
||||||
#define COLOR_OLIVE TRANSLATE24BIT_TO_RGB565(COLOR24_OLIVE)
|
|
||||||
#define COLOR_TEAL TRANSLATE24BIT_TO_RGB565(COLOR24_TEAL)
|
|
||||||
#define COLOR_BLUE TRANSLATE24BIT_TO_RGB565(COLOR24_BLUE)
|
|
||||||
#define COLOR_LIME TRANSLATE24BIT_TO_RGB565(COLOR24_LIME)
|
|
||||||
#define COLOR_PURPLE TRANSLATE24BIT_TO_RGB565(COLOR24_PURPLE)
|
|
||||||
#define COLOR_WHITE TRANSLATE24BIT_TO_RGB565(COLOR24_WHITE)
|
|
||||||
#define COLOR_FUCHSIA TRANSLATE24BIT_TO_RGB565(COLOR24_FUCHSIA)
|
|
||||||
#define COLOR_MAROON TRANSLATE24BIT_TO_RGB565(COLOR24_MAROON)
|
|
||||||
#define COLOR_RED TRANSLATE24BIT_TO_RGB565(COLOR24_RED)
|
|
||||||
#define COLOR_YELLOW TRANSLATE24BIT_TO_RGB565(COLOR24_YELLOW)
|
|
||||||
|
|
||||||
|
|
||||||
void LCD_Line (int xmin,int xmax,int ymin,int ymax,int color);
|
|
||||||
void LCD_FilledRect(int xmin,int xmax,int ymin,int ymax,int color);
|
|
||||||
void LCD_Rect(int xmin,int xmax,int ymin,int ymax,int color);
|
|
||||||
void LCD_WriteBitMap8x15(int x, int y, int height, int width, unsigned char *pBitMap, int color);
|
|
||||||
void LCD_PlotPoint(int x,int y,int color);
|
|
||||||
void LCD_Circle (int x0, int y0, int radius, int color);
|
|
||||||
void LCD_FilledCircle (int x0, int y0, int radius, int color);
|
|
||||||
void LCD_ClearScreen(void);
|
|
||||||
void LCD_WriteBitMap8x15(int x, int y, int height, int width, unsigned char *pBitMap, int color);
|
|
||||||
void LCD_PrintChar(int x, int y, unsigned char c, int color );
|
|
||||||
void LCD_PrintString(int x, int y, char *pcString, int iStrLen, int color);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*LCD_H_*/
|
|
@ -1,53 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// +--+
|
|
||||||
// | ++----+
|
|
||||||
// +-++ |
|
|
||||||
// | |
|
|
||||||
// +-+--+ |
|
|
||||||
// | +--+--+
|
|
||||||
// +----+ Copyright (c) 2009 Code Red Technologies Ltd.
|
|
||||||
//
|
|
||||||
// lcd_commands.h contains defines mapping onto the commands accepted by the
|
|
||||||
// Sitronix ST7637 LCD Controller/driver used on the RDB1768 development board.//
|
|
||||||
//
|
|
||||||
// Software License Agreement
|
|
||||||
//
|
|
||||||
// The software is owned by Code Red Technologies and/or its suppliers, and is
|
|
||||||
// protected under applicable copyright laws. All rights are reserved. Any
|
|
||||||
// use in violation of the foregoing restrictions may subject the user to criminal
|
|
||||||
// sanctions under applicable laws, as well as to civil liability for the breach
|
|
||||||
// of the terms and conditions of this license.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
||||||
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
||||||
// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
|
|
||||||
// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
|
|
||||||
// CODE RED TECHNOLOGIES LTD.
|
|
||||||
|
|
||||||
#ifndef LCD_COMMANDS_H_
|
|
||||||
#define LCD_COMMANDS_H_
|
|
||||||
|
|
||||||
#define DD_NOP 0x00
|
|
||||||
#define DD_SWRESET 0x01 //SW reset the display
|
|
||||||
#define DD_SLPIN 0x10 //Sleep in and booster off
|
|
||||||
#define DD_SLPOUT 0x11 //Sleep out and booster on
|
|
||||||
#define DD_NORON 0x13 //Partial mode off (Normal mode on)
|
|
||||||
#define DD_DISPOFF 0x28 //Display Off
|
|
||||||
#define DD_DISPON 0x29 //Display On
|
|
||||||
#define DD_CASET 0x2a //Column address set
|
|
||||||
#define DD_RASET 0x2b //Row address set
|
|
||||||
#define DD_RAMWR 0x2c //Memory write
|
|
||||||
#define DD_MADCTR 0x36 //Memory Data Access Control
|
|
||||||
#define DD_COLORMOD 0x3a //Set the color mode for the display
|
|
||||||
#define DD_ColScanDir 0xb7 //Set the column scanning direction
|
|
||||||
#define DD_VopSet 0xc0 //LCD supply voltage set
|
|
||||||
#define DD_BiasSel 0xc3 //Bias selection
|
|
||||||
#define DD_BstMbpXSel 0xc4 //Booster setting
|
|
||||||
#define DD_AUTOLOADSET 0xd7 //Control auto load of ROM data
|
|
||||||
#define DD_EPCTIN 0xe0 //OTP control RD/WR
|
|
||||||
#define DD_EPREAD 0xe3 //OTP read
|
|
||||||
#define DD_EPCTOUT 0xe1 //OTP control cancel
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*LCD_COMMANDS_H_*/
|
|
@ -1,190 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// +--+
|
|
||||||
// | ++----+
|
|
||||||
// +-++ |
|
|
||||||
// | |
|
|
||||||
// +-+--+ |
|
|
||||||
// | +--+--+
|
|
||||||
// +----+ Copyright (c) 2009 Code Red Technologies Ltd.
|
|
||||||
//
|
|
||||||
// lcd_driver.c contains the lowest level access routines for the Sitronix
|
|
||||||
// ST7637 LCD Controller/driver used on the RDB1768 development board.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Software License Agreement
|
|
||||||
//
|
|
||||||
// The software is owned by Code Red Technologies and/or its suppliers, and is
|
|
||||||
// protected under applicable copyright laws. All rights are reserved. Any
|
|
||||||
// use in violation of the foregoing restrictions may subject the user to criminal
|
|
||||||
// sanctions under applicable laws, as well as to civil liability for the breach
|
|
||||||
// of the terms and conditions of this license.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
||||||
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
||||||
// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
|
|
||||||
// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
|
|
||||||
// CODE RED TECHNOLOGIES LTD.
|
|
||||||
|
|
||||||
#include "NXP/LPC17xx/LPC17xx.h"
|
|
||||||
#include "lcd_driver.h"
|
|
||||||
#include "lcd_commands.h"
|
|
||||||
|
|
||||||
// Bits within GPIO port 2 used for LCD driver
|
|
||||||
#define LCD_CSB_PIN (1<<13)
|
|
||||||
#define LCD_A0_PIN (1<<8)
|
|
||||||
#define LCD_WR_PIN (1<<11)
|
|
||||||
#define LCD_RD_PIN (1<<12)
|
|
||||||
#define LCD_DATA_PIN 0xff
|
|
||||||
|
|
||||||
// Bit within GPIO port 3 used for LCD driver
|
|
||||||
#define LCD_RESB_PIN (1<<25)
|
|
||||||
|
|
||||||
// Bits to configure as outputs for driving LCD
|
|
||||||
#define LCD_PORT2_DIRECTIONS (LCD_CSB_PIN | LCD_A0_PIN | LCD_WR_PIN | LCD_RD_PIN | LCD_DATA_PIN)
|
|
||||||
#define LCD_PORT3_DIRECTIONS (LCD_RESB_PIN)
|
|
||||||
|
|
||||||
// Define names for GPIO port 2 and 3 registers to better indicate in code
|
|
||||||
// the operation being carried out on the LCD driver hardware.
|
|
||||||
#define LCD_DATA_CLR FIO2CLR
|
|
||||||
#define LCD_DATA_SET FIO2SET
|
|
||||||
|
|
||||||
#define LCD_CSB_CLR FIO2CLR
|
|
||||||
#define LCD_CSB_SET FIO2SET
|
|
||||||
|
|
||||||
#define LCD_RESB_CLR FIO3CLR
|
|
||||||
#define LCD_RESB_SET FIO3SET
|
|
||||||
|
|
||||||
#define LCD_A0_CLR FIO2CLR
|
|
||||||
#define LCD_A0_SET FIO2SET
|
|
||||||
|
|
||||||
#define LCD_WR_CLR FIO2CLR
|
|
||||||
#define LCD_WR_SET FIO2SET
|
|
||||||
|
|
||||||
#define LCD_RD_CLR FIO2CLR
|
|
||||||
#define LCD_RD_SET FIO2SET
|
|
||||||
|
|
||||||
// Routine to write data to LCD driver. Normally called in combination
|
|
||||||
// with LCDdriver_WriteCom() routine
|
|
||||||
void LCDdriver_WriteData(unsigned char LCD_Data)
|
|
||||||
{
|
|
||||||
LCD_DATA_CLR = LCD_DATA_PIN;
|
|
||||||
LCD_DATA_SET = LCD_Data;
|
|
||||||
LCD_CSB_CLR = LCD_CSB_PIN;
|
|
||||||
LCD_WR_CLR = LCD_WR_PIN;
|
|
||||||
LCD_WR_SET = LCD_WR_PIN;
|
|
||||||
LCD_CSB_SET = LCD_CSB_PIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Routine to configure set LCD driver to accept particular command.
|
|
||||||
// A call to this routine will normally be followed by a call
|
|
||||||
// to LCDdriver_WriteData() to transfer appropriate parameters to driver.
|
|
||||||
void LCDdriver_WriteCom(unsigned char LCD_Command)
|
|
||||||
{
|
|
||||||
LCD_DATA_CLR = LCD_DATA_PIN;
|
|
||||||
LCD_DATA_SET = LCD_Command;
|
|
||||||
LCD_A0_CLR = LCD_A0_PIN;
|
|
||||||
LCD_CSB_CLR = LCD_CSB_PIN;
|
|
||||||
LCD_WR_CLR = LCD_WR_PIN;
|
|
||||||
LCD_WR_SET = LCD_WR_PIN;
|
|
||||||
LCD_CSB_SET = LCD_CSB_PIN;
|
|
||||||
LCD_A0_SET = LCD_A0_PIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to add short delays in writing things to the LCD.
|
|
||||||
void ms_delay(int n)
|
|
||||||
{
|
|
||||||
volatile int d;
|
|
||||||
for (d=0; d<n*3000; d++){}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize GPIO connection to the LCD driver
|
|
||||||
void LCDdriver_ConfigGPIOtoLCD(void)
|
|
||||||
{
|
|
||||||
// set direction to outputs
|
|
||||||
FIO2DIR |= LCD_PORT2_DIRECTIONS;
|
|
||||||
FIO3DIR |= LCD_PORT3_DIRECTIONS;
|
|
||||||
|
|
||||||
// Set GPIO outputs connected to LCD to default values
|
|
||||||
LCD_CSB_SET = LCD_CSB_PIN;
|
|
||||||
LCD_A0_SET = LCD_A0_PIN;
|
|
||||||
LCD_WR_SET = LCD_WR_PIN;
|
|
||||||
LCD_RD_SET = LCD_RD_PIN;
|
|
||||||
LCD_RESB_SET = LCD_RESB_PIN;
|
|
||||||
LCD_DATA_CLR = 0xff; // data bus to zero
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Initialisation routine to set up LCD
|
|
||||||
void LCDdriver_initialisation(void)
|
|
||||||
{
|
|
||||||
int i; // temp loop variable
|
|
||||||
|
|
||||||
LCDdriver_ConfigGPIOtoLCD(); // Initialize the GPIO for the display
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_SWRESET); // SW reset
|
|
||||||
ms_delay(120); // Small delay
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_AUTOLOADSET); // disable auto loading of mask rom data
|
|
||||||
LCDdriver_WriteData(0xBF);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_EPCTIN); // OTP control mode=read
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
ms_delay(10); // Small delay
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_EPREAD); // Start the OTP read.
|
|
||||||
ms_delay(20); // Small delay
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_EPCTOUT); // Cancel the OTP read (20ms should have been enough)
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_DISPOFF); // display off
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_SLPOUT); // Exit sleep mode.
|
|
||||||
ms_delay(50); // Small delay
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_VopSet); // set LCD operating voltage to 14V.
|
|
||||||
LCDdriver_WriteData(0x04);
|
|
||||||
LCDdriver_WriteData(0x01);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_BiasSel); // Select an LCD bias voltage ratio of 1/12.
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_BstMbpXSel); // x8 booster circuit on
|
|
||||||
LCDdriver_WriteData(0x07);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_ColScanDir); // Invert the column scan direction for the panel.
|
|
||||||
LCDdriver_WriteData(0xC0);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_COLORMOD); // 16bpp, 5-6-5 data input mode.
|
|
||||||
LCDdriver_WriteData(0x05);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_MADCTR); // mem scan direction
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_DISPON); // display on
|
|
||||||
|
|
||||||
// Now Clear the Screen
|
|
||||||
LCDdriver_WriteCom(DD_CASET);
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
LCDdriver_WriteData(0x7F);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_RASET);
|
|
||||||
LCDdriver_WriteData(0x01);
|
|
||||||
LCDdriver_WriteData(0x80);
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_RAMWR);
|
|
||||||
for(i = 0; i < (128 * 128); i++)
|
|
||||||
{
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
LCDdriver_WriteData(0x00);
|
|
||||||
}
|
|
||||||
|
|
||||||
LCDdriver_WriteCom(DD_NORON); // normal operation mode
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// +--+
|
|
||||||
// | ++----+
|
|
||||||
// +-++ |
|
|
||||||
// | |
|
|
||||||
// +-+--+ |
|
|
||||||
// | +--+--+
|
|
||||||
// +----+ Copyright (c) 2009 Code Red Technologies Ltd.
|
|
||||||
//
|
|
||||||
// lcd_driver.h - Header file for driver for the lowest level access routines
|
|
||||||
// for the Sitronix ST7637 LCD Controller/driver used on the RDB1768
|
|
||||||
// development board.
|
|
||||||
//
|
|
||||||
// Software License Agreement
|
|
||||||
//
|
|
||||||
// The software is owned by Code Red Technologies and/or its suppliers, and is
|
|
||||||
// protected under applicable copyright laws. All rights are reserved. Any
|
|
||||||
// use in violation of the foregoing restrictions may subject the user to criminal
|
|
||||||
// sanctions under applicable laws, as well as to civil liability for the breach
|
|
||||||
// of the terms and conditions of this license.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
|
||||||
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
|
||||||
// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
|
|
||||||
// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
|
|
||||||
// CODE RED TECHNOLOGIES LTD.
|
|
||||||
|
|
||||||
#ifndef LCD_DRIVER_H_
|
|
||||||
#define LCD_DRIVER_H_
|
|
||||||
|
|
||||||
void LCDdriver_WriteData(unsigned char LCD_Data);
|
|
||||||
void LCDdriver_WriteCom(unsigned char LCD_Command);
|
|
||||||
void LCDdriver_initialisation(void);
|
|
||||||
|
|
||||||
#endif /*LCD_DRIVER_H_*/
|
|
Loading…
Reference in New Issue