Zephyr API 3.6.99
Loading...
Searching...
No Matches
linear_range.h File Reference
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

Data Structures

struct  linear_range
 Linear range. More...
 

Macros

#define LINEAR_RANGE_INIT(_min, _step, _min_idx, _max_idx)
 Initializer for Linear Range.
 

Functions

static uint32_t linear_range_values_count (const struct linear_range *r)
 Obtain the number of values representable in a linear range.
 
static uint32_t linear_range_group_values_count (const struct linear_range *r, size_t r_cnt)
 Obtain the number of values representable by a group of linear ranges.
 
static int32_t linear_range_get_max_value (const struct linear_range *r)
 Obtain the maximum value representable by a linear range.
 
static int linear_range_get_value (const struct linear_range *r, uint16_t idx, int32_t *val)
 Obtain value given a linear range index.
 
static int linear_range_group_get_value (const struct linear_range *r, size_t r_cnt, uint16_t idx, int32_t *val)
 Obtain value in a group given a linear range index.
 
static int linear_range_get_index (const struct linear_range *r, int32_t val, uint16_t *idx)
 Obtain index given a value.
 
static int linear_range_group_get_index (const struct linear_range *r, size_t r_cnt, int32_t val, uint16_t *idx)
 Obtain index in a group given a value.
 
static int linear_range_get_win_index (const struct linear_range *r, int32_t val_min, int32_t val_max, uint16_t *idx)
 Obtain index given a window of values.
 
static int linear_range_group_get_win_index (const struct linear_range *r, size_t r_cnt, int32_t val_min, int32_t val_max, uint16_t *idx)
 Obtain index in a group given a value that must be within a window of values.