-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathat_string.h
More file actions
64 lines (52 loc) · 2.8 KB
/
at_string.h
File metadata and controls
64 lines (52 loc) · 2.8 KB
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
#ifndef AT_STRING_H
//header envroiment variabile, is used to detect multiple inclusion
//of the same header, and can be used in the c file to detect the
//included library
#define AT_STRING_H
/****************************************************************************
** ENVROIMENT VARIABILE
****************************************************************************/
/****************************************************************************
** GLOBAL INCLUDE
** TIPS: you can put here the library common to all source file
****************************************************************************/
/****************************************************************************
** DEFINE
****************************************************************************/
//max digit of a 8 bit number
#define MAX_DIGIT8 3
//max digit of a 16 bit number
#define MAX_DIGIT16 5
//max digit of a 32 bit number
#define MAX_DIGIT32 10
/****************************************************************************
** MACRO
****************************************************************************/
/****************************************************************************
** TYPEDEF
****************************************************************************/
/****************************************************************************
** STRUCTURE
****************************************************************************/
/****************************************************************************
** PROTOTYPE: GLOBAL VARIABILE
****************************************************************************/
/****************************************************************************
** PROTOTYPE: FUNCTIONS
****************************************************************************/
//NOTE: User must care about providing a valid vector with sufficient space. Return the index of the terminator inside the vector
//Convert a uint8_t in string form, and loads it into a provided vector, terminating it with '\0'
extern uint8_t u8_to_str( uint8_t num, uint8_t *str );
//Convert an int8_t to string
extern uint8_t s8_to_str( int8_t num, uint8_t *str );
//Convert a uint16_t in string form, and loads it into a provided vector, terminating it with '\0'
extern uint8_t u16_to_str( uint16_t num, uint8_t *str );
//Convert an int16_t to string
extern uint8_t s16_to_str( int16_t num, uint8_t *str );
//Convert a uint32_t in string form, and loads it into a provided vector, terminating it with '\0'
extern uint8_t u32_to_str( uint32_t num, uint8_t *str );
//Convert an uint32_t to string
extern uint8_t s32_to_str( int32_t num, uint8_t *str );
#else
#warning "multiple inclusion of the header file at_string.h"
#endif