Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Robey Pointer
reform
Commits
18727a0a
Commit
18727a0a
authored
Aug 18, 2021
by
Robey Pointer
Browse files
fix display of bitmaps from program memory vs ram (hid report)
parent
3243a02f
Changes
3
Hide whitespace changes
Inline
Side-by-side
reform2-keyboard-fw/display.c
View file @
18727a0a
...
...
@@ -138,6 +138,10 @@ static void render(void) {
oled_finish_render
();
}
void
display_refresh
(
void
)
{
render
();
}
void
display_flush
(
void
)
{
if
(
!
text_dirty
)
return
;
uint8_t
x_offset
=
(
DisplayWidth
-
text_width
*
text_font
->
width
)
/
2
;
...
...
@@ -228,3 +232,31 @@ void display_packed_bitmap(uint16_t offset, const uint8_t *data, uint16_t len) {
void
display_packed_bitmap_pgm
(
uint16_t
offset
,
const
uint8_t
*
data
,
uint16_t
len
,
bool
cursor_effect
)
{
_display_packed_bitmap
(
code_read_byte
,
offset
,
data
,
len
,
cursor_effect
);
}
// low-level overwrite the framebuffer for an alert like "low battery"
void
display_blit_packed_bitmap_pgm
(
const
uint8_t
*
data
,
uint16_t
len
)
{
oled_on
();
oled_home
();
oled_start_render
();
int
i
=
0
;
const
uint8_t
*
end
=
data
+
len
;
while
(
i
<
DisplayWidth
*
DisplayHeight
&&
data
<
end
)
{
uint8_t
header
=
pgm_read_byte
(
data
++
);
if
(
header
==
0
||
data
>=
end
)
break
;
uint8_t
n
=
header
&
0x7f
;
if
(
header
&
0x80
)
{
uint8_t
repeat
=
pgm_read_byte
(
data
++
);
for
(
int
j
=
0
;
j
<
n
;
j
++
)
{
if
(
i
>=
sizeof
(
framebuffer
))
break
;
oled_render
(
repeat
);
}
}
else
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
{
if
(
i
>=
sizeof
(
framebuffer
)
||
data
>=
end
)
break
;
oled_render
(
pgm_read_byte
(
data
++
));
}
}
}
oled_finish_render
();
}
reform2-keyboard-fw/display.h
View file @
18727a0a
...
...
@@ -40,7 +40,9 @@ void display_write_len(const char *text, int len);
void
display_write
(
const
char
*
text
);
void
display_move
(
uint8_t
x
,
uint8_t
y
);
void
display_invert
(
bool
invert
);
void
display_refresh
(
void
);
void
display_flush
(
void
);
void
display_bitmap
(
uint16_t
offset
,
const
uint8_t
*
data
,
uint16_t
len
);
void
display_packed_bitmap
(
uint16_t
offset
,
const
uint8_t
*
data
,
uint16_t
len
);
void
display_packed_bitmap_pgm
(
uint16_t
offset
,
const
uint8_t
*
data
,
uint16_t
len
,
bool
cursor_effect
);
void
display_blit_packed_bitmap_pgm
(
const
uint8_t
*
data
,
uint16_t
len
);
reform2-keyboard-fw/ux.c
View file @
18727a0a
...
...
@@ -89,27 +89,12 @@ void ux_show_status(void) {
display_flush
();
}
#define BATTERY_EMPTY_LEFT 0
#define BATTERY_EMPTY_RIGHT 6
#define BATTERY_ALERT_LEFT 12
#define BATTERY_ALERT_RIGHT 13
void
ux_blink_low_battery
(
bool
blink
)
{
// FIXME
// switch to the large font, and sneakily drop down one half-row
display_init
(
&
font_bizcat
);
// display->roll = 1;
display_move
(
7
,
0
);
if
(
blink
)
{
display_putc
(
BATTERY_ALERT_LEFT
);
display_putc
(
BATTERY_ALERT_RIGHT
);
display_blit_packed_bitmap_pgm
(
battery_warn_bitmap
,
sizeof
(
battery_warn_bitmap
));
}
else
{
display_putc
(
BATTERY_EMPTY_LEFT
);
display_putc
(
BATTERY_EMPTY_RIGHT
);
display_refresh
();
}
display_flush
();
// display->roll = 0;
}
// display the boot logo
...
...
Write
Preview
Supports
Markdown
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