CCAux  2.20.0.0
CCAux API reference
Functions
Button functions

Functions

EXTERN_C CCAUXDLL_API BUTTONHANDLE CCAUXDLL_CALLING_CONV GetButton (void)
 
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Button_release (BUTTONHANDLE)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getButtonDownStatus (BUTTONHANDLE, uint16_t *buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getBacklightPattern (BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime, uint16_t *offTime, uint8_t *brightness)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setBacklightPattern (BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime, uint16_t offTime, uint8_t brightness)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getBootBacklightPattern (BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime, uint16_t *offTime, uint8_t *brightness)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setBootBacklightPattern (BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime, uint16_t offTime, uint8_t brightness)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getStartupButtons (BUTTONHANDLE, uint32_t *buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setStartupButtons (BUTTONHANDLE, uint32_t buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getWakeupButtons (BUTTONHANDLE, uint32_t *buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setWakeupButtons (BUTTONHANDLE, uint32_t buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getSuspendButtons (BUTTONHANDLE, uint32_t *buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setSuspendButtons (BUTTONHANDLE, uint32_t buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getShutdownButtons (BUTTONHANDLE, uint32_t *buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setShutdownButtons (BUTTONHANDLE, uint32_t buttons)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getLongPressTime (BUTTONHANDLE, uint16_t *time)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setLongPressTime (BUTTONHANDLE, uint16_t time)
 

Detailed Description

Functions in the Button class

Function Documentation

◆ Button_getBacklightPattern()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getBacklightPattern ( BUTTONHANDLE  ,
uint16_t ledActiveBitmask,
uint16_t onTime,
uint16_t offTime,
uint8_t brightness 
)

Get current button backlight brightness and blink pattern.

Supported Platform(s): Yukon, V510, V710

Parameters
ledActiveBitmaskBitmask that tells which LEDs are active. Bit 0 corresponds to button 0 LED. 0 = LED is inactive, 1 = LED is active.
onTimeButton backlight on time in ms (0-2550). Actual resolution is 10ms. Example: setting on time = 300ms and off time = 700ms => cycle time of 1s (1Hz) and a duty cycle of 30%.
offTimeButton backlight off time in ms (0-2550).
brightnessButton backlight brightness (0-100%).
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint16_t ledActiveBitmask;
uint16_t onTime;
uint16_t offTime;
uint8_t brightness;
err = CrossControl::Button_getBacklightPattern(pButton, &ledActiveBitmask, &onTime, &offTime, &brightness);
std::cout << "Button backlight pattern is " << onTime << " ms on" << offTime << " ms off" << brightness
<< " % brightness" << std::endl;
unsigned short uint16_t
Definition: CCAuxTypes.h:38
unsigned char uint8_t
Definition: CCAuxTypes.h:37
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getBacklightPattern(BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime, uint16_t *offTime, uint8_t *brightness)
@ ERR_SUCCESS
Definition: CCAuxTypes.h:163

◆ Button_getBootBacklightPattern()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getBootBacklightPattern ( BUTTONHANDLE  ,
uint16_t ledActiveBitmask,
uint16_t onTime,
uint16_t offTime,
uint8_t brightness 
)

Get button backlight brightness and blink pattern and used during boot.

Supported Platform(s): Yukon, V510, V710

Parameters
ledActiveBitmaskBitmask that tells which LEDs are active. Bit 0 corresponds to button 0 LED. 0 = LED is inactive, 1 = LED is active.
onTimeButton backlight on time in ms (0-2550). Actual resolution is 10ms. Example: setting on time = 300ms and off time = 700ms => cycle time of 1s (1Hz) and a duty cycle of 30%.
offTimeButton backlight off time in ms (0-2550).
brightnessButton backlight brightness (0-100%). 0% means backlight is off.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint16_t ledActiveBitmaskBoot;
uint16_t onTimeBoot;
uint16_t offTimeBoot;
uint8_t brightnessBoot;
err = CrossControl::Button_getBootBacklightPattern(pButton, &ledActiveBitmaskBoot, &onTimeBoot, &offTimeBoot,
&brightnessBoot);
std::cout << "Button backlight pattern during boot is " << onTimeBoot << " ms on " << offTimeBoot << " ms off "
<< brightnessBoot << " % brightness" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getBootBacklightPattern(BUTTONHANDLE, uint16_t *ledActiveBitmask, uint16_t *onTime, uint16_t *offTime, uint8_t *brightness)

◆ Button_getButtonDownStatus()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getButtonDownStatus ( BUTTONHANDLE  ,
uint16_t buttons 
)

Get current button down/up status for the buttons on the side of the display.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons are pressed. Bit 0 corresponds to button 0. 0 = button is not pressed, 1 = button is pressed.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint16_t buttonStatus;
err = CrossControl::Button_getButtonDownStatus(pButton, &buttonStatus);
{
std::cout << "Button status bitmask: " << buttonStatus << std::endl;
if (buttonStatus & CrossControl::BTN_Button0)
{
std::cout << "Button 0 pressed" << std::endl;
}
else
{
std::cout << "Button 0 NOT pressed" << std::endl;
}
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getButtonDownStatus(BUTTONHANDLE, uint16_t *buttons)
@ BTN_Button0
Definition: Button.h:36

◆ Button_getLongPressTime()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getLongPressTime ( BUTTONHANDLE  ,
uint16_t time 
)

Get time for a button press to be considered as a long-press. This applies to button 0-15 (not to separate power button).

Supported Platform(s): Yukon, V510, V710

Parameters
timeTime in ms
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint16_t time;
std::cout << "Button long press time is " << time << " ms" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getLongPressTime(BUTTONHANDLE, uint16_t *time)

◆ Button_getShutdownButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getShutdownButtons ( BUTTONHANDLE  ,
uint32_t buttons 
)

Get buttons that will trigger a shut-down. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a shut-down. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint32_t shutDownButtons;
err = CrossControl::Button_getShutdownButtons(pButton, &shutDownButtons);
std::cout << "Shut down buttons are " << shutDownButtons << std::endl;
unsigned int uint32_t
Definition: CCAuxTypes.h:39
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getShutdownButtons(BUTTONHANDLE, uint32_t *buttons)

◆ Button_getStartupButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getStartupButtons ( BUTTONHANDLE  ,
uint32_t buttons 
)

Get buttons that will trigger a start-up from power-off. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a start-up. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint32_t startUpButtons;
err = CrossControl::Button_getStartupButtons(pButton, &startUpButtons);
std::cout << "Start up buttons are " << startUpButtons << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getStartupButtons(BUTTONHANDLE, uint32_t *buttons)

◆ Button_getSuspendButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getSuspendButtons ( BUTTONHANDLE  ,
uint32_t buttons 
)

Get buttons that will trigger a suspend. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a suspend. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint32_t suspendButtons;
err = CrossControl::Button_getSuspendButtons(pButton, &suspendButtons);
std::cout << "Suspend buttons are " << suspendButtons << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getSuspendButtons(BUTTONHANDLE, uint32_t *buttons)

◆ Button_getWakeupButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_getWakeupButtons ( BUTTONHANDLE  ,
uint32_t buttons 
)

Get buttons that will trigger a wake-up from suspend. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a wake-up. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

uint32_t wakeUpButtons;
err = CrossControl::Button_getWakeupButtons(pButton, &wakeUpButtons);
std::cout << "Wake up buttons are" << wakeUpButtons << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_getWakeupButtons(BUTTONHANDLE, uint32_t *buttons)

◆ Button_release()

EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV CrossControl::Button_release ( BUTTONHANDLE  )

Delete the button object.

Supported Platform(s): Yukon, V510, V710

Returns
-

Example Usage:

assert(pButton);
handle_buttons(pButton);
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV Button_release(BUTTONHANDLE)
EXTERN_C CCAUXDLL_API BUTTONHANDLE CCAUXDLL_CALLING_CONV GetButton(void)
void * BUTTONHANDLE
Definition: Button.h:70

◆ Button_setBacklightPattern()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setBacklightPattern ( BUTTONHANDLE  ,
uint16_t  ledActiveBitmask,
uint16_t  onTime,
uint16_t  offTime,
uint8_t  brightness 
)

Set button backlight brightness and blink pattern.

Supported Platform(s): Yukon, V510, V710

Parameters
ledActiveBitmaskBitmask that tells which LEDs should be active. Bit 0 corresponds to button 0 LED. 0 = LED is inactive, 1 = LED is active.
onTimeButton backlight on time in ms (0-2550). Actual resolution is 10ms. Example: setting on time = 300ms and off time = 700ms => cycle time of 1s (1Hz) and a duty cycle of 30%.
offTimeButton backlight off time in ms (0-2550).
brightnessButton backlight brightness (0-100%).
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

300, 700, 100);
std::cout << "Button backlight pattern is now 300ms on, 700ms off with 100% brightness for buttons 0-4 (LEDs "
"for buttons 5-9 disabled)"
<< std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setBacklightPattern(BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime, uint16_t offTime, uint8_t brightness)
@ BTN_Button3
Definition: Button.h:39
@ BTN_Button4
Definition: Button.h:40
@ BTN_Button2
Definition: Button.h:38
@ BTN_Button1
Definition: Button.h:37

◆ Button_setBootBacklightPattern()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setBootBacklightPattern ( BUTTONHANDLE  ,
uint16_t  ledActiveBitmask,
uint16_t  onTime,
uint16_t  offTime,
uint8_t  brightness 
)

Set button backlight brightness and blink pattern used during boot. Setting will be stored in eeprom and will automatically be used every boot. To change blink pattern after boot, use Button_setBacklightPattern from application or script.

Supported Platform(s): Yukon, V510, V710

Parameters
ledActiveBitmaskBitmask that tells which LEDs should be active. Bit 0 corresponds to button 0 LED. 0 = LED is inactive, 1 = LED is active.
onTimeButton backlight on time in ms (0-2550). Actual resolution is 10ms. Example: setting on time = 300ms and off time = 700ms => cycle time of 1s (1Hz) and a duty cycle of 30%.
offTimeButton backlight off time in ms (0-2550).
brightnessButton backlight brightness (0-100%). 0% means backlight is off.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = CrossControl::Button_setBootBacklightPattern(pButton, 0xFFFF, 500, 500, 50);
std::cout << "Button backlight pattern during boot is now 500ms on, 500ms off, 50% brightness for all buttons"
<< std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setBootBacklightPattern(BUTTONHANDLE, uint16_t ledActiveBitmask, uint16_t onTime, uint16_t offTime, uint8_t brightness)

◆ Button_setLongPressTime()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setLongPressTime ( BUTTONHANDLE  ,
uint16_t  time 
)

Set time for a button press to be considered as a long-press. This applies to button 0-15 (not to separate power button).

Supported Platform(s): Yukon, V510, V710

Parameters
timeTime in ms (500-60000)
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

constexpr uint32_t LONG_PRESS_TIME_MS = 4000;
err = CrossControl::Button_setLongPressTime(pButton, LONG_PRESS_TIME_MS);
std::cout << "Button long press time is set to " << LONG_PRESS_TIME_MS << " ms" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setLongPressTime(BUTTONHANDLE, uint16_t time)

◆ Button_setShutdownButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setShutdownButtons ( BUTTONHANDLE  ,
uint32_t  buttons 
)

Set buttons that will trigger a shut-down. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a shut-down. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

std::cout << "Button 0 long press will shut down unit" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setShutdownButtons(BUTTONHANDLE, uint32_t buttons)
@ BTN_Button0_LONGPRESS
Definition: Button.h:52

◆ Button_setStartupButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setStartupButtons ( BUTTONHANDLE  ,
uint32_t  buttons 
)

Set buttons that will trigger a start-up from power-off. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a start-up. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

std::cout << "Button 0 or button 5 will start unit from off" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setStartupButtons(BUTTONHANDLE, uint32_t buttons)
@ BTN_Button5
Definition: Button.h:41

◆ Button_setSuspendButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setSuspendButtons ( BUTTONHANDLE  ,
uint32_t  buttons 
)

Set buttons that will trigger a suspend. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a suspend. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

std::cout << "Button 0 short press will set unit to suspend" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setSuspendButtons(BUTTONHANDLE, uint32_t buttons)

◆ Button_setWakeupButtons()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::Button_setWakeupButtons ( BUTTONHANDLE  ,
uint32_t  buttons 
)

Set buttons that will trigger a wake-up from suspend. Several buttons can be configured to trigger the same function.

Supported Platform(s): Yukon, V510, V710

Parameters
buttonsBitmask that tells which buttons should trigger a wake-up. Bit 0 corresponds to button 0.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

std::cout << "Button 0 or button 5 will wake up unit from suspend" << std::endl;
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV Button_setWakeupButtons(BUTTONHANDLE, uint32_t buttons)

◆ GetButton()

EXTERN_C CCAUXDLL_API BUTTONHANDLE CCAUXDLL_CALLING_CONV CrossControl::GetButton ( void  )

Factory function that creates instances of the button object.

Supported Platform(s): Yukon, V510, V710

Returns
BUTTONHANDLE to an allocated button object. The returned handle needs to be deallocated using the Button_release(BUTTONHANDLE) method when it's no longer needed.

Returns NULL if it fails to allocate memory.

Example Usage:

assert(pButton);
handle_buttons(pButton);