fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
|
Cell table for tracking output states. More...
#include "cell.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "crmap.h"
#include "std2/errcode.h"
Data Structures | |
struct | cell_s |
A single cell in the cell table, repesenting a single output channel. More... | |
struct | ctable_s |
Represents a table of cells that map raw FSEQ sequence indexes to a known unit and channel number. More... | |
Macros | |
#define | MAX_MATCHES 16 |
Maximum number of matching cells to find in a single group. | |
#define | CHANNEL_BIT(i) |
Returns a bitmask for the given channel index. | |
Functions | |
int | CT_init (const struct cr_s *cmap, const uint32_t size, struct ctable_s **table) |
Initializes table that maps the raw fseq sequence indexes to a known LOR unit and channel number using the provided channel map. The lookup is cached into the table for faster access. The table is dynamically allocated and must be freed with CT_free . | |
void | CT_set (struct ctable_s *table, const uint32_t index, const uint8_t output) |
Sets the output intensity for the cell at the given index. This marks the cell as modified, regardless if the new output intensity is the same as the current value. | |
void | CT_change (struct ctable_s *table, const uint32_t index, const uint8_t output) |
Changes the output intensity for the cell at the given index. This only marks the cell as modified if the new output intensity is different from the current value. | |
static int | CT_matches (const struct cell_s *a, const struct cell_s *b) |
Checks if two cells match, which indicates they are addressed to the same hardware controller (unit+section), and have a matching output intensity. | |
static int | CT_findMatches (struct ctable_s *table, const uint32_t start, const struct cell_s *cmp, struct cell_s *matches[MAX_MATCHES]) |
Finds all cells in the table that match the provided reference cell. The reference cell must be valid and modified. The matching cells are stored in the provided array, up to a maximum of MAX_MATCHES . | |
int | CT_groupof (struct ctable_s *table, uint32_t at, struct ctgroup_s *group) |
Returns a group of linked cells starting at the given index. The group is identified by the unit number, channel section, and output intensity value. Any cells that have not been modified, or do not match, are excluded from the grouping. Assuming the cell at at is valid and modified, group should always contain at least one cell. | |
void | CT_free (struct ctable_s *table) |
Frees the table and any held resources. | |
Cell table for tracking output states.
#define CHANNEL_BIT | ( | i | ) |
Returns a bitmask for the given channel index.
i | channel index |
#define MAX_MATCHES 16 |
Maximum number of matching cells to find in a single group.
void CT_change | ( | struct ctable_s * | table, |
uint32_t | index, | ||
uint8_t | output ) |
Changes the output intensity for the cell at the given index. This only marks the cell as modified if the new output intensity is different from the current value.
table | table to change the output on |
index | index of the cell to change |
output | intensity to change to |
|
static |
Finds all cells in the table that match the provided reference cell. The reference cell must be valid and modified. The matching cells are stored in the provided array, up to a maximum of MAX_MATCHES
.
table | table to search |
start | index to start searching from |
cmp | reference cell to match against |
matches | array to store matching cells |
void CT_free | ( | struct ctable_s * | table | ) |
Frees the table and any held resources.
table | table to free |
Returns a group of linked cells starting at the given index. The group is identified by the unit number, channel section, and output intensity value. Any cells that have not been modified, or do not match, are excluded from the grouping. Assuming the cell at at
is valid and modified, group
should always contain at least one cell.
table | table to search |
at | index to start the group search |
group | pointer to store the group |
Initializes table that maps the raw fseq sequence indexes to a known LOR unit and channel number using the provided channel map. The lookup is cached into the table for faster access. The table is dynamically allocated and must be freed with CT_free
.
cmap | channel map to use for lookup |
size | number of indexes to map |
table | pointer to store the table |
Checks if two cells match, which indicates they are addressed to the same hardware controller (unit+section), and have a matching output intensity.
a | first cell to compare |
b | second cell to compare |
void CT_set | ( | struct ctable_s * | table, |
uint32_t | index, | ||
uint8_t | output ) |
Sets the output intensity for the cell at the given index. This marks the cell as modified, regardless if the new output intensity is the same as the current value.
table | table to set the output on |
index | index of the cell to set |
output | intensity to set |