RocketLogger  2.0.0
rl_hw.c File Reference
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "calibration.h"
#include "gpio.h"
#include "log.h"
#include "pru.h"
#include "rl.h"
#include "rl_file.h"
#include "sensor/sensor.h"
#include "rl_hw.h"
+ Include dependency graph for rl_hw.c:

Go to the source code of this file.

Functions

void hw_init (rl_config_t const *const config)
 
void hw_deinit (rl_config_t const *const config)
 
int hw_sample (rl_config_t const *const config)
 

Variables

gpio_tgpio_fhr1 = NULL
 
gpio_tgpio_fhr2 = NULL
 
gpio_tgpio_led_status = NULL
 
gpio_tgpio_led_error = NULL
 

Function Documentation

◆ hw_deinit()

void hw_deinit ( rl_config_t const *const  config)

Deinitialize and close all hardware modules.

Parameters
configCurrent measurement configuration

Definition at line 93 of file rl_hw.c.

References rl_config::ambient_enable, rl_config::background_enable, rl_status::disk_use_rate, gpio_deinit(), gpio_fhr1, gpio_fhr2, gpio_led_error, gpio_led_status, gpio_release(), gpio_set_value(), pru_deinit(), pru_stop(), rl_status_write(), rl_status::sensor_available, sensors_close(), and sensors_deinit().

+ Here is the call graph for this function:

◆ hw_init()

void hw_init ( rl_config_t const *const  config)

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:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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. Initialize all hardware modules.

Parameters
configCurrent measurement configuration

Definition at line 51 of file rl_hw.c.

References rl_config::ambient_enable, rl_config::channel_enable, rl_config::channel_force_range, count_channels(), rl_config::digital_enable, rl_status::disk_use_rate, rl_config::file_enable, GPIO_FHR1, gpio_fhr1, GPIO_FHR2, gpio_fhr2, gpio_init(), GPIO_LED_ERROR, gpio_led_error, GPIO_LED_STATUS, gpio_led_status, GPIO_MODE_OUT, gpio_set_value(), gpio_setup(), pru_init(), rl_status_write(), rl_config::sample_rate, rl_status::sensor_available, rl_status::sensor_count, sensors_init(), sensors_scan(), and rl_config::update_rate.

+ Here is the call graph for this function:

◆ hw_sample()

int hw_sample ( rl_config_t const *const  config)

Hardware perform samling of data.

Parameters
configCurrent measurement configuration
Returns
Returns 0 on success, negative on failure with errno set accordingly

Definition at line 127 of file rl_hw.c.

References rl_config::ambient_enable, rl_config::calibration_ignore, calibration_load(), calibration_reset_offsets(), calibration_reset_scales(), ERROR, rl_config::file_enable, rl_config::file_name, gpio_led_error, gpio_set_value(), pru_sample(), rl_file_get_ambient_file_name(), rl_log(), RL_LOG_ERROR, RL_LOG_WARNING, and SUCCESS.

+ Here is the call graph for this function:

Variable Documentation

◆ gpio_fhr1

gpio_t* gpio_fhr1 = NULL

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:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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 46 of file rl_hw.c.

Referenced by hw_deinit(), and hw_init().

◆ gpio_fhr2

gpio_t* gpio_fhr2 = NULL

Definition at line 47 of file rl_hw.c.

Referenced by hw_deinit(), and hw_init().

◆ gpio_led_error

gpio_t* gpio_led_error = NULL

Definition at line 49 of file rl_hw.c.

Referenced by hw_deinit(), hw_init(), and hw_sample().

◆ gpio_led_status

gpio_t* gpio_led_status = NULL

Definition at line 48 of file rl_hw.c.

Referenced by hw_deinit(), and hw_init().