Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
types.h
1//useful things to include in code
2
3#ifndef TYPES_H
4#define TYPES_H
5
6#ifndef WIN32
7 // true/false defines
8 #define FALSE 0
9 #define TRUE -1
10#endif
11
12// datatype definitions macros
13typedef unsigned char u08;
14typedef signed char s08;
15typedef unsigned short u16;
16typedef signed short s16;
17typedef unsigned long u32;
18typedef signed long s32;
19typedef unsigned long long u64;
20typedef signed long long s64;
21
22// #ifndef __AVR__
23#ifdef __MBED__
24 // use inttypes.h instead
25 // C99 standard integer type definitions
26 typedef unsigned char uint8_t;
27 typedef signed char int8_t;
28 typedef unsigned short uint16_t;
29 typedef signed short int16_t;
30 /*typedef unsigned long uint32_t;
31 typedef signed long int32_t;
32 typedef unsigned long uint64_t;
33 typedef signed long int64_t;
34 */
35#endif
36
37// maximum value that can be held
38// by unsigned data types (8,16,32bits)
39#define MAX_U08 255
40#define MAX_U16 65535
41#define MAX_U32 4294967295
42
43// maximum values that can be held
44// by signed data types (8,16,32bits)
45#define MIN_S08 -128
46#define MAX_S08 127
47#define MIN_S16 -32768
48#define MAX_S16 32767
49#define MIN_S32 -2147483648
50#define MAX_S32 2147483647
51
52#ifndef WIN32
53 // more type redefinitions
54 typedef unsigned char BOOL;
55 typedef unsigned char BYTE;
56 typedef unsigned int WORD;
57 typedef unsigned long DWORD;
58
59 typedef unsigned char UCHAR;
60 typedef unsigned int UINT;
61 typedef unsigned short USHORT;
62 typedef unsigned long ULONG;
63
64 typedef char CHAR;
65 typedef int INT;
66 typedef long LONG;
67#endif
68
69#endif