ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_driver_error.h File Reference

Ruuvi error codes and error check function. More...

#include <float.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define RD_FLOAT_INVALID   NAN
 Signal that value should not be used. More...
 
#define RD_UINT64_INVALID   UINT64_MAX
 Signal that value should not be used. More...
 
#define RD_INT64_INVALID   INT64_MIN
 Signal that value should not be used. More...
 
#define RD_INT32_INVALID   INT32_MIN
 Signal that value should not be used. More...
 
#define RD_SUCCESS   (0U)
 Internal Error. More...
 
#define RD_ERROR_INTERNAL   (1U<<0U)
 Internal Error. More...
 
#define RD_ERROR_NO_MEM   (1U<<1U)
 No Memory for operation. More...
 
#define RD_ERROR_NOT_FOUND   (1U<<2U)
 Not found. More...
 
#define RD_ERROR_NOT_SUPPORTED   (1U<<3U)
 Not supported. More...
 
#define RD_ERROR_INVALID_PARAM   (1U<<4U)
 Invalid Parameter. More...
 
#define RD_ERROR_INVALID_STATE   (1U<<5U)
 Invalid state, operation disallowed in this state. More...
 
#define RD_ERROR_INVALID_LENGTH   (1U<<6U)
 Invalid Length. More...
 
#define RD_ERROR_INVALID_FLAGS   (1U<<7U)
 Invalid Flags. More...
 
#define RD_ERROR_INVALID_DATA   (1U<<8U)
 Invalid Data. More...
 
#define RD_ERROR_DATA_SIZE   (1U<<9U)
 Invalid Data size. More...
 
#define RD_ERROR_TIMEOUT   (1U<<10U)
 Operation timed out. More...
 
#define RD_ERROR_NULL   (1U<<11U)
 Null Pointer. More...
 
#define RD_ERROR_FORBIDDEN   (1U<<12U)
 Forbidden Operation. More...
 
#define RD_ERROR_INVALID_ADDR   (1U<<13U)
 Bad Memory Address. More...
 
#define RD_ERROR_BUSY   (1U<<14U)
 Busy. More...
 
#define RD_ERROR_RESOURCES   (1U<<15U)
 Not enough resources for operation. More...
 
#define RD_ERROR_NOT_IMPLEMENTED   (1U<<16U)
 Not implemented yet. More...
 
#define RD_ERROR_SELFTEST   (1U<<17U)
 Self-test fail. More...
 
#define RD_STATUS_MORE_AVAILABLE   (1U<<18U)
 Driver has more data queued. More...
 
#define RD_ERROR_NOT_INITIALIZED   (1U<<19U)
 Driver is not initialized. More...
 
#define RD_ERROR_NOT_ACKNOWLEDGED   (1U<<20U)
 Ack was expected but not received. More...
 
#define RD_ERROR_NOT_ENABLED   (1U<<21U)
 Driver is not enabled. More...
 
#define RD_WARNING_DEPRECATED   (1U<<22U)
 Deprecated function, warn user. More...
 
#define RD_ERROR_FATAL   (1U<<31U)
 Program should always reset after this. More...
 
#define RD_ERROR_CHECK(error, mask)   rd_error_check(error, mask, __FILE__, __LINE__)
 Shorthand macro for calling the rd_error_check with current file & line. More...
 

Typedefs

typedef uint32_t rd_status_t
 bitfield for representing errors More...
 
typedef void(* rd_error_cb) (const rd_status_t error, const bool fatal, const char *file, const int line)
 

Functions

void rd_error_check (const rd_status_t error, const rd_status_t non_fatal_mask, const char *p_file, const int line)
 Check given error code and compare it to non-fatal errors. More...
 
rd_status_t rd_errors_clear ()
 
void rd_error_cb_set (rd_error_cb cb)
 Configure application callback for errors. More...
 

Detailed Description

Ruuvi error codes and error check function.

Author
Otso Jousimaa
Date
2020-05-20

Definition in file ruuvi_driver_error.h.