Documentation ¶
Overview ¶
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Andrew Amos Copyright (C) 2019 Graeme Sutherland, Nodestone Limited
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
------------------------------------------------------------------------ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. ------------------------------------------------------------------------
07 July 2019, Andrew Amos M0VVA, modified original c code to fit go syntax
and leveraged CWC protocol for sending rather than GPIO pins
Adapted from https://github.com/n1gp/iambic-keyer/blob/master/iambic.c
Copywrite (C) Phil Harman VK6PH May 2014 ---------------------------------------------------------------------------------
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func BuildPayload(events []Event) bitoip.CarrierEventPayload
- func CarrierKey() bitoip.CarrierKeyType
- func ChannelId() bitoip.ChannelIdType
- func QueueForTransmit(carrierEvents *bitoip.CarrierEventPayload)
- func RunMorseRx(ctx context.Context, morseIO IO, toSend chan bitoip.CarrierEventPayload, ...)
- func Sample(t time.Time, toSend chan bitoip.CarrierEventPayload, morseIO IO, sidetone bool)
- func SampleKeyer(t time.Time, toSend chan bitoip.CarrierEventPayload, morseIO IO)
- func SetCarrierKey(ck bitoip.CarrierKeyType)
- func SetChannelId(cId bitoip.ChannelIdType)
- func SetKeyMode(m int)
- func SetKeyerOut(state int, t time.Time, toSend chan bitoip.CarrierEventPayload, morseIO IO)
- func SetKeyerSpacing(s bool)
- func SetRoundTrip(t int64)
- func SetSendWait(sw time.Duration)
- func SetTickTime(tt time.Duration)
- func SetTimeOffset(t int64)
- func Startup(morseIO IO)
- func StationClient(ctx context.Context, config *Config, morseIO IO)
- func Stop(morseIO IO)
- func TransmitToHardware(t time.Time, morseIO IO)
- type Config
- type ConfigMap
- type Event
- type GPIOPins
- type IO
- type Keyer
- type NullIO
- func (n *NullIO) Bit() bool
- func (*NullIO) Close()
- func (n *NullIO) Config() *Config
- func (n *NullIO) Dash() bool
- func (n *NullIO) Dot() bool
- func (n *NullIO) Open() error
- func (n *NullIO) SetBit(b bool)
- func (n *NullIO) SetState(state State)
- func (n *NullIO) SetStatusLED(s bool)
- func (n *NullIO) SetToneOut(b bool)
- func (n *NullIO) State() State
- type PiGPIO
- type SerialIO
- type SerialPins
- type State
Constants ¶
const ( CHECK int = 0 PREDOT int = 1 PREDASH int = 2 SENDDOT int = 3 SENDDASH int = 4 DOTDELAY int = 5 DASHDELAY int = 6 DOTHELD int = 7 DASHHELD int = 8 LETTERSPACE int = 9 EXITLOOP int = 10 )
const BreakinTime = time.Duration(100 * Ms)
const DefaultTickTime = time.Duration(5 * Ms)
const HWKeyRing = 27
const HWKeyTip = 17
const HWLEDSignal = 23
const HWLEDStatus = 22
const KeyerTickTime = time.Duration(1 * Ms)
const Keyin = "keyin"
Config consts
const Keyout = "keyout"
const LocalMulticast = "224.0.0.73:%d"
const MaxEvents = 100
const MaxSendTimespan = time.Duration(1000 * Ms)
const Ms = int64(1e6)
const OnDutyCycle = uint32(1)
PWM settings
const PWMCycleLength = uint32(32)
const Pcmout = "pcmout"
const Sidetonefreq = "sidetonefreq"
const Us = int64(1000)
Variables ¶
var LastBit bool = false
var RxMutex = sync.Mutex{}
var SendWait = MaxSendTimespan
var TickTime = DefaultTickTime
var TxMutex = sync.Mutex{}
Lock for the Morse Transmit Queue
var TxQueue = make([]Event, 100)
Morse Transmit Queue
Functions ¶
func BuildPayload ¶
func BuildPayload(events []Event) bitoip.CarrierEventPayload
Build a payload (CarrierEventPayload) of on and off events. Called from Flush() to make a packet ready to send.
func CarrierKey ¶
func CarrierKey() bitoip.CarrierKeyType
func ChannelId ¶
func ChannelId() bitoip.ChannelIdType
func QueueForTransmit ¶
func QueueForTransmit(carrierEvents *bitoip.CarrierEventPayload)
Queue this stuff for sending to hardware -- LED or relay or PWM by adding to queue that will be sent out based on the tick timing
func RunMorseRx ¶
func Sample ¶
Sample the input pin for the morse key. This is called (currently) every 5ms to look for a change in input pin.
TODO should have some sort of back-off if not used recently for power saving
func SampleKeyer ¶
func SampleKeyer(t time.Time, toSend chan bitoip.CarrierEventPayload, morseIO IO)
func SetCarrierKey ¶
func SetCarrierKey(ck bitoip.CarrierKeyType)
func SetChannelId ¶
func SetChannelId(cId bitoip.ChannelIdType)
func SetKeyMode ¶
func SetKeyMode(m int)
func SetKeyerOut ¶
func SetKeyerSpacing ¶
func SetKeyerSpacing(s bool)
func SetRoundTrip ¶
func SetRoundTrip(t int64)
func SetSendWait ¶
func SetTickTime ¶
func SetTimeOffset ¶
func SetTimeOffset(t int64)
func StationClient ¶
General station client Can be in local mode, in which case all is local muticast on the local network Else the client of a reflector
func TransmitToHardware ¶
When woken up (same timer as checking for an incoming bit change) check to see if an output state change is needed and do it.
Types ¶
type Config ¶
type Config struct { NetworkMode string ReflectorAddress string LocalPort int HardwareType string // GPIO or Serial or None SerialDevice string // unix device or COM port KeyType string // straight or paddle or bug -- only straight curently supported SidetoneEnable bool SidetoneFrequency int RemoteEcho bool Channel bitoip.ChannelIdType Callsign string GPIOPins GPIOPins SerialPins SerialPins KeyerSpeed int KeyerWeight int KeyerMode int }
func ReadConfig ¶
type Keyer ¶
type Keyer struct {
// contains filtered or unexported fields
}
func (*Keyer) SetStatusLED ¶
type NullIO ¶
type NullIO struct {
// contains filtered or unexported fields
}
func (*NullIO) SetStatusLED ¶
func (*NullIO) SetToneOut ¶
type PiGPIO ¶
type PiGPIO struct {
// contains filtered or unexported fields
}
func (*PiGPIO) SetStatusLED ¶
type SerialIO ¶
type SerialIO struct {
// contains filtered or unexported fields
}
func (*SerialIO) SetStatusLED ¶
func (*SerialIO) SetToneOut ¶
No tone sending supported, so this does nothing