Remove USB/serial support: network-only protocol, drop tinyusb and PICOBOOT
This commit is contained in:
@@ -8,7 +8,6 @@ extern std::string_view firmware_name;
|
||||
|
||||
void handlers_init();
|
||||
void handlers_start();
|
||||
std::optional<ResponsePICOBOOT> handle_picoboot(const responder& resp, const RequestPICOBOOT&);
|
||||
std::optional<ResponseInfo> handle_info(const responder& resp, const RequestInfo&);
|
||||
std::optional<ResponseLog> handle_log(const responder& resp, const RequestLog&);
|
||||
std::optional<ResponseFlashErase> handle_flash_erase(const responder& resp, const RequestFlashErase&);
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
|
||||
#define CFG_TUD_CDC 1
|
||||
#define CFG_TUD_CDC_RX_BUFSIZE 256
|
||||
#define CFG_TUD_CDC_TX_BUFSIZE 256
|
||||
#define CFG_TUD_CDC_EP_BUFSIZE 64
|
||||
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include "tusb.h"
|
||||
#include "ring_buffer.h"
|
||||
|
||||
struct usb_cdc {
|
||||
ring_buffer<uint8_t, 8192> tx;
|
||||
|
||||
bool send(std::span<const uint8_t> data) {
|
||||
if (!tx.push(data)) return false;
|
||||
drain();
|
||||
return true;
|
||||
}
|
||||
|
||||
void send(const std::vector<uint8_t>& data) {
|
||||
send(std::span<const uint8_t>{data});
|
||||
}
|
||||
|
||||
void drain() {
|
||||
while (!tx.empty()) {
|
||||
uint32_t avail = tud_cdc_write_available();
|
||||
if (avail == 0) break;
|
||||
auto chunk = tx.read_contiguous();
|
||||
if (chunk.size() > avail) chunk = chunk.first(avail);
|
||||
tud_cdc_write(chunk.data(), chunk.size());
|
||||
tx.consume(chunk.size());
|
||||
}
|
||||
tud_cdc_write_flush();
|
||||
}
|
||||
};
|
||||
@@ -27,18 +27,6 @@ struct DeviceError {
|
||||
auto as_tuple() { return std::tie(code, message); }
|
||||
};
|
||||
|
||||
struct RequestPICOBOOT {
|
||||
static constexpr int8_t ext_id = 2;
|
||||
auto as_tuple() const { return std::tie(); }
|
||||
auto as_tuple() { return std::tie(); }
|
||||
};
|
||||
|
||||
struct ResponsePICOBOOT {
|
||||
static constexpr int8_t ext_id = 3;
|
||||
auto as_tuple() const { return std::tie(); }
|
||||
auto as_tuple() { return std::tie(); }
|
||||
};
|
||||
|
||||
struct RequestInfo {
|
||||
static constexpr int8_t ext_id = 4;
|
||||
auto as_tuple() const { return std::tie(); }
|
||||
|
||||
Reference in New Issue
Block a user