Prusa MINI Firmware overview
|
#include <binary_protocol.h>
|
enum | Protocol : uint8_t { Protocol::CONTROL,
Protocol::FILE_TRANSFER
} |
|
enum | ProtocolControl : uint8_t { ProtocolControl::SYNC = 1,
ProtocolControl::CLOSE
} |
|
enum | StreamState : uint8_t {
StreamState::PACKET_RESET,
StreamState::PACKET_WAIT,
StreamState::PACKET_HEADER,
StreamState::PACKET_DATA,
StreamState::PACKET_FOOTER,
StreamState::PACKET_PROCESS,
StreamState::PACKET_RESEND,
StreamState::PACKET_TIMEOUT,
StreamState::PACKET_ERROR
} |
|
◆ Protocol
Enumerator |
---|
CONTROL | |
FILE_TRANSFER | |
223 :
uint8_t { CONTROL, FILE_TRANSFER };
◆ ProtocolControl
◆ StreamState
Enumerator |
---|
PACKET_RESET | |
PACKET_WAIT | |
PACKET_HEADER | |
PACKET_DATA | |
PACKET_FOOTER | |
PACKET_PROCESS | |
PACKET_RESEND | |
PACKET_TIMEOUT | |
PACKET_ERROR | |
227 :
uint8_t { PACKET_RESET, PACKET_WAIT, PACKET_HEADER, PACKET_DATA, PACKET_FOOTER,
228 PACKET_PROCESS, PACKET_RESEND, PACKET_TIMEOUT, PACKET_ERROR };
◆ reset()
void BinaryStream::reset |
( |
| ) |
|
◆ checksum()
uint32_t BinaryStream::checksum |
( |
uint32_t |
cs, |
|
|
uint8_t |
value |
|
) |
| |
282 uint16_t cs_low = (((cs & 0xFF) + value) % 255);
283 return ((((cs >> 8) + cs_low) % 255) << 8) | cs_low;
◆ stream_read()
bool BinaryStream::stream_read |
( |
uint8_t & |
data | ) |
|
◆ receive()
template<const size_t buffer_size>
void BinaryStream::receive |
( |
char(&) |
buffer[buffer_size] | ) |
|
Data stream packet handling
305 #if ENABLED(SDSUPPORT)
309 #pragma GCC diagnostic push
310 #pragma GCC diagnostic ignored "-Warray-bounds"
346 SERIAL_ECHOLNPAIR(
"ss",
sync,
",", buffer_size,
",",
VERSION_MAJOR,
".",
VERSION_MINOR,
".",
VERSION_PATCH);
446 #pragma GCC diagnostic pop
◆ dispatch()
void BinaryStream::dispatch |
( |
| ) |
|
454 card.flag.binary_mode =
false;
◆ idle()
void BinaryStream::idle |
( |
| ) |
|
◆ packet
◆ PACKET_MAX_WAIT
const uint16_t BinaryStream::PACKET_MAX_WAIT = 500 |
|
static |
◆ RX_TIMESLICE
const uint16_t BinaryStream::RX_TIMESLICE = 20 |
|
static |
◆ MAX_RETRIES
const uint16_t BinaryStream::MAX_RETRIES = 0 |
|
static |
◆ VERSION_MAJOR
const uint16_t BinaryStream::VERSION_MAJOR = 0 |
|
static |
◆ VERSION_MINOR
const uint16_t BinaryStream::VERSION_MINOR = 1 |
|
static |
◆ VERSION_PATCH
const uint16_t BinaryStream::VERSION_PATCH = 0 |
|
static |
◆ packet_retries
uint8_t BinaryStream::packet_retries |
◆ sync
◆ buffer_next_index
uint16_t BinaryStream::buffer_next_index |
◆ bytes_received
uint32_t BinaryStream::bytes_received |
◆ stream_state
#define PENDING(NOW, SOON)
Definition: millis_t.h:28
#define PORT_REDIRECT(p)
Definition: serial.h:66
Header header
Definition: binary_protocol.h:256
int bs_read_serial(const uint8_t index)
Definition: binary_protocol.h:42
void reset()
Definition: binary_protocol.h:274
uint16_t header_checksum
Definition: binary_protocol.h:259
uint8_t packet_retries
Definition: binary_protocol.h:474
uint8_t data[8]
Definition: masstorage.h:49
static const uint16_t VERSION_MAJOR
Definition: binary_protocol.h:473
static const uint16_t PACKET_MAX_WAIT
Definition: binary_protocol.h:473
uint8_t sync
Definition: binary_protocol.h:474
bool stream_read(uint8_t &data)
Definition: binary_protocol.h:289
uint32_t millis(void)
Definition: wiring_time.c:29
void reset()
Definition: binary_protocol.h:263
static void idle()
Definition: binary_protocol.h:157
#define SERIAL_ECHO_START()
Definition: serial.h:179
static const uint16_t VERSION_MINOR
Definition: binary_protocol.h:473
static void process(uint8_t packet_type, char *buffer, const uint16_t length)
Definition: binary_protocol.h:166
uint16_t buffer_next_index
Definition: binary_protocol.h:475
uint32_t checksum(uint32_t cs, uint8_t value)
Definition: binary_protocol.h:281
#define SERIAL_ECHO_MSG(S)
Definition: serial.h:183
struct BinaryStream::Packet packet
StreamState stream_state
Definition: binary_protocol.h:477
uint32_t bytes_received
Definition: binary_protocol.h:258
Footer footer
Definition: binary_protocol.h:257
#define SERIAL_ECHOLNPAIR(V...)
Definition: serial.h:144
static const uint16_t VERSION_PATCH
Definition: binary_protocol.h:473
#define ELAPSED(NOW, SOON)
Definition: millis_t.h:29
const uint8_t[]
Definition: 404_html.c:3
uint16_t checksum
Definition: binary_protocol.h:259
millis_t timeout
Definition: binary_protocol.h:260
void dispatch()
Definition: binary_protocol.h:449
char * buffer
Definition: binary_protocol.h:261
uint32_t millis_t
Definition: millis_t.h:26
static const uint16_t MAX_RETRIES
Definition: binary_protocol.h:473
bool bs_serial_data_available(const uint8_t index)
Definition: binary_protocol.h:32
void idle()
Definition: binary_protocol.h:468
uint32_t bytes_received
Definition: binary_protocol.h:476
static const uint16_t RX_TIMESLICE
Definition: binary_protocol.h:473