Added complete support for Altera Terasic MAX10 NEEK board
This commit is contained in:
parent
d3e9955496
commit
170869dea9
@ -3,4 +3,5 @@ GFXSRC +=
|
|||||||
GFXDEFS +=
|
GFXDEFS +=
|
||||||
GFXLIBS +=
|
GFXLIBS +=
|
||||||
|
|
||||||
include $(GFXLIB)/drivers/gdisp/framebuffer/driver.mk
|
include $(GFXLIB)/drivers/gdisp/alteraframereader/driver.mk
|
||||||
|
include $(GFXLIB)/drivers/ginput/touch/FT5316/driver.mk
|
||||||
|
30
boards/base/Altera-MAX10-Neek/board_alteraframereader.h
Normal file
30
boards/base/Altera-MAX10-Neek/board_alteraframereader.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SCREEN_WIDTH 800
|
||||||
|
#define SCREEN_HEIGHT 480
|
||||||
|
#define FRAMEREADER_BASE ALT_VIP_VFR_0_BASE
|
||||||
|
|
||||||
|
#if GDISP_NEED_CONTROL
|
||||||
|
static void board_backlight(GDisplay* g, uint8_t percent)
|
||||||
|
{
|
||||||
|
(void) g;
|
||||||
|
(void) percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void board_contrast(GDisplay* g, uint8_t percent)
|
||||||
|
{
|
||||||
|
(void) g;
|
||||||
|
(void) percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void board_power(GDisplay* g, powermode_t pwr)
|
||||||
|
{
|
||||||
|
(void) g;
|
||||||
|
(void) pwr;
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is subject to the terms of the GFX License. If a copy of
|
|
||||||
* the license was not distributed with this file, you can obtain one at:
|
|
||||||
*
|
|
||||||
* http://ugfx.org/license.html
|
|
||||||
*/
|
|
||||||
#include <system.h>
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
#define SCREEN_WIDTH 800
|
|
||||||
#define SCREEN_HEIGHT 480
|
|
||||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
|
|
||||||
|
|
||||||
#ifdef GDISP_DRIVER_VMT
|
|
||||||
|
|
||||||
static void board_init(GDisplay* g, fbInfo* fbi)
|
|
||||||
{
|
|
||||||
g->g.Width = SCREEN_WIDTH;
|
|
||||||
g->g.Height = SCREEN_HEIGHT;
|
|
||||||
g->g.Backlight = 100;
|
|
||||||
g->g.Contrast = 50;
|
|
||||||
fbi->linelen = g->g.Width * sizeof(LLDCOLOR_TYPE); // bytes per row
|
|
||||||
fbi->pixels = gfxAlloc(SCREEN_WIDTH * SCREEN_HEIGHT * sizeof(LLDCOLOR_TYPE)); // pointer to the memory frame buffer
|
|
||||||
if (!fbi->pixels) {
|
|
||||||
gfxHalt("Couldn't allocate memory for framebuffer\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Let the framebuffer reader know where to find the framebuffer
|
|
||||||
IOWR(FRAMEBUFFER_READER_BASE, 0, (alt_u32*)fbi->pixels);
|
|
||||||
|
|
||||||
// Make sure the MSB is set so we bypass the data cache
|
|
||||||
fbi->pixels = (void*)((char*)fbi->pixels + 0x80000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if GDISP_HARDWARE_FLUSH
|
|
||||||
static void board_flush(GDisplay* g)
|
|
||||||
{
|
|
||||||
(void) g;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GDISP_NEED_CONTROL
|
|
||||||
static void board_backlight(GDisplay* g, uint8_t percent)
|
|
||||||
{
|
|
||||||
(void) g;
|
|
||||||
(void) percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void board_contrast(GDisplay* g, uint8_t percent)
|
|
||||||
{
|
|
||||||
(void) g;
|
|
||||||
(void) percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void board_power(GDisplay* g, powermode_t pwr)
|
|
||||||
{
|
|
||||||
(void) g;
|
|
||||||
(void) pwr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* GDISP_LLD_BOARD_IMPLEMENTATION */
|
|
106
boards/base/Altera-MAX10-Neek/gmouse_lld_FT5316_board.h
Normal file
106
boards/base/Altera-MAX10-Neek/gmouse_lld_FT5316_board.h
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
#define _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <system.h>
|
||||||
|
#include "i2c_opencores.h"
|
||||||
|
|
||||||
|
#define FT5316_I2C_SLAVE_ADDRESS 0x38
|
||||||
|
|
||||||
|
// Resolution and Accuracy Settings
|
||||||
|
#define GMOUSE_FT5316_PEN_CALIBRATE_ERROR 8
|
||||||
|
#define GMOUSE_FT5316_PEN_CLICK_ERROR 6
|
||||||
|
#define GMOUSE_FT5316_PEN_MOVE_ERROR 4
|
||||||
|
#define GMOUSE_FT5316_FINGER_CALIBRATE_ERROR 14
|
||||||
|
#define GMOUSE_FT5316_FINGER_CLICK_ERROR 18
|
||||||
|
#define GMOUSE_FT5316_FINGER_MOVE_ERROR 14
|
||||||
|
|
||||||
|
// How much extra data to allocate at the end of the GMouse structure for the board's use
|
||||||
|
#define GMOUSE_FT5316_BOARD_DATA_SIZE 0
|
||||||
|
|
||||||
|
// Set this to TRUE if you want self-calibration.
|
||||||
|
// NOTE: This is not as accurate as real calibration.
|
||||||
|
// It requires the orientation of the touch panel to match the display.
|
||||||
|
// It requires the active area of the touch panel to exactly match the display size.
|
||||||
|
#define GMOUSE_FT5316_SELF_CALIBRATE TRUE
|
||||||
|
|
||||||
|
static unsigned int device_write(unsigned char device_address, unsigned char sub_address, unsigned char wdata)
|
||||||
|
{
|
||||||
|
I2C_start(I2C_OPENCORES_0_BASE, device_address, 0); // Device address in write mode
|
||||||
|
I2C_write(I2C_OPENCORES_0_BASE, sub_address, 0); // Set sub address to read register
|
||||||
|
I2C_write(I2C_OPENCORES_0_BASE, wdata, 1); // Set write register
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int device_read(unsigned char device_address, unsigned char sub_address)
|
||||||
|
{
|
||||||
|
unsigned int rdata;
|
||||||
|
|
||||||
|
I2C_start(I2C_OPENCORES_0_BASE, device_address, 0); // Device address in write mode
|
||||||
|
rdata = I2C_write(I2C_OPENCORES_0_BASE, sub_address, 0); // Set sub address to read register.
|
||||||
|
I2C_start(I2C_OPENCORES_0_BASE, device_address, 1); // Send start again but this time in read mode
|
||||||
|
rdata = I2C_read(I2C_OPENCORES_0_BASE, 1); // Read the register and send stop
|
||||||
|
|
||||||
|
return rdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int device_read_16(unsigned char device_address, unsigned char sub_address)
|
||||||
|
{
|
||||||
|
unsigned int rdata_l;
|
||||||
|
unsigned int rdata_h;
|
||||||
|
|
||||||
|
I2C_start(I2C_OPENCORES_0_BASE, device_address, 0); // Eccelerometer address in write mode
|
||||||
|
rdata_l = I2C_write(I2C_OPENCORES_0_BASE, sub_address, 0); // Set sub address to read register.
|
||||||
|
I2C_start(I2C_OPENCORES_0_BASE, device_address, 1); // Send start again but this time in read mode
|
||||||
|
rdata_l = I2C_read(I2C_OPENCORES_0_BASE, 0); // Read the register and MACK
|
||||||
|
rdata_h = I2C_read(I2C_OPENCORES_0_BASE, 1); // Read the next register and send stop
|
||||||
|
|
||||||
|
return (0xFFFF & ((rdata_h << 8) | rdata_l));
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool_t init_board(GMouse* m, unsigned instance)
|
||||||
|
{
|
||||||
|
(void)m;
|
||||||
|
(void)instance;
|
||||||
|
|
||||||
|
I2C_init(I2C_OPENCORES_0_BASE, 50000000, 400000);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_reg(GMouse* m, uint8_t reg, uint8_t val)
|
||||||
|
{
|
||||||
|
(void)m;
|
||||||
|
|
||||||
|
device_write(FT5316_I2C_SLAVE_ADDRESS, reg, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t read_byte(GMouse* m, uint8_t reg)
|
||||||
|
{
|
||||||
|
(void)m;
|
||||||
|
uint8_t ret = 0;
|
||||||
|
|
||||||
|
ret = (uint8_t)device_read(FT5316_I2C_SLAVE_ADDRESS, reg);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint16_t read_word(GMouse* m, uint8_t reg)
|
||||||
|
{
|
||||||
|
(void)m;
|
||||||
|
uint16_t ret = 0;
|
||||||
|
|
||||||
|
ret = (uint16_t)device_read(FT5316_I2C_SLAVE_ADDRESS, reg);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
@ -6,4 +6,5 @@ In order to use this board file, the following things are needed:
|
|||||||
data cache if the MSB is set.
|
data cache if the MSB is set.
|
||||||
|
|
||||||
On this board uGFX currently supports:
|
On this board uGFX currently supports:
|
||||||
- GDISP via the framebuffer driver
|
- GDISP via the altraframereader driver
|
||||||
|
- GINPUT via the FT5316 mouse/touchscreen driver
|
||||||
|
@ -18,6 +18,7 @@ FIX: Fixed extra dots when drawing anti-aliased fonts with wordwrap
|
|||||||
FEATURE: Increase non-UTF8 font support to 0 to 255 rather than just the true ascii set
|
FEATURE: Increase non-UTF8 font support to 0 to 255 rather than just the true ascii set
|
||||||
FEATURE: Added Fb24bpp driver for RGB888 and BGR888 packed framebuffer displays
|
FEATURE: Added Fb24bpp driver for RGB888 and BGR888 packed framebuffer displays
|
||||||
FEATURE: Added UC8173 driver
|
FEATURE: Added UC8173 driver
|
||||||
|
FEATURE: Added complete support for Altera Terasic MAX10 NEEK board
|
||||||
|
|
||||||
|
|
||||||
*** Release 2.7 ***
|
*** Release 2.7 ***
|
||||||
|
Loading…
Reference in New Issue
Block a user