|
Sequencer
|
Simple timed sequencer (millisecond precission), which generates simple events. More...
#include <assert.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | sequencer_entry |
| struct | sequencer |
Enumerations | |
| enum | sequencer_mode { SEQUENCER_MODE_SINGLE , SEQUENCER_MODE_REPEAT , SEQUENCER_MODES } |
Functions | |
| void | sequencer_init (struct sequencer *self, struct sequencer_entry *entries, size_t capacity) |
| void | sequencer_set_mode (struct sequencer *self, uint8_t mode) |
| bool | sequencer_add_entry (struct sequencer *self, uint16_t timer_ms, uint8_t event) |
| size_t | sequencer_get_entry_count (struct sequencer *self) |
| void | sequencer_reset (struct sequencer *self) |
| void | sequencer_clean (struct sequencer *self) |
| uint16_t | sequencer_update (struct sequencer *self, uint16_t delta_time_ms) |
Simple timed sequencer (millisecond precission), which generates simple events.
This file contains the software implementation of the sequencer. The design is hardware-agnostic, requiring an external adaptation layer for hardware interaction.
Conventions: C89, Linux kernel style, MISRA, rule of 10, No hardware specific code, only generic C and some binding layer. Be extra specific about types.
Scientific units where posible at end of the names, for example:
Keep variables without units if they're unknown or not specified or hard to define with short notation.
Be free, be wise and take care of yourself! With best wishes and respect, furdog
| enum sequencer_mode |
| void sequencer_init | ( | struct sequencer * | self, |
| struct sequencer_entry * | entries, | ||
| size_t | capacity ) |
Initializes sequencer, takes entries array and its capacity to work with
| void sequencer_set_mode | ( | struct sequencer * | self, |
| uint8_t | mode ) |
Sets sequencer working mode. SEQUENCER_MODE_SINGLE is default
| bool sequencer_add_entry | ( | struct sequencer * | self, |
| uint16_t | timer_ms, | ||
| uint8_t | event ) |
Adds entry into a sequencer, return false if no capacity
| size_t sequencer_get_entry_count | ( | struct sequencer * | self | ) |
Returns sequencer entry count
| void sequencer_reset | ( | struct sequencer * | self | ) |
Resets the sequencer (starts from very beginning)
| void sequencer_clean | ( | struct sequencer * | self | ) |
Resets and cleanups the sequencer (zeroes entry count)
| uint16_t sequencer_update | ( | struct sequencer * | self, |
| uint16_t | delta_time_ms ) |
Updates sequencer, returns an event if exceed single entry timer. Advances to the next entry after entry timer exceed. Resets entry count to zero if last entry processed