-
Notifications
You must be signed in to change notification settings - Fork 13
/
lib_bindec.h
66 lines (52 loc) · 1.4 KB
/
lib_bindec.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* File name: lib_bindec.h
* Date first: 12/24/2017
* Date last: 12/18/2018
*
* Description: Library of binary/decimal functions for STM8
*
* Author: Richard Hodges
*
* Copyright (C) 2017, 2018 Richard Hodges. All rights reserved.
* Permission is hereby granted for any use.
*
******************************************************************************
*
* Convert 16 bit unsigned binary to 5 digit decimal, terminate with zero
*/
void bin16_dec(short, char *);
/*
* Convert 32 bit unsigned binary to 10 digit decimal, terminate with zero
*/
void bin32_dec(long, char *);
/*
* Convert 8 bit unsigned binary to 2 digit decimal, terminate with zero
*/
void bin8_dec2(char, char *);
/*
* Trim leading zeroes from decimal buffer
* in: buffer, maximum zeroes to remove
* out: first non-zero digit
*/
char *decimal_rlz(char *, char);
/*
* Combine 16 bit binary to decimal and remove leading zeroes
* in: 16 bit binary, 6 digit buffer
* out: first non-zero digit
*/
char *bin16_dec_rlz(short, char *);
/*
* Convert binary byte to hex, terminate with zero
*/
void bin8_hex(char, char *);
/*
* Convert ASCII decimal digits to 16-bit binary
* Stops on first non-decimal character
*/
int dec_bin16(char *);
/*
* Convert ASCII decimal digits to 16-bit binary
* Digits may be preceded with sign
* Stops on first non-decimal character
*/
int dec_bin16s(char *);