Last change
on this file since 46 was
46,
checked in by jrpelegrina, 4 years ago
|
First release to Xenial
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | ############################################################################### |
---|
3 | # |
---|
4 | # Temboo Arduino library |
---|
5 | # |
---|
6 | # Copyright 2015, Temboo Inc. |
---|
7 | # |
---|
8 | # Licensed under the Apache License, Version 2.0 (the "License"); |
---|
9 | # you may not use this file except in compliance with the License. |
---|
10 | # You may obtain a copy of the License at |
---|
11 | # |
---|
12 | # http://www.apache.org/licenses/LICENSE-2.0 |
---|
13 | # |
---|
14 | # Unless required by applicable law or agreed to in writing, |
---|
15 | # software distributed under the License is distributed on an |
---|
16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
---|
17 | # either express or implied. See the License for the specific |
---|
18 | # language governing permissions and limitations under the License. |
---|
19 | # |
---|
20 | ############################################################################### |
---|
21 | */ |
---|
22 | |
---|
23 | #include "TembooGlobal.h" |
---|
24 | |
---|
25 | char* uint16toa(uint16_t value, char* dest) { |
---|
26 | return uint32toa(value, dest); |
---|
27 | } |
---|
28 | |
---|
29 | char* uint32toa(uint32_t value, char* dest) { |
---|
30 | char* end = dest; |
---|
31 | do { |
---|
32 | *end++ = (value % 10) + '0'; |
---|
33 | } while (value /= 10); |
---|
34 | *end = '\0'; |
---|
35 | end--; |
---|
36 | |
---|
37 | char c; |
---|
38 | char* begin = dest; |
---|
39 | while(end > begin) { |
---|
40 | c = *end; |
---|
41 | *end = *begin; |
---|
42 | *begin = c; |
---|
43 | end--; |
---|
44 | begin++; |
---|
45 | } |
---|
46 | |
---|
47 | return dest; |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.