Prusa MINI Firmware overview
marlin_host.c File Reference
#include "marlin_host.h"
#include "string.h"

Functions

const char * marlin_host_prompt_get_text (host_prompt_type_t type)
 
host_prompt_type_t marlin_host_prompt_by_text (const char *text)
 
const char * marlin_host_prompt_button_get_text (host_prompt_button_t button)
 
host_prompt_button_t marlin_host_prompt_button_by_text (const char *text)
 
uint32_t marlin_host_prompt_encode (marlin_host_prompt_t *prompt)
 
void marlin_host_prompt_decode (uint32_t ui32, marlin_host_prompt_t *prompt)
 

Variables

const char * __prompt_text []
 
const char * __prompt_button_text []
 

Function Documentation

◆ marlin_host_prompt_get_text()

const char* marlin_host_prompt_get_text ( host_prompt_type_t  type)
22  {
23  uint8_t index = (uint8_t)type;
24  if (index < HOST_PROMPT_END)
25  return __prompt_text[index];
26  return "";
27 }

◆ marlin_host_prompt_by_text()

host_prompt_type_t marlin_host_prompt_by_text ( const char *  text)
29  {
30  uint8_t index;
31  for (index = 0; index < HOST_PROMPT_END; index++)
32  if (strcmp(text, __prompt_text[index]) == 0)
33  return (host_prompt_type_t)index;
34  return HOST_PROMPT_None;
35 }
Here is the caller graph for this function:

◆ marlin_host_prompt_button_get_text()

const char* marlin_host_prompt_button_get_text ( host_prompt_button_t  button)
37  {
38  uint8_t index = (uint8_t)button;
39  if (index < HOST_PROMPT_BTN_END)
40  return __prompt_text[index];
41  return "";
42 }

◆ marlin_host_prompt_button_by_text()

host_prompt_button_t marlin_host_prompt_button_by_text ( const char *  text)
44  {
45  uint8_t index;
46  for (index = 0; index < HOST_PROMPT_BTN_END; index++)
47  if (strcmp(text, __prompt_button_text[index]) == 0)
48  return (host_prompt_button_t)index;
49  return HOST_PROMPT_BTN_None;
50 }
Here is the caller graph for this function:

◆ marlin_host_prompt_encode()

uint32_t marlin_host_prompt_encode ( marlin_host_prompt_t prompt)
52  {
53  return ((uint32_t)prompt->type & 0xf) | (((uint32_t)prompt->button_count & 0xf) << 4) | (((uint32_t)prompt->button[0] & 0xf) << 8) | (((uint32_t)prompt->button[1] & 0xf) << 12) | (((uint32_t)prompt->button[2] & 0xf) << 16) | (((uint32_t)prompt->button[3] & 0xf) << 20);
54 }
Here is the caller graph for this function:

◆ marlin_host_prompt_decode()

void marlin_host_prompt_decode ( uint32_t  ui32,
marlin_host_prompt_t prompt 
)
56  {
57  prompt->type = ui32 & 0xf;
58  prompt->button_count = (ui32 >> 4) & 0xf;
59  prompt->button[0] = (ui32 >> 8) & 0xf;
60  prompt->button[1] = (ui32 >> 12) & 0xf;
61  prompt->button[2] = (ui32 >> 16) & 0xf;
62  prompt->button[3] = (ui32 >> 20) & 0xf;
63 }
Here is the caller graph for this function:

Variable Documentation

◆ __prompt_text

const char* __prompt_text[]
Initial value:
= {
"",
"Paused",
"FilamentRunout T",
"LoadFilament T",
}

◆ __prompt_button_text

const char* __prompt_button_text[]
Initial value:
= {
"",
"Continue",
"PurgeMore",
"DisableRunout",
}
_marlin_host_prompt_t::button
host_prompt_button_t button[HOST_PROMPT_MAX_BUTTONS]
Definition: marlin_host.h:49
host_prompt_type_t
host_prompt_type_t
Definition: marlin_host.h:17
type
uint8_t type
Definition: UsbCore.h:184
__prompt_text
const char * __prompt_text[]
Definition: marlin_host.c:7
_marlin_host_prompt_t::type
host_prompt_type_t type
Definition: marlin_host.h:47
__prompt_button_text
const char * __prompt_button_text[]
Definition: marlin_host.c:15
HOST_PROMPT_None
Definition: marlin_host.h:18
HOST_PROMPT_BTN_None
Definition: marlin_host.h:26
_marlin_host_prompt_t::button_count
uint8_t button_count
Definition: marlin_host.h:48
HOST_PROMPT_END
Definition: marlin_host.h:22
HOST_PROMPT_BTN_END
Definition: marlin_host.h:30
host_prompt_button_t
host_prompt_button_t
Definition: marlin_host.h:25
uint8_t
const uint8_t[]
Definition: 404_html.c:3