LSH-Core
A robust C++ framework for Arduino-based home automation nodes
Loading...
Searching...
No Matches
lsh_user_macros.hpp File Reference

Provides the user-facing macros (LSH_ACTUATOR, LSH_BUTTON, LSH_INDICATOR) for device configuration. More...

Include dependency graph for lsh_user_macros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LSH_ACTUATOR(var_name, pin, id)
 Defines an Actuator with a compile-time check to ensure its ID is not 0.
 
#define LSH_BUTTON(var_name, pin, id)
 Defines a Clickable (Button) with a compile-time check to ensure its ID is not 0.
 
#define LSH_INDICATOR(var_name, pin)    Indicator var_name((pin))
 Defines an IndicatorLight. Does not require an ID.
 

Detailed Description

Provides the user-facing macros (LSH_ACTUATOR, LSH_BUTTON, LSH_INDICATOR) for device configuration.

Author
Jacopo Labardi (labodj)

Copyright 2025 Jacopo Labardi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Macro Definition Documentation

◆ LSH_ACTUATOR

#define LSH_ACTUATOR (   var_name,
  pin,
  id 
)
Value:
static_assert((id) > 0, "Actuator ID must be > 0. Please use positive IDs starting from 1."); \
Actuator var_name((pin), (id))
Represents an actuator (relay) attached to a digital pin.
Definition actuator.hpp:33

Defines an Actuator with a compile-time check to ensure its ID is not 0.

Parameters
var_nameThe name of the variable to declare (e.g., rel0).
pinThe hardware pin for the actuator.
idThe unique numeric ID for the actuator. MUST be > 0.

◆ LSH_BUTTON

#define LSH_BUTTON (   var_name,
  pin,
  id 
)
Value:
static_assert((id) > 0, "Button ID must be > 0. Please use positive IDs starting from 1."); \
Clickable var_name((pin), (id))
A class that represents a clickable object, like a button, and its associated logic.
Definition clickable.hpp:37

Defines a Clickable (Button) with a compile-time check to ensure its ID is not 0.

Parameters
var_nameThe name of the variable to declare (e.g., btn0).
pinThe hardware pin for the clickable.
idThe unique numeric ID for the clickable. MUST be > 0.

◆ LSH_INDICATOR

#define LSH_INDICATOR (   var_name,
  pin 
)     Indicator var_name((pin))

Defines an IndicatorLight. Does not require an ID.

Parameters
var_nameThe name of the variable to declare (e.g., light0).
pinThe hardware pin for the indicator.