|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
OpenLCB node allocation, enumeration, and lifecycle management. More...
Macros | |
| #define | OPENLCB_EVENT_ID_OFFSET 16 |
| Bit shift to convert a 48-bit node ID into a 64-bit event ID base. | |
Functions | |
| void | OpenLcbNode_initialize (const interface_openlcb_node_t *interface) |
| Initializes the node management module. | |
| openlcb_node_t * | OpenLcbNode_get_first (uint8_t key) |
| Returns the first allocated node for enumeration. | |
| openlcb_node_t * | OpenLcbNode_get_next (uint8_t key) |
| Returns the next allocated node for the given enumerator key. | |
| bool | OpenLcbNode_is_last (uint8_t key) |
| Returns true if the current enumeration position is the last node. | |
| openlcb_node_t * | OpenLcbNode_allocate (uint64_t node_id, const node_parameters_t *node_parameters) |
| Allocates a new node with the given ID and configuration. | |
| openlcb_node_t * | OpenLcbNode_find_by_alias (uint16_t alias) |
| Finds a node by its 12-bit CAN alias. | |
| openlcb_node_t * | OpenLcbNode_find_by_node_id (uint64_t node_id) |
| Finds a node by its 64-bit OpenLCB node ID. | |
| void | OpenLcbNode_100ms_timer_tick (uint8_t current_tick) |
| 100ms timer tick handler — gates the application callback. | |
| void | OpenLcbNode_reset_state (void) |
| Resets all allocated nodes to their initial login state. | |
| uint16_t | OpenLcbNode_get_count (void) |
| Returns the number of allocated nodes. | |
OpenLCB node allocation, enumeration, and lifecycle management.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Fixed-size pool of openlcb_node_t structures with allocation, multi-key enumeration, alias/ID lookup, and auto-generated event IDs.
| #define OPENLCB_EVENT_ID_OFFSET 16 |
Bit shift to convert a 48-bit node ID into a 64-bit event ID base.
| void OpenLcbNode_initialize | ( | const interface_openlcb_node_t * | interface | ) |
Initializes the node management module.
Algorithm:
* @param interface Pointer to @ref interface_openlcb_node_t with optional callbacks, or NULL *
| openlcb_node_t * OpenLcbNode_get_first | ( | uint8_t | key | ) |
Returns the first allocated node for enumeration.
Algorithm:
* @param key Enumerator index (0 to MAX_NODE_ENUM_KEY_VALUES - 1) *
| openlcb_node_t * OpenLcbNode_get_next | ( | uint8_t | key | ) |
Returns the next allocated node for the given enumerator key.
Algorithm:
* @param key Same enumerator index used in the corresponding get_first call *
| bool OpenLcbNode_is_last | ( | uint8_t | key | ) |
Returns true if the current enumeration position is the last node.
Algorithm:
* @param key Same enumerator index used in the corresponding get_first/get_next calls *
| openlcb_node_t * OpenLcbNode_allocate | ( | uint64_t | node_id, |
| const node_parameters_t * | node_parameters ) |
Allocates a new node with the given ID and configuration.
Algorithm:
* @param node_id 64-bit unique OpenLCB node identifier * @param node_parameters Pointer to @ref node_parameters_t defining node capabilities *
| openlcb_node_t * OpenLcbNode_find_by_alias | ( | uint16_t | alias | ) |
Finds a node by its 12-bit CAN alias.
Algorithm:
* @param alias 12-bit CAN alias to search for *
| openlcb_node_t * OpenLcbNode_find_by_node_id | ( | uint64_t | node_id | ) |
Finds a node by its 64-bit OpenLCB node ID.
Algorithm:
* @param node_id 64-bit OpenLCB node identifier to search for *
| void OpenLcbNode_100ms_timer_tick | ( | uint8_t | current_tick | ) |
100ms timer tick handler — gates the application callback.
Called from the main loop with the current global tick. Fires the application callback at most once per unique tick value. The per-node timerticks increment has been removed — all modules now use the global clock via subtraction-based elapsed-time checks.
* @param current_tick Current value of the global 100ms tick counter. *
| void OpenLcbNode_reset_state | ( | void | ) |
Resets all allocated nodes to their initial login state.
Algorithm:
| uint16_t OpenLcbNode_get_count | ( | void | ) |
Returns the number of allocated nodes.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License