|
RocketLogger
2.0.0
|
#include <errno.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <signal.h>#include <sys/reboot.h>#include <unistd.h>#include "gpio.h"#include "log.h"#include "pwm.h"#include "rl.h"#include "rl_lib.h"
Include dependency graph for rocketloggerd.c:Go to the source code of this file.
Macros | |
| #define | RL_DAEMON_MIN_INTERVAL 1 |
| Minimal time interval between two interrupts (in seconds) More... | |
| #define | RL_CALIBRATION_DURATION_SEC 1 |
| Duration of calibration run (in seconds) More... | |
| #define | RL_POWERUP_DELAY_US 5000 |
| Delay on cape power up (in microseconds) More... | |
| #define | RL_BUTTON_LONG_PRESS_SEC 3 |
| Min duration of a long button press (in seconds) More... | |
| #define | RL_BUTTON_VERY_LONG_PRESS_SEC 6 |
| Min duration of a very long button press (in seconds) More... | |
| #define | RL_BUTTON_EXTRA_LONG_PRESS_SEC 10 |
| Min duration of an extra long button press (in seconds) More... | |
Typedefs | |
| typedef enum system_action | system_action_t |
Enumerations | |
| enum | system_action { SYSTEM_ACTION_NONE , SYSTEM_ACTION_REBOOT , SYSTEM_ACTION_POWEROFF } |
Functions | |
| int | adc_calibrate (uint64_t duration) |
| void | button_interrupt_handler (int value) |
| int | main (void) |
Variables | |
| volatile bool | daemon_shutdown = false |
| Flag to terminate the infinite daemon loop. More... | |
| volatile system_action_t | system_action = SYSTEM_ACTION_NONE |
| System action to perform when exiting the daemon. More... | |
| gpio_t * | gpio_power = NULL |
| GPIO handle for power switch. More... | |
| gpio_t * | gpio_button = NULL |
| GPIO handle for user button. More... | |
| #define RL_BUTTON_EXTRA_LONG_PRESS_SEC 10 |
Min duration of an extra long button press (in seconds)
Definition at line 64 of file rocketloggerd.c.
| #define RL_BUTTON_LONG_PRESS_SEC 3 |
Min duration of a long button press (in seconds)
Definition at line 58 of file rocketloggerd.c.
| #define RL_BUTTON_VERY_LONG_PRESS_SEC 6 |
Min duration of a very long button press (in seconds)
Definition at line 61 of file rocketloggerd.c.
| #define RL_CALIBRATION_DURATION_SEC 1 |
Duration of calibration run (in seconds)
Definition at line 52 of file rocketloggerd.c.
| #define RL_DAEMON_MIN_INTERVAL 1 |
Minimal time interval between two interrupts (in seconds)
Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 49 of file rocketloggerd.c.
| #define RL_POWERUP_DELAY_US 5000 |
Delay on cape power up (in microseconds)
Definition at line 55 of file rocketloggerd.c.
| typedef enum system_action system_action_t |
Typedef for daemon exit system action
Definition at line 1 of file rocketloggerd.c.
| enum system_action |
Daemon exit system action definition
| Enumerator | |
|---|---|
| SYSTEM_ACTION_NONE | perform no system action |
| SYSTEM_ACTION_REBOOT | reboot the system |
| SYSTEM_ACTION_POWEROFF | power off the system |
Definition at line 69 of file rocketloggerd.c.
| int adc_calibrate | ( | uint64_t | duration | ) |
Perform RocketLogger ADC reference voltage calibration.
Run a measurement without data output to file or web for the given duration. Resets the sampling status to default after completion.
| duration | The duration of the calibration run in seconds |
Definition at line 106 of file rocketloggerd.c.
References rl_config::background_enable, rl_config::file_enable, rl_config::interactive_enable, rl_config_reset(), rl_run(), RL_SAMPLE_RATE_MIN, rl_status, rl_status_reset(), rl_status_write(), rl_config::sample_limit, rl_config::sample_rate, and rl_config::web_enable.
Here is the call graph for this function:| void button_interrupt_handler | ( | int | value | ) |
GPIO interrupt handler
| value | GPIO value after interrupt |
Definition at line 138 of file rocketloggerd.c.
References daemon_shutdown, RL_BUTTON_EXTRA_LONG_PRESS_SEC, RL_BUTTON_LONG_PRESS_SEC, RL_BUTTON_VERY_LONG_PRESS_SEC, RL_DAEMON_MIN_INTERVAL, rl_log(), RL_LOG_ERROR, RL_LOG_INFO, rl_status_read(), rl_status::sampling, SYSTEM_ACTION_NONE, SYSTEM_ACTION_POWEROFF, and SYSTEM_ACTION_REBOOT.
Here is the call graph for this function:| int main | ( | void | ) |
RocketLogger deamon program. Continuously waits on interrupt on button GPIO and starts/stops RocketLogger
Arguments: none
Definition at line 240 of file rocketloggerd.c.
References rl_log_init(), and SUCCESS.
Here is the call graph for this function:| volatile bool daemon_shutdown = false |
Flag to terminate the infinite daemon loop.
Definition at line 85 of file rocketloggerd.c.
Referenced by button_interrupt_handler().
| gpio_t* gpio_button = NULL |
GPIO handle for user button.
Definition at line 94 of file rocketloggerd.c.
| gpio_t* gpio_power = NULL |
GPIO handle for power switch.
Definition at line 91 of file rocketloggerd.c.
| volatile system_action_t system_action = SYSTEM_ACTION_NONE |
System action to perform when exiting the daemon.
Definition at line 88 of file rocketloggerd.c.