-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_delay_5000.comp
More file actions
48 lines (42 loc) · 1.11 KB
/
Copy pathstart_delay_5000.comp
File metadata and controls
48 lines (42 loc) · 1.11 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
component start_delay_5000 "adds some delay during startup while HAL file is loaded";
description """ loadrt start_delay delay_ms=1000
delay_ms: delay in milliseconds
This component is useful to add some delay during startup while HAL file is loaded.
It is useful to ensure that Pins are avaiolbale before HAL file tries to write values to them.
""";
pin out bit is_module = 1; //one pin is required to use halcompile)
license "GPL";
author "Dominik Zarfl";
//version "0.1";
option extra_setup;
option userspace yes;
;;
#include <rtapi.h>
#include "hal.h"
#include "stdio.h"
//static int* delay_ms = 5000;
//RTAPI_MP_INT(delay_ms, "delay_ms to be added");
static int delay_ms = 5000;
EXTRA_SETUP() {
long int nsec = 1000000 * delay_ms;
rtapi_print_msg(RTAPI_MSG_ERR, "start_delay: adding delay of %d ms\n", delay_ms);
rtapi_delay(nsec);
rtapi_print_msg(RTAPI_MSG_ERR, "start_delay: done\n");
return 0;
}
void user_mainloop(void)
{
long int nsec = 1000000 * delay_ms;
// nothing to do
/* while (true)
{
while (0xb)
{
FOR_ALL_INSTS()
{
rtapi_delay(nsec);
}
}
} */
return rtapi_delay(nsec);
}