129 FILE *data_file = (FILE *)-1;
130 FILE *ambient_file = (FILE *)-1;
140 "no calibration file, returning uncalibrated values");
146 data_file = fopen64(config->
file_name,
"w+");
147 if (data_file == NULL) {
149 "failed to open data file '%s'; %d message: %s",
150 config->
file_name, errno, strerror(errno));
156 char *ambient_file_name =
158 ambient_file = fopen64(ambient_file_name,
"w+");
159 if (data_file == NULL) {
161 "failed to open ambient file '%s'; %d message: %s",
162 ambient_file, errno, strerror(errno));
168 ret =
pru_sample(data_file, ambient_file, config);
179 fclose(ambient_file);
void calibration_reset_offsets(void)
int calibration_load(void)
void calibration_reset_scales(void)
int gpio_set_value(gpio_t *gpio, int value)
void gpio_release(gpio_t *gpio)
gpio_t * gpio_setup(int gpio_number, gpio_mode_t mode, const char *name)
@ GPIO_MODE_OUT
GPIO write mode.
#define GPIO_FHR2
GPIO number for forcing I2 high.
#define GPIO_LED_STATUS
GPIO number of status LED.
#define GPIO_FHR1
GPIO number for forcing I1 high.
#define GPIO_LED_ERROR
GPIO number of error LED.
int rl_log(rl_log_level_t log_level, char const *const format,...)
int pru_sample(FILE *data_file, FILE *ambient_file, rl_config_t const *const config)
int rl_status_write(rl_status_t *const status)
#define ERROR
Function return value for errors (use errno to indicate the error)
#define SUCCESS
Function return value for successful completion.
char * rl_file_get_ambient_file_name(char const *const data_file_name)
void hw_deinit(rl_config_t const *const config)
void hw_init(rl_config_t const *const config)
int hw_sample(rl_config_t const *const config)
int sensors_scan(bool sensor_available[SENSOR_REGISTRY_SIZE])
void sensors_close(bool const sensor_available[SENSOR_REGISTRY_SIZE])
void sensors_deinit(void)
bool channel_force_range[RL_CHANNEL_SWITCHED_COUNT]
Current channels to force to high range.
char file_name[PATH_MAX]
Data file name.
bool background_enable
Put the measurement process in background after successful start.
bool ambient_enable
Enable logging of ambient sensor.
uint32_t sample_rate
Sampling rate.
bool channel_enable[RL_CHANNEL_COUNT]
Channels to sample.
uint32_t update_rate
Data update rate.
bool file_enable
Enable storing measurements to file.
bool digital_enable
Enable digital inputs.
bool calibration_ignore
Perform calibration measurement (ignore existing calibration)
uint32_t disk_use_rate
Disk space in bytes required per minute when sampling.
uint16_t sensor_count
Number of sensors found connected to the system.
bool sensor_available[RL_SENSOR_COUNT_MAX]
Identifiers of sensors found.
int count_channels(bool const channels[RL_CHANNEL_COUNT])
struct rl_timestamp rl_timestamp_t