SatNOGS-COMMS
4.1.0
A COMMS subsystem for CubeSats
Toggle main menu visibility
Loading...
Searching...
No Matches
io_wdg.hpp
Go to the documentation of this file.
1
/*
2
* SatNOGS-COMMS MCU software
3
*
4
* Copyright (C) 2024, Libre Space Foundation <http://libre.space>
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*
19
* SPDX-License-Identifier: GNU General Public License v3.0 or later
20
*/
21
22
#pragma once
23
24
#include <zephyr/kernel.h>
25
26
namespace
satnogs::comms
27
{
28
41
class
io_wdg
42
{
43
public
:
47
static
constexpr
uint32_t
min_period_mins
= 240;
48
52
static
constexpr
uint32_t
max_period_mins
= 20160;
53
54
static
constexpr
uint32_t
task_wdg_interval
= 30000;
55
61
static
io_wdg
&
62
get_instance
()
63
{
64
static
io_wdg
instance;
65
return
instance;
66
}
67
68
io_wdg
(
io_wdg
const
&) =
delete
;
69
70
void
71
operator=
(
io_wdg
const
&) =
delete
;
72
73
void
74
start
();
75
76
void
77
set_period
(uint32_t
period_mins
);
78
79
uint32_t
80
period_mins
();
81
82
void
83
reset
();
84
85
private
:
86
static
void
87
monitor_thread(
void
*arg1,
void
*arg2,
void
*arg3);
88
89
io_wdg
();
90
91
struct
k_thread m_thread_data;
92
k_tid_t m_tid;
93
k_mutex m_mtx;
94
uint32_t m_period_mins;
95
int64_t m_last_reset_ts;
96
};
97
98
}
// namespace satnogs::comms
satnogs::comms::io_wdg::period_mins
uint32_t period_mins()
Gets the currently configured period in minutes.
Definition
io_wdg.cpp:74
satnogs::comms::io_wdg::start
void start()
Starts the io_wdg. This method should be called after the board initialization process (satnogs::comm...
Definition
io_wdg.cpp:54
satnogs::comms::io_wdg::io_wdg
io_wdg(io_wdg const &)=delete
satnogs::comms::io_wdg::set_period
void set_period(uint32_t period_mins)
Updates the watchdog period in both the currently running instance and at the persistent storage.
Definition
io_wdg.cpp:135
satnogs::comms::io_wdg::task_wdg_interval
static constexpr uint32_t task_wdg_interval
Definition
io_wdg.hpp:54
satnogs::comms::io_wdg::get_instance
static io_wdg & get_instance()
Singleton access to the io_wdg subsystem.
Definition
io_wdg.hpp:62
satnogs::comms::io_wdg::operator=
void operator=(io_wdg const &)=delete
satnogs::comms::io_wdg::reset
void reset()
Resets the watchdog timer.
Definition
io_wdg.cpp:160
satnogs::comms::io_wdg::min_period_mins
static constexpr uint32_t min_period_mins
Definition
io_wdg.hpp:47
satnogs::comms::io_wdg::max_period_mins
static constexpr uint32_t max_period_mins
Definition
io_wdg.hpp:52
satnogs::comms
Definition
bsp.cpp:28
src
io_wdg.hpp
Generated by
1.17.0