123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef SENSORSIM_H__
- #define SENSORSIM_H__
- #include <stdint.h>
- #include <stdbool.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef struct
- {
- uint32_t min;
- uint32_t max;
- uint32_t incr;
- bool start_at_max;
- } sensorsim_cfg_t;
- typedef struct
- {
- uint32_t current_val;
- bool is_increasing;
- } sensorsim_state_t;
- void sensorsim_init(sensorsim_state_t * p_state,
- const sensorsim_cfg_t * p_cfg);
- uint32_t sensorsim_measure(sensorsim_state_t * p_state,
- const sensorsim_cfg_t * p_cfg);
- void sensorsim_increment(sensorsim_state_t * p_state,
- const sensorsim_cfg_t * p_cfg);
- void sensorsim_decrement(sensorsim_state_t * p_state,
- const sensorsim_cfg_t * p_cfg);
- #ifdef __cplusplus
- }
- #endif
- #endif
|