ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
Loading...
Searching...
No Matches
ruuvi_interface_log.h
Go to the documentation of this file.
1#ifndef RUUVI_INTERFACE_LOG_H
2#define RUUVI_INTERFACE_LOG_H
3#ifdef __cplusplus
4extern "C" {
5#endif
25#include "ruuvi_driver_error.h"
26#include "ruuvi_driver_sensor.h"
27#include <stddef.h>
28
30#if RI_LOG_ENABLED
31# define RUUVI_NRF5_SDK15_LOG_ENABLED RUUVI_NRF5_SDK15_ENABLED
32# define RUUVI_FRUITY_LOG_ENABLED RUUVI_FRUITY_ENABLED
33#endif
34
35
39typedef enum
40{
41 RI_LOG_LEVEL_NONE = 0, //<! Log nothing
42 RI_LOG_LEVEL_ERROR, //<! An error occured
43 RI_LOG_LEVEL_WARNING, //<! Warn user abour something, such as uninitialized peripheral
44 RI_LOG_LEVEL_INFO, //<! General information, such as changing mode of application
45 RI_LOG_LEVEL_DEBUG //<! Debug messages
47
55rd_status_t ri_log_init (const ri_log_severity_t min_severity);
56
63
73void ri_log (const ri_log_severity_t severity,
74 const char * const message);
75
86void ri_log_hex (const ri_log_severity_t severity,
87 const uint8_t * const bytes,
88 size_t byte_length);
89
99size_t ri_error_to_string (rd_status_t error, char * error_string,
100 size_t space_remaining);
101
110 const rd_sensor_configuration_t * const configuration, const char * unit);
112#endif
113#ifdef __cplusplus
114}
115#endif
uint32_t rd_status_t
bitfield for representing errors
void ri_log_hex(const ri_log_severity_t severity, const uint8_t *const bytes, size_t byte_length)
Queues bytes to be logged out as a hex string.
rd_status_t ri_log_init(const ri_log_severity_t min_severity)
Runs initialization code for the logging backend and sets the severity level.
ri_log_severity_t
Enable implementation selected by application.
void ri_log(const ri_log_severity_t severity, const char *const message)
Queues messages into log.
size_t ri_error_to_string(rd_status_t error, char *error_string, size_t space_remaining)
Write text description of error message into given string pointer and null-terminate it....
void ri_log_sensor_configuration(const ri_log_severity_t level, const rd_sensor_configuration_t *const configuration, const char *unit)
rd_status_t ri_log_flush(void)
Blocks until remaining log messages are sent out.
@ RI_LOG_LEVEL_ERROR
@ RI_LOG_LEVEL_INFO
@ RI_LOG_LEVEL_DEBUG
@ RI_LOG_LEVEL_WARNING
@ RI_LOG_LEVEL_NONE
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Ruuvi sensor interface Lifecycle: Beta
All sensors must implement configuration functions which accept this struct.