Disabled external gits
This commit is contained in:
68
cs473-es/lab3/sw/.gitignore
vendored
Normal file
68
cs473-es/lab3/sw/.gitignore
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
lab3_lcd_bsp
|
||||
|
||||
*.o
|
||||
*.d
|
||||
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
*.map
|
||||
*.elf
|
||||
*.objdump
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
|
||||
# CDT- autotools
|
||||
.autotools
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# Tern plugin
|
||||
.tern-project
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
|
||||
# Annotation Processing
|
||||
.apt_generated/
|
||||
.apt_generated_test/
|
||||
|
||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||
.cache-main
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
|
||||
# Uncomment this line if you wish to ignore the project description file.
|
||||
# Typically, this file would be tracked if it contains build/dependency configurations:
|
||||
#.project
|
0
cs473-es/lab3/sw/nios/.force_relink
Normal file
0
cs473-es/lab3/sw/nios/.force_relink
Normal file
40
cs473-es/lab3/sw/nios/.project
Normal file
40
cs473-es/lab3/sw/nios/.project
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>lab3_lcd</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.altera.sbtgui.project.makefileBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.altera.sbtgui.project.makefileBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>com.altera.sbtgui.project.SBTGUINature</nature>
|
||||
<nature>com.altera.sbtgui.project.SBTGUIAppNature</nature>
|
||||
<nature>com.altera.sbtgui.project.SBTGUIManagedNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
1084
cs473-es/lab3/sw/nios/Makefile
Normal file
1084
cs473-es/lab3/sw/nios/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
152
cs473-es/lab3/sw/nios/application/image_test.c
Normal file
152
cs473-es/lab3/sw/nios/application/image_test.c
Normal file
@ -0,0 +1,152 @@
|
||||
#ifdef ENABLE_IMAGE_TEST
|
||||
|
||||
#include "stdint.h"
|
||||
#include "math.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#include "lt24.h"
|
||||
|
||||
#include "system.h"
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
|
||||
#define W (320)
|
||||
#define H (240)
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char red,green,blue;
|
||||
} PPMPixel;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
PPMPixel *data;
|
||||
} PPMImage;
|
||||
|
||||
#define RGB_COMPONENT_COLOR 255
|
||||
|
||||
// Source: https://stackoverflow.com/questions/2693631/read-ppm-file-and-store-it-in-an-array-coded-with-c
|
||||
static PPMImage *readPPM(const char *filename)
|
||||
{
|
||||
char buff[16];
|
||||
PPMImage *img;
|
||||
FILE *fp;
|
||||
int c, rgb_comp_color;
|
||||
//open PPM file for reading
|
||||
fp = fopen(filename, "rb");
|
||||
if (!fp) {
|
||||
fprintf(stderr, "Unable to open file '%s'\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//read image format
|
||||
if (!fgets(buff, sizeof(buff), fp)) {
|
||||
perror(filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//check the image format
|
||||
if (buff[0] != 'P' || buff[1] != '6') {
|
||||
fprintf(stderr, "Invalid image format (must be 'P6')\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//alloc memory form image
|
||||
img = HPS_0_BRIDGES_BASE;//(PPMImage *)malloc(sizeof(PPMImage));
|
||||
if (!img) {
|
||||
fprintf(stderr, "Unable to allocate memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//check for comments
|
||||
c = getc(fp);
|
||||
while (c == '#') {
|
||||
while (getc(fp) != '\n') ;
|
||||
c = getc(fp);
|
||||
}
|
||||
|
||||
ungetc(c, fp);
|
||||
//read image size information
|
||||
if (fscanf(fp, "%d %d", &img->x, &img->y) != 2) {
|
||||
fprintf(stderr, "Invalid image size (error loading '%s')\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//read rgb component
|
||||
if (fscanf(fp, "%d", &rgb_comp_color) != 1) {
|
||||
fprintf(stderr, "Invalid rgb component (error loading '%s')\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//check rgb component depth
|
||||
if (rgb_comp_color!= RGB_COMPONENT_COLOR) {
|
||||
fprintf(stderr, "'%s' does not have 8-bits components\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (fgetc(fp) != '\n') ;
|
||||
//memory allocation for pixel data
|
||||
img->data = HPS_0_BRIDGES_BASE + sizeof(PPMImage);
|
||||
|
||||
if (!img) {
|
||||
fprintf(stderr, "Unable to allocate memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//read pixel data from file
|
||||
if (fread(img->data, 3 * img->x, img->y, fp) != img->y) {
|
||||
fprintf(stderr, "Error loading image '%s'\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
void ppmToLCD(uint16_t* lcdbuf, PPMImage* ppm) {
|
||||
pixel_t p;
|
||||
for(int y = 0; y < ppm->y; y++) {
|
||||
for(int x = 0; x < ppm->x; x++) {
|
||||
const PPMPixel* ppmPixel = &ppm->data[y*W + x];
|
||||
p.r = ppmPixel->red >> 3;
|
||||
p.g = ppmPixel->green >> 2;
|
||||
p.b = ppmPixel->blue >> 3;
|
||||
IOWR_16DIRECT(lcdbuf,y*W + x, encPixel(&p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
struct LT24 *lcd = LCDCONTROLLER_0_BASE;
|
||||
uint16_t *buffer = HPS_0_BRIDGES_BASE;
|
||||
|
||||
LT24_initialize(lcd);
|
||||
LT24_setWidth(lcd, W);
|
||||
LT24_setHeight(lcd, H);
|
||||
|
||||
LT24_writeBase(lcd, (uint32_t)buffer);
|
||||
|
||||
// Read PPM from file
|
||||
PPMImage* img = readPPM("/mnt/host/application/testimage.ppm");
|
||||
if (img == NULL){
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Ensure equal to LCD display
|
||||
if(img->x != W || img->y != H) {
|
||||
fprintf(stderr, "Invalid image size (must be 320x240 but was %d x %d)\n", img->x, img->y);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Write (and translate) to LCD buffer
|
||||
ppmToLCD(buffer, img);
|
||||
|
||||
LT24_refresh(lcd);
|
||||
|
||||
while (1){}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
99
cs473-es/lab3/sw/nios/application/lcdcam_system_test.c
Executable file
99
cs473-es/lab3/sw/nios/application/lcdcam_system_test.c
Executable file
@ -0,0 +1,99 @@
|
||||
#ifdef ENABLE_LCDCAM_TEST
|
||||
|
||||
#include "lt24.h"
|
||||
#include "stdint.h"
|
||||
#include "stddef.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#define WIDTH 320
|
||||
#define HEIGHT 240
|
||||
#define NPIXELS WIDTH*HEIGHT
|
||||
#define PIXELSIZE 2 // 16 bits
|
||||
#define BUFFER_SIZE NPIXELS / PIXELSIZE // in words
|
||||
#define BUFFER1 0x10000000
|
||||
#define BUFFER2 BUFFER1 + BUFFER_SIZE
|
||||
#define BUFFER3 BUFFER2 + BUFFER_SIZE
|
||||
#define N_BUFFERS 3
|
||||
|
||||
struct BufferManager {
|
||||
uint32_t* buffers[N_BUFFERS];
|
||||
|
||||
// Buffer assignment semantics:
|
||||
// if null
|
||||
// => device currently has no assigne buffer
|
||||
// => device is currently now showing/capturing
|
||||
uint32_t* lcd_buffer;
|
||||
uint32_t* cam_buffer;
|
||||
};
|
||||
|
||||
struct BufferManager bman;
|
||||
struct LT24 *lcd = LCDCONTROLLER_0_BASE;
|
||||
// struct Camera cam = CAMERA_ADDRESS;
|
||||
|
||||
void setupBuffers(struct BufferManager* bman, uint32_t* b1, uint32_t* b2, uint32_t* b3) {
|
||||
bman->buffers[0] = b1;
|
||||
bman->buffers[1] = b2;
|
||||
bman->buffers[2] = b3;
|
||||
bman->lcd_buffer = 0;
|
||||
bman->cam_buffer = 0;
|
||||
}
|
||||
|
||||
int main_changeme() {
|
||||
setupBuffers(&bman, BUFFER1, BUFFER2, BUFFER3);
|
||||
|
||||
LT24_initialize(lcd);
|
||||
// startCamera(&cam);
|
||||
while(1) {
|
||||
// TODO: put to sleep...
|
||||
}
|
||||
}
|
||||
|
||||
void tryLCDShow() {
|
||||
char gotBuffer = 0;
|
||||
for (int i = 0; i < N_BUFFERS; i++) {
|
||||
if (bman.buffers[i] != 0 && bman.buffers[i] != bman.cam_buffer) {
|
||||
bman.lcd_buffer = bman.buffers[i];
|
||||
gotBuffer = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gotBuffer) {
|
||||
LT24_refresh(lcd);
|
||||
} else {
|
||||
bman.lcd_buffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void tryCamCapture() {
|
||||
char gotBuffer = 0;
|
||||
for (int i = 0; i < N_BUFFERS; i++) {
|
||||
if (bman.buffers[i] != bman.lcd_buffer && bman.buffers[i] != bman.cam_buffer) {
|
||||
bman.cam_buffer = bman.buffers[i];
|
||||
gotBuffer = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gotBuffer) {
|
||||
// captureImage(bman.lcd_buffer);
|
||||
} else {
|
||||
bman.cam_buffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void IRQ_lcd() {
|
||||
bman.lcd_buffer = 0; // Yield buffer
|
||||
tryLCDShow(); // Locate any ready buffer
|
||||
if (bman.cam_buffer == 0) { // If camera currently inactive, re-try capture (we just yielded a buffer)
|
||||
tryCamCapture();
|
||||
}
|
||||
}
|
||||
|
||||
void IRQ_camera() {
|
||||
tryCamCapture();
|
||||
if (bman.lcd_buffer == 0) {
|
||||
tryLCDShow();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
67
cs473-es/lab3/sw/nios/application/lcdtest.c
Executable file
67
cs473-es/lab3/sw/nios/application/lcdtest.c
Executable file
@ -0,0 +1,67 @@
|
||||
#define LCD_TEST
|
||||
#ifdef LCD_TEST
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lt24.h"
|
||||
|
||||
#include "system.h"
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
#define MAX_RED (2 << 5)
|
||||
#define MAX_GREEN (2 << 6)
|
||||
#define MAX_BLUE (2 << 5)
|
||||
|
||||
#define MAX_RED_V 0b11111
|
||||
#define MAX_GREEN_V 0b111111
|
||||
#define MAX_BLUE_V 0b11111
|
||||
|
||||
// Compute an image that is h + MAX_GREEN in height
|
||||
void drawTestImage(uint16_t *buffer, const unsigned h, const unsigned w, const unsigned offset)
|
||||
{
|
||||
pixel_t p0 = {0};
|
||||
int idx = 0;
|
||||
float rh = 1.*MAX_RED_V;
|
||||
float rw = 1.*MAX_BLUE_V;
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
p0.r = (unsigned)(y*rh / h);
|
||||
p0.b = (unsigned)(x*rw / w);
|
||||
|
||||
IOWR_16DIRECT(buffer, idx, encPixel(&p0));
|
||||
idx+=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define W (320)
|
||||
#define H (240)
|
||||
uint16_t *buffer = HPS_0_BRIDGES_BASE;
|
||||
struct LT24 *lcd = LCDCONTROLLER_0_BASE;
|
||||
|
||||
void lcd_ISR()
|
||||
{
|
||||
LT24_clearIRQ(lcd, LT24_IRQ_CTRL_IRQ0_ACTIVE);
|
||||
LT24_refresh(lcd);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
LT24_initialize(lcd);
|
||||
LT24_writeIRQ(lcd, LT24_IRQ_CTRL_ENABLE);
|
||||
LT24_setWidth(lcd, W);
|
||||
LT24_setHeight(lcd, H);
|
||||
|
||||
LT24_writeBase(lcd, (uint32_t)buffer);
|
||||
// Register LCD refresh finished interrupt
|
||||
alt_ic_isr_register(LCDCONTROLLER_0_IRQ_INTERRUPT_CONTROLLER_ID,
|
||||
LCDCONTROLLER_0_IRQ, lcd_ISR, 0, 0);
|
||||
|
||||
drawTestImage(buffer,H,W,0);
|
||||
// Initiate continuous refreshing through an initial call to the ISR
|
||||
lcd_ISR();
|
||||
while (1){}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
248
cs473-es/lab3/sw/nios/application/lt24.h
Executable file
248
cs473-es/lab3/sw/nios/application/lt24.h
Executable file
@ -0,0 +1,248 @@
|
||||
#include "stdint.h"
|
||||
#include "stddef.h"
|
||||
#include "unistd.h"
|
||||
|
||||
|
||||
#include "io.h"
|
||||
|
||||
// LT24 LCD Controller pixel format
|
||||
typedef struct Pixel
|
||||
{
|
||||
unsigned r : 5;
|
||||
unsigned g : 6;
|
||||
unsigned b : 5;
|
||||
} pixel_t;
|
||||
|
||||
static inline uint16_t encPixel(const struct Pixel *p)
|
||||
{
|
||||
return (p->r << (5 + 6)) | (p->g << 5) | (p->b);
|
||||
}
|
||||
|
||||
// LT24 LCD Controller hardware address register layout
|
||||
struct LT24
|
||||
{
|
||||
uint32_t writeReg;
|
||||
uint32_t writeData;
|
||||
uint32_t writeBase;
|
||||
uint32_t refresh;
|
||||
uint32_t ctrlReg;
|
||||
uint32_t setHeight;
|
||||
uint32_t setWidth;
|
||||
uint32_t writeIRQ;
|
||||
uint32_t setIRQ;
|
||||
uint32_t clearIRQ;
|
||||
uint32_t isBusy;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
|
||||
static inline void SleepMS(int someTime)
|
||||
{
|
||||
usleep(1000*someTime);
|
||||
}
|
||||
|
||||
#define LT24_WIDTH 320
|
||||
#define LT24_HEIGHT 240
|
||||
|
||||
|
||||
// LT24 Interrupt control register
|
||||
#define LT24_IRQ_CTRL_ENABLE_OFFSET 0
|
||||
#define LT24_IRQ_CTRL_ENABLE (1 << LT24_IRQ_CTRL_ENABLE_OFFSET)
|
||||
#define LT24_IRQ_CTRL_CLEAR_ON_REFRESH_OFFSET 1
|
||||
#define LT24_IRQ_CTRL_CLEAR_ON_REFRESH (1 << LT24_IRQ_CTRL_CLEAR_ON_REFRESH_OFFSET)
|
||||
#define LT24_IRQ_CTRL_IRQ0_ACTIVE_OFFSET 2
|
||||
#define LT24_IRQ_CTRL_IRQ0_ACTIVE (1 << LT24_IRQ_CTRL_IRQ0_ACTIVE_OFFSET)
|
||||
|
||||
// LT24 Control register
|
||||
#define LT24_CTRL_LCD_ON_OFFSET 0
|
||||
#define LT24_CTRL_LCD_ON (1 << LT24_CTRL_LCD_ON_OFFSET)
|
||||
#define LT24_CTRL_RST_OFFSET 1
|
||||
#define LT24_CTRL_RST (1 << LT24_CTRL_RST_OFFSET)
|
||||
|
||||
// LT24 Read convenience functions
|
||||
#define LT24_DEFINE_32_RDFUNC(funcname, fieldName) \
|
||||
static inline uint32_t LT24_##funcname(struct LT24 *lcd) \
|
||||
{ \
|
||||
return IORD_32DIRECT(lcd, offsetof(struct LT24, fieldName)); \
|
||||
}
|
||||
|
||||
LT24_DEFINE_32_RDFUNC(isBusy, isBusy);
|
||||
|
||||
// LT24 write convenience functions
|
||||
#define LT24_DEFINE_16_WRFUNC(funcname, fieldName) \
|
||||
static inline void LT24_##funcname(struct LT24 *lcd, uint16_t value) \
|
||||
{ \
|
||||
IOWR_32DIRECT(lcd, offsetof(struct LT24, fieldName), value); \
|
||||
}
|
||||
|
||||
LT24_DEFINE_16_WRFUNC(writeReg, writeReg)
|
||||
LT24_DEFINE_16_WRFUNC(writeData, writeData)
|
||||
LT24_DEFINE_16_WRFUNC(writeBase, writeBase)
|
||||
LT24_DEFINE_16_WRFUNC(writeCtrlReg, ctrlReg)
|
||||
LT24_DEFINE_16_WRFUNC(setHeight, setHeight)
|
||||
LT24_DEFINE_16_WRFUNC(setWidth, setWidth)
|
||||
LT24_DEFINE_16_WRFUNC(writeIRQ, writeIRQ)
|
||||
LT24_DEFINE_16_WRFUNC(setIRQ, setIRQ)
|
||||
LT24_DEFINE_16_WRFUNC(clearIRQ, clearIRQ)
|
||||
|
||||
static inline void LT24_setCursor(struct LT24 *lcd, alt_u16 x, alt_u16 y)
|
||||
{
|
||||
LT24_writeReg(lcd, 0x002A);
|
||||
LT24_writeData(lcd, x>>8);
|
||||
LT24_writeData(lcd, x&0XFF);
|
||||
LT24_writeReg(lcd, 0x002B);
|
||||
LT24_writeData(lcd, y>>8);
|
||||
LT24_writeData(lcd, y&0XFF);
|
||||
}
|
||||
|
||||
static inline void LT24_refresh(struct LT24 *lcd)
|
||||
{
|
||||
LT24_setCursor(lcd, 0, 0); // Initialize draw position to (0,0)
|
||||
LT24_writeReg(lcd, 0x2C); //Memory Write
|
||||
IOWR_32DIRECT(lcd, offsetof(struct LT24, refresh), 0);
|
||||
}
|
||||
|
||||
static inline void LT24_manualRefresh(struct LT24 *lcd, uint16_t* buffer, unsigned width, unsigned height)
|
||||
{
|
||||
LT24_setCursor(lcd, 0, 0); // Initialize draw position to (0,0)
|
||||
LT24_writeReg(lcd, 0x2C); //Memory Write
|
||||
for(int i = 0; i < width*height; i++) {
|
||||
LT24_writeData(lcd, *(buffer + i));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void LT24_reset(struct LT24 *lcd) {
|
||||
|
||||
LT24_writeCtrlReg(lcd, LT24_CTRL_LCD_ON);
|
||||
SleepMS(500);
|
||||
LT24_writeCtrlReg(lcd, LT24_CTRL_LCD_ON | LT24_CTRL_RST);
|
||||
SleepMS(10);
|
||||
LT24_writeCtrlReg(lcd, LT24_CTRL_LCD_ON);
|
||||
SleepMS(120);
|
||||
LT24_writeReg(lcd, 0x11); //Sleep Out
|
||||
SleepMS(10); // Docs: It will be necessary to wait 5msec before sending next to command, this is to allow time for the supply voltages and clock circuits to stabilize
|
||||
}
|
||||
|
||||
static inline void LT24_initialize(struct LT24 *lcd)
|
||||
{
|
||||
LT24_reset(lcd);
|
||||
|
||||
LT24_writeReg(lcd, 0xCF); //Power Control B
|
||||
LT24_writeData(lcd, 0x00); //Always0x00
|
||||
LT24_writeData(lcd, 0x81);
|
||||
LT24_writeData(lcd, 0xC0);
|
||||
|
||||
LT24_writeReg(lcd, 0xED); //Power on sequence control
|
||||
LT24_writeData(lcd, 0x64); //Soft Start Keep1 frame
|
||||
LT24_writeData(lcd, 0x03);
|
||||
LT24_writeData(lcd, 0X12);
|
||||
LT24_writeData(lcd, 0X81);
|
||||
|
||||
LT24_writeReg(lcd, 0xE8); //Driver timing control A
|
||||
LT24_writeData(lcd, 0x85);
|
||||
LT24_writeData(lcd, 0x01);
|
||||
LT24_writeData(lcd, 0x0798); // 0x00798 ???
|
||||
|
||||
LT24_writeReg(lcd, 0xCB); // Power control A
|
||||
LT24_writeData(lcd, 0x39);
|
||||
LT24_writeData(lcd, 0x2C);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x34);
|
||||
LT24_writeData(lcd, 0x02);
|
||||
|
||||
LT24_writeReg(lcd, 0xF7); // Pumpratio control
|
||||
LT24_writeData(lcd, 0x20);
|
||||
|
||||
LT24_writeReg(lcd, 0xEA); // Driver timing control B
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
|
||||
LT24_writeReg(lcd, 0xB1); // Frame Control (In Normal Mode)
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x1b);
|
||||
|
||||
LT24_writeReg(lcd, 0xB6); // Display FunctionControl
|
||||
LT24_writeData(lcd, 0x0A);
|
||||
LT24_writeData(lcd, 0xA2);
|
||||
|
||||
LT24_writeReg(lcd, 0xC0); //Power control 1
|
||||
LT24_writeData(lcd, 0x05); //VRH[5:0]
|
||||
|
||||
LT24_writeReg(lcd, 0xC1); //Power control 2
|
||||
LT24_writeData(lcd, 0x11); //SAP[2:0];BT[3:0]
|
||||
|
||||
LT24_writeReg(lcd, 0xC5); //VCM control 1
|
||||
LT24_writeData(lcd, 0x45); //3F
|
||||
LT24_writeData(lcd, 0x45); //3C
|
||||
|
||||
LT24_writeReg(lcd, 0xC7); //VCM control 2
|
||||
LT24_writeData(lcd, 0xA2);
|
||||
|
||||
LT24_writeReg(lcd, 0x36); //Memory Access Control
|
||||
LT24_writeData(lcd, 0x68);
|
||||
|
||||
LT24_writeReg(lcd, 0x2A); // Column Addr
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x01);
|
||||
LT24_writeData(lcd, 0x3F);
|
||||
|
||||
LT24_writeReg(lcd, 0x2B); // Page Addr
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0xF0);
|
||||
|
||||
LT24_writeReg(lcd, 0xF2); //Disable 3Gamma
|
||||
LT24_writeData(lcd, 0x00);
|
||||
|
||||
LT24_writeReg(lcd, 0x26); //Gamma Curve Selected
|
||||
LT24_writeData(lcd, 0x01);
|
||||
|
||||
LT24_writeReg(lcd, 0xE0); //Positive Gamma Correction, Set Gamma
|
||||
LT24_writeData(lcd, 0x0F);
|
||||
LT24_writeData(lcd, 0x26);
|
||||
LT24_writeData(lcd, 0x24);
|
||||
LT24_writeData(lcd, 0x0B);
|
||||
LT24_writeData(lcd, 0x0E);
|
||||
LT24_writeData(lcd, 0x08);
|
||||
LT24_writeData(lcd, 0x4B);
|
||||
LT24_writeData(lcd, 0XA8);
|
||||
LT24_writeData(lcd, 0x3B);
|
||||
LT24_writeData(lcd, 0x0A);
|
||||
LT24_writeData(lcd, 0x14);
|
||||
LT24_writeData(lcd, 0x06);
|
||||
LT24_writeData(lcd, 0x10);
|
||||
LT24_writeData(lcd, 0x09);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
|
||||
LT24_writeReg(lcd, 0XE1); //NegativeGamma Correction, Set Gamma
|
||||
LT24_writeData(lcd, 0x00);
|
||||
LT24_writeData(lcd, 0x1C);
|
||||
LT24_writeData(lcd, 0x20);
|
||||
LT24_writeData(lcd, 0x04);
|
||||
LT24_writeData(lcd, 0x10);
|
||||
LT24_writeData(lcd, 0x08);
|
||||
LT24_writeData(lcd, 0x34);
|
||||
LT24_writeData(lcd, 0x47);
|
||||
LT24_writeData(lcd, 0x44);
|
||||
LT24_writeData(lcd, 0x05);
|
||||
LT24_writeData(lcd, 0x0B);
|
||||
LT24_writeData(lcd, 0x09);
|
||||
LT24_writeData(lcd, 0x2F);
|
||||
LT24_writeData(lcd, 0x36);
|
||||
LT24_writeData(lcd, 0x0F);
|
||||
|
||||
LT24_writeReg(lcd, 0x3A); //COLMOD: Pixel Format Set
|
||||
LT24_writeData(lcd, 0x55);
|
||||
|
||||
LT24_writeReg(lcd, 0xF6); //Interface Control
|
||||
LT24_writeData(lcd, 0x01);
|
||||
LT24_writeData(lcd, 0x30);
|
||||
LT24_writeData(lcd, 0x00);
|
||||
|
||||
LT24_writeReg(lcd, 0x29); //Display on
|
||||
|
||||
LT24_setCursor(lcd, 0, 0); // Initialize draw position to (0,0)
|
||||
|
||||
LT24_writeReg(lcd, 0x2C); //Memory Write
|
||||
}
|
230404
cs473-es/lab3/sw/nios/application/testimage.ppm
Normal file
230404
cs473-es/lab3/sw/nios/application/testimage.ppm
Normal file
File diff suppressed because it is too large
Load Diff
0
cs473-es/lab3/sw/nios/obj/default/.force_relink
Normal file
0
cs473-es/lab3/sw/nios/obj/default/.force_relink
Normal file
26
cs473-es/lab3/sw/nios/readme.txt
Normal file
26
cs473-es/lab3/sw/nios/readme.txt
Normal file
@ -0,0 +1,26 @@
|
||||
Readme - Hello World Software Example
|
||||
|
||||
DESCRIPTION:
|
||||
Simple program that prints "Hello from Nios II"
|
||||
|
||||
The memory footprint of this hosted application is intended to be small (under 100 kbytes) by default
|
||||
using a standard reference deisgn.
|
||||
|
||||
For an even smaller, reduced footprint version of this template, and an explanation of how
|
||||
to reduce the memory footprint for a given application, see the
|
||||
"small_hello_world" template.
|
||||
|
||||
|
||||
PERIPHERALS USED:
|
||||
This example exercises the following peripherals:
|
||||
- STDOUT device (UART or JTAG UART)
|
||||
|
||||
SOFTWARE SOURCE FILES:
|
||||
This example includes the following software source files:
|
||||
- hello_world.c: Everyone needs a Hello World program, right?
|
||||
|
||||
BOARD/HOST REQUIREMENTS:
|
||||
This example requires only a JTAG connection with a Nios Development board. If
|
||||
the host communication settings are changed from JTAG UART (default) to use a
|
||||
conventional UART, a serial cable between board DB-9 connector and the host is
|
||||
required.
|
6
cs473-es/lab3/sw/nios/system/template.xml
Executable file
6
cs473-es/lab3/sw/nios/system/template.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template_settings>
|
||||
<template
|
||||
default_build_configuration="Release">
|
||||
</template>
|
||||
</template_settings>
|
Reference in New Issue
Block a user