Choco OS  V.0.16.9.0
Join to the chocolate world
oc_stdtypes.h
Go to the documentation of this file.
1 
28 #ifndef SYSTEM_LIBRARIES_INC_OC_STDTYPES_H_
29 #define SYSTEM_LIBRARIES_INC_OC_STDTYPES_H_
30 
31 #include <stdint.h>
32 
33 //==========================================================================================================================================
39 //==========================================================================================================================================
40 typedef uint8_t oC_uint8_t;
41 //==========================================================================================================================================
47 //==========================================================================================================================================
48 typedef uint16_t oC_uint16_t;
49 //==========================================================================================================================================
55 //==========================================================================================================================================
56 typedef uint32_t oC_uint32_t;
57 //==========================================================================================================================================
63 //==========================================================================================================================================
64 typedef uint64_t oC_uint64_t;
65 //==========================================================================================================================================
71 //==========================================================================================================================================
72 typedef int8_t oC_int8_t;
73 //==========================================================================================================================================
79 //==========================================================================================================================================
80 typedef int16_t oC_int16_t;
81 //==========================================================================================================================================
87 //==========================================================================================================================================
88 typedef int32_t oC_int32_t;
89 //==========================================================================================================================================
95 //==========================================================================================================================================
96 typedef int64_t oC_int64_t;
97 //==========================================================================================================================================
103 //==========================================================================================================================================
104 #if MACHINE_WORD_SIZE==4
105 typedef oC_uint32_t oC_UInt_t;
106 #elif MACHINE_WORD_SIZE==2
107 typedef oC_uint16_t oC_UInt_t;
108 #elif MACHINE_WORD_SIZE==1
109 typedef oC_uint8_t oC_UInt_t;
110 #else
111 # error Unsupported machine word size architecture
112 #endif
113 //==========================================================================================================================================
119 //==========================================================================================================================================
120 #if MACHINE_WORD_SIZE==4
121 typedef oC_int32_t oC_Int_t;
122 #elif MACHINE_WORD_SIZE==2
123 typedef oC_int16_t oC_Int_t;
124 #elif MACHINE_WORD_SIZE==1
125 typedef oC_int8_t oC_Int_t;
126 #else
127 # error Unsupported machine word size architecture
128 #endif
129 //==========================================================================================================================================
134 //==========================================================================================================================================
135 #define oC_uint8_MAX (0xFFU)
136 //==========================================================================================================================================
141 //==========================================================================================================================================
142 #define oC_uint8_MIN (0)
143 //==========================================================================================================================================
148 //==========================================================================================================================================
149 #define oC_uint16_MAX (0xFFFFU)
150 //==========================================================================================================================================
155 //==========================================================================================================================================
156 #define oC_uint16_MIN (0)
157 //==========================================================================================================================================
162 //==========================================================================================================================================
163 #define oC_uint32_MAX (0xFFFFFFFFUL)
164 //==========================================================================================================================================
169 //==========================================================================================================================================
170 #define oC_uint32_MIN (0)
171 //==========================================================================================================================================
176 //==========================================================================================================================================
177 #define oC_uint64_MAX (0xFFFFFFFFFFFFFFFFULL)
178 //==========================================================================================================================================
183 //==========================================================================================================================================
184 #define oC_uint64_MIN (0)
185 //==========================================================================================================================================
190 //==========================================================================================================================================
191 #define oC_int8_MAX (127)
192 //==========================================================================================================================================
197 //==========================================================================================================================================
198 #define oC_int8_MIN (-128)
199 //==========================================================================================================================================
204 //==========================================================================================================================================
205 #define oC_int16_MAX (31767)
206 //==========================================================================================================================================
211 //==========================================================================================================================================
212 #define oC_int16_MIN (-32768)
213 //==========================================================================================================================================
218 //==========================================================================================================================================
219 #define oC_int32_MAX (2147483647L)
220 //==========================================================================================================================================
225 //==========================================================================================================================================
226 #define oC_int32_MIN (-2147483648L)
227 //==========================================================================================================================================
232 //==========================================================================================================================================
233 #define oC_int64_MAX (9223372036854775807LL)
234 //==========================================================================================================================================
239 //==========================================================================================================================================
240 #define oC_int64_MIN (-9223372036854775808LL)
241 
242 //==========================================================================================================================================
248 //==========================================================================================================================================
249 typedef enum
250 {
255 } oC_Power_t;
256 
257 //==========================================================================================================================================
258 //==========================================================================================================================================
259 typedef enum
260 {
261  oC_IoFlags_WaitForAllElements = (1<<0) ,
262  oC_IoFlags_ReadOneLine = (1<<1) ,
263  oC_IoFlags_EchoWhenRead = (1<<2) ,
264  oC_IoFlags_EchoAsPassword = (1<<3) ,
265  oC_IoFlags_SleepWhileWaiting = (1<<4) ,
266  oC_IoFlags_60sTimeout = (1<<5) ,
267  oC_IoFlags_10sTimeout = (1<<6) ,
268  oC_IoFlags_1sTimeout = (1<<7) ,
269  oC_IoFlags_500msTimeout = (1<<8) ,
270  oC_IoFlags_0sTimeout = (1<<9) ,
271  oC_IoFlags_NoTimeout = (1<<10) ,
272  oC_IoFlags_WaitForSomeElements= (1<<11) ,
273  oC_IoFlags_ClearRxBeforeRead = (1<<12) ,
274  oC_IoFlags_WriteToStdError = (1<<13) ,
275  oC_IoFlags_Default = oC_IoFlags_SleepWhileWaiting | oC_IoFlags_WaitForAllElements | oC_IoFlags_ReadOneLine | oC_IoFlags_EchoWhenRead | oC_IoFlags_NoTimeout | oC_IoFlags_ClearRxBeforeRead,
276 } oC_IoFlags_t;
277 
278 #define oC_IoFlags_GetTimeout(IoFlags) ( ((IoFlags) & oC_IoFlags_60sTimeout) ? oC_s(60) : \
279  ((IoFlags) & oC_IoFlags_10sTimeout) ? oC_s(10) : \
280  ((IoFlags) & oC_IoFlags_1sTimeout) ? oC_s(1) : \
281  ((IoFlags) & oC_IoFlags_NoTimeout) ? oC_hour(1) : \
282  ((IoFlags) & oC_IoFlags_500msTimeout) ? oC_ms(500) : 0 \
283  )
284 
285 #define oC_CastType(Type,Value) ( (Type) (Value) )
286 
287 #define oC_InitByte(B7,B6,B5,B4,B3,B2,B1,B0) ( B0 << 0 ) | \
288  ( B1 << 1 ) | \
289  ( B2 << 2 ) | \
290  ( B3 << 3 ) | \
291  ( B4 << 4 ) | \
292  ( B5 << 5 ) | \
293  ( B6 << 6 ) | \
294  ( B7 << 7 )
295 
296 #endif /* SYSTEM_LIBRARIES_INC_OC_STDTYPES_H_ */
Something is powered on.
Definition: oc_stdtypes.h:252
Something index is not correct.
Definition: oc_stdtypes.h:254
Something power is not handled.
Definition: oc_stdtypes.h:253
int16_t oC_int16_t
type for 16 bit signed integer
Definition: oc_stdtypes.h:80
uint32_t oC_uint32_t
type for 32 bit unsigned integer
Definition: oc_stdtypes.h:56
int8_t oC_int8_t
type for 8 bit signed integer
Definition: oc_stdtypes.h:72
int32_t oC_int32_t
type for 32 bit signed integer
Definition: oc_stdtypes.h:88
int64_t oC_int64_t
type for 64 bit signed integer
Definition: oc_stdtypes.h:96
uint16_t oC_uint16_t
type for 16 bit unsigned integer
Definition: oc_stdtypes.h:48
uint8_t oC_uint8_t
type for 8 bit unsigned integer
Definition: oc_stdtypes.h:40
Something is powered off.
Definition: oc_stdtypes.h:251
uint64_t oC_uint64_t
type for 64 bit unsigned integer
Definition: oc_stdtypes.h:64
oC_Power_t
stores registers power state
Definition: oc_stdtypes.h:249