BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
13351c00
Commit
13351c00
authored
Mar 07, 2018
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_math: lv_math_num_to_str: return with buf
parent
19f98ce8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
lv_math.c
lv_misc/lv_math.c
+5
-2
lv_math.h
lv_misc/lv_math.h
+7
-1
No files found.
lv_misc/lv_math.c
View file @
13351c00
...
...
@@ -37,14 +37,15 @@
* Convert a number to string
* @param num a number
* @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)
* @return same as `buf` (just for convenience)
*/
void
lv_math_num_to_str
(
int32_t
num
,
char
*
buf
)
char
*
lv_math_num_to_str
(
int32_t
num
,
char
*
buf
)
{
char
*
buf_ori
=
buf
;
if
(
num
==
0
)
{
buf
[
0
]
=
'0'
;
buf
[
1
]
=
'\0'
;
return
;
return
buf
;
}
else
if
(
num
<
0
)
{
(
*
buf
)
=
'-'
;
buf
++
;
...
...
@@ -85,6 +86,8 @@ void lv_math_num_to_str(int32_t num, char * buf)
}
(
*
buf
)
=
'\0'
;
return
buf_ori
;
}
/**********************
...
...
lv_misc/lv_math.h
View file @
13351c00
...
...
@@ -31,7 +31,13 @@ extern "C" {
/**********************
* GLOBAL PROTOTYPES
**********************/
void
lv_math_num_to_str
(
int32_t
num
,
char
*
buf
);
/**
* Convert a number to string
* @param num a number
* @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)
* @return same as `buf` (just for convenience)
*/
char
*
lv_math_num_to_str
(
int32_t
num
,
char
*
buf
);
/**********************
* MACROS
...
...
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