Merge branch 'master' of https://bitbucket.org/Tectu/ugfx into gwin

This commit is contained in:
Joel Bodenmann 2014-04-20 10:41:53 +02:00
commit c88e25b84f
179 changed files with 3409 additions and 4225 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,9 @@
* http://ugfx.org/license.html
*/
/* Board interface definitions for ED060SC4 PrimeView E-ink panel.
/**
* @file boards/addons/gdisp/board_ED060SC4_example.h
* @brief GDISP Graphic Driver subsystem board interface for the ED060SC4 display.
*
* This file corresponds to the connections shown in example_schematics.png,
* and is designed to interface with ChibiOS/RT.

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h
* @file boards/addons/gdisp/board_HX8347D_stm32f4discovery.h
* @brief GDISP Graphic Driver subsystem board SPI interface for the HX8347D display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h
* @brief GDISP Graphic Driver subsystem board interface for the ILI9325 display.
* @file boards/addons/gdisp/board_ILI9320_olimex_pic32mx_lcd.h
* @brief GDISP Graphic Driver subsystem board SPI interface for the ILI9325 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef GDISP_LLD_BOARD_H

View File

@ -19,8 +19,11 @@
/**
* @file drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h
* @brief GDISP Graphic Driver subsystem board interface for the ILI9325 display.
* @file boards/addons/gdisp/board_ILI9325_hy_stm32_100p.h
* @brief GDISP Graphic Driver subsystem board SPI interface for the ILI9325 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef GDISP_LLD_BOARD_H

View File

@ -0,0 +1,222 @@
/*
* 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
*/
/**
* @file boards/addons/gdisp/board_ILI9341_spi.h
* @brief GDISP Graphic Driver subsystem board interface for the ILI9341 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
#define LCD_PORT GPIOB
#define LCD_MOSI 15
#define LCD_MISO 14
#define LCD_SCK 13
#define LCD_CS 12
#define LCD_DC 11
#define LCD_RES 10
#define LCD_DC_CMD palClearPad(LCD_PORT, LCD_DC)
#define LCD_DC_DATA palSetPad(LCD_PORT, LCD_DC)
#define LCD_SCK_SET palSetPad(LCD_PORT, LCD_SCK)
#define LCD_SCK_RES palClearPad(LCD_PORT, LCD_SCK)
#define LCD_CS_RES palSetPad(LCD_PORT, LCD_CS)
#define LCD_CS_SET palClearPad(LCD_PORT, LCD_CS)
/**
* SPI configuration structure.
* Speed 12 MHz, CPHA=0, CPOL=0, 8bits frames, MSb transmitted first.
* Soft slave select.
*/
static const SPIConfig spi2cfg = {
NULL,
LCD_PORT,
LCD_CS,
(SPI_CR1_MSTR | SPI_CR1_SPE | SPI_CR1_SSM | SPI_CR1_SSI)
};
static void send_data(uint16_t data);
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->board to NULL as we don't use it.
g->board = 0;
palSetPadMode(LCD_PORT, LCD_CS, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(LCD_PORT, LCD_DC, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(LCD_PORT, LCD_RES, PAL_MODE_OUTPUT_PUSHPULL);
spiStart(&SPID2, &spi2cfg);
spiSelectI(&SPID2);
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
if (state == TRUE) {
palClearPad(LCD_PORT, LCD_RES);
} else {
palSetPad(LCD_PORT, LCD_RES);
}
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the lcd.
*
* @param[in] data The data to send
*
* @notapi
*/
static inline void send_data(uint16_t data) {
// http://forum.easyelectronics.ru/viewtopic.php?p=262122#p262122
while (!(SPI2->SR & SPI_SR_TXE)); // ïðè âõîäå íà îòïðàâêó ïðîâåðÿåì - à ïóñòîé ëè SPI_DR
SPI2->DR = data; // çàãðóçèëè â SPI_DR êîä êîìàíäû
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
while (SPI2->SR & SPI_SR_BSY);
LCD_CS_RES;
LCD_DC_CMD; // ïåðåâîäèì äèñïëåé â ðåæèì êîìàíä
LCD_CS_SET;
send_data(index);
while (SPI2->SR & SPI_SR_BSY); // ïîêà ôëàã óñòàíîâëåí (==1) -- ìîäóëü SPI çàíÿò
/* ëèøíèé öèêë îæèäàíèÿ îêîí÷àíèÿ ïåðåäà÷è êîìàíäû ïîçâîëÿåò â äàëüíåéøåì ñëàòü
* áàéòû äàííûõ áåç íåíóæíûõ îæèäàíèé è çàäåðæåê.
*/
LCD_DC_DATA; // ïåðåâîäèì äèñïëåé â ðåæèì äàííûõ
}
/**
* @brief Send data to the lcd with DC control.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
send_data(data);
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
#endif /* _GDISP_LLD_BOARD_H */

View File

@ -6,9 +6,11 @@
*/
/**
* @file drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h
* @brief GDISP Graphics Driver subsystem low level driver source for
* the ILI9481 and compatible HVGA display
* @file boards/addons/gdisp/board_ILI9481_firebullstm32f103.h
* @brief GDISP Graphics Driver subsystem low level driver source for the ILI9481 and compatible HVGA display
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h
* @brief GDISP Graphic Driver subsystem board interface for the S6D1121 display
* @file boards/addons/gdisp/board_S6D1121_olimex_e407.h
* @brief GDISP Graphic Driver subsystem board interface for the S6D1121 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h
* @file boards/addons/gdisp/board_SSD1289_stm32f4discovery.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1289 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/SSD1306/board_SSD1306_i2c.h
* @file boards/addons/gdisp/board_SSD1306_i2c.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/SSD1306/board_SSD1306_spi.h
* @file boards/addons/gdisp/board_SSD1306_spi.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/SSD1963/board_SSD1963_fsmc.h
* @file boards/addons/gdisp/board_SSD1963_fsmc.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1963 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,8 +6,11 @@
*/
/**
* @file drivers/gdisp/SSD1963/board_SSD1963_gpio.h
* @file boards/addons/gdisp/board_SSD1963_gpio.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1963 display.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GDISP_LLD_BOARD_H

View File

@ -6,12 +6,11 @@
*/
/**
* @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
* @file boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h
* @brief GINPUT Touch low level driver source for the ADS7843 on an Olimex STM32E407.
*
* @defgroup Mouse Mouse
* @ingroup GINPUT
* @{
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
@ -87,4 +86,4 @@ static inline uint16_t read_value(uint16_t port) {
}
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
/** @} */

View File

@ -5,6 +5,14 @@
* http://ugfx.org/license.html
*/
/**
* @file boards/addons/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h
* @brief GINPUT Touch low level driver source for the ADS7843 on an st_stm32f4_discovery.
*
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
#define _GINPUT_LLD_MOUSE_BOARD_H

View File

@ -6,13 +6,11 @@
*/
/**
* @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
* @file boards/addons/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
* @brief GINPUT Touch low level driver source for the MCU on the example board.
*
* @defgroup Mouse Mouse
* @ingroup GINPUT
*
* @{
* @note This file contains a mix of hardware specific and operating system specific
* code. You will need to change it for your CPU and/or operating system.
*/
#ifndef _GINPUT_LLD_MOUSE_BOARD_H

View File

@ -153,6 +153,7 @@ LD = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary

View File

@ -29,6 +29,10 @@
*/
#define STM32F4xx_MCUCONF
#define STM32F40_41xxx
// Define this if you are using an older ChibiOS version
//#define STM32_VOS STM32_VOS_HIGH
/*
* HAL driver system settings.
@ -57,7 +61,6 @@
#define STM32_I2SSRC STM32_I2SSRC_CKIN
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SR_VALUE 5
#define STM32_VOS STM32_VOS_HIGH
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_BKPRAM_ENABLE FALSE

View File

@ -6,3 +6,4 @@ include $(GFXLIB)/drivers/gadc/AT91SAM7/gadc_lld.mk
include $(GFXLIB)/drivers/ginput/dial/GADC/ginput_lld.mk
include $(GFXLIB)/drivers/ginput/toggle/Pal/ginput_lld.mk
include $(GFXLIB)/drivers/gaudio/gadc/driver.mk
include $(GFXLIB)/drivers/gaudio/pwm/driver.mk

View File

@ -136,6 +136,7 @@ LD = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary

View File

@ -80,7 +80,7 @@
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
#define HAL_USE_GPT FALSE
#define HAL_USE_GPT TRUE
#endif
/**
@ -116,10 +116,6 @@
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM TRUE
#define PWM_USE_PWM1 FALSE
#define PWM_USE_PWM2 TRUE
#define PWM_USE_PWM3 FALSE
#define PWM_USE_PWM4 FALSE
#endif
/**

View File

@ -52,6 +52,10 @@
/*
* PWM driver system settings.
*/
#define PWM_USE_PWM1 TRUE // used by audio-out
#define PWM_USE_PWM2 TRUE // used by back-light
#define PWM_USE_PWM3 FALSE
#define PWM_USE_PWM4 FALSE
/*
* SERIAL driver system settings.
@ -69,3 +73,10 @@
#define AT91SAM7_SPI_USE_SPI1 FALSE
#define AT91SAM7_SPI0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)
#define AT91SAM7_SPI1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)
/*
* GPT driver system settings.
*/
#define AT91_GPT_USE_TC0 FALSE // used internally by ADC driver
#define AT91_GPT_USE_TC1 TRUE // uGFX used for audio-out
#define AT91_GPT_USE_TC2 FALSE

View File

@ -0,0 +1,75 @@
/*
* 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 GAUDIO_PLAY_BOARD_H
#define GAUDIO_PLAY_BOARD_H
/* Our timer callback */
static void gptcallback(GPTDriver *gptp) {
(void) gptp;
gaudio_play_pwm_timer_callbackI();
}
/* PWM configuration structure. The speaker is on PWM0/PB19 ie PWM1/PIN1 in ChibiOS speak */
static PWMConfig pwmcfg = {
1000000, /* 1 MHz PWM clock frequency. Ignored as we are using PWM_MCK_DIV_n */
1024, /* PWM period is 1024 cycles (10 bits). */
0,
{
{PWM_MCK_DIV_1 | PWM_OUTPUT_CENTER | PWM_OUTPUT_ACTIVE_HIGH | PWM_OUTPUT_PIN1 | PWM_DISABLEPULLUP_PIN1, 0},
},
};
/* Timer configuration structure. We use Timer 2 (TC1) */
static GPTConfig gptcfg = {
8192, // frequency
gptcallback, // callback
GPT_CLOCK_FREQUENCY, // clocksource
GPT_GATE_NONE, // clockgate
GPT_TRIGGER_NONE, // trigger
};
static uint16_t lastvalue;
static bool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) {
if (format == ARRAY_DATA_10BITUNSIGNED)
pwmcfg.period = 1024;
else if (format == ARRAY_DATA_8BITUNSIGNED)
pwmcfg.period = 256;
else
return FALSE;
gptcfg.frequency = frequency;
return TRUE;
}
static void gaudio_play_pwm_start(void) {
/* Start the PWM */
pwmStart(&PWMD1, &pwmcfg);
lastvalue = pwmcfg.period>>1;
pwmEnableChannelI(&PWMD1, 0, lastvalue);
/* Start the timer interrupt */
gptStart(&GPTD2, &gptcfg);
gptStartContinuous(&GPTD2, 0);
}
static void gaudio_play_pwm_stop(void) {
/* Stop the timer interrupt */
gptStopTimer(&GPTD2);
/* Stop the PWM */
pwmStop(&PWMD1);
}
static void gaudio_play_pwm_setI(uint16_t value) {
if (value != lastvalue) {
lastvalue = value;
pwmEnableChannelI(&PWMD1, 0, value);
}
}
#endif /* GAUDIO_PLAY_BOARD_H */

View File

@ -19,13 +19,18 @@
#define GAUDIO_RECORD_NUM_CHANNELS 1
/**
* @brief Whether each channel is mono or stereo
*/
#define GAUDIO_RECORD_CHANNEL0_IS_STEREO FALSE
/**
* The list of audio channels and their uses
*/
#define GAUDIO_RECORD_MICROPHONE 0
#ifdef GAUDIO_RECORD_IMPLEMENTATION
static uint32_t gaudin_lld_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
static uint32_t gaudio_gadc_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
GADC_PHYSDEV_MICROPHONE,
};
#endif

