Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
e002454b
Commit
e002454b
authored
Sep 08, 2014
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lcd: Fixed the tearing effect (at least in FreeRTOS).
parent
6e04225a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
2 deletions
+41
-2
lcd.c
sw/common/drivers/lcd.c
+20
-0
lcd.h
sw/common/drivers/lcd.h
+8
-0
lcd_dma.c
sw/common/drivers/lcd_dma.c
+11
-0
Makefile
sw/freertos/Makefile
+2
-2
No files found.
sw/common/drivers/lcd.c
View file @
e002454b
...
...
@@ -36,6 +36,10 @@
#include <em_rtc.h>
#include <em_timer.h>
#ifdef FREERTOS
xSemaphoreHandle
lcd_sem
;
#endif
/* FREERTOS */
// Frame buffer - pixels are stored as consecutive rows
uint8_t
lcd_buffer
[
LCD_BUF_SIZE
];
uint8_t
*
const
off_buffer
=
lcd_buffer
+
LCD_CONTROL_BYTES
;
...
...
@@ -147,6 +151,13 @@ void lcd_init(void)
{
uint16_t
cmd
;
#ifdef FREERTOS
lcd_sem
=
xSemaphoreCreateMutex
();
if
(
lcd_sem
==
NULL
)
{
// TODO oops..
}
#endif
/* FREERTOS */
spi_init
();
// TODO I am pretty sure, it will be already initialized somewhere..
CMU_ClockEnable
(
cmuClock_GPIO
,
true
);
...
...
@@ -206,6 +217,11 @@ void lcd_clear(void)
uint32_t
*
p
=
(
uint32_t
*
)
lcd_buffer
;
uint16_t
x
,
y
;
#ifdef FREERTOS
if
(
xSemaphoreTake
(
lcd_sem
,
LCD_SEM_TICKS
)
!=
pdTRUE
)
return
;
#endif
/* FREERTOS */
for
(
y
=
0
;
y
<
LCD_HEIGHT
;
++
y
)
{
// skip control bytes
p
=
(
uint32_t
*
)((
uint8_t
*
)
p
+
2
);
...
...
@@ -215,6 +231,10 @@ void lcd_clear(void)
*
p
++
=
0x00
;
}
}
#ifdef FREERTOS
xSemaphoreGive
(
lcd_sem
);
#endif
/* FREERTOS */
}
void
lcd_update
(
void
)
...
...
sw/common/drivers/lcd.h
View file @
e002454b
...
...
@@ -30,6 +30,14 @@
#include "em_gpio.h"
#ifdef FREERTOS
#include <FreeRTOS.h>
#include <semphr.h>
///> How long should we wait for the semaphore
#define LCD_SEM_TICKS 100
extern
xSemaphoreHandle
lcd_sem
;
#endif
/* FREERTOS */
// Dimensions
#define LCD_HEIGHT 128
#define LCD_WIDTH 128
...
...
sw/common/drivers/lcd_dma.c
View file @
e002454b
...
...
@@ -56,6 +56,10 @@ static void lcd_dma_tx_complete(unsigned int channel, bool primary, void *user)
(
void
)
user
;
dma_transfer_active
=
false
;
#ifdef FREERTOS
xSemaphoreGive
(
lcd_sem
);
#endif
/* FREERTOS */
}
void
lcd_dma_init
(
void
)
...
...
@@ -110,10 +114,17 @@ void lcd_dma_init(void)
void
lcd_dma_send_frame
(
void
)
{
#ifdef FREERTOS
if
(
xSemaphoreTake
(
lcd_sem
,
LCD_SEM_TICKS
)
!=
pdTRUE
)
return
;
#else
while
(
dma_transfer_active
);
#endif
/* else FREERTOS */
dma_transfer_active
=
true
;
DMA_ActivateScatterGather
(
DMA_CHANNEL
,
true
,
dma_cfg_block
,
DMA_TRANSFERS
);
// semaphore is given back in the DMA transfer finished interrupt
}
bool
lcd_dma_is_active
(
void
)
...
...
sw/freertos/Makefile
View file @
e002454b
...
...
@@ -96,7 +96,7 @@ DEPFLAGS = -MMD -MP -MF $(@:.o=.d)
override
CFLAGS
+=
-D
$(DEVICE)
-Wall -Wextra -mcpu=cortex-m3 -mthumb
\
-mfix-cortex-m3-ldrd -ffunction-sections
\
-fdata-sections -fomit-frame-pointer -DGCC_ARMCM3
\
$(DEPFLAGS)
-DFREERTOS
$(DEPFLAGS)
override
ASMFLAGS
+=
-x assembler-with-cpp -D
$(DEVICE)
-Wall -Wextra -mcpu=cortex-m3 -mthumb
...
...
@@ -107,7 +107,7 @@ override LDFLAGS += -Xlinker -Map=$(LST_DIR)/$(PROJECTNAME).map -mcpu=cortex-m3
-mthumb -T../common/Device/EnergyMicro/EFM32GG/Source/GCC/efm32gg.ld
\
-Wl,--gc-sections
LIBS
=
-Wl,--start-group -lgcc -lc -lnosys
-Wl,--end-group
LIBS
=
-Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group
INCLUDEPATHS
+=
\
-Isrc
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment