LoRa-BLE-Sensor
|
This is a library for sensor power configurations and control. This is manages the power configuration, pin configuration, and control of sensor power. More...
#include "sensor_power.h"
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/drivers/adc.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/logging/log.h>
Functions | |
LOG_MODULE_REGISTER (sensor_power, LOG_LEVEL_INF) | |
int | set_sensor_output (sensor_power_config_t *config, enum sensor_voltage voltage) |
Set the sensor voltage for an output, enabling/disabling the correct regulators, and setting the correct gpios. When setting the voltage to OFF the voltage may take 1-2 seconds to fully turn off, due to capacitors on the output. | |
int | sensor_power_init (sensor_power_config_t *config) |
Initialize a sensor_power_setup. This sets the id of the output, the gpios beings used and the regulator device being used. After configurations are set, the sensors output is set OFF. | |
enum sensor_voltage | get_sensor_output (sensor_power_config_t *config) |
Get the sensor voltage that is set for an output. | |
float | read_sensor_output (sensor_power_config_t *config) |
Read the voltage output of the selected sensor power configuration. Takes into account resistor divider on output. | |
int | validate_output (sensor_power_config_t *config, enum sensor_voltage voltage, uint8_t accepted_error) |
Variables | |
const float | sensor_voltage_values [] |
enum sensor_voltage | sensor_state [SENSOR_POWER_INDEX_LIMIT] |
This is a library for sensor power configurations and control. This is manages the power configuration, pin configuration, and control of sensor power.
enum sensor_voltage get_sensor_output | ( | sensor_power_config_t * | config | ) |
Get the sensor voltage that is set for an output.
config | sensor_power_config_t sensor power configuration for the current sensor |
float read_sensor_output | ( | sensor_power_config_t * | config | ) |
Read the voltage output of the selected sensor power configuration. Takes into account resistor divider on output.
config | sensor_power_config_t sensor power configuration for the current sensor |
int sensor_power_init | ( | sensor_power_config_t * | config | ) |
Initialize a sensor_power_setup. This sets the id of the output, the gpios beings used and the regulator device being used. After configurations are set, the sensors output is set OFF.
config | sensor_power_config_t sensor power configuration for the current sensor |
int set_sensor_output | ( | sensor_power_config_t * | config, |
enum sensor_voltage | voltage | ||
) |
Set the sensor voltage for an output, enabling/disabling the correct regulators, and setting the correct gpios. When setting the voltage to OFF the voltage may take 1-2 seconds to fully turn off, due to capacitors on the output.
config | sensor_power_config_t sensor power configuration for the current sensor |
voltage | enum sensor_voltage setting selected |
int validate_output | ( | sensor_power_config_t * | config, |
enum sensor_voltage | voltage, | ||
uint8_t | accepted_error | ||
) |
config | sensor_power_config_t sensor power configuration for the current sensor |
voltage | enum sensor_voltage setting selected |
accepted_error | error in percent that the device is allowed to be off by |
const float sensor_voltage_values[] |