68 if (safety_button_pressed && !_safety_btn_off) {
74 _safety_btn_off =
true;
78 }
else if (safety_button_pressed && _safety_btn_off) {
85 _safety_btn_off =
false;
97 #if defined(GPIO_LED_SAFETY) 105 if (_safety_btn_off) {
113 }
else if (armed.
armed) {
121 px4_arch_gpiowrite(GPIO_LED_SAFETY, !((uint16_t)pattern & (1 << _blink_counter++)));
123 if (_blink_counter > 15) {
128 #endif // GPIO_LED_SAFETY 150 _to_safety.publish(
safety);
156 if (PX4_MFT_HW_SUPPORTED(PX4_MFT_PX4IO)) {
157 PX4_ERR(
"not starting (use px4io for safety button)");
162 PX4_WARN(
"disabled by CBRK_IO_SAFETY, exiting");
169 _object.store(instance);
170 _task_id = task_id_is_work_queue;
172 if (instance->
Start() == PX4_OK) {
177 PX4_ERR(
"alloc failed");
181 _object.store(
nullptr);
191 ScheduleOnInterval(100_ms);
205 PX4_INFO(
"Safety State (from button): %s", _safety_btn_off ?
"off" :
"on");
214 PX4_WARN(
"%s\n", reason);
217 PRINT_MODULE_DESCRIPTION(
220 This module is responsible for the safety button. 224 PRINT_MODULE_USAGE_NAME("safety_button",
"driver");
225 PRINT_MODULE_USAGE_COMMAND_DESCR(
"start",
"Start the safety button driver");
#define CBRK_IO_SAFETY_KEY
bool circuit_breaker_enabled(const char *breaker, int32_t magic)
int main(int argc, char **argv)
static void print_usage()
bool safety_switch_available
static struct safety_s safety
static struct actuator_armed_s armed
static bool safety_button_pressed
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).