WPILibC++
2023.4.3
Main.h
Go to the documentation of this file.
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
#pragma once
6
7
#include "
hal/Types.h
"
8
9
/**
10
* @defgroup hal_relay Main loop functions
11
* @ingroup hal_capi
12
* @{
13
*/
14
15
#ifdef __cplusplus
16
extern
"C"
{
17
#endif
18
19
/**
20
* Sets up the system to run the provided main loop in the main thread (e.g.
21
* the thread in which main() starts execution) and run the robot code in a
22
* separate thread.
23
*
24
* Normally the robot code runs in the main thread, but some GUI systems
25
* require the GUI be run in the main thread.
26
*
27
* To be effective, this function must be called before the robot code starts
28
* the main loop (e.g. by frc::StartRobot()).
29
*
30
* @param param parameter data to pass to mainFunc and exitFunc
31
* @param mainFunc the function to be run when HAL_RunMain() is called.
32
* @param exitFunc the function to be run when HAL_ExitMain() is called.
33
*/
34
void
HAL_SetMain
(
void
* param,
void
(*mainFunc)(
void
*),
void
(*exitFunc)(
void
*));
35
36
/**
37
* Returns true if HAL_SetMain() has been called.
38
*
39
* @return True if HAL_SetMain() has been called, false otherwise.
40
*/
41
HAL_Bool
HAL_HasMain
(
void
);
42
43
/**
44
* Runs the main function provided to HAL_SetMain().
45
*
46
* If HAL_SetMain() has not been called, simply sleeps until HAL_ExitMain()
47
* is called.
48
*/
49
void
HAL_RunMain
(
void
);
50
51
/**
52
* Causes HAL_RunMain() to exit.
53
*
54
* If HAL_SetMain() has been called, this calls the exit function provided
55
* to that function.
56
*/
57
void
HAL_ExitMain
(
void
);
58
59
#ifdef __cplusplus
60
}
// extern "C"
61
#endif
62
/** @} */
Types.h
HAL_RunMain
void HAL_RunMain(void)
Runs the main function provided to HAL_SetMain().
HAL_SetMain
void HAL_SetMain(void *param, void(*mainFunc)(void *), void(*exitFunc)(void *))
Sets up the system to run the provided main loop in the main thread (e.g.
HAL_HasMain
HAL_Bool HAL_HasMain(void)
Returns true if HAL_SetMain() has been called.
HAL_ExitMain
void HAL_ExitMain(void)
Causes HAL_RunMain() to exit.
HAL_Bool
int32_t HAL_Bool
Definition:
Types.h:73
hal
Main.h
Generated on Mon Mar 27 2023 03:33:15 for WPILibC++ by
1.9.4