SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*
2 * SatNOGS-COMMS MCU software
3 *
4 * Copyright (C) 2022-2023, 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#include "mission.hpp"
23#include "msg_arbiter.hpp"
24#include "ota.hpp"
25#include "startup.hpp"
27#include <zephyr/kernel.h>
28
29namespace sc = satnogs::comms;
30namespace scl = sc::lib;
31
37int
38main(void)
39{
41 auto &startup = sc::startup::get_instance();
42 startup.prepare();
43 startup.start();
44 auto &leds = scl::board::get_instance().leds();
45
46 while (1) {
47 try {
48 task_wdt_feed(startup.wdg_id());
49 k_msleep(500);
50 leds.toggle(scl::leds::led::led0);
51 leds.toggle(scl::leds::led::led1);
52 } catch (const scl::exception &e) {
53 err.handle(e);
54 /*
55 * Exceptions that are not of the base type satnogs::comms::lib::exception
56 * are handled directly as critical
57 */
58 } catch (std::exception &e) {
59 err.handle(e);
60 }
61 }
62
63 /*
64 * Exceptions that are not of the base type satnogs::comms::lib::exception
65 * are handled directly as critical
66 */
67
68 return 0;
69}
static error_handler & get_instance()
Singleton access to the error_handler subsystem.
comms::lib::leds & leds()
Returns a reference to the LEDs subsystem.
Definition board.cpp:124
static board & get_instance()
Gets a reference to the single instance of the Board interface class.
Definition board.cpp:66
Exception base class.
Definition exception.hpp:63
static startup & get_instance()
Get a singleton access to the startup subsystem.
Definition startup.hpp:80
int main(void)
The main sequence to initialize the Satnogs-COMMS board.
Definition main.cpp:38