|
RocketLogger
2.0.0
|
Include dependency graph for sensor.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | rl_sensor |
Macros | |
| #define | MAX_MESSAGE_LENGTH 1000 |
| #define | I2C_BUS_FILENAME "/dev/i2c-2" |
| #define | SENSOR_REGISTRY_SIZE 5 |
| Number of sensor registered. More... | |
| #define | SENSOR_NAME_LENGTH (RL_FILE_CHANNEL_NAME_LENGTH) |
Typedefs | |
| typedef struct rl_sensor | rl_sensor_t |
Functions | |
| int | sensors_init (void) |
| void | sensors_deinit (void) |
| int | sensors_open_bus (void) |
| int | sensors_close_bus (int bus) |
| int | sensors_get_bus (void) |
| int | sensors_init_comm (uint8_t device_address) |
| int | sensors_scan (bool sensor_available[SENSOR_REGISTRY_SIZE]) |
| int | sensors_read (int32_t *const sensor_data, bool const sensor_available[SENSOR_REGISTRY_SIZE]) |
| void | sensors_close (bool const sensor_available[SENSOR_REGISTRY_SIZE]) |
Variables | |
| const rl_sensor_t | SENSOR_REGISTRY [SENSOR_REGISTRY_SIZE] |
| #define MAX_MESSAGE_LENGTH 1000 |
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.
| #define SENSOR_NAME_LENGTH (RL_FILE_CHANNEL_NAME_LENGTH) |
| typedef struct rl_sensor rl_sensor_t |
| void sensors_close | ( | bool const | sensor_available[SENSOR_REGISTRY_SIZE] | ) |
Close all sensors used on the I2C bus.
| sensor_available | List of available (previously initialized) sensors |
Definition at line 222 of file sensor.c.
References rl_sensor::deinit, SENSOR_REGISTRY, and SENSOR_REGISTRY_SIZE.
Referenced by hw_deinit().
| int sensors_close_bus | ( | int | bus | ) |
Close a I2C sensor bus.
| bus | The I2C bus to close |
Definition at line 141 of file sensor.c.
References rl_log(), and RL_LOG_ERROR.
Referenced by sensors_deinit().
Here is the call graph for this function:| void sensors_deinit | ( | void | ) |
Deinitialize the shared I2C sensor bus.
Definition at line 126 of file sensor.c.
References sensor_bus, and sensors_close_bus().
Referenced by hw_deinit().
Here is the call graph for this function:| int sensors_get_bus | ( | void | ) |
Get the shared I2C bus handle.
Definition at line 150 of file sensor.c.
References sensor_bus.
Referenced by bme280_get_id(), bme280_init(), bme280_read(), bme280_read_calibration(), bme280_set_parameters(), tsl4531_get_id(), tsl4531_init(), tsl4531_read(), tsl4531_send_range(), and tsl4531_set_parameters().
| int sensors_init | ( | void | ) |
Initialize the shared I2C sensor bus.
Definition at line 121 of file sensor.c.
References sensor_bus, and sensors_open_bus().
Referenced by hw_init().
Here is the call graph for this function:| int sensors_init_comm | ( | uint8_t | device_address | ) |
Initiate an I2C communication with a device.
| device_address | The I2C address of the device |
Definition at line 152 of file sensor.c.
References sensor_bus.
Referenced by bme280_init(), bme280_read(), tsl4531_init(), and tsl4531_read().
| int sensors_open_bus | ( | void | ) |
Open a new handle of the I2C bus.
Definition at line 132 of file sensor.c.
References I2C_BUS_FILENAME, rl_log(), and RL_LOG_ERROR.
Referenced by sensors_init().
Here is the call graph for this function:| int sensors_read | ( | int32_t *const | sensor_data, |
| bool const | sensor_available[SENSOR_REGISTRY_SIZE] | ||
| ) |
Read available sensors on the I2C bus.
| sensor_data | Data array to store the sensor values to |
| sensor_available | List of available (previously initialized) sensors |
Definition at line 198 of file sensor.c.
References rl_sensor::get_value, rl_sensor::identifier, rl_sensor::read, SENSOR_REGISTRY, and SENSOR_REGISTRY_SIZE.
Referenced by pru_sample().
| int sensors_scan | ( | bool | sensor_available[SENSOR_REGISTRY_SIZE] | ) |
Scan the I2C sensor for sensor in the registry and initialize them.
| sensor_available | List of sensors of the registry available |
Definition at line 156 of file sensor.c.
References rl_sensor::identifier, rl_sensor::init, MAX_MESSAGE_LENGTH, rl_log(), RL_LOG_INFO, RL_LOG_WARNING, SENSOR_REGISTRY, SENSOR_REGISTRY_SIZE, and SUCCESS.
Referenced by hw_init().
Here is the call graph for this function:
|
extern |
The sensor registry structure.
Register your sensor (channels) here. Multiple channels from the same sensor should be added as consecutive entries.
The sensor registry structure.
Register your sensor (channels) here. Multiple channels from the same sensor should be added as consecutive entries.
Definition at line 63 of file sensor.c.
Referenced by rl_file_setup_ambient_channels(), rl_socket_metadata(), rl_status_get_json(), sensors_close(), sensors_read(), and sensors_scan().