a2io

package
v0.0.0-...-1e73e8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2Gpio

type A2Gpio struct {
}

A2Gpio is the live implementation of A2Io interface

func (A2Gpio) Init

func (a2 A2Gpio) Init()

Init initializes the GPIO ports on the Raspberry Pi

func (A2Gpio) ReadBlock

func (a2 A2Gpio) ReadBlock(buffer []byte) error

ReadBlock reads 512 bytes from the Apple II via Raspberry Pi's GPIO ports

func (A2Gpio) ReadByte

func (a2 A2Gpio) ReadByte(noDelay ...bool) (byte, error)

ReadByte reads a byte from the Apple II via Raspberry Pi's GPIO ports

func (A2Gpio) ReadCharacter

func (a2 A2Gpio) ReadCharacter() (string, error)

ReadCharacter is a pass-through to vt100 implementation

func (A2Gpio) ReadString

func (a2 A2Gpio) ReadString() (string, error)

ReadString reads a string from the Apple II via Raspberry Pi's GPIO ports

func (A2Gpio) SendCharacter

func (a2 A2Gpio) SendCharacter(character byte)

SendCharacter is a pass-through to vt100 implementation

func (A2Gpio) WriteBlock

func (a2 A2Gpio) WriteBlock(buffer []byte) error

WriteBlock writes 512 bytes to the Apple II via Raspberry Pi's GPIO ports

func (A2Gpio) WriteBuffer

func (a2 A2Gpio) WriteBuffer(buffer []byte) error

WriteBuffer writes a buffer of bytes to the Apple II via Raspberry Pi's GPIO ports

func (A2Gpio) WriteByte

func (a2 A2Gpio) WriteByte(data byte) error

WriteByte writes a byte to the Apple II via Raspberry Pi's GPIO ports

func (A2Gpio) WriteString

func (a2 A2Gpio) WriteString(outString string) error

WriteString writes a string to the Apple II via Raspberry Pi's GPIO ports

type A2Io

type A2Io interface {
	Init()
	WriteByte(data byte) error
	WriteString(outString string) error
	WriteBlock(buffer []byte) error
	WriteBuffer(buffer []byte) error
	ReadByte(noDelay ...bool) (byte, error)
	ReadString() (string, error)
	ReadBlock(buffer []byte) error
	SendCharacter(character byte)
	ReadCharacter() (string, error)
}

A2Io provides an interface to send and receive data to the Apple II

type CDCio

type CDCio struct {
}

CDCio is a live implementation of A2Io interface

func (CDCio) Init

func (a2 CDCio) Init()

Init initializes the CDC driver on the Raspberry Pi

func (CDCio) ReadBlock

func (a2 CDCio) ReadBlock(buffer []byte) error

ReadBlock reads 512 bytes from the Apple II via Raspberry Pi's CDC driver

func (CDCio) ReadByte

func (a2 CDCio) ReadByte(noDelay ...bool) (byte, error)

ReadByte reads a byte from the Apple II via Raspberry Pi's CDC driver

func (CDCio) ReadCharacter

func (a2 CDCio) ReadCharacter() (string, error)

ReadCharacter is a pass-through to vt100 implementation

func (CDCio) ReadString

func (a2 CDCio) ReadString() (string, error)

ReadString reads a string from the Apple II via Raspberry Pi's CDC driver

func (CDCio) SendCharacter

func (a2 CDCio) SendCharacter(character byte)

SendCharacter is a pass-through to vt100 implementation

func (CDCio) WriteBlock

func (a2 CDCio) WriteBlock(buffer []byte) error

WriteBlock writes 512 bytes to the Apple II via Raspberry Pi's CDC driver

func (CDCio) WriteBuffer

func (a2 CDCio) WriteBuffer(buffer []byte) error

WriteBuffer writes a buffer of bytes to the Apple II via Raspberry Pi's CDC driver

func (CDCio) WriteByte

func (a2 CDCio) WriteByte(data byte) error

WriteByte writes a byte to the Apple II via Raspberry Pi's CDC driver

func (CDCio) WriteString

func (a2 CDCio) WriteString(outString string) error

WriteString writes a string to the Apple II via Raspberry Pi's CDC driver

type MockIo

type MockIo struct {
	Data *MockIoData
}

MockIo implements A2Io to allow unit tests to run without needing GPIO functioning

func (MockIo) Init

func (mockIo MockIo) Init()

Init is only here to complete A2Io interface

func (MockIo) ReadBlock

func (mockIo MockIo) ReadBlock(buffer []byte) error

ReadBlock mocks reading a 512 byte block from the Apple II

func (MockIo) ReadByte

func (mockIo MockIo) ReadByte(noDelay ...bool) (byte, error)

ReadByte mocks reading a byte from the Apple II

func (MockIo) ReadCharacter

func (mockIo MockIo) ReadCharacter() (string, error)

ReadCharacter is a pass-through to vt100 implementation

func (MockIo) ReadString

func (mockIo MockIo) ReadString() (string, error)

ReadString mocks reading a null terminated string from the Apple II

func (MockIo) SendCharacter

func (mockIo MockIo) SendCharacter(character byte)

SendCharacter is a pass-through to vt100 implementation

func (MockIo) WriteBlock

func (mockIo MockIo) WriteBlock(buffer []byte) error

WriteBlock mocks writing a block to the Apple II

func (MockIo) WriteBuffer

func (mockIo MockIo) WriteBuffer(buffer []byte) error

WriteBuffer mocks writing a buffer to the Apple II

func (MockIo) WriteByte

func (mockIo MockIo) WriteByte(data byte) error

WriteByte mocks writing a byte to the Apple II

func (MockIo) WriteString

func (mockIo MockIo) WriteString(outString string) error

WriteString mocks writing a string to the Apple II

type MockIoData

type MockIoData struct {
	BytesToRead        []byte
	BytesWritten       []byte
	NumberBytesRead    int
	NumberBytesWritten int
	ErrorToThrow       error
}

MockIoData is used to verify tests were successful

type UserIo

type UserIo struct {
}

UserIo implements A2Io for the purpose of debugging locally

func (UserIo) Init

func (userIo UserIo) Init()

Init is only here to complete A2Io interface

func (UserIo) ReadBlock

func (userIo UserIo) ReadBlock(buffer []byte) error

ReadBlock should simulate reading to the Apple II but is not yet supported

func (UserIo) ReadByte

func (userIo UserIo) ReadByte(noDelay ...bool) (byte, error)

ReadByte simulates reading to the Apple II but uses stdin instead

func (UserIo) ReadCharacter

func (userIo UserIo) ReadCharacter() (string, error)

ReadCharacter is a pass-through to vt100 implementation

func (UserIo) ReadString

func (userIo UserIo) ReadString() (string, error)

ReadString simulates reading to the Apple II but uses stdin instead

func (UserIo) SendCharacter

func (userIo UserIo) SendCharacter(character byte)

SendCharacter is a pass-through to vt100 implementation

func (UserIo) WriteBlock

func (userIo UserIo) WriteBlock(buffer []byte) error

WriteBlock simulates writing to the Apple II but uses stdout instead

func (UserIo) WriteBuffer

func (userIo UserIo) WriteBuffer(buffer []byte) error

WriteBuffer simulates writing to the Apple II but uses stdout instead

func (UserIo) WriteByte

func (userIo UserIo) WriteByte(data byte) error

WriteByte simulates writing to the Apple II but uses stdout instead

func (UserIo) WriteString

func (userIo UserIo) WriteString(outString string) error

WriteString simulates writing to the Apple II but uses stdout instead

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL