Skip to content

Commit

Permalink
zio: Beginning of a better sensor api in ZIO
Browse files Browse the repository at this point in the history
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
teburd authored and MaureenHelm committed May 23, 2019
1 parent 6b9e160 commit 4fe8819
Show file tree
Hide file tree
Showing 25 changed files with 1,808 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -253,6 +253,8 @@
/include/toolchain.h @andrewboie @andyross @nashif
/include/toolchain/ @andrewboie @andyross
/include/zephyr.h @andrewboie @andyross
/include/zio.h @bfrog
/include/zio/ @bfrog
/kernel/ @andrewboie @andyross
/lib/gui/ @vanwinkeljan
/lib/libc/ @nashif
Expand Down Expand Up @@ -328,6 +330,7 @@
/subsys/storage/ @nvlsianpu
/subsys/testsuite/ @nashif
/subsys/usb/ @jfischer-phytec-iot @finikorg
/subsys/zio/ @bfrog
/tests/ @nashif
/tests/boards/native_posix/ @aescolar
/tests/boards/intel_s1000_crb/ @dcpleung @sathishkuttan
Expand All @@ -351,6 +354,7 @@
/tests/net/socket/ @jukkar @tbursztyka @pfalcon
/tests/subsys/fs/ @nashif @wentongwu
/tests/subsys/settings/ @nvlsianpu
/tests/subsys/zio/ @bfrog

# Get all docs reviewed
*.rst @dbkinder
17 changes: 17 additions & 0 deletions include/zio.h
@@ -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
61 changes: 61 additions & 0 deletions include/zio/zio_attr.h
@@ -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_ */

0 comments on commit 4fe8819

Please sign in to comment.