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
6054d48d
Commit
6054d48d
authored
Aug 30, 2014
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lcd: Rotated extra 180 degrees.
parent
c56d0c38
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
lcd.c
sw/common/drivers/lcd.c
+16
-7
No files found.
sw/common/drivers/lcd.c
View file @
6054d48d
...
...
@@ -32,7 +32,7 @@
#include <udelay.h>
// Enable 90* rotation
#define LCD_ROTATE
#define LCD_ROTATE
_90
// Do not use DMA for frame transfer
#define LCD_NODMA
...
...
@@ -265,13 +265,16 @@ void lcd_set_pixel(uint8_t x, uint8_t y, uint8_t value)
x
%=
LCD_WIDTH
;
y
%=
LCD_HEIGHT
;
#ifdef LCD_ROTATE
#if defined(LCD_ROTATE_90)
uint8_t
mask
=
0x80
>>
(
y
&
0x07
);
uint16_t
offset
=
(
x
*
LCD_STRIDE
)
+
((
LCD_HEIGHT
-
1
-
y
)
>>
3
);
#elif defined(LCD_ROTATE_270)
uint8_t
mask
=
1
<<
(
y
&
0x07
);
uint16_t
offset
=
((
LCD_WIDTH
-
x
-
1
)
*
LCD_STRIDE
)
+
(
y
>>
3
);
#else
uint8_t
mask
=
1
<<
(
x
&
0x07
);
// == 1 << (x % 8)
uint16_t
offset
=
(
y
*
LCD_STRIDE
)
+
(
x
>>
3
);
// == y * LCD_STRIDE + x / 8
#endif
/* else LCD_ROTATE */
#endif
if
(
value
)
buffer
[
offset
]
|=
mask
;
...
...
@@ -284,13 +287,16 @@ void lcd_toggle_pixel(uint8_t x, uint8_t y)
x
%=
LCD_WIDTH
;
y
%=
LCD_HEIGHT
;
#ifdef LCD_ROTATE
#if defined(LCD_ROTATE_90)
uint8_t
mask
=
0x80
>>
(
y
&
0x07
);
uint16_t
offset
=
(
x
*
LCD_STRIDE
)
+
((
LCD_HEIGHT
-
1
-
y
)
>>
3
);
#elif defined(LCD_ROTATE_270)
uint8_t
mask
=
1
<<
(
y
&
0x07
);
uint16_t
offset
=
((
LCD_WIDTH
-
x
-
1
)
*
LCD_STRIDE
)
+
(
y
>>
3
);
#else
uint8_t
mask
=
1
<<
(
x
&
0x07
);
// == 1 << (x % 8)
uint16_t
offset
=
(
y
*
LCD_STRIDE
)
+
(
x
>>
3
);
// == y * LCD_STRIDE + x / 8
#endif
/* else LCD_ROTATE */
#endif
buffer
[
offset
]
^=
mask
;
}
...
...
@@ -300,13 +306,16 @@ uint8_t lcd_get_pixel(uint8_t x, uint8_t y)
x
%=
LCD_WIDTH
;
y
%=
LCD_HEIGHT
;
#ifdef LCD_ROTATE
#if defined(LCD_ROTATE_90)
uint8_t
mask
=
0x80
>>
(
y
&
0x07
);
uint16_t
offset
=
(
x
*
LCD_STRIDE
)
+
((
LCD_HEIGHT
-
1
-
y
)
>>
3
);
#elif defined(LCD_ROTATE_270)
uint8_t
mask
=
1
<<
(
y
&
0x07
);
uint16_t
offset
=
((
LCD_WIDTH
-
x
-
1
)
*
LCD_STRIDE
)
+
(
y
>>
3
);
#else
uint8_t
mask
=
1
<<
(
x
&
0x07
);
// == 1 << (x % 8)
uint16_t
offset
=
(
y
*
LCD_STRIDE
)
+
(
x
>>
3
);
// == y * LCD_STRIDE + x / 8
#endif
/* else LCD_ROTATE */
#endif
return
buffer
[
offset
]
&
mask
;
}
...
...
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