Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
st7789_mpy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
st7789_mpy
Commits
8b5fb492
Commit
8b5fb492
authored
Dec 12, 2021
by
russhughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed uint16_t overflows, replaced with size_t
parent
dc0a669c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
st7789/st7789.c
st7789/st7789.c
+7
-7
st7789/st7789.h
st7789/st7789.h
+1
-1
No files found.
st7789/st7789.c
View file @
8b5fb492
...
@@ -659,7 +659,7 @@ STATIC mp_obj_t st7789_ST7789_write(size_t n_args, const mp_obj_t *args)
...
@@ -659,7 +659,7 @@ STATIC mp_obj_t st7789_ST7789_write(size_t n_args, const mp_obj_t *args)
// allocate buffer large enough the the widest character in the font
// allocate buffer large enough the the widest character in the font
// if a buffer was not specified during the driver init.
// if a buffer was not specified during the driver init.
uint32
_t
buf_size
=
max_width
*
height
*
2
;
size
_t
buf_size
=
max_width
*
height
*
2
;
if
(
self
->
buffer_size
==
0
)
{
if
(
self
->
buffer_size
==
0
)
{
self
->
i2c_buffer
=
m_malloc
(
buf_size
);
self
->
i2c_buffer
=
m_malloc
(
buf_size
);
}
}
...
@@ -792,12 +792,12 @@ STATIC mp_obj_t st7789_ST7789_bitmap(size_t n_args, const mp_obj_t *args)
...
@@ -792,12 +792,12 @@ STATIC mp_obj_t st7789_ST7789_bitmap(size_t n_args, const mp_obj_t *args)
mp_get_buffer_raise
(
bitmap_data_buff
,
&
bufinfo
,
MP_BUFFER_READ
);
mp_get_buffer_raise
(
bitmap_data_buff
,
&
bufinfo
,
MP_BUFFER_READ
);
bitmap_data
=
bufinfo
.
buf
;
bitmap_data
=
bufinfo
.
buf
;
uint16
_t
buf_size
=
width
*
height
*
2
;
size
_t
buf_size
=
width
*
height
*
2
;
if
(
self
->
buffer_size
==
0
)
{
if
(
self
->
buffer_size
==
0
)
{
self
->
i2c_buffer
=
m_malloc
(
buf_size
);
self
->
i2c_buffer
=
m_malloc
(
buf_size
);
}
}
uint32
_t
ofs
=
0
;
size
_t
ofs
=
0
;
bs_bit
=
0
;
bs_bit
=
0
;
if
(
bitmaps
)
{
if
(
bitmaps
)
{
if
(
idx
<
bitmaps
)
{
if
(
idx
<
bitmaps
)
{
...
@@ -874,7 +874,7 @@ STATIC mp_obj_t st7789_ST7789_text(size_t n_args, const mp_obj_t *args)
...
@@ -874,7 +874,7 @@ STATIC mp_obj_t st7789_ST7789_text(size_t n_args, const mp_obj_t *args)
bg_color
=
_swap_bytes
(
BLACK
);
bg_color
=
_swap_bytes
(
BLACK
);
uint8_t
wide
=
width
/
8
;
uint8_t
wide
=
width
/
8
;
uint16
_t
buf_size
=
width
*
height
*
2
;
size
_t
buf_size
=
width
*
height
*
2
;
if
(
self
->
buffer_size
==
0
)
{
if
(
self
->
buffer_size
==
0
)
{
self
->
i2c_buffer
=
m_malloc
(
buf_size
);
self
->
i2c_buffer
=
m_malloc
(
buf_size
);
...
...
st7789/st7789.h
View file @
8b5fb492
...
@@ -87,7 +87,7 @@ typedef struct _st7789_ST7789_obj_t {
...
@@ -87,7 +87,7 @@ typedef struct _st7789_ST7789_obj_t {
mp_file_t
*
fp
;
// file object
mp_file_t
*
fp
;
// file object
uint16_t
*
i2c_buffer
;
// resident buffer if buffer_size given
uint16_t
*
i2c_buffer
;
// resident buffer if buffer_size given
void
*
work
;
// work buffer for jpg decoding
void
*
work
;
// work buffer for jpg decoding
uint16_t
buffer_size
;
// resident buffer size, 0=dynamic
size_t
buffer_size
;
// resident buffer size, 0=dynamic
uint16_t
display_width
;
// physical width
uint16_t
display_width
;
// physical width
uint16_t
width
;
// logical width (after rotation)
uint16_t
width
;
// logical width (after rotation)
uint16_t
display_height
;
// physical width
uint16_t
display_height
;
// physical width
...
...
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