aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMateusz Tomaszkiewicz <silentdemon@gmail.com>2013-06-13 00:20:00 +0200
committerMateusz Tomaszkiewicz <silentdemon@gmail.com>2013-06-18 23:32:22 +0200
commitf820fb90d51e5dba715a520baf40474d521bdce2 (patch)
treeb863e3a3b633f6ad7472b507a3bde224e1ffacae /drivers
parent2a65ea53880ca07fa3755a84a91747acda2f48ba (diff)
downloaduGFX-f820fb90d51e5dba715a520baf40474d521bdce2.tar.gz
uGFX-f820fb90d51e5dba715a520baf40474d521bdce2.tar.bz2
uGFX-f820fb90d51e5dba715a520baf40474d521bdce2.zip
SSD2119: GDISP_USE_FSMC "switch" added
Enable FSMC functions only when GDISP_USE_FSMC is set.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gdisp/SSD2119/gdisp_lld.c36
-rw-r--r--drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h7
2 files changed, 29 insertions, 14 deletions
diff --git a/drivers/gdisp/SSD2119/gdisp_lld.c b/drivers/gdisp/SSD2119/gdisp_lld.c
index d7e08504..8ace4912 100644
--- a/drivers/gdisp/SSD2119/gdisp_lld.c
+++ b/drivers/gdisp/SSD2119/gdisp_lld.c
@@ -318,7 +318,7 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
set_cursor(0, 0);
stream_start();
- #if defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
+ #if defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
uint8_t i;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, &color);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
@@ -334,7 +334,7 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
uint32_t index;
for(index = 0; index < area; index++)
write_data(color);
- #endif // defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
+ #endif // defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
stream_stop();
release_bus();
@@ -369,7 +369,7 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
set_viewport(x, y, cx, cy);
stream_start();
- #if defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
+ #if defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
uint8_t i;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, &color);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
@@ -385,7 +385,7 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
uint32_t index;
for(index = 0; index < area; index++)
write_data(color);
- #endif // defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
+ #endif // defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
stream_stop();
release_bus();
@@ -422,7 +422,7 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
set_viewport(x, y, cx, cy);
stream_start();
- #if defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
+ #if defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
uint32_t area = cx * cy;
uint8_t i;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
@@ -444,7 +444,7 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
for(; y < endy; y++, buffer += lg)
for(x=srcx; x < endx; x++)
write_data(*buffer++);
- #endif // defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
+ #endif // defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
stream_stop();
release_bus();
@@ -472,14 +472,18 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
set_cursor(x, y);
stream_start();
- /* FSMC timing */
- FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_3 | FSMC_BTR1_DATAST_3 | FSMC_BTR1_BUSTURN_0;
+ #if defined(GDISP_USE_FSMC)
+ /* FSMC timing */
+ FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_3 | FSMC_BTR1_DATAST_3 | FSMC_BTR1_BUSTURN_0;
+ #endif // defined(GDISP_USE_FSMC)
color = read_data(); // dummy read
color = read_data();
- /* FSMC timing */
- FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0;
+ #if defined(GDISP_USE_FSMC)
+ /* FSMC timing */
+ FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0;
+ #endif // defined(GDISP_USE_FSMC)
stream_stop();
release_bus();
@@ -536,15 +540,19 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
set_viewport(x, row0, cx, 1);
stream_start();
- /* FSMC timing */
- FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_3 | FSMC_BTR1_DATAST_3 | FSMC_BTR1_BUSTURN_0;
+ #if defined(GDISP_USE_FSMC)
+ /* FSMC timing */
+ FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_3 | FSMC_BTR1_DATAST_3 | FSMC_BTR1_BUSTURN_0;
+ #endif // defined(GDISP_USE_FSMC)
j = read_data(); // dummy read
for (j = 0; (coord_t)j < cx; j++)
buf[j] = read_data();
- /* FSMC timing */
- FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0;
+ #if defined(GDISP_USE_FSMC)
+ /* FSMC timing */
+ FSMC_Bank1->BTCR[FSMC_Bank + 1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0;
+ #endif // defined(GDISP_USE_FSMC)
stream_stop();
diff --git a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h
index a223ad18..4993a511 100644
--- a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h
+++ b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h
@@ -16,6 +16,9 @@
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
+/* This board file uses only FSMC, so don't undefine this. */
+#define GDISP_USE_FSMC
+/* But it is OK to disable DMA use. */
#define GDISP_USE_DMA
#define GDISP_DMA_STREAM STM32_DMA2_STREAM6
@@ -57,6 +60,10 @@ static const PWMConfig pwmcfg = {
*/
static inline void init_board(void) {
+ #ifndef GDISP_USE_FSMC
+ #error "This board uses only FSMC, please define GDISP_USE_FSMC"
+ #endif
+
#if defined(STM32F4XX) || defined(STM32F2XX)
/* STM32F4 FSMC init */
rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0);