Bind
C++ UI toolkit for Arduino
 
Loading...
Searching...
No Matches
BindKnob Class Reference

The BindKnob class represents a knob UI element for use with BindCanvas. More...

#include <BindKnob.hpp>

Inheritance diagram for BindKnob:
BindView

Public Member Functions

 BindKnob (const char *cstr)
 Constructs a BindKnob with a custom label.
 
 BindKnob ()
 Constructs a BindKnob with a default label.
 
void setlabel (const char *cstr)
 Sets the label text for the knob.
 
void setCallback (void(*callback)(int16_t))
 Set the Callback function for the knob.
 
void invokeCallback (int16_t valueIn)
 
uint16_t getBytes (uint8_t *out) override
 Retrieves the bytes representing the knob for synchronization.
 

Public Attributes

int16_t x
 X-coordinate position of the knob.
 
int16_t y
 Y-coordinate position of the knob.
 
uint8_t cmdId = 0
 Command ID for the knob. See the notes for possible cmdId values.
 
int16_t dimSize
 Dimensions or size of the knob.
 
int16_t minValue
 Minimum value of the knob's range.
 
int16_t maxValue
 Maximum value of the knob's range.
 
int16_t value
 Current value of the knob.
 
- Public Attributes inherited from BindView
int16_t tag
 

Detailed Description

The BindKnob class represents a knob UI element for use with BindCanvas.

BindKnob

BindKnob is a class that defines a knob UI element that can be used within BindCanvas-based applications. It inherits from the BindView class and provides functionality to create and customize knobs, including setting labels, positions, dimensions, value ranges, and current values.

Note
Possible cmdId values for a BindView and corresponding effects:
  • BIND_ADD_OR_REFRESH_CMD: Adds the object to the canvas (screen) or refreshes the existing one.
  • BIND_DATA_ONLY_CMD: Refreshes the existing object without moving or resizing; updates data, such as text.
  • BIND_REMOVE_CMD: Removes the object from the canvas (screen).
  • BIND_DISABLE_CMD: Disables the object.
  • BIND_ENABLE_CMD: Enables the object.
  • BIND_HIDE_CMD: Hides the object.
  • BIND_VISIBLE_CMD: Restores the object's visibility.

Knobs created with BindKnob can be synchronized with BindCanvas through the Bind framework, allowing interactive user interfaces to be built for various applications.

Note
To use BindKnob effectively, you can set various properties such as the label, position, dimensions, value range (minimum and maximum), and the current knob value.

Constructor & Destructor Documentation

◆ BindKnob() [1/2]

BindKnob::BindKnob ( const char *  cstr)
inline

Constructs a BindKnob with a custom label.

This constructor creates a BindKnob with a custom text label. The label can be used to define the knob's label or description.

Parameters
cstrA pointer to the character array representing the custom label for the knob.

◆ BindKnob() [2/2]

BindKnob::BindKnob ( )
inline

Constructs a BindKnob with a default label.

This constructor creates a BindKnob with a default label of "Knob." You can customize the label later using the 'setLabel' function.

Member Function Documentation

◆ getBytes()

uint16_t BindKnob::getBytes ( uint8_t *  out)
inlineoverridevirtual

Retrieves the bytes representing the knob for synchronization.

This function is used to gather the bytes that represent the knob's properties for synchronization.

Note
The user does not need to call this function, Bind calls it internally.
Parameters
outA pointer to the output buffer where the knob data will be stored.
Returns
The number of bytes written to the output buffer.

Reimplemented from BindView.

◆ setCallback()

void BindKnob::setCallback ( void(*)(int16_t)  callback)
inline

Set the Callback function for the knob.

This callback function is called when the knob value is changed. The signature of the callback function should be like:

void callback(int16_t value)
int16_t value
Current value of the knob.
Definition BindKnob.hpp:61
Parameters
callback

◆ setlabel()

void BindKnob::setlabel ( const char *  cstr)
inline

Sets the label text for the knob.

This function allows you to set the text label for the knob, providing additional information or description for the knob's purpose.

Note
You need to sync the knob, e.g. call bind.sync(bindKnob).
Parameters
cstrA pointer to the character array representing the label text.

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