summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 0f070ed2fe..9b4a54fdd6 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -108,15 +108,14 @@ inline void lcd_begin_write_gram(void)
inline void lcd_write_data(const unsigned short* p_bytes, int count) ICODE_ATTR;
inline void lcd_write_data(const unsigned short* p_bytes, int count)
{
- /* Ok, by doing 32bit reads we gain a tad bit so I decided to leave this
- code in for now, even though when called with an odd 'count' we will
- actually output one pixel "too many". */
-
unsigned int tmp;
unsigned int *ptr = (unsigned int *)p_bytes;
+ bool extra;
+
+ /* if there's on odd number of pixels, remmber this and output the
+ trailing pixel after the loop */
+ extra = (count&1)?true:false;
- if(count&1)
- count++;
count >>= 1;
while(count--) {
tmp = *ptr++;
@@ -125,6 +124,12 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count)
*(volatile unsigned short *)0xf0008002 = high8to9[(tmp >> 8)&255];
*(volatile unsigned short *)0xf0008002 = tmp<<1;
}
+ if(extra) {
+ /* the final "spare" pixel */
+ unsigned short read = *(unsigned short *)ptr;
+ *(volatile unsigned short *)0xf0008002 = high8to9[read >> 8];
+ *(volatile unsigned short *)0xf0008002 = read<<1;
+ }
}
/*** hardware configuration ***/