Documentation ¶
Index ¶
- Constants
- func BytesToUint16(value []byte) uint16
- func SlipEncode(b []byte) []byte
- func Uint16ToBytes(value uint16) []byte
- func Uint32ToBytes(value uint32) []byte
- type Command
- func NewAttachSpiFlashCommand() *Command
- func NewBeginFlashCommand(eraseSize uint32, numBlocks uint32, blockSize uint32, offset uint32) *Command
- func NewBeginFlashDeflCommand(eraseSize uint32, numBlocks uint32, blockSize uint32, offset uint32) *Command
- func NewChangeBaudrateCommand(newBaudrate uint32, oldBaudrate uint32) *Command
- func NewCommand(opcode Opcode, data []byte) *Command
- func NewFlashDataCommand(data []byte, sequence uint32) *Command
- func NewFlashDataDeflCommand(data []byte, sequence uint32) *Command
- func NewFlashEndCommand(reboot bool) *Command
- func NewReadFlashCommand(offset uint32, size uint32) *Command
- func NewReadRegisterCommand(register uint32) *Command
- func NewSyncCommand() *Command
- type Direction
- type ErrorCode
- type Opcode
- type Response
- type ResponseStatus
- type SlipReadWriter
Constants ¶
View Source
const ( SlipHeader byte = 0xC0 SlipEscapeChar byte = 0xDB )
Variables ¶
This section is empty.
Functions ¶
func BytesToUint16 ¶
func SlipEncode ¶
func Uint16ToBytes ¶
func Uint32ToBytes ¶
Types ¶
type Command ¶
func NewAttachSpiFlashCommand ¶
func NewAttachSpiFlashCommand() *Command
func NewBeginFlashCommand ¶
func NewCommand ¶
func NewFlashDataCommand ¶
func NewFlashDataDeflCommand ¶
func NewFlashEndCommand ¶
func NewReadFlashCommand ¶
func NewReadRegisterCommand ¶
func NewSyncCommand ¶
func NewSyncCommand() *Command
type ErrorCode ¶
type ErrorCode byte
ErrorCode - ROM Loader Error Codes
const ( // ReceivedMessageInvalid parameters or length field is invalid ReceivedMessageInvalid ErrorCode = 0x05 // FailedToActOnReceivedMessage FailedToActOnReceivedMessage ErrorCode = 0x06 // InvalidCRC Invalid CRC in message InvalidCRC ErrorCode = 0x07 // FlashWriteError - after writing a block of data to flash, the ROM loader reads the value back and the 8-bit CRC is compared to the data read from flash. If they don't match, this error is returned. FlashWriteError ErrorCode = 0x08 // FlashReadError SPI read failed FlashReadError ErrorCode = 0x09 // FlashReadLengthError SPI read request length is too long FlashReadLengthError ErrorCode = 0x0A // DeflateError (ESP32 compressed uploads only) DeflateError ErrorCode = 0x0B )
type Opcode ¶
type Opcode byte
const ( OpcodeFlashBegin Opcode = 0x02 OpcodeFlashData Opcode = 0x03 OpcodeFlashEnd Opcode = 0x04 OpcodeMemBegin Opcode = 0x05 OpcodeMemEnd Opcode = 0x06 OpcodeMemData Opcode = 0x07 OpcodeSync Opcode = 0x08 OpcodeWriteReg Opcode = 0x09 OpcodeReadReg Opcode = 0x0A OpcodeSpiSetParams Opcode = 0x0B OpcodeSpiAttachFlash Opcode = 0x0D OpcodeReadFlash Opcode = 0x0E OpcodeChangeBaudrate Opcode = 0x0F OpcodeFlashDeflBegin Opcode = 0x10 OpcodeFlashDeflData Opcode = 0x11 OpcodeFlashDeflEnd Opcode = 0x12 OpcodeSpiFlashMd5 Opcode = 0x13 OpcodeEraseFlash Opcode = 0xD0 OpcodeEraseRegion Opcode = 0xD1 OpcodeReadFlashFast Opcode = 0xD2 OpcodeRunUserCode Opcode = 0xD3 )
type Response ¶
type Response struct { Direction Direction Opcode Opcode Size uint16 Value [4]byte Data []byte Status *ResponseStatus }
func NewResponse ¶
type ResponseStatus ¶
func NewResponseStatus ¶
func NewResponseStatus(data []byte) (*ResponseStatus, error)
func (*ResponseStatus) String ¶
func (r *ResponseStatus) String() string
type SlipReadWriter ¶
type SlipReadWriter struct { BaseReadWriter io.ReadWriter Timeout time.Duration // contains filtered or unexported fields }
func NewSlipReadWriter ¶
func NewSlipReadWriter(base io.ReadWriter, logger *log.Logger) *SlipReadWriter
func (*SlipReadWriter) Write ¶
func (s *SlipReadWriter) Write(b []byte) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.