Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
This system allows one to communicate with the ESP at runtime and issue a series of commands from userspace applications using HID API. This can be concurrent to using the interface as any type of HID device, mouse, keyboard etc.
This is a convenient way of writing to flash, IRAM, etc. and testing out code without needing to reflash the whole chip.
Commands are in the form:
REPORT_SIZE+1
bytes (With first byte being the report ID (0xAA). Linux allows variations.The commands that are supported are defined in ausb_cmd_t.
Go to the source code of this file.
Macros | |
#define | SCRATCH_IMMEDIATE_DWORDS 64 |
The number of 32 bit variables in the RAM scratch space. | |
Enumerations | |
enum | ausb_cmd_t { AUSB_CMD_REBOOT = 0x03 , AUSB_CMD_WRITE_RAM = 0x04 , AUSB_CMD_READ_RAM = 0x05 , AUSB_CMD_EXEC_RAM = 0x06 , AUSB_CMD_SWITCH_MODE = 0x07 , AUSB_CMD_ALLOC_SCRATCH = 0x08 , ACMD_CMD_MEMSET = 0x09 , ACMD_CMD_GET_VER = 0x0a , AUSB_CMD_FLASH_ERASE = 0x10 , AUSB_CMD_FLASH_WRITE = 0x11 , AUSB_CMD_FLASH_READ = 0x12 } |
Functions | |
int | handle_advanced_usb_control_get (uint8_t *data, int reqLen) |
Accept a "get" feature report command from a USB host and write back whatever is needed to send back. | |
int | handle_advanced_usb_terminal_get (uint8_t *data, int reqLen) |
USB request to get text in buffer. | |
void | handle_advanced_usb_control_set (const uint8_t *data, int datalen) |
Accept a "send" feature report command from a USB host and interpret it. executing whatever needs to be executed. | |
int | advanced_usb_write_log_printf (const char *fmt, va_list args) |
vaprintf stand-in for USB logging. | |
int | uprintf (const char *fmt,...) |
vaprintf stand-in for USB logging. | |
#define SCRATCH_IMMEDIATE_DWORDS 64 |
The number of 32 bit variables in the RAM scratch space.
enum ausb_cmd_t |
The command types that may be sent over USB
int handle_advanced_usb_control_get | ( | uint8_t * | data, |
int | reqLen ) |
Accept a "get" feature report command from a USB host and write back whatever is needed to send back.
reqLen | Number of bytes host is requesting from us. |
data | Pointer to a feature get request for the command set. |
int handle_advanced_usb_terminal_get | ( | uint8_t * | data, |
int | reqLen ) |
USB request to get text in buffer.
reqLen | The number of bytes the host is requesting from us. |
data | The data that we will write back into |
void handle_advanced_usb_control_set | ( | const uint8_t * | data, |
int | datalen ) |
Accept a "send" feature report command from a USB host and interpret it. executing whatever needs to be executed.
datalen | Total length of the buffer (command ID included) |
data | Pointer to full command |
int advanced_usb_write_log_printf | ( | const char * | fmt, |
va_list | args ) |
vaprintf stand-in for USB logging.
fmt | vaprintf format |
args | vaprintf args |
int uprintf | ( | const char * | fmt, |
... ) |
vaprintf stand-in for USB logging.
fmt | vaprintf format |
... | vaprintf args |