View File

@ -51,7 +51,6 @@
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_CONTROL TRUE
#define GDISP_NEED_MULTITHREAD TRUE
/* GDISP - builtin fonts */

View File

@ -38,9 +38,6 @@
/* Include internal GWIN routines so we can build our own superset class */
#include "src/gwin/class_gwin.h"
/* The size of our dynamically allocated audio buffer */
#define AUDIOBUFSZ 64*2
/* How many flat-line sample before we trigger */
#define FLATLINE_SAMPLES 8
@ -50,10 +47,6 @@ static void _destroy(GHandle gh) {
gfxFree(((GScopeObject *)gh)->lastscopetrace);
((GScopeObject *)gh)->lastscopetrace = 0;
}
if (((GScopeObject *)gh)->audiobuf) {
gfxFree(((GScopeObject *)gh)->audiobuf);
((GScopeObject *)gh)->audiobuf = 0;
}
}
static const gwinVMT scopeVMT = {
@ -68,12 +61,9 @@ GHandle gwinGScopeCreate(GDisplay *g, GScopeObject *gs, GWindowInit *pInit, uint
/* Initialise the base class GWIN */
if (!(gs = (GScopeObject *)_gwindowCreate(g, &gs->g, pInit, &scopeVMT, 0)))
return 0;
gfxSemInit(&gs->bsem, 0, 1);
gs->nextx = 0;
if (!(gs->lastscopetrace = gfxAlloc(gs->g.width * sizeof(coord_t))))
return 0;
if (!(gs->audiobuf = gfxAlloc(AUDIOBUFSZ * sizeof(adcsample_t))))
return 0;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
gs->lasty = gs->g.height/2;
#elif TRIGGER_METHOD == TRIGGER_MINVALUE
@ -82,8 +72,7 @@ GHandle gwinGScopeCreate(GDisplay *g, GScopeObject *gs, GWindowInit *pInit, uint
#endif
/* Start the GADC high speed converter */
gadcHighSpeedInit(physdev, frequency, gs->audiobuf, AUDIOBUFSZ, AUDIOBUFSZ/2);
gadcHighSpeedSetBSem(&gs->bsem, &gs->myEvent);
gadcHighSpeedInit(physdev, frequency);
gadcHighSpeedStart();
gwinSetVisible((GHandle)gs, pInit->show);
@ -97,6 +86,8 @@ void gwinScopeWaitForTrace(GHandle gh) {
coord_t yoffset;
adcsample_t *pa;
coord_t *pc;
GDataBuffer *pd;
uint8_t shr;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
bool_t rdytrigger;
int flsamples;
@ -109,20 +100,21 @@ void gwinScopeWaitForTrace(GHandle gh) {
if (gh->vmt != &scopeVMT)
return;
/* Wait for a set of audio conversions */
gfxSemWait(&gs->bsem, TIME_INFINITE);
/* Wait for a set of conversions */
pd = gadcHighSpeedGetData(TIME_INFINITE);
/* Ensure we are drawing in the right area */
#if GDISP_NEED_CLIP
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
shr = 16 - gfxSampleFormatBits(GADC_SAMPLE_FORMAT);
yoffset = gh->height/2;
if (!(GADC_SAMPLE_FORMAT & 1))
if (!gfxSampleFormatIsSigned(GADC_SAMPLE_FORMAT))
yoffset += (1<<SCOPE_Y_BITS)/2;
x = gs->nextx;
pc = gs->lastscopetrace+x;
pa = gs->myEvent.buffer;
pa = (adcsample_t *)(pd+1);
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
rdytrigger = FALSE;
flsamples = 0;
@ -132,14 +124,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
scopemin = 0;
#endif
for(i = gs->myEvent.count; i; i--) {
for(i = pd->len/sizeof(adcsample_t); i; i--) {
/* Calculate the new scope value - re-scale using simple shifts for efficiency, re-center and y-invert */
#if GADC_BITS_PER_SAMPLE > SCOPE_Y_BITS
y = yoffset - (*pa++ >> (GADC_BITS_PER_SAMPLE - SCOPE_Y_BITS));
#else
y = yoffset - (*pa++ << (SCOPE_Y_BITS - GADC_BITS_PER_SAMPLE));
#endif
y = yoffset - (((coord_t)(*pa++) << shr) >> (16-SCOPE_Y_BITS));
#if TRIGGER_METHOD == TRIGGER_MINVALUE
/* Calculate the scopemin ready for the next trace */
@ -205,5 +193,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
gs->scopemin = scopemin;
#endif
gfxBufferRelease(pd);
#undef gs
}

View File

@ -43,7 +43,7 @@
/* The extent of scaling for our audio data - fixed scale at the moment */
#ifndef SCOPE_Y_BITS
#define SCOPE_Y_BITS 7 // 7 bits = 0..128
#define SCOPE_Y_BITS 7 // 7 bits = 0..128
#endif
/* Trigger methods */
@ -64,9 +64,6 @@ typedef struct GScopeObject_t {
GWindowObject g; // Base Class
coord_t *lastscopetrace; // To store last scope trace
gfxSem bsem; // We get signalled on this
adcsample_t *audiobuf; // To store audio samples
GEventADC myEvent; // Information on received samples
coord_t nextx; // Where we are up to
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
coord_t lasty; // The last y value - used for trigger slope detection

View File

@ -167,6 +167,20 @@ int main(void) {
gtimerStart(&lsTimer, LowSpeedTimer, ghText, TRUE, MY_LS_DELAY);
#endif
/**
* Allocate buffers for the high speed GADC device - eg. 4 x 128 byte buffers.
* You may need to increase this for slower cpu's.
* You may be able to decrease this for low latency operating systems.
* 4 x 128 seems to work on the really slow Olimex SAM7EX256 board (display speed limitation)
* If your oscilloscope display stops but the low speed reading keep going then it is likely that
* your high speed timer has stalled due to running out of free buffers. Increase the number
* of buffers..
* If you make the buffers too large with a slow sample rate you may not allow enough time for all
* the low speed items to occur in which case your memory will fill up with low speed requests until
* you run out of memory.
*/
gfxBufferAlloc(4, 128);
/* Set up the scope window in the top right on the screen */
{
GWindowInit wi;

View File

@ -45,7 +45,6 @@
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
#define GFX_USE_GTIMER TRUE
//#define GFX_USE_GADC TRUE
#define GFX_USE_GAUDIO TRUE
/* Features for the GDISP sub-system. */

View File

@ -96,7 +96,7 @@ GHandle gwinGScopeCreate(GDisplay *g, GScopeObject *gs, GWindowInit *pInit, uint
void gwinScopeWaitForTrace(GHandle gh) {
#define gs ((GScopeObject *)(gh))
GAudioData *paud;
GDataBuffer *paud;
int i;
coord_t x, y;
coord_t yoffset;
@ -144,10 +144,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
scopemin = 0;
#endif
for(i = paud->len/(gfxSampleFormatBits(gs->format)/8); i; i--) {
for(i = paud->len/((gfxSampleFormatBits(gs->format)+7)/8); i; i--) {
/* Calculate the new scope value - re-scale using simple shifts for efficiency, re-center and y-invert */
if (gs->format <= 8)
if (gfxSampleFormatBits(gs->format) <= 8)
y = yoffset - (((coord_t)(*pa8++ ) << shr) >> (16-SCOPE_Y_BITS));
else
y = yoffset - (((coord_t)(*pa16++) << shr) >> (16-SCOPE_Y_BITS));
@ -216,6 +216,6 @@ void gwinScopeWaitForTrace(GHandle gh) {
gs->scopemin = scopemin;
#endif
gaudioReleaseBuffer(paud);
gfxBufferRelease(paud);
#undef gs
}

View File

@ -55,10 +55,15 @@ int main(void) {
gfxInit();
// Allocate audio buffers - 4 x 128 byte buffers.
// You may need to increase this for slower cpu's.
// You may be able to decrease this for low latency operating systems.
gaudioAllocBuffers(4, 128);
/**
* Allocate audio buffers - eg. 4 x 128 byte buffers.
* You may need to increase this for slower cpu's.
* You may be able to decrease this for low latency operating systems.
* 8 x 256 seems to work on the really slow Olimex SAM7EX256 board (display speed limitation) @8kHz
* If your oscilloscope display stops then it is likely that your driver has stalled due to running
* out of free buffers. Increase the number of buffers..
*/
gfxBufferAlloc(8, 256);
/* Get the screen dimensions */
swidth = gdispGetWidth();

View File

@ -52,7 +52,7 @@ int main(void) {
uint32_t frequency;
ArrayDataFormat datafmt;
uint32_t len;
GAudioData *paud;
GDataBuffer *pd;
// Initialise everything
gfxInit();
@ -64,11 +64,12 @@ int main(void) {
// Allocate audio buffers - 4 x 512 byte buffers.
// You may need to increase this for slower cpu's.
// You may be able to decrease this for low latency operating systems.
if (!gaudioAllocBuffers(4, 512)) {
if (!gfxBufferAlloc(4, 512)) {
errmsg = "Err: No Memory";
goto theend;
}
repeatplay:
// Open the wave file
if (!(f = gfileOpen("allwrong.wav", "r"))) {
errmsg = "Err: Open WAV";
@ -164,20 +165,20 @@ int main(void) {
gdispDrawString(0, gdispGetHeight()/2, "Playing...", font, Yellow);
while(toplay) {
// Get a buffer to put the data into
paud = gaudioGetBuffer(TIME_INFINITE); // This should never fail as we are waiting forever
pd = gfxBufferGet(TIME_INFINITE); // This should never fail as we are waiting forever
// How much data can we put in
len = toplay > paud->size ? paud->size : toplay;
paud->len = len;
len = toplay > pd->size ? pd->size : toplay;
pd->len = len;
toplay -= len;
// Read the data
if (gfileRead(f, paud+1, len) != len) {
if (gfileRead(f, pd+1, len) != len) {
errmsg = "Err: Read fail";
goto theend;
}
gaudioPlay(paud);
gaudioPlay(pd);
}
gfileClose(f);
@ -185,6 +186,11 @@ int main(void) {
gaudioPlayWait(TIME_INFINITE);
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, Green);
// Repeat the whole thing
gfxSleepMilliseconds(1500);
gdispClear(Black);
goto repeatplay;
// The end
theend:
if (errmsg)

View File

@ -8,10 +8,6 @@
/**
* @file drivers/gadc/AT91SAM7/gadc_lld.c
* @brief GADC - Periodic ADC driver source file for the AT91SAM7 cpu.
*
* @defgroup Driver Driver
* @ingroup GADC
* @{
*/
#include "gfx.h"
@ -20,69 +16,73 @@
#include "src/gadc/driver.h"
static uint32_t nextfreq;
// Forward references to ISR routines
static void ISR_CompleteI(ADCDriver *adcp, adcsample_t *buffer, size_t n);
static void ISR_ErrorI(ADCDriver *adcp, adcerror_t err);
static ADCConversionGroup acg = {
FALSE, // circular
1, // num_channels
GADC_ISR_CompleteI, // end_cb
GADC_ISR_ErrorI, // error_cb
ISR_CompleteI, // end_cb
ISR_ErrorI, // error_cb
0, // channelselects
0, // trigger
0, // frequency
};
static void ISR_CompleteI(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void) adcp;
(void) buffer;
gadcGotDataI(n);
}
static void ISR_ErrorI(ADCDriver *adcp, adcerror_t err) {
(void) adcp;
(void) err;
gadcGotDataI(0);
}
void gadc_lld_init(void) {
adcStart(&ADCD1, 0);
}
size_t gadc_lld_samples_per_conversion(uint32_t physdev) {
size_t cnt;
int i;
size_t gadc_lld_samplesperconversion(uint32_t physdev) {
size_t samples;
/* The AT91SAM7 has AD0..7 - physdev is a bitmap of those channels */
for(cnt = 0, i = 0; i < 8; i++, physdev >>= 1)
for(samples = 0; physdev; physdev >>= 1)
if (physdev & 0x01)
cnt++;
return cnt;
samples++;
return samples;
}
void gadc_lld_start_timer(uint32_t physdev, uint32_t frequency) {
(void) physdev;
/**
* The AT91SAM7 ADC driver supports triggering the ADC using a timer without having to implement
* an interrupt handler for the timer. The driver also initialises the timer correctly for us.
* Because we aren't trapping the interrupt ourselves we can't increment GADC_Timer_Missed if an
* interrupt is missed.
*/
acg.frequency = frequency;
void gadc_lld_start_timerI(uint32_t frequency) {
// Nothing to do here - the AT91SAM7 adc driver uses an internal timer
// which is set up when the job is started. We save this here just to
// indicate the timer should be re-initialised on the next timer job
nextfreq = frequency;
}
void gadc_lld_stop_timer(uint32_t physdev) {
(void) physdev;
if ((acg.trigger & ~ADC_TRIGGER_SOFTWARE) == ADC_TRIGGER_TIMER)
adcStop(&ADCD1);
void gadc_lld_stop_timerI(void) {
// Nothing to do here. The AT91SAM7 adc driver automatically turns off timer interrupts
// on completion of the job
}
void gadc_lld_adc_timerI(GadcLldTimerData *pgtd) {
/**
* We don't need to calculate num_channels because the AT91SAM7 ADC does this for us.
*/
acg.channelselects = pgtd->physdev;
acg.trigger = pgtd->now ? (ADC_TRIGGER_TIMER|ADC_TRIGGER_SOFTWARE) : ADC_TRIGGER_TIMER;
adcStartConversionI(&ADCD1, &acg, pgtd->buffer, pgtd->count);
/* Next time assume the same (still running) timer */
acg.frequency = 0;
void gadc_lld_timerjobI(GadcTimerJob *pj) {
acg.channelselects = pj->physdev;
acg.trigger = ADC_TRIGGER_TIMER;
acg.frequency = nextfreq;
nextfreq = 0; // Next job use the same timer
adcStartConversionI(&ADCD1, &acg, pj->buffer, pj->todo);
}
void gadc_lld_adc_nontimerI(GadcLldNonTimerData *pgntd) {
/**
* We don't need to calculate num_channels because the AT91SAM7 ADC does this for us.
*/
acg.channelselects = pgntd->physdev;
void gadc_lld_nontimerjobI(GadcNonTimerJob *pj) {
acg.channelselects = pj->physdev;
acg.trigger = ADC_TRIGGER_SOFTWARE;
adcStartConversionI(&ADCD1, &acg, pgntd->buffer, 1);
adcStartConversionI(&ADCD1, &acg, pj->buffer, 1);
}
#endif /* GFX_USE_GADC */
/** @} */

View File

@ -35,18 +35,13 @@
* @note For the AT91SAM7 ADC driver, it post-dates the finding of the bug so we safely
* say that the bug doesn't exist for this driver.
*/
#define ADC_ISR_FULL_CODE_BUG FALSE
#define CHIBIOS_ADC_ISR_FULL_CODE_BUG FALSE
/**
* @brief The maximum sample frequency supported by this CPU
*/
#define GADC_MAX_SAMPLE_FREQUENCY 132000
/**
* @brief The number of bits in a sample
*/
#define GADC_BITS_PER_SAMPLE AT91_ADC1_RESOLUTION
/**
* @brief The sample format
*/

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/Win32/gaudio_play_config.h
* @brief GAUDIO Play Driver config file.
*
* @addtogroup GAUDIO
* @{
*/
#ifndef GAUDIO_PLAY_CONFIG_H
#define GAUDIO_PLAY_CONFIG_H
@ -22,42 +14,16 @@
/* Driver hardware support. */
/*===========================================================================*/
/**
* @brief The maximum sample frequency supported by this audio device
*/
#define GAUDIO_PLAY_MAX_SAMPLE_FREQUENCY 44100
/**
* @brief The number of audio formats supported by this driver
*/
#define GAUDIO_PLAY_NUM_FORMATS 2
/**
* @brief The available audio sample formats in order of preference
*/
#define GAUDIO_PLAY_FORMAT1 ARRAY_DATA_16BITSIGNED
#define GAUDIO_PLAY_FORMAT2 ARRAY_DATA_8BITUNSIGNED
/**
* @brief The number of audio channels supported by this driver
*/
#define GAUDIO_PLAY_NUM_CHANNELS 2
/**
* @brief Whether each channel is mono or stereo
*/
#define GAUDIO_PLAY_CHANNEL0_IS_STEREO FALSE
#define GAUDIO_PLAY_CHANNEL1_IS_STEREO TRUE
/**
* @brief The list of audio channel names and their uses
* @{
*/
#define GAUDIO_PLAY_MONO 0
#define GAUDIO_PLAY_STEREO 1
/** @} */
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_PLAY */
#endif /* GAUDIO_PLAY_CONFIG_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/Win32/gaudio_play_lld.c
* @brief GAUDIO - Play Driver file for Win32.
*/
#include "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_PLAY
@ -47,7 +42,7 @@ static DWORD threadID;
*************************************************************************/
static bool_t senddata(WAVEHDR *pwh) {
GAudioData *paud;
GDataBuffer *paud;
// Get the next data block to send
gfxSystemLock();
@ -94,7 +89,7 @@ static DWORD WINAPI waveProc(LPVOID arg) {
// Give the buffer back to the Audio Free List
gfxSystemLock();
gaudioPlayReleaseDataBlockI((GAudioData *)pwh->dwUser);
gaudioPlayReleaseDataBlockI((GDataBuffer *)pwh->dwUser);
gfxSystemUnlock();
pwh->lpData = 0;
nQueuedBuffers--;

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/Win32/gaudio_record_config.h
* @brief GAUDIO Record Driver config file.
*
* @addtogroup GAUDIO
* @{
*/
#ifndef GAUDIO_RECORD_CONFIG_H
#define GAUDIO_RECORD_CONFIG_H
@ -22,42 +14,16 @@
/* Driver hardware support. */
/*===========================================================================*/
/**
* @brief The maximum sample frequency supported by this audio device
*/
#define GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY 44100
/**
* @brief The number of audio formats supported by this driver
*/
#define GAUDIO_RECORD_NUM_FORMATS 2
/**
* @brief The available audio sample formats in order of preference
*/
#define GAUDIO_RECORD_FORMAT1 ARRAY_DATA_16BITSIGNED
#define GAUDIO_RECORD_FORMAT2 ARRAY_DATA_8BITUNSIGNED
/**
* @brief The number of audio channels supported by this driver
*/
#define GAUDIO_RECORD_NUM_CHANNELS 2
/**
* @brief Whether each channel is mono or stereo
*/
#define GAUDIO_RECORD_CHANNEL0_IS_STEREO FALSE
#define GAUDIO_RECORD_CHANNEL1_IS_STEREO TRUE
/**
* @brief The list of audio channels and their uses
* @{
*/
#define GAUDIO_RECORD_MONO 0
#define GAUDIO_RECORD_STEREO 1
/** @} */
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_RECORD */
#endif /* GAUDIO_RECORD_CONFIG_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/Win32/gaudio_record_lld.c
* @brief GAUDIO - Record Driver file for Win32.
*/
#include "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_RECORD
@ -47,7 +42,7 @@ static DWORD threadID;
*************************************************************************/
static bool_t getbuffer(WAVEHDR *pwh) {
GAudioData *paud;
GDataBuffer *paud;
// Get the next data block to send
gfxSystemLock();
@ -81,7 +76,7 @@ static bool_t getbuffer(WAVEHDR *pwh) {
static DWORD WINAPI waveProc(LPVOID arg) {
MSG msg;
WAVEHDR *pwh;
GAudioData *paud;
GDataBuffer *paud;
(void) arg;
while (GetMessage(&msg, 0, 0, 0)) {
@ -93,7 +88,7 @@ static DWORD WINAPI waveProc(LPVOID arg) {
waveInUnprepareHeader(ah, pwh, sizeof(WAVEHDR));
// Save the buffer in the audio record list
paud = (GAudioData *)pwh->dwUser;
paud = (GDataBuffer *)pwh->dwUser;
paud->len = pwh->dwBytesRecorded;
gfxSystemLock();
gaudioRecordSaveDataBlockI(paud);

View File

@ -3,3 +3,7 @@ GFXSRC += $(GFXLIB)/drivers/gaudio/gadc/gaudio_record_lld.c
# Required include directories
GFXINC += $(GFXLIB)/drivers/gaudio/gadc
# Make sure the GADC sub-system is turned on
GFXDEFS += -DGFX_USE_GADC=GAUDIO_NEED_RECORD

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/gadc/gaudio_record_board_template.h
* @brief GAUDIO Record Driver board config board file
*
* @addtogroup GAUDIO
* @{
*/
#ifndef _GAUDIO_RECORD_BOARD_H
#define _GAUDIO_RECORD_BOARD_H
@ -20,31 +12,16 @@
/* Audio inputs on this board */
/*===========================================================================*/
/**
* @brief The number of audio channels supported by this driver
* @note This is an example
*/
#define GAUDIO_RECORD_NUM_CHANNELS 1
/**
* @brief The list of audio channels and their uses
* @note This is an example
* @{
*/
#define GAUDIO_RECORD_MICROPHONE 0
/** @} */
#define GAUDIO_RECORD_CHANNEL0_IS_STEREO FALSE
#define GAUDIO_RECORD_MICROPHONE 0
/**
* @brief The audio channel to GADC physical device assignment
* @note This is an example
* @{
*/
#ifdef GAUDIO_RECORD_LLD_IMPLEMENTATION
static uint32_t gaudin_lld_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
static uint32_t gaudio_gadc_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
GADC_PHYSDEV_MICROPHONE,
};
#endif
/** @} */
#endif /* _GAUDIO_RECORD_BOARD_H */
/** @} */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/gadc/gaudio_record_config.h
* @brief GAUDIN Record Driver config file.
*
* @addtogroup GAUDIO
* @{
*/
#ifndef GAUDIO_RECORD_CONFIG_H
#define GAUDIO_RECORD_CONFIG_H
@ -22,38 +14,13 @@
/* Driver hardware support. */
/*===========================================================================*/
/**
* @brief The audio record sample type
* @details For this driver it matches the cpu sample type
*/
typedef adcsample_t audio_record_sample_t;
#define GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY GADC_MAX_HIGH_SPEED_SAMPLERATE
#define GAUDIO_RECORD_NUM_FORMATS 1
#define GAUDIO_RECORD_FORMAT1 GADC_SAMPLE_FORMAT
/**
* @brief The maximum sample frequency supported by this audio device
* @details For this driver it matches the GADC maximum high speed sample rate
*/
#define GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY GADC_MAX_HIGH_SPEED_SAMPLERATE
/**
* @brief The number of bits in a sample
* @details For this driver it matches the cpu sample bits
*/
#define GAUDIO_RECORD_BITS_PER_SAMPLE GADC_BITS_PER_SAMPLE
/**
* @brief The format of an audio sample
* @details For this driver it matches the cpu sample format
*/
#define GAUDIO_RECORD_SAMPLE_FORMAT GADC_SAMPLE_FORMAT
/**
* For the GAUDIO driver that uses GADC - all the remaining config definitions are specific
* to the board.
*/
/* Include the user supplied board definitions */
#include "gaudio_record_board.h"
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_RECORD */
#endif /* GAUDIO_RECORD_CONFIG_H */
/** @} */

View File

@ -5,22 +5,7 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gaudio/gadc/gaudio_record_lld.c
* @brief GAUDIO - Record Driver file for using the cpu ADC (via GADC).
*
* @addtogroup GAUDIO
*
* @{
*/
/**
* We are now implementing the driver - pull in our channel table
* from the board definitions.
*/
#define GAUDIO_RECORD_IMPLEMENTATION
#include "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_RECORD
@ -33,30 +18,38 @@
/* Include the driver defines */
#include "src/gaudio/driver_record.h"
static void gadcCallbackI(void) {
GDataBuffer *pd;
pd = gadcHighSpeedGetDataI();
if (pd)
gaudioRecordSaveDataBlockI(pd);
}
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
void gaudin_lld_init(const gaudin_params *paud) {
bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) {
/* Check the parameters */
if (channel >= GAUDIO_RECORD_NUM_CHANNELS || frequency > GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY || format != GAUDIO_RECORD_FORMAT1)
return FALSE;
/* Setup the high speed GADC */
gadcHighSpeedInit(gaudin_lld_physdevs[paud->channel], paud->frequency, paud->buffer, paud->bufcount, paud->samplesPerEvent);
gadcHighSpeedInit(gaudio_gadc_physdevs[channel], frequency);
/* Register ourselves for ISR callbacks */
gadcHighSpeedSetISRCallback(GAUDIN_ISR_CompleteI);
gadcHighSpeedSetISRCallback(gadcCallbackI);
/**
* The gadc driver handles any errors for us by restarting the transaction so there is
* no need for us to setup anything for GAUDIN_ISR_ErrorI()
*/
return TRUE;
}
void gaudin_lld_start(void) {
void gaudio_record_lld_start(void) {
gadcHighSpeedStart();
}
void gaudin_lld_stop(void) {
void gaudio_record_lld_stop(void) {
gadcHighSpeedStop();
}
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_RECORD */
/** @} */

View File

@ -0,0 +1,5 @@
# List the required driver.
GFXSRC += $(GFXLIB)/drivers/gaudio/pwm/gaudio_play_lld.c
# Required include directories
GFXINC += $(GFXLIB)/drivers/gaudio/pwm

View File

@ -0,0 +1,38 @@
/*
* 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 GAUDIO_PLAY_BOARD_H
#define GAUDIO_PLAY_BOARD_H
/*
* This routine is defined in the driver - the timer interrupt should call this routine.
*
* static void gaudio_play_pwm_timer_callbackI(void);
*
*/
static bool gaudio_play_pwm_setup(uint32_t frequency, ArrayDataFormat format) {
/* Initialise the PWM - use a midpoint value for the initial PWM value */
/* Initialise the timer interrupt @ frequency */
/* Return FALSE if any parameter invalid */
}
static void gaudio_play_pwm_start(void) {
/* Start the PWM */
/* Start the timer interrupt */
}
static void gaudio_play_pwm_stop(void) {
/* Stop the timer interrupt */
/* Stop the PWM */
}
static void gaudio_play_pwm_setI(uint16_t value) {
/* Set the PWM value */
}
#endif /* GAUDIO_PLAY_BOARD_H */

View File

@ -0,0 +1,34 @@
/*
* 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 GAUDIO_PLAY_CONFIG_H
#define GAUDIO_PLAY_CONFIG_H
#if GFX_USE_GAUDIO && GAUDIO_NEED_PLAY
/*===========================================================================*/
/* Driver hardware support. */
/*===========================================================================*/
/* These may need to change for your hardware. If so copy this file to your
* project directory and then alter it.
* The maximum sample frequency should be less than
* Max PWM Clock / (2 ^ Bits per sample)
* eg. For the AT91SAM7 max PWM clock = 48MHz / 2
* For 10 bit PWM accuracy that means GAUDIO_PLAY_MAX_SAMPLE_FREQUENCY = 23,437 Hz
*/
#define GAUDIO_PLAY_MAX_SAMPLE_FREQUENCY 22000
#define GAUDIO_PLAY_NUM_FORMATS 2
#define GAUDIO_PLAY_FORMAT1 ARRAY_DATA_10BITUNSIGNED
#define GAUDIO_PLAY_FORMAT2 ARRAY_DATA_8BITUNSIGNED
#define GAUDIO_PLAY_NUM_CHANNELS 1
#define GAUDIO_PLAY_CHANNEL0_IS_STEREO FALSE
#define GAUDIO_PLAY_MONO 0
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_PLAY */
#endif /* GAUDIO_PLAY_CONFIG_H */

View File

@ -0,0 +1,117 @@
/*
* 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 "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_PLAY
/* Include the driver defines */
#include "src/gaudio/driver_play.h"
/* Forward definition */
static void gaudio_play_pwm_timer_callbackI(void);
/* Include the board interface */
#include "gaudio_play_board.h"
static GDataBuffer *pplay;
static ArrayDataFormat playfmt;
static size_t playlen;
static uint8_t *pdata;
static void gaudio_play_pwm_timer_callbackI(void) {
if (pplay) {
// Get the next value from the current data buffer
if (gfxSampleFormatBits(playfmt) > 8) {
gaudio_play_pwm_setI(*(uint16_t *)pdata);
pdata += 2;
} else {
gaudio_play_pwm_setI(*pdata);
pdata++;
}
// Are we done yet
if (--playlen)
return;
gaudioPlayReleaseDataBlockI(pplay);
// Get a new data buffer
if (!(pplay = gaudioPlayGetDataBlockI())) {
// All is done
gaudioPlayDoneI();
return;
}
} else {
// Get a new data buffer
if (!(pplay = gaudioPlayGetDataBlockI()))
return;
}
// Set up ready for the new buffer
playlen = pplay->len;
if (gfxSampleFormatBits(playfmt) > 8)
playlen >>= 1;
pdata = (uint8_t *)(pplay+1);
}
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
bool_t gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) {
(void) channel;
if (format != ARRAY_DATA_8BITUNSIGNED && format != ARRAY_DATA_10BITUNSIGNED)
return FALSE;
playfmt = format;
return gaudio_play_pwm_setup(frequency, format);
}
bool_t gaudio_play_lld_set_volume(uint8_t vol) {
(void) vol;
return FALSE;
}
void gaudio_play_lld_start(void) {
gfxSystemLock();
// Get a new data buffer
if (pplay || !(pplay = gaudioPlayGetDataBlockI())) {
gfxSystemUnlock(); // Nothing to do
return;
}
// Set up ready for the new buffer
playlen = pplay->len;
if (gfxSampleFormatBits(playfmt) > 8)
playlen >>= 1;
pdata = (uint8_t *)(pplay+1);
gfxSystemUnlock();
// Start the playing
gaudio_play_pwm_start();
}
void gaudio_play_lld_stop(void) {
// Stop everything
gaudio_play_pwm_stop();
// We may need to clean up the remaining buffer.
gfxSystemLock();
if (pplay) {
gaudioPlayReleaseDataBlockI(pplay);
pplay = 0;
gaudioPlayDoneI();
}
gfxSystemUnlock();
}
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_PLAY */

View File

@ -0,0 +1,12 @@
This driver uses a PWM output and a timer to implement an audio play channel.
Whilst the default config settings will probably work for your hardware, you may need to change them.
If so copy gaudio_play_config.h to your project directory and then alter it.
The maximum sample frequency is governed primarily by the number of bits of resolution and the
maximum PWM clock rate. The maximum sample frequency should be less than...
Max PWM Clock / (2 ^ Bits per sample)
eg. For the AT91SAM7 max PWM clock = 48MHz / 2
For 10 bit PWM accuracy that means GAUDIO_PLAY_MAX_SAMPLE_FREQUENCY = 23,437 Hz

View File

@ -5,18 +5,10 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ST7565/board_ST7565_template.h
* @brief GDISP Graphic Driver subsystem board interface for the ST7565 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
/*
* @brief Optional parameters that can be put in this file.
* @note The values listed below are the defaults.
*
@ -54,149 +46,67 @@
* #define EINK_WRITECOUNT 4
*/
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Delay for display waveforms. Should be an accurate microsecond delay.
*
* @param[in] us The number of microseconds
*/
static void eink_delay(int us) {
(void) us;
}
/**
* @brief Turn the E-ink panel Vdd supply (+3.3V) on or off.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpower_vdd(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Turn the E-ink panel negative supplies (-15V, -20V) on or off.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpower_vneg(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Turn the E-ink panel positive supplies (-15V, -20V) on or off.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpower_vpos(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the LE (source driver Latch Enable) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_le(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the OE (source driver Output Enable) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_oe(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the CL (source driver Clock) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_cl(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the SPH (source driver Start Pulse Horizontal) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_sph(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the D0-D7 (source driver Data) pins.
*
* @param[in] g The GDisplay structure
* @param[in] value The byte to write
*/
static inline void setpins_data(GDisplay *g, uint8_t value) {
(void) g;
(void) value;
}
/**
* @brief Set the state of the CKV (gate driver Clock Vertical) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_ckv(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the GMODE (gate driver Gate Mode) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_gmode(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
/**
* @brief Set the state of the SPV (gate driver Start Pulse Vertical) pin.
*
* @param[in] g The GDisplay structure
* @param[in] on On or off
*/
static inline void setpin_spv(GDisplay *g, bool_t on) {
(void) g;
(void) on;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ED060SC4/gdisp_lld.c
* @brief GDISP Graphics Driver for the E-ink panel ED060SC4.
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -83,7 +78,7 @@
#define PRIV(g) ((drvPriv *)g->priv)
/** Delay between signal changes, to give time for IO pins to change state. */
/* Delay between signal changes, to give time for IO pins to change state. */
static inline void clockdelay(void)
{
#if EINK_CLOCKDELAY & 1
@ -111,7 +106,7 @@ static inline void clockdelay(void)
#endif
}
/** Fast vertical clock pulse for gate driver, used during initializations */
/* Fast vertical clock pulse for gate driver, used during initializations */
static void vclock_quick(GDisplay *g)
{
setpin_ckv(g, TRUE);
@ -120,7 +115,7 @@ static void vclock_quick(GDisplay *g)
eink_delay(4);
}
/** Horizontal clock pulse for clocking data into source driver */
/* Horizontal clock pulse for clocking data into source driver */
static void hclock(GDisplay *g)
{
clockdelay();
@ -129,7 +124,7 @@ static void hclock(GDisplay *g)
setpin_cl(g, FALSE);
}
/** Start a new vertical gate driver scan from top.
/* Start a new vertical gate driver scan from top.
* Note: Does not clear any previous bits in the shift register,
* so you should always scan through the whole display before
* starting a new scan.
@ -144,7 +139,7 @@ static void vscan_start(GDisplay *g)
vclock_quick(g);
}
/** Waveform for strobing a row of data onto the display.
/* Waveform for strobing a row of data onto the display.
* Attempts to minimize the leaking of color to other rows by having
* a long idle period after a medium-length strobe period.
*/
@ -158,7 +153,7 @@ static void vscan_write(GDisplay *g)
eink_delay(200);
}
/** Waveform used when clearing the display. Strobes a row of data to the
/* Waveform used when clearing the display. Strobes a row of data to the
* screen, but does not mind some of it leaking to other rows.
*/
static void vscan_bulkwrite(GDisplay *g)
@ -169,7 +164,7 @@ static void vscan_bulkwrite(GDisplay *g)
eink_delay(200);
}
/** Waveform for skipping a vertical row without writing anything.
/* Waveform for skipping a vertical row without writing anything.
* Attempts to minimize the amount of change in any row.
*/
static void vscan_skip(GDisplay *g)
@ -180,7 +175,7 @@ static void vscan_skip(GDisplay *g)
eink_delay(100);
}
/** Stop the vertical scan. The significance of this escapes me, but it seems
/* Stop the vertical scan. The significance of this escapes me, but it seems
* necessary or the next vertical scan may be corrupted.
*/
static void vscan_stop(GDisplay *g)
@ -193,7 +188,7 @@ static void vscan_stop(GDisplay *g)
vclock_quick(g);
}
/** Start updating the source driver data (from left to right). */
/* Start updating the source driver data (from left to right). */
static void hscan_start(GDisplay *g)
{
/* Disable latching and output enable while we are modifying the row. */
@ -204,7 +199,7 @@ static void hscan_start(GDisplay *g)
setpin_sph(g, FALSE);
}
/** Write data to the horizontal row. */
/* Write data to the horizontal row. */
static void hscan_write(GDisplay *g, const uint8_t *data, int count)
{
while (count--)
@ -217,7 +212,7 @@ static void hscan_write(GDisplay *g, const uint8_t *data, int count)
}
}
/** Finish and transfer the row to the source drivers.
/* Finish and transfer the row to the source drivers.
* Does not set the output enable, so the drivers are not yet active. */
static void hscan_stop(GDisplay *g)
{
@ -231,7 +226,7 @@ static void hscan_stop(GDisplay *g)
setpin_le(g, FALSE);
}
/** Turn on the power to the E-Ink panel, observing proper power sequencing. */
/* Turn on the power to the E-Ink panel, observing proper power sequencing. */
static void power_on(GDisplay *g)
{
unsigned i;
@ -264,7 +259,7 @@ static void power_on(GDisplay *g)
vscan_stop(g);
}
/** Turn off the power, observing proper power sequencing. */
/* Turn off the power, observing proper power sequencing. */
static void power_off(GDisplay *g)
{
/* First the high voltages */
@ -336,7 +331,7 @@ typedef struct drvPriv {
uint8_t g_blockmap[BLOCKS_Y][BLOCKS_X];
} drvPriv;
/** Check if the row contains any allocated blocks. */
/* Check if the row contains any allocated blocks. */
static bool_t blocks_on_row(GDisplay *g, unsigned by)
{
unsigned bx;
@ -350,7 +345,7 @@ static bool_t blocks_on_row(GDisplay *g, unsigned by)
return FALSE;
}
/** Write out a block row. */
/* Write out a block row. */
static void write_block_row(GDisplay *g, unsigned by)
{
unsigned bx, dy, dx;
@ -379,7 +374,7 @@ static void write_block_row(GDisplay *g, unsigned by)
}
}
/** Clear the block map, i.e. deallocate all blocks */
/* Clear the block map, i.e. deallocate all blocks */
static void clear_block_map(GDisplay *g)
{
unsigned bx, by;
@ -394,7 +389,7 @@ static void clear_block_map(GDisplay *g)
PRIV(g)->g_next_block = 0;
}
/** Initialize a newly allocated block. */
/* Initialize a newly allocated block. */
static void zero_block(block_t *block)
{
unsigned dx, dy;
@ -407,7 +402,7 @@ static void zero_block(block_t *block)
}
}
/** Allocate a buffer
/* Allocate a buffer
* Automatically flushes if all buffers are full. */
static block_t *alloc_buffer(GDisplay *g, unsigned bx, unsigned by)
{

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/HX8347D/HX8347D.h
* @brief GDISP Graphic Driver support header for the HX8347D display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _HX8347D_H
#define _HX8347D_H
@ -140,4 +132,3 @@
#define HX8347D_REG_PGSEL 0xff /* Page select */
#endif /* _HX8347D_H */
/** @} */

View File

@ -5,152 +5,56 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/HX8347D/board_HX8347D_template.h
* @brief GDISP Graphic Driver subsystem board SPI interface for the HX8347D display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus in 16 bit mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void busmode16(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus in 8 bit mode (the default)
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void busmode8(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint8_t index) {
(void) g;
(void) index;
}
/**
* @brief Send 8 bits of data to the lcd.
* @pre The bus is in 8 bit mode
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint8_t data) {
(void) g;
(void) data;
}
/**
* @brief Send 16 bits of data to the lcd.
* @pre The bus is in 16 bit mode
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_ram16(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/HX8347D/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the HX8347D display.
*/
#include "gfx.h"
#if GFX_USE_GDISP

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/HX8347D/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the HX8347D display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -30,4 +22,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,153 +5,56 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9320/board_ILI9320_template.h
* @brief GDISP Graphic Driver subsystem board interface for the ILI9320 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef GDISP_LLD_BOARD_H
#define GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @note The chip select may need to be asserted/de-asserted
* around the actual spi read
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
#endif /* GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9320/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the ILI9320 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -330,7 +325,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
case GDISP_ROTATE_90:
acquire_bus(g);
write_reg(g, 0x01, 0x0100);
write_reg(g, 0x01, 0x0000);
write_reg(g, 0x03, 0x1030);
write_reg(g, 0x60, 0x2700);
release_bus(g);
@ -352,7 +347,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
case GDISP_ROTATE_270:
acquire_bus(g);
write_reg(g, 0x01, 0x0000);
write_reg(g, 0x01, 0x0100);
write_reg(g, 0x03, 0x1038);
write_reg(g, 0x60, 0xA700);
release_bus(g);

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9320/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the ILI9320 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef GDISP_LLD_CONFIG_H
#define GDISP_LLD_CONFIG_H
@ -32,5 +24,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,151 +5,56 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9325/board_ILI9325_template.h
* @brief GDISP Graphic Driver subsystem board interface for the ILI9325 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef GDISP_LLD_BOARD_H
#define GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
#endif /* GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9325/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the ILI9325 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP /*|| defined(__DOXYGEN__)*/

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9325/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the ILI9325 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef GDISP_LLD_CONFIG_H
#define GDISP_LLD_CONFIG_H
@ -32,5 +24,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,150 +5,56 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9341/board_ILI9341_template.h
* @brief GDISP Graphic Driver subsystem board interface for the ILI9341 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,12 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9341/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for
* the ILI9341 and compatible HVGA display
*/
#include "gfx.h"
#if GFX_USE_GDISP

View File

@ -5,15 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9481/gdisp_lld_config.h
* @brief GDISP Graphics Driver subsystem low level driver source for
* the ILI9481 and compatible HVGA display
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -32,4 +23,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,151 +5,56 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9481/board_ILI9481_template.h
* @brief GDISP Graphics Driver subsystem low level driver source for
* the ILI9481 and compatible HVGA display
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,12 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9481/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for
* the ILI9481 and compatible HVGA display
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -325,4 +319,3 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#endif
#endif /* GFX_USE_GDISP */
/** @} */

View File

@ -5,15 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ILI9481/gdisp_lld_config.h
* @brief GDISP Graphics Driver subsystem low level driver source for
* the ILI9481 and compatible HVGA display
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -32,4 +23,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -0,0 +1,71 @@
/*
* 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 GDISP_LLD_BOARD_H
#define GDISP_LLD_BOARD_H
static inline void init_board(GDisplay *g)
{
(void) g;
}
static inline void post_init_board(GDisplay *g)
{
(void) g;
}
static inline void setpin_reset(GDisplay *g, bool_t state)
{
(void) g;
(void) state;
}
static inline void set_backlight(GDisplay *g, uint8_t percent)
{
(void) g;
(void) percent;
}
static inline void acquire_bus(GDisplay *g)
{
(void) g;
}
static inline void release_bus(GDisplay *g)
{
(void) g;
}
static inline void write_index(GDisplay *g, uint16_t index)
{
(void) g;
(void) index;
}
static inline void write_data(GDisplay *g, uint16_t data)
{
(void) g;
(void) data;
}
static inline void setreadmode(GDisplay *g)
{
(void) g;
}
static inline void setwritemode(GDisplay *g)
{
(void) g;
}
static inline uint16_t read_data(GDisplay *g)
{
(void) g;
return 0;
}
#endif /* GDISP_LLD_BOARD_H */

View File

@ -0,0 +1,2 @@
GFXINC += $(GFXLIB)/drivers/gdisp/LGD4532
GFXSRC += $(GFXLIB)/drivers/gdisp/LGD4532/gdisp_lld_LGD4532.c

View File

@ -0,0 +1,359 @@
/*
* 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 "gfx.h"
#if GFX_USE_GDISP
/* This controller is only ever used with a 240 x 320 display */
#if defined(GDISP_SCREEN_HEIGHT)
#warning "GDISP: This low level driver does not support setting a screen size. It is being ignored."
#undef GDISP_SCREEN_HEIGHT
#endif
#if defined(GDISP_SCREEN_WIDTH)
#warning "GDISP: This low level driver does not support setting a screen size. It is being ignored."
#undef GDISP_SCREEN_WIDTH
#endif
#define GDISP_DRIVER_VMT GDISPVMT_LGD4532
#include "gdisp_lld_config.h"
#include "src/gdisp/driver.h"
#include "board_LGD4532.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT
#define GDISP_SCREEN_HEIGHT 320
#endif
#ifndef GDISP_SCREEN_WIDTH
#define GDISP_SCREEN_WIDTH 240
#endif
#ifndef GDISP_INITIAL_CONTRAST
#define GDISP_INITIAL_CONTRAST 50
#endif
#ifndef GDISP_INITIAL_BACKLIGHT
#define GDISP_INITIAL_BACKLIGHT 100
#endif
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
// Some common routines and macros
#define dummy_read(g) { volatile uint16_t dummy; dummy = read_data(g); (void) dummy; }
#define write_reg(g, reg, data) { write_index(g, reg); write_data(g, data); }
static void set_cursor(GDisplay *g) {
switch(g->g.Orientation) {
default:
case GDISP_ROTATE_0:
case GDISP_ROTATE_180:
write_reg(g, 0x20, g->p.x);
write_reg(g, 0x21, g->p.y);
break;
case GDISP_ROTATE_90:
case GDISP_ROTATE_270:
write_reg(g, 0x20, g->p.y);
write_reg(g, 0x21, g->p.x);
break;
}
write_index(g, 0x22);
}
static void set_viewport(GDisplay* g) {
switch(g->g.Orientation) {
default:
case GDISP_ROTATE_0:
case GDISP_ROTATE_180:
write_reg(g, 0x50, g->p.x);
write_reg(g, 0x51, g->p.x + g->p.cx - 1);
write_reg(g, 0x52, g->p.y);
write_reg(g, 0x53, g->p.y + g->p.cy - 1);
break;
case GDISP_ROTATE_90:
case GDISP_ROTATE_270:
write_reg(g, 0x50, g->p.y);
write_reg(g, 0x51, g->p.y + g->p.cy - 1);
write_reg(g, 0x52, g->p.x);
write_reg(g, 0x53, g->p.x + g->p.cx - 1);
break;
}
}
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// No private area for this controller
g->priv = 0;
// Initialise the board interface
init_board(g);
/* Hardware reset */
setpin_reset(g, TRUE);
gfxSleepMilliseconds(1);
setpin_reset(g, FALSE);
gfxSleepMilliseconds(2);
acquire_bus(g);
setwritemode(g);
// chinese code starts here
//############# void Power_Set(void) ################//
write_reg(g, 0x00, 0x0001);
gfxSleepMilliseconds(10);
write_reg(g, 0x15, 0x0030);
write_reg(g, 0x11, 0x0040);
write_reg(g, 0x10, 0x1628);
write_reg(g, 0x12, 0x0000);
write_reg(g, 0x13, 0x104d);
gfxSleepMilliseconds(10);
write_reg(g, 0x12, 0x0010);
gfxSleepMilliseconds(10);
write_reg(g, 0x10, 0x2620);
write_reg(g, 0x13, 0x344d); //304d
gfxSleepMilliseconds(10);
write_reg(g, 0x01, 0x0100);
write_reg(g, 0x02, 0x0300);
write_reg(g, 0x03, 0x1038);//0x1030
write_reg(g, 0x08, 0x0604);
write_reg(g, 0x09, 0x0000);
write_reg(g, 0x0A, 0x0008);
write_reg(g, 0x41, 0x0002);
write_reg(g, 0x60, 0xA700);
write_reg(g, 0x61, 0x0001);
write_reg(g, 0x90, 0x0182);
write_reg(g, 0x93, 0x0001);
write_reg(g, 0xa3, 0x0010);
gfxSleepMilliseconds(10);
//################# void Gamma_Set(void) ####################//
write_reg(g, 0x30, 0x0000);
write_reg(g, 0x31, 0x0502);
write_reg(g, 0x32, 0x0307);
write_reg(g, 0x33, 0x0305);
write_reg(g, 0x34, 0x0004);
write_reg(g, 0x35, 0x0402);
write_reg(g, 0x36, 0x0707);
write_reg(g, 0x37, 0x0503);
write_reg(g, 0x38, 0x1505);
write_reg(g, 0x39, 0x1505);
gfxSleepMilliseconds(10);
//################## void Display_ON(void) ####################//
write_reg(g, 0x07, 0x0001);
gfxSleepMilliseconds(10);
write_reg(g, 0x07, 0x0021);
write_reg(g, 0x07, 0x0023);
gfxSleepMilliseconds(10);
write_reg(g, 0x07, 0x0033);
gfxSleepMilliseconds(10);
write_reg(g, 0x07, 0x0133);
// chinese code ends here
// Finish Init
post_init_board(g);
// Release the bus
release_bus(g);
// Turn on the backlight
set_backlight(g, GDISP_INITIAL_BACKLIGHT);
/* Initialise the GDISP structure */
g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Orientation = GDISP_ROTATE_0;
g->g.Powermode = powerOn;
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
g->g.Contrast = GDISP_INITIAL_CONTRAST;
return TRUE;
}
#if GDISP_HARDWARE_STREAM_WRITE
LLDSPEC void gdisp_lld_write_start(GDisplay *g) {
acquire_bus(g);
set_viewport(g);
}
LLDSPEC void gdisp_lld_write_color(GDisplay *g) {
write_data(g, gdispColor2Native(g->p.color));
}
LLDSPEC void gdisp_lld_write_stop(GDisplay *g) {
release_bus(g);
}
LLDSPEC void gdisp_lld_write_pos(GDisplay *g) {
set_cursor(g);
}
#endif
#if GDISP_HARDWARE_STREAM_READ
LLDSPEC void gdisp_lld_read_start(GDisplay *g) {
acquire_bus(g);
set_viewport(g);
set_cursor(g);
setreadmode(g);
dummy_read(g);
}
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) {
uint16_t data;
data = read_data(g);
return gdispNative2Color(data);
}
LLDSPEC void gdisp_lld_read_stop(GDisplay *g) {
setwritemode(g);
release_bus(g);
}
#endif
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) {
case GDISP_CONTROL_POWER:
if (g->g.Powermode == (powermode_t)g->p.ptr)
return;
switch((powermode_t)g->p.ptr) {
case powerOff:
acquire_bus(g);
write_reg(g, 0x07, 0x0000);
write_reg(g, 0x10, 0x0000);
write_reg(g, 0x11, 0x0000);
write_reg(g, 0x12, 0x0000);
write_reg(g, 0x13, 0x0000);
release_bus(g);
set_backlight(g, 0);
break;
case powerOn:
//*************Power On sequence ******************//
acquire_bus(g);
write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
gfxSleepMilliseconds(200); /* Dis-charge capacitor power voltage */
write_reg(g, 0x10, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
write_reg(g, 0x11, 0x0147); /* DC1[2:0], DC0[2:0], VC[2:0] */
gfxSleepMilliseconds(50);
write_reg(g, 0x12, 0x013C); /* VREG1OUT voltage */
gfxSleepMilliseconds(50);
write_reg(g, 0x13, 0x0E00); /* VDV[4:0] for VCOM amplitude */
write_reg(g, 0x29, 0x0009); /* VCM[4:0] for VCOMH */
gfxSleepMilliseconds(50);
write_reg(g, 0x07, 0x0173); /* 262K color and display ON */
release_bus(g);
set_backlight(g, g->g.Backlight);
break;
case powerSleep:
acquire_bus(g);
write_reg(g, 0x07, 0x0000); /* display OFF */
write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
gfxSleepMilliseconds(200); /* Dis-charge capacitor power voltage */
write_reg(g, 0x10, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
release_bus(g);
set_backlight(g, g->g.Backlight);
break;
case powerDeepSleep:
acquire_bus(g);
write_reg(g, 0x07, 0x0000); /* display OFF */
write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
gfxSleepMilliseconds(200); /* Dis-charge capacitor power voltage */
write_reg(g, 0x10, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
release_bus(g);
set_backlight(g, g->g.Backlight);
break;
default:
return;
}
g->g.Powermode = (powermode_t)g->p.ptr;
return;
case GDISP_CONTROL_ORIENTATION:
if (g->g.Orientation == (orientation_t)g->p.ptr)
return;
switch((orientation_t)g->p.ptr) {
case GDISP_ROTATE_0:
acquire_bus(g);
write_reg(g, 0x01, 0x0100);
write_reg(g, 0x03, 0x1030);
write_reg(g, 0x60, 0x2700);
release_bus(g);
g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Width = GDISP_SCREEN_WIDTH;
break;
case GDISP_ROTATE_90:
acquire_bus(g);
write_reg(g, 0x01, 0x0100);
write_reg(g, 0x03, 0x1038);
write_reg(g, 0x60, 0xA700);
release_bus(g);
g->g.Height = GDISP_SCREEN_WIDTH;
g->g.Width = GDISP_SCREEN_HEIGHT;
break;
case GDISP_ROTATE_180:
acquire_bus(g);
write_reg(g, 0x01, 0x0000);
write_reg(g, 0x03, 0x1030);
write_reg(g, 0x60, 0xa700);
release_bus(g);
g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Width = GDISP_SCREEN_WIDTH;
break;
case GDISP_ROTATE_270:
acquire_bus(g);
write_reg(g, 0x01, 0x0000);
write_reg(g, 0x03, 0x1038);
write_reg(g, 0x60, 0x2700);
release_bus(g);
g->g.Height = GDISP_SCREEN_WIDTH;
g->g.Width = GDISP_SCREEN_HEIGHT;
break;
default:
return;
}
g->g.Orientation = (orientation_t)g->p.ptr;
return;
case GDISP_CONTROL_BACKLIGHT:
if ((unsigned)g->p.ptr > 100)
g->p.ptr = (void *)100;
set_backlight(g, (unsigned)g->p.ptr);
g->g.Backlight = (unsigned)g->p.ptr;
return;
default:
return;
}
}
#endif
#endif /* GFX_USE_GDISP */

View File

@ -0,0 +1,21 @@
/*
* 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 GDISP_LLD_CONFIG_H
#define GDISP_LLD_CONFIG_H
#if GFX_USE_GDISP
#define GDISP_HARDWARE_STREAM_WRITE TRUE
#define GDISP_HARDWARE_STREAM_READ TRUE
#define GDISP_HARDWARE_STREAM_POS TRUE
#define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_template.h
* @brief GDISP Graphic Driver subsystem board interface for the Nokia6610 GE12 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
@ -28,104 +20,40 @@
//#define GDISP_INITIAL_CONTRAST 50 // The initial contrast percentage
//#define GDISP_INITIAL_BACKLIGHT 100 // The initial backlight percentage
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/Nokia6610GE12/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the Nokia6610 GE12 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/Nokia6610GE12/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the Nokia6610 GE12 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -30,4 +22,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_template.h
* @brief GDISP Graphic Driver subsystem board interface for the Nokia6610 GE12 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
@ -28,104 +20,40 @@
//#define GDISP_INITIAL_CONTRAST 50 // The initial contrast percentage
//#define GDISP_INITIAL_BACKLIGHT 100 // The initial backlight percentage
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,19 +5,11 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/Nokia6610GE8/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the Nokia6610 GE8 display.
*
* @addtogroup GDISP
* @{
*/
#include "gfx.h"
#if GFX_USE_GDISP
/**
/*
* This is for the EPSON (GE8) controller driving a Nokia6610 color LCD display.
* Note that there is also a PHILIPS (GE12) controller for the same display that this code
* does not support.
@ -136,25 +128,55 @@
#define write_cmd3(g, cmd, d1, d2, d3) { write_index(g, cmd); write_data3(g, d1, d2, d3); }
#define write_cmd4(g, cmd, d1, d2, d3, d4) { write_index(g, cmd); write_data4(g, d1, d2, d3, d4); }
#if GDISP_HARDWARE_DRAWPIXEL
static inline void set_viewpoint(GDisplay* g) {
#if GDISP_NOKIA_ORIENTATION && GDISP_NEED_CONTROL
switch(g->g.Orientation) {
default:
case GDISP_ROTATE_0:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.x, GDISP_RAM_X_OFFSET+g->p.x); // Column address set
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.y, GDISP_RAM_Y_OFFSET+g->p.y); // Page address set
break;
case GDISP_ROTATE_90:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.y, GDISP_RAM_X_OFFSET+g->p.y);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET-1+g->g.Width-g->p.x, GDISP_RAM_Y_OFFSET-1+g->g.Width-g->p.x);
break;
case GDISP_ROTATE_180:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET-1+g->g.Width-g->p.x, GDISP_RAM_X_OFFSET-1+g->g.Width-g->p.x);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET-1+g->g.Height-g->p.y, GDISP_RAM_Y_OFFSET-1+g->g.Height-g->p.y);
break;
case GDISP_ROTATE_270:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET-1+g->g.Height-g->p.y, GDISP_RAM_X_OFFSET-1+g->g.Height-g->p.y);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.x, GDISP_RAM_Y_OFFSET+g->p.x);
break;
}
#else
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.x, GDISP_RAM_X_OFFSET+g->p.x); // Column address set
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.y, GDISP_RAM_Y_OFFSET+g->p.y); // Page address set
#endif
write_index(g, RAMWR);
}
#endif
static inline void set_viewport(GDisplay* g) {
#if GDISP_NOKIA_ORIENTATION && GDISP_NEED_CONTROL
switch(g->g.Orientation) {
default:
case GDISP_ROTATE_0:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.x, GDISP_RAM_X_OFFSET+g->p.x); // Column address set
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.y, GDISP_RAM_Y_OFFSET+g->p.y); // Page address set
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.x, GDISP_RAM_X_OFFSET+g->p.x+g->p.cx-1); // Column address set
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.y, GDISP_RAM_Y_OFFSET+g->p.y+g->p.cy-1); // Page address set
break;
case GDISP_ROTATE_90:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.y, GDISP_RAM_X_OFFSET+g->p.y);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET-1+g->g.Width-g->p.x, GDISP_RAM_Y_OFFSET-1+g->g.Width-g->p.x);
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->p.y, GDISP_RAM_X_OFFSET+g->p.y+g->p.cy-1);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->g.Width-g->p.x-g->p.cx, GDISP_RAM_Y_OFFSET-1+g->g.Width-g->p.x);
break;
case GDISP_ROTATE_180:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET-1+g->g.Width-g->p.x, GDISP_RAM_X_OFFSET-1+g->g.Width-g->p.x);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET-1+g->g.Height-g->p.y, GDISP_RAM_Y_OFFSET-1+g->g.Height-g->p.y);
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->g.Width-g->p.x-g->p.cx, GDISP_RAM_X_OFFSET-1+g->g.Width-g->p.x);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->g.Height-g->p.y-g->p.cy, GDISP_RAM_Y_OFFSET-1+g->g.Height-g->p.y);
break;
case GDISP_ROTATE_270:
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET-1+g->g.Height-g->p.y, GDISP_RAM_X_OFFSET-1+g->g.Height-g->p.y);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.x, GDISP_RAM_Y_OFFSET+g->p.x);
write_cmd2(g, CASET, GDISP_RAM_X_OFFSET+g->g.Height-g->p.y-g->p.cy, GDISP_RAM_X_OFFSET-1+g->g.Height-g->p.y);
write_cmd2(g, PASET, GDISP_RAM_Y_OFFSET+g->p.x, GDISP_RAM_Y_OFFSET+g->p.x+g->p.cx-1);
break;
}
#else
@ -292,8 +314,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
c = gdispColor2Native(g->p.color);
acquire_bus(g);
set_viewport(g);
write_data3(g, 0, (c>>8) & 0x0F, c & 0xFF);
set_viewpoint(g);
write_data3(g, 0, ((c>>8) & 0x0F), (c & 0xFF));
release_bus(g);
}
#endif
@ -569,4 +591,3 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#endif
#endif /* GFX_USE_GDISP */
/** @} */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the Nokia6610 GE8 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -46,4 +38,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,139 +5,50 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1963/board_RA8875_template.h
* @brief GDISP Graphic Driver subsystem board interface for the RA8875 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @note The chip select may need to be asserted/de-asserted
* around the actual spi read
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/RA8875/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source.
*/
#include "gfx.h"
#if GFX_USE_GDISP /*|| defined(__DOXYGEN__)*/

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1963/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -32,5 +24,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,150 +5,56 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/S6D1121/board_S6D1121_template.h
* @brief GDISP Graphic Driver subsystem board interface for the S6D1121 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/S6D1121/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the S6d1121 display.
*
* @addtogroup GDISP
* @{
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -336,5 +328,3 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#endif
#endif /* GFX_USE_GDISP */
/** @} */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/S6D1121/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the S6D1121 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -32,5 +24,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,181 +5,67 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1289/board_SSD1289_template.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1289 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
/**
* The below section you can replace with #error if your interface doesn't support DMA
*/
#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__)
//#error "GDISP - SSD1289: This interface does not support DMA"
/**
* @brief Transfer data using DMA but don't increment the source address
*
* @param[in] g The GDisplay structure
* @param[in] buffer The source buffer location
* @param[in] area The number of pixels to transfer
*
* @notapi
*/
static inline void dma_with_noinc(GDisplay *g, color_t *buffer, int area) {
(void) g;
(void) buffer;
(void) area;
}
/**
* @brief Transfer data using DMA incrementing the source address
*
* @param[in] g The GDisplay structure
* @param[in] buffer The source buffer location
* @param[in] area The number of pixels to transfer
*
* @notapi
*/
static inline void dma_with_inc(GDisplay *g, color_t *buffer, int area) {
(void) g;
(void) buffer;
@ -188,4 +74,3 @@ static inline uint16_t read_data(GDisplay *g) {
#endif
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1289/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the SSD1289 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1289/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the SSD1289 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -40,4 +32,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -53,5 +53,3 @@
#define SSD1306_SCROLL_VERTICAL_AND_HORIZONTAL_LEFT 0x2A
#endif /* _SSD1306_H */
/** @} */

View File

@ -5,106 +5,37 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1306/board_SSD1306_template.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1306 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Optional: A byte to prefix on each display page line.
* @note If not defined then no byte is prefixed on each page line.
*
* @notapi
*/
//#define SSD1306_PAGE_PREFIX 0x40
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send a command to the controller.
*
* @param[in] g The GDisplay structure
* @param[in] cmd The command to send *
*
* @notapi
*/
static inline void write_cmd(GDisplay *g, uint8_t cmd) {
(void) g;
(void) cmd;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
(void) g;
(void) data;
@ -112,5 +43,3 @@ static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1306/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the SSD1306 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -279,4 +274,3 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#endif // GDISP_NEED_CONTROL
#endif // GFX_USE_GDISP

View File

@ -28,5 +28,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,47 +5,9 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1963/board_SSD1963_template.h
* @brief GDISP Graphic Driver subsystem board interface for the SSD1963 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief LCD panel specs
*
* @note The timings need to follow the datasheet for your particular TFT/LCD screen
* (the actual screen, not the controller).
* @note Datasheets normally use a specific set of timings and acronyms, their value refers
* to the number of pixel clocks. Non-display periods refer to pulses/timings that occur
* before or after the timings that actually put pixels on the screen. Display periods
* refer to pulses/timings that directly put pixels on the screen.
* @note HDP: Horizontal Display Period, normally the width - 1<br>
* HT: Horizontal Total period (display + non-display)<br>
* HPS: non-display period between the start of the horizontal sync (LLINE) signal
* and the first display data<br>
* LPS: horizontal sync pulse (LLINE) start location in pixel clocks<br>
* HPW: Horizontal sync Pulse Width<br>
* VDP: Vertical Display period, normally height - 1<br>
* VT: Vertical Total period (display + non-display)<br>
* VPS: non-display period in lines between the start of the frame and the first display
* data in number of lines<br>
* FPS: vertical sync pulse (LFRAME) start location in lines.<br>
* VPW: Vertical sync Pulse Width
* @note Here's how to convert them:<br>
* SCREEN_HSYNC_FRONT_PORCH = ( HT - HPS ) - GDISP_SCREEN_WIDTH<br>
* SCREEN_HSYNC_PULSE = HPW<br>
* SCREEN_HSYNC_BACK_PORCH = HPS - HPW<br>
* SCREEN_VSYNC_FRONT_PORCH = ( VT - VPS ) - GDISP_SCREEN_HEIGHT<br>
* SCREEN_VSYNC_PULSE = VPW<br>
* SCREEN_VSYNC_BACK_PORCH = VPS - LPS<br>
*/
static const LCD_Parameters DisplayTimings[] = {
// You need one of these array elements per display
{
@ -58,91 +20,35 @@ static const LCD_Parameters DisplayTimings[] = {
},
};
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1963/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source.
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -282,4 +277,3 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#endif
#endif /* GFX_USE_GDISP */

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD1963/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -30,5 +22,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -9,7 +9,6 @@
#define SSD1963_H
/* SSD1963 commands */
#define SSD1963_NOP 0x0000
#define SSD1963_SOFT_RESET 0x0001
#define SSD1963_GET_POWER_MODE 0x000A
@ -95,4 +94,3 @@
#define SSD1963_GET_PIXEL_DATA_INTERFACE 0x00F1
#endif

View File

@ -5,181 +5,67 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD2119/board_SSD2119_template.h
* @brief GDISP Graphic Driver subsystem board template for the SSD2119 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Set the lcd back-light level.
*
* @param[in] g The GDisplay structure
* @param[in] percent 0 to 100%
*
* @notapi
*/
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send data to the index register.
*
* @param[in] g The GDisplay structure
* @param[in] index The index register to set
*
* @notapi
*/
static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
}
/**
* @brief Set the bus in read mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setreadmode(GDisplay *g) {
(void) g;
}
/**
* @brief Set the bus back into write mode
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void setwritemode(GDisplay *g) {
(void) g;
}
/**
* @brief Read data from the lcd.
* @return The data from the lcd
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline uint16_t read_data(GDisplay *g) {
(void) g;
return 0;
}
/**
* The below section you can replace with #error if your interface doesn't support DMA
*/
#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__)
//#error "GDISP - SSD2119: This interface does not support DMA"
/**
* @brief Transfer data using DMA but don't increment the source address
*
* @param[in] g The GDisplay structure
* @param[in] buffer The source buffer location
* @param[in] area The number of pixels to transfer
*
* @notapi
*/
static inline void dma_with_noinc(GDisplay *g, color_t *buffer, int area) {
(void) g;
(void) buffer;
(void) area;
}
/**
* @brief Transfer data using DMA incrementing the source address
*
* @param[in] g The GDisplay structure
* @param[in] buffer The source buffer location
* @param[in] area The number of pixels to transfer
*
* @notapi
*/
static inline void dma_with_inc(GDisplay *g, color_t *buffer, int area) {
(void) g;
(void) buffer;
@ -188,4 +74,3 @@ static inline uint16_t read_data(GDisplay *g) {
#endif
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD2119/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the SSD2119 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP

View File

@ -5,14 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD2119/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the SSD2119 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_CONFIG_H
#define _GDISP_LLD_CONFIG_H
@ -40,4 +32,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -5,19 +5,10 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/SSD2119/ssd2119.h
* @brief GDISP Graphic Driver support header for the SSD2119 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _SSD2119_H
#define _SSD2119_H
/* SSD2119 registers */
#define SSD2119_REG_DEVICE_CODE_READ 0x00
#define SSD2119_REG_OSC_START 0x00
#define SSD2119_REG_OUTPUT_CTRL 0x01
@ -65,4 +56,3 @@
#define SSD2119_REG_Y_RAM_ADDR 0x4F
#endif /* _SSD2119_H */
/** @} */

View File

@ -5,20 +5,9 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ST7565/board_ST7565_template.h
* @brief GDISP Graphic Driver subsystem board interface for the ST7565 display.
*
* @addtogroup GDISP
* @{
*/
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
/**
* Driver configuration
*/
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
#define ST7565_ADC ST7565_ADC_NORMAL
#define ST7565_COM_SCAN ST7565_COM_SCAN_INC
@ -28,87 +17,32 @@
* #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
*/
/**
* @brief Initialise the board for the display.
*
* @param[in] g The GDisplay structure
*
* @note Set the g->board member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set.
*
* @notapi
*/
static inline void init_board(GDisplay *g) {
(void) g;
}
/**
* @brief After the initialisation.
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void post_init_board(GDisplay *g) {
(void) g;
}
/**
* @brief Set or clear the lcd reset pin.
*
* @param[in] g The GDisplay structure
* @param[in] state TRUE = lcd in reset, FALSE = normal operation
*
* @notapi
*/
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
}
/**
* @brief Take exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void acquire_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Release exclusive control of the bus
*
* @param[in] g The GDisplay structure
*
* @notapi
*/
static inline void release_bus(GDisplay *g) {
(void) g;
}
/**
* @brief Send a command to the controller.
*
* @param[in] g The GDisplay structure
* @param[in] cmd The command to send *
*
* @notapi
*/
static inline void write_cmd(GDisplay *g, uint8_t cmd) {
(void) g;
(void) cmd;
}
/**
* @brief Send data to the lcd.
*
* @param[in] g The GDisplay structure
* @param[in] data The data to send
*
* @notapi
*/
static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
(void) g;
(void) data;
@ -116,5 +50,3 @@ static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
}
#endif /* _GDISP_LLD_BOARD_H */
/** @} */

View File

@ -5,11 +5,6 @@
* http://ugfx.org/license.html
*/
/**
* @file drivers/gdisp/ST7565/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the ST7565 display.
*/
#include "gfx.h"
#if GFX_USE_GDISP
@ -77,7 +72,7 @@
/* Driver exported functions. */
/*===========================================================================*/
/**
/*
* As this controller can't update on a pixel boundary we need to maintain the
* the entire display surface in memory so that we can do the necessary bit
* operations. Fortunately it is a small display in monochrome.

View File

@ -24,5 +24,3 @@
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_LLD_CONFIG_H */
/** @} */

View File

@ -35,5 +35,3 @@
#define ST7565_POWER_CONTROL 0x28
#endif /* _ST7565_H */
/** @} */

Some files were not shown because too many files have changed in this diff Show More