gameboy-advance

Constants

  1. const NoPin = Pin(-1)

NoPin explicitly indicates “not a pin”. Use this pin if you want to leave oneof the pins in a peripheral unconfigured (if supported by the hardware).

  1. const (
  2. IRQ_VBLANK = 0
  3. IRQ_HBLANK = 1
  4. IRQ_VCOUNT = 2
  5. IRQ_TIMER0 = 3
  6. IRQ_TIMER1 = 4
  7. IRQ_TIMER2 = 5
  8. IRQ_TIMER3 = 6
  9. IRQ_COM = 7
  10. IRQ_DMA0 = 8
  11. IRQ_DMA1 = 9
  12. IRQ_DMA2 = 10
  13. IRQ_DMA3 = 11
  14. IRQ_KEYPAD = 12
  15. IRQ_GAMEPAK = 13
  16. )

Interrupt numbers as used on the GameBoy Advance. Register them withruntime/interrupt.New.

Variables

  1. var (
  2. ErrInvalidInputPin = errors.New("machine: invalid input pin")
  3. ErrInvalidOutputPin = errors.New("machine: invalid output pin")
  4. ErrInvalidClockPin = errors.New("machine: invalid clock pin")
  5. ErrInvalidDataPin = errors.New("machine: invalid data pin")
  6. )
  1. var Display = FramebufDisplay{(*[160][240]volatile.Register16)(unsafe.Pointer(uintptr(0x06000000)))}

func NewRingBuffer

  1. func NewRingBuffer() *RingBuffer

NewRingBuffer returns a new ring buffer.

type ADC

  1. type ADC struct {
  2. Pin Pin
  3. }

type FramebufDisplay

  1. type FramebufDisplay struct {
  2. port *[160][240]volatile.Register16
  3. }

func (FramebufDisplay) Configure

  1. func (d FramebufDisplay) Configure()

func (FramebufDisplay) Display

  1. func (d FramebufDisplay) Display() error

func (FramebufDisplay) SetPixel

  1. func (d FramebufDisplay) SetPixel(x, y int16, c color.RGBA)

func (FramebufDisplay) Size

  1. func (d FramebufDisplay) Size() (x, y int16)

type PWM

  1. type PWM struct {
  2. Pin Pin
  3. }

type Pin

  1. type Pin int8

Pin is a single pin on a chip, which may be connected to other hardwaredevices. It can either be used directly as GPIO pin or it can be used inother peripherals like ADC, I2C, etc.

func (Pin) High

  1. func (p Pin) High()

High sets this GPIO pin to high, assuming it has been configured as an outputpin. It is hardware dependent (and often undefined) what happens if you set apin to high that is not configured as an output pin.

func (Pin) Low

  1. func (p Pin) Low()

Low sets this GPIO pin to low, assuming it has been configured as an outputpin. It is hardware dependent (and often undefined) what happens if you set apin to low that is not configured as an output pin.

func (Pin) Set

  1. func (p Pin) Set(value bool)

Set has not been implemented.

type PinConfig

  1. type PinConfig struct {
  2. Mode PinMode
  3. }

type PinMode

  1. type PinMode uint8

type RingBuffer

  1. type RingBuffer struct {
  2. rxbuffer [bufferSize]volatile.Register8
  3. head volatile.Register8
  4. tail volatile.Register8
  5. }

RingBuffer is ring buffer implementation inspired by post athttps://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php

It has some limitations currently due to how “volatile” variables that aremembers of a struct are not compiled correctly by TinyGo.See https://github.com/tinygo-org/tinygo/issues/151 for details.

func (*RingBuffer) Get

  1. func (rb *RingBuffer) Get() (byte, bool)

Get returns a byte from the buffer. If the buffer is empty,the method will return a false as the second value.

func (*RingBuffer) Put

  1. func (rb *RingBuffer) Put(val byte) bool

Put stores a byte in the buffer. If the buffer is alreadyfull, the method will return false.

func (*RingBuffer) Used

  1. func (rb *RingBuffer) Used() uint8

Used returns how many bytes in buffer have been used.