Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zio: Beginning of a better sensor api in ZIO
Add a new sensor device API called zio_dev along with supporting interface and implmentations needed to better encapsulate a large range of functionality typical sampled input/output (sensor and signal generator) type devices commonly provide. Every device has a set of channels and attributes associated with it. Channels may be attached to a fifo like interface (zio_buf) which provides a pollable mechanism for obtaining the raw channel data at a designated watermark level. Signed-off-by: Tom Burdick <thomas.burdick@gmail.com>
- Loading branch information
1 parent
6b9e160
commit 4fe8819
Showing
25 changed files
with
1,808 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2019 Thomas Burdick <thomas.burdick@gmail.com> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_ZIO_H_ | ||
#define ZEPHYR_INCLUDE_ZIO_H_ | ||
|
||
#include <zio/zio_variant.h> | ||
#include <zio/zio_attr.h> | ||
#include <zio/zio_fifo.h> | ||
#include <zio/zio_buf.h> | ||
#include <zio/zio_fifo_buf.h> | ||
#include <zio/zio_dev.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2019 Thomas Burdick <thomas.burdick@gmail.com> | ||
* Copyright (c) 2019 Kevin Townsend | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief ZIO attribute definitions. | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_ZIO_ATTR_H_ | ||
#define ZEPHYR_INCLUDE_ZIO_ATTR_H_ | ||
|
||
#include <zephyr/types.h> | ||
#include <device.h> | ||
#include <zio/zio_variant.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief ZIO attribute enum and struct definitions. | ||
* @defgroup zio_attributes ZIO attribute definitions | ||
* @ingroup zio | ||
* @{ | ||
*/ | ||
|
||
/** @brief ZIO attribute types. */ | ||
enum zio_attr_type { | ||
/* samples per second */ | ||
ZIO_SAMPLE_RATE, | ||
|
||
/* A count of attribute types always begins the user definable range */ | ||
ZIO_ATTR_TYPES, | ||
|
||
/* enforce a specific enum size allowing for a good number of user | ||
* definable values | ||
*/ | ||
ZIO_ATTR_MAKE_16_BIT = 0xFFFF | ||
}; | ||
|
||
/** Attribute record. */ | ||
struct zio_attr { | ||
/** Attribute identifier. */ | ||
enum zio_attr_type type; | ||
/** Attribute variant. */ | ||
struct zio_variant data; | ||
}; | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ZEPHYR_INCLUDE_ZIO_ATTR_H_ */ |
Oops, something went wrong.