embedded system library for e-puck  1.0.1
A redesigned API library for the e-puck robot platform
 All Data Structures Files Functions Variables Enumerations Enumerator Modules Pages
el_clock.h
Go to the documentation of this file.
1 /*
2 
3 embedded system library for e-puck
4 
5 --------------------------------------------------------------------------------
6 
7 code distribution:
8 https://github.com/jianingchen/epucklib
9 
10 online documentation:
11 http://jianingchen.github.io/epucklib/html/
12 
13 --------------------------------------------------------------------------------
14 
15 This file is released under the terms of the MIT license (see "el.h").
16 
17 */
18 
30 #ifndef EL_CLOCK
31 #define EL_CLOCK
32 
33 #include "el_common.h"
34 
35 // general purpose time type, unit = 1/1000 second
36 typedef signed short el_time;
37 #define EL_TIME_FREQ 1000
38 
39 // master clock time types, unit = 1/144000 second
40 typedef uint32_t el_mct;
41 #define EL_MASTERCLOCK_FREQ (144000L)
42 
43 
44 el_mct el_get_masterclock();
45 el_time el_get_time_diff(el_mct k0,el_mct k1,el_mct*residue);
46 
47 
48 /*
49 --------------------------------------------------------------------------------
50 */
51 
52 
53 #ifdef EL_INCLUDE_LIB_INTERNAL_CONTEXT
54 
55 typedef int16_t el_mcd;
56 #define EL_TIME_TO_MCT(t) ((el_mct)(EL_MASTERCLOCK_FREQ/EL_TIME_FREQ)*(t))
57 
58 #define EL_MCT_ZERO_POINT (65536UL)
59 
60 #define EL_SYS_ERROR_MALLOC_NULL 1
61 #define EL_SYS_ERROR_PROCESS_TIME_OUT 2
62 #define EL_SYS_ERROR_PROCESS_LAUNCH_FAIL 3
63 #define EL_SYS_ERROR_TIMER_TIME_OUT 4
64 #define EL_SYS_ERROR_TIMER_CREATE_FAIL 5
65 #define EL_SYS_ERROR_TRIGGER_TIME_OUT 6
66 #define EL_SYS_ERROR_TRIGGER_CREATE_FAIL 7
67 
68 
69 extern int el_error_signal;
70 
71 void el_init_masterclock();
72 void el_routine_masterclock_14400hz();
73 void el_nop_delay(int x);
74 
75 #endif
76 
77 
78 
79 #endif