|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
User-facing configuration struct and initialization API for OpenLcbCLib. More...
Go to the source code of this file.
Data Structures | |
| struct | openlcb_config_t |
| User configuration for OpenLcbCLib. More... | |
Functions | |
| void | OpenLcb_initialize (const openlcb_config_t *config) |
| Initializes the entire OpenLCB stack with one call. | |
| void | OpenLcb_100ms_timer_tick (void) |
| Increments the global 100ms tick counter. | |
| uint8_t | OpenLcb_get_global_100ms_tick (void) |
| Returns the current value of the global 100ms tick counter. | |
| openlcb_node_t * | OpenLcb_create_node (node_id_t node_id, const node_parameters_t *parameters) |
| Allocates and registers a new node on the OpenLCB network. | |
| void | OpenLcb_run (void) |
| Runs one iteration of all state machines. | |
User-facing configuration struct and initialization API for OpenLcbCLib.
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.
Users populate one openlcb_config_t struct with hardware driver functions and optional application callbacks, then call OpenLcb_initialize() to bring up the entire stack.
|
extern |
Initializes the entire OpenLCB stack with one call.
Initializes all buffer infrastructure, builds internal interface structs from the user config, and starts only the protocol modules selected by OPENLCB_COMPILE_* defines. After this returns, call OpenLcb_create_node() to allocate nodes, then call OpenLcb_run() in your main loop.
| config | Pointer to the openlcb_config_t to use. Must remain valid for the lifetime of the application (use static or global storage). |
Initializes the entire OpenLCB stack with one call.
Algorithm:
* @param config Pointer to the @ref openlcb_config_t to use *
|
extern |
Increments the global 100ms tick counter.
Call from a 100ms hardware timer interrupt or periodic task. This is the ONLY action performed by the timer context – all real protocol work runs in the main loop via OpenLcb_run().
Increments the global 100ms tick counter.
|
extern |
Returns the current value of the global 100ms tick counter.
Used by wiring code (openlcb_config.c, can_config.c) to read the clock and inject it into modules via parameters or interface function pointers. Individual modules should NOT call this directly — they receive the tick through their function parameters or interface.
|
extern |
Allocates and registers a new node on the OpenLCB network.
| node_id | Unique 48-bit node_id_t for the new node. |
| parameters | Pointer to the node_parameters_t (SNIP info, protocol flags, events). |
Allocates and registers a new node on the OpenLCB network.
* @param node_id Unique 48-bit @ref node_id_t for the new node * @param parameters Pointer to @ref node_parameters_t (SNIP, protocol flags, events) *
|
extern |
Runs one iteration of all state machines.
Call as fast as possible in your main loop. Non-blocking — returns after processing one operation per call.
Runs one iteration of all state machines.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License