Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
swym
firmware
Commits
13386d1a
Verified
Commit
13386d1a
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
docs: Improve stream documentation
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
6a5ae34e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/epicardium.h
+13
-7
13 additions, 7 deletions
epicardium/epicardium.h
epicardium/modules/stream.h
+5
-4
5 additions, 4 deletions
epicardium/modules/stream.h
with
18 additions
and
11 deletions
epicardium/epicardium.h
+
13
−
7
View file @
13386d1a
...
...
@@ -68,11 +68,18 @@ API(API_LEDS_SET, void epic_leds_set(int led, uint8_t r, uint8_t g, uint8_t b));
/**
* Read sensor data into a buffer. ``epic_stream_read()`` will read as many
* sensor data packets as possible into ``buf`` and return as soon as possible.
* It will poke the sensor driver once to check whether new data can be fetched.
* If there is no new sensor data, ``epic_stream_read()`` will return ``0`` and
* not touch ``buf``. Otherwise it will return the number of data packets which
* were read into ``buf``.
* sensor samples into the provided buffer as possible and return the number of
* samples written. If no samples are available, ``epic_stream_read()`` will
* return ``0`` immediately.
*
* ``epic_stream_read()`` expects the provided buffer to have a size which is a
* multiple of the sample size for the given stream. For the sample-format and
* size, please consult the sensors documentation.
*
* Before reading the internal sensor sample queue, ``epic_stream_read()`` will
* call a sensor specific *poll* function to allow the sensor driver to fetch
* new samples from its hardware. This should, however, never take a long
* amount of time.
*
* :param int sd: Sensor Descriptor. You get sensor descriptors as return
* values when activating the respective sensors.
...
...
@@ -84,8 +91,7 @@ API(API_LEDS_SET, void epic_leds_set(int led, uint8_t r, uint8_t g, uint8_t b));
*
* - ``-ENODEV``: Sensor is not currently available.
* - ``-EBADF``: The given sensor descriptor is unknown.
* - ``-EINVAL``: If ``count`` is not a multiple of the sensor data packet
* size.
* - ``-EINVAL``: ``count`` is not a multiple of the sensor's sample size.
*
* **Example**:
*
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/stream.h
+
5
−
4
View file @
13386d1a
...
...
@@ -7,8 +7,6 @@
#include
"FreeRTOS.h"
#include
"queue.h"
#define STREAM_QUEUE_WAIT pdMS_TO_TICKS(10)
/**
* **Stream Descriptors**:
*
...
...
@@ -38,11 +36,14 @@ struct stream_info {
/** The size of one data packet (= queue element). */
size_t
item_size
;
/**
* An optional function to call before performing the read.
* An optional function to call before performing the read. Set to
* ``NULL`` if unused.
*
* ``poll_stream()`` is intended for sensors who passively collect data.
* A sensor driver might for example retrieve the latest samples in this
* function instead of actively polling in a task loop.
*
* The function registered here should never block for a longer time.
*/
int
(
*
poll_stream
)();
};
...
...
@@ -50,7 +51,7 @@ struct stream_info {
/**
* Register a stream so it can be read from Epicardium API.
*
* :param int sd: Stream Descriptor. Must be from the
above
enum.
* :param int sd: Stream Descriptor. Must be from the
:c:type:`stream_descriptor`
enum.
* :param stream_info stream: Stream info.
* :returns: ``0`` on success or a negative value on error. Possible errors:
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment