Prusa MINI Firmware overview
variant8.h
Go to the documentation of this file.
1 // variant8.h
2 
3 #ifndef _VARIANT8_H
4 #define _VARIANT8_H
5 
6 #include <inttypes.h>
7 
8 #define VARIANT8_EMPTY 0x00 // empty - no data
9 #define VARIANT8_I8 0x01 // signed char - 1byte
10 #define VARIANT8_UI8 0x02 // unsigned char - 1byte
11 #define VARIANT8_I16 0x03 // signed short - 2byte
12 #define VARIANT8_UI16 0x04 // unsigned short - 2byte
13 #define VARIANT8_I32 0x05 // signed long - 4byte
14 #define VARIANT8_UI32 0x06 // unsigned long - 4byte
15 #define VARIANT8_FLT 0x07 // float - 4byte
16 #define VARIANT8_USER 0x3f // user - up to 7 bytes
17 #define VARIANT8_PTR 0x40 // pointer - 4 bytes
18 #define VARIANT8_ARRAY 0x80 // array
19 #define VARIANT8_ERROR 0xff // error
20 
21 #pragma pack(push)
22 #pragma pack(1)
23 
24 typedef struct _variant8_t {
27  uint16_t usr16;
28  union {
29  char *pc;
30  uint32_t usr32;
31  float flt;
32  uint32_t ui32;
33  int32_t i32;
34  uint16_t ui16;
35  int16_t i16;
37  int8_t i8;
38  };
39 } variant8_t;
40 
41 #pragma pack(pop)
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif //__cplusplus
46 
47 extern variant8_t variant8_empty(void); // returns VARIANT8_EMPTY
48 
49 extern variant8_t variant8_i8(int8_t i8); // returns VARIANT8_I8
50 
51 extern variant8_t variant8_ui8(uint8_t ui8); // returns VARIANT8_UI8
52 
53 extern variant8_t variant8_i16(int16_t i16); // returns VARIANT8_I16
54 
55 extern variant8_t variant8_ui16(uint16_t ui16); // returns VARIANT8_UI16
56 
57 extern variant8_t variant8_i32(int32_t i32); // returns VARIANT8_I32
58 
59 extern variant8_t variant8_ui32(uint32_t ui32); // returns VARIANT8_UI32
60 
61 extern variant8_t variant8_flt(float flt); // returns VARIANT8_FLT
62 
63 extern variant8_t variant8_user(uint32_t usr32); // returns VARIANT8_USER
64 
65 #ifdef __cplusplus
66 }
67 #endif //__cplusplus
68 
69 #endif //_VARIANT8_H
variant8_i32
variant8_t variant8_i32(int32_t i32)
Definition: variant8.c:36
_variant8_t::pc
char * pc
Definition: variant8.h:29
VARIANT8_UI8
#define VARIANT8_UI8
Definition: variant8.h:10
variant8_ui8
variant8_t variant8_ui8(uint8_t ui8)
Definition: variant8.c:18
variant8_i8
variant8_t variant8_i8(int8_t i8)
Definition: variant8.c:12
_variant8_t::ui16
uint16_t ui16
Definition: variant8.h:34
VARIANT8_I16
#define VARIANT8_I16
Definition: variant8.h:11
type
uint8_t type
Definition: UsbCore.h:184
_variant8_t::ui8
uint8_t ui8
Definition: variant8.h:36
variant8_user
variant8_t variant8_user(uint32_t usr32)
Definition: variant8.c:54
VARIANT8_I8
#define VARIANT8_I8
Definition: variant8.h:9
variant8_ui32
variant8_t variant8_ui32(uint32_t ui32)
Definition: variant8.c:42
VARIANT8_USER
#define VARIANT8_USER
Definition: variant8.h:16
_variant8_t::type
uint8_t type
Definition: variant8.h:25
_variant8_t::usr16
uint16_t usr16
Definition: variant8.h:27
variant8_user
variant8_t variant8_user(uint32_t usr32)
Definition: variant8.c:54
variant8_ui8
variant8_t variant8_ui8(uint8_t ui8)
Definition: variant8.c:18
variant8_ui16
variant8_t variant8_ui16(uint16_t ui16)
Definition: variant8.c:30
_variant8_t
Definition: variant8.h:24
variant8_t
struct _variant8_t variant8_t
_variant8_t::flt
float flt
Definition: variant8.h:31
variant8.h
variant8_empty
variant8_t variant8_empty(void)
Definition: variant8.c:10
variant8_ui16
variant8_t variant8_ui16(uint16_t ui16)
Definition: variant8.c:30
variant8_
variant8_t variant8_(uint8_t type)
Definition: variant8.c:5
variant8_empty
variant8_t variant8_empty(void)
Definition: variant8.c:10
variant8_i16
variant8_t variant8_i16(int16_t i16)
Definition: variant8.c:24
uint8_t
const uint8_t[]
Definition: 404_html.c:3
VARIANT8_EMPTY
#define VARIANT8_EMPTY
Definition: variant8.h:8
_variant8_t::i16
int16_t i16
Definition: variant8.h:35
variant8_ui32
variant8_t variant8_ui32(uint32_t ui32)
Definition: variant8.c:42
VARIANT8_UI16
#define VARIANT8_UI16
Definition: variant8.h:12
VARIANT8_FLT
#define VARIANT8_FLT
Definition: variant8.h:15
variant8_i32
variant8_t variant8_i32(int32_t i32)
Definition: variant8.c:36
_variant8_t::usr8
uint8_t usr8
Definition: variant8.h:26
_variant8_t::usr32
uint32_t usr32
Definition: variant8.h:30
VARIANT8_UI32
#define VARIANT8_UI32
Definition: variant8.h:14
_variant8_t::i8
int8_t i8
Definition: variant8.h:37
_variant8_t::ui32
uint32_t ui32
Definition: variant8.h:32
VARIANT8_I32
#define VARIANT8_I32
Definition: variant8.h:13
variant8_i16
variant8_t variant8_i16(int16_t i16)
Definition: variant8.c:24
variant8_flt
variant8_t variant8_flt(float flt)
Definition: variant8.c:48
variant8_flt
variant8_t variant8_flt(float flt)
Definition: variant8.c:48
variant8_i8
variant8_t variant8_i8(int8_t i8)
Definition: variant8.c:12
_variant8_t::i32
int32_t i32
Definition: variant8.h:33