tcMenu
Loading...
Searching...
No Matches
Public Member Functions | List of all members
AnalogItemBuilder Class Reference

A builder class for configuring and adding an analog menu item. More...

#include <TcMenuBuilder.h>

Public Member Functions

 AnalogItemBuilder (AnalogMenuItem &item, AnalogMenuInfo &info, TcMenuBuilder &parentBuilder)
 
 AnalogItemBuilder (const AnalogItemBuilder &)=default
 
AnalogItemBuilderoffset (int16_t offs)
 
AnalogItemBuilderdivisor (uint16_t divisor)
 
AnalogItemBuilderstep (int step)
 
AnalogItemBuildermaxValue (int maxVal)
 
AnalogItemBuilderunit (const char *unit)
 
TcMenuBuilderendItem () const
 Finalizes the configuration of the analog menu item and returns control to the parent menu builder.
 

Detailed Description

A builder class for configuring and adding an analog menu item.

This class facilitates the creation and customization of an analog menu item. It offers a fluent API to define attributes such as offset, divisor, step size, maximum value, and unit for the analog menu item before finalizing its addition to the parent menu structure.

The builder modifies the AnalogMenuInfo properties and the associated AnalogMenuItem object to define the behavior and display characteristics of the item within the menu. The configured item is integrated into the menu hierarchy via the commit operation, returning control to the parent TcMenuBuilder.

See also
https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/analog-menu-item/

Member Function Documentation

◆ offset()

AnalogItemBuilder & AnalogItemBuilder::offset ( int16_t  offs)
inline

Set the offset of the analog item, the offset is added to the analog value before display. So if you set this to be a negative number, the displayed value will be negative until the raw value hits offset.

Parameters
offsthe offset value to apply to the analog item
Returns
a reference to the current instance of AnalogItemBuilder for chaining additional configurations

◆ divisor()

AnalogItemBuilder & AnalogItemBuilder::divisor ( uint16_t  divisor)
inline

Set the divisor of the analog item, I.E this is the fixed point divisor for the analog item. If you select for example 2, this will divide the analog value by 2 before displaying it in halves.

Parameters
divisorthe divisor value
Returns
a reference to the current instance of AnalogItemBuilder for chaining additional configurations

◆ step()

AnalogItemBuilder & AnalogItemBuilder::step ( int  step)
inline

An optional step size for the analog item, allowing for finer control over the displayed values.

Parameters
stepthe step size value
Returns
a reference to the current instance of AnalogItemBuilder for chaining additional configurations

◆ maxValue()

AnalogItemBuilder & AnalogItemBuilder::maxValue ( int  maxVal)
inline

The maximum value that can be represented, this is the RAW value before divisors or offsets are applied.

Parameters
maxValthe maximum value that can be represented
Returns
a reference to the current instance of AnalogItemBuilder for chaining additional configurations

◆ unit()

AnalogItemBuilder & AnalogItemBuilder::unit ( const char *  unit)

Set the unit name for the analog item, this is displayed after the value.

Parameters
unitthe unit name to display
Returns
a reference to the current instance of AnalogItemBuilder for chaining additional configurations

◆ endItem()

TcMenuBuilder & AnalogItemBuilder::endItem ( ) const
inline

Finalizes the configuration of the analog menu item and returns control to the parent menu builder.

This method completes the building process of the analog menu item by finalizing its configuration to the associated AnalogMenuItem and integrates it into the menu structure. It then returns control to the parent TcMenuBuilder to allow for further menu items.

Returns
A reference to the parent TcMenuBuilder instance.

The documentation for this class was generated from the following files: