Documentation
¶
Index ¶
Constants ¶
const ( // Calibrated[Min|Max]AI was calculated using the EuroPi calibration program: // https://github.com/Allen-Synthesis/EuroPi/blob/main/software/programming_instructions.md#calibrate-the-module CalibratedMinAI = 384 CalibratedMaxAI = 44634 DefaultSamples = 1000 )
const ( OLEDFreq = machine.TWI_FREQ_400KHZ OLEDAddr = 0x3C OLEDWidth = 128 OLEDHeight = 32 )
const ( MaxVoltage = 10.0 MinVoltage = 0.0 )
const ( // Manually calibrated to best match expected voltages. Additional info: // https://github.com/Allen-Synthesis/EuroPi/blob/main/software/programming_instructions.md#calibrate-the-module CalibratedOffset = 32 // The default PWM Top of MaxUint16 caused noisy output. Dropping this down to a 12bit value resulted in much smoother cv output. CalibratedTop = 0xfff - CalibratedOffset )
const DefaultDebounceDelay = time.Duration(50 * time.Millisecond)
Variables ¶
var ( DefaultChannel = machine.I2C0 DefaultFont = &proggy.TinySZ8pt7b White = color.RGBA{255, 255, 255, 255} )
Functions ¶
func DebugMemoryUsage ¶ added in v0.1.3
func DebugMemoryUsage()
Types ¶
type AnalogInput ¶
A struct for handling the reading of analogue control voltage. The analogue input allows you to 'read' CV from anywhere between 0 and 12V.
func (*AnalogInput) Percent ¶
func (a *AnalogInput) Percent() float32
Percent return the percentage of the input's current relative range as a float between 0.0 and 1.0.
func (*AnalogInput) Range ¶
func (a *AnalogInput) Range(steps uint16) uint16
Range return a value between 0 and the given steps (not inclusive) based on the range of the analog input.
func (*AnalogInput) ReadVoltage ¶
func (a *AnalogInput) ReadVoltage() float32
ReadVoltage return the current read voltage between 0.0 and 10.0 volts.
func (*AnalogInput) Samples ¶
func (a *AnalogInput) Samples(samples uint16)
Samples sets the number of reads for an more accurate average read.
type AnalogReader ¶
type AnalogReader interface {
Samples(samples uint16)
ReadVoltage() float32
Percent() float32
Range(steps uint16) uint16
}
AnalogReader is an interface for common analog read methods for knobs and cv input.
type Button ¶
Button is a struct for handling push button behavior.
func (*Button) HandlerWithDebounce ¶ added in v0.1.3
Handler sets the callback function to be call when the button is pressed and debounce delay time has elapsed.
type DigitalInput ¶
DigitalInput is a struct for handling reading of the digital input.
func (*DigitalInput) Handler ¶
func (d *DigitalInput) Handler(handler func(p machine.Pin))
Handler sets the callback function to be call when a rising edge is detected.
func (*DigitalInput) HandlerWithDebounce ¶ added in v0.1.3
func (d *DigitalInput) HandlerWithDebounce(handler func(p machine.Pin), delay time.Duration)
Handler sets the callback function to be call when a rising edge is detected and debounce delay time has elapsed.
func (*DigitalInput) LastInput ¶
func (d *DigitalInput) LastInput() time.Time
LastInput return the time of the last high input (triggered at 0.8v).
func (*DigitalInput) Value ¶
func (d *DigitalInput) Value() bool
Value returns true if the input is high (above 0.8v), else false.
type DigitalReader ¶
type DigitalReader interface {
Handler(func(machine.Pin))
HandlerWithDebounce(func(machine.Pin), time.Duration)
LastInput() time.Time
Value() bool
}
DigitalReader is an interface for common digital inputs methods.
type Display ¶
Display is a wrapper around `ssd1306.Device` for drawing graphics and text to the OLED.
func NewDisplay ¶
NewDisplay returns a new Display struct.
type EuroPi ¶
type EuroPi struct {
// Display is a wrapper around ssd1306.Device
Display *Display
DI DigitalReader
AI AnalogReader
B1 DigitalReader
B2 DigitalReader
K1 AnalogReader
K2 AnalogReader
CV1 Outputer
CV2 Outputer
CV3 Outputer
CV4 Outputer
CV5 Outputer
CV6 Outputer
CV [6]Outputer
}
EuroPi is the collection of component wrappers used to interact with the module.
type Knob ¶
A struct for handling the reading of knob voltage and position.
func (*Knob) Percent ¶
Percent return the percentage of the knob's current relative range as a float between 0.0 and 1.0.
func (*Knob) Range ¶
Range return a value between 0 and the given steps (not inclusive) based on the range of the knob's position.
func (*Knob) ReadVoltage ¶
ReadVoltage return the current read voltage between 0.0 and 10.0 volts.
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Outputer is struct for interacting with the cv output jacks.
type PWMer ¶
type PWMer interface {
Configure(config machine.PWMConfig) error
Channel(pin machine.Pin) (channel uint8, err error)
Top() uint32
SetTop(top uint32)
Get(channel uint8) (value uint32)
Set(channel uint8, value uint32)
SetPeriod(period uint64) error
}
PWMer is an interface for interacting with a machine.pwmGroup