Documentation
¶
Overview ¶
CWKeyer is a library for sending morse code (CW). The library uses an asynchronous send queue that allows the caller to adjust the speed, stop a message, or send additional messages while a previous message is still being keyed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BeepKey ¶
type BeepKey struct {
// contains filtered or unexported fields
}
func NewBeepKey ¶
NewBeepKey creates a BeepKey. Suggested values based on testing: freq=700, sampleRate=48000, bufferSize=1200.
func (*BeepKey) CloseSpeaker ¶
func (b *BeepKey) CloseSpeaker()
type Key ¶
type Key interface { Down() error // Called when the keyer keys down Up() error // Called when the keyer keys up }
Key abstracts a CW key into a type with methods called when the key is circuit opened or closed.
type Keyer ¶
type Keyer struct {
// contains filtered or unexported fields
}
func (*Keyer) DrainSendQueue ¶
func (k *Keyer) DrainSendQueue()
DrainSendQueue interrupts the current message by draining the send queue, returning when it is empty.
func (*Keyer) ProcessSendQueue ¶
ProcessSendQueue processes the send queue. A bool is accepted to indicate if ProcessSendQueue should return when the queue is empty. A method error from the Key will always cause a return.
func (*Keyer) QueueMessage ¶
QueueMessage adds a string to the send queue. An error is returned if the string contains an unsupported rune.
func (*Keyer) QueueRune ¶
QueueRune adds a rune to the send queue. An error is returned if the rune is unsupported.
func (*Keyer) SendQueueIsEmpty ¶
SendQueueIsEmpty returns true when there is nothing waiting to be sent.
type SerialDTRKey ¶
type SerialDTRKey struct {
// contains filtered or unexported fields
}
func NewSerialDTRKey ¶
func NewSerialDTRKey(portName string, baudrate int) (*SerialDTRKey, error)
NewSerialDTRKey creates a SerialDTRKey on the specified port. Suggested values based on testing: baudrate=115200.
func (*SerialDTRKey) ClosePort ¶
func (s *SerialDTRKey) ClosePort() error
func (*SerialDTRKey) Down ¶
func (s *SerialDTRKey) Down() error
func (*SerialDTRKey) Up ¶
func (s *SerialDTRKey) Up() error
type SpeedProvider ¶
type SpeedProvider interface {
Speed() int
}
SpeedProvider provides the speed each time a CW event is keyed.