BV: add text styling methods
This commit is contained in:
parent
fbb6fd18cc
commit
5faaeb02cc
|
@ -223,6 +223,25 @@ void busvoodoo_safe_state(void)
|
|||
}
|
||||
}
|
||||
|
||||
void busvoodoo_text_style(enum busvoodoo_text_style_t style)
|
||||
{
|
||||
switch (style) {
|
||||
case BUSVOODOO_TEXT_STYLE_ERROR:
|
||||
printf("\x1b[31m");
|
||||
break;
|
||||
case BUSVOODOO_TEXT_STYLE_WARNING:
|
||||
printf("\x1b[33m");
|
||||
break;
|
||||
case BUSVOODOO_TEXT_STYLE_INFO:
|
||||
printf("\x1b[32m");
|
||||
break;
|
||||
case BUSVOODOO_TEXT_STYLE_RESET:
|
||||
default:
|
||||
printf("\x1b[0m");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool busvoodoo_vout_switch(bool on)
|
||||
{
|
||||
if (on) { // we need to switch on Vout
|
||||
|
|
|
@ -111,6 +111,14 @@
|
|||
/** recommended duration in ms for pulsing LEDs to show activity */
|
||||
#define BUSVOODOO_LED_PULSE 100
|
||||
|
||||
/** printing text style */
|
||||
enum busvoodoo_text_style_t {
|
||||
BUSVOODOO_TEXT_STYLE_RESET, /**< remove text style */
|
||||
BUSVOODOO_TEXT_STYLE_ERROR, /**< text style for errors (red) */
|
||||
BUSVOODOO_TEXT_STYLE_WARNING, /**< text style for warnings (yellow) */
|
||||
BUSVOODOO_TEXT_STYLE_INFO, /**< text style for information (green) */
|
||||
};
|
||||
|
||||
/** BusVoodoo mode interface */
|
||||
struct busvoodoo_mode_t {
|
||||
const char* name; /**< name of the mode (i.e. protocol shortcut for the menu) */
|
||||
|
@ -156,6 +164,11 @@ extern char busvoodoo_global_string[64];
|
|||
void busvoodoo_setup(void);
|
||||
/** set safe state by disabling all outputs */
|
||||
void busvoodoo_safe_state(void);
|
||||
/** set printf text style
|
||||
* @param[in] style text style
|
||||
* @note uses ANSII escape codes
|
||||
*/
|
||||
void busvoodoo_text_style(enum busvoodoo_text_style_t style);
|
||||
/** switch 3V3 and 5V power outputs on I/O connector
|
||||
* @param[in] on switch on (true) or off (false) power output
|
||||
* @return if switching succeeded. else it means there is a probably a short on one of the outputs
|
||||
|
|
Loading…
Reference in New Issue