Skip to content

Commit 6cf87cf

Browse files
committed
Remove references to PA enable pin, since the CC1200 HAT doesn't have one
1 parent 444907b commit 6cf87cf

5 files changed

Lines changed: 6 additions & 39 deletions

File tree

cc1200_modem.go

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ type CC1200Modem struct {
6767
txTimer *time.Timer
6868
cmdSource chan byte
6969
nRST Line
70-
paEnable Line
7170
boot0 Line
7271
debugLog *os.File
7372
lastTXData time.Time
@@ -83,14 +82,12 @@ func NewCC1200Modem(
8382
port := modemCfg.Key("Port").String()
8483
baudRate, baudRateErr := modemCfg.Key("Speed").Int()
8584
nRSTPin, nRSTPinErr := modemCfg.Key("NRSTPin").Int()
86-
paEnablePin, paEnablePinErr := modemCfg.Key("PAEnablePin").Int()
8785
boot0Pin, boot0PinErr := modemCfg.Key("Boot0Pin").Int()
8886

8987
var err error
9088
err = errors.Join(
9189
baudRateErr,
9290
nRSTPinErr,
93-
paEnablePinErr,
9491
boot0PinErr,
9592
)
9693
if err != nil {
@@ -124,7 +121,7 @@ func NewCC1200Modem(
124121
// This is the emulator so don't initialize GPIO
125122
} else {
126123
log.Printf("[DEBUG] Opening modem")
127-
err = ret.gpioSetup(nRSTPin, paEnablePin, boot0Pin)
124+
err = ret.gpioSetup(nRSTPin, boot0Pin)
128125
if err != nil {
129126
return nil, err
130127
}
@@ -278,18 +275,6 @@ func (m *CC1200Modem) setNRSTGPIO(set bool) error {
278275
return m.nRST.SetValue(0)
279276
}
280277

281-
func (m *CC1200Modem) setPAEnableGPIO(set bool) error {
282-
if m.paEnable == nil {
283-
// Emulation mode
284-
return nil
285-
}
286-
log.Printf("[DEBUG] setPAEnableGPIO(%v)", set)
287-
if set {
288-
return m.paEnable.SetValue(1)
289-
}
290-
return m.paEnable.SetValue(0)
291-
}
292-
293278
func (m *CC1200Modem) setBoot0GPIO(set bool) error {
294279
if m.boot0 == nil {
295280
// Emulation mode
@@ -306,11 +291,10 @@ func (m *CC1200Modem) setBoot0GPIO(set bool) error {
306291
func (m *CC1200Modem) Reset() error {
307292
log.Print("[DEBUG] modem Reset()")
308293
err1 := m.setBoot0GPIO(false)
309-
err2 := m.setPAEnableGPIO(false)
310-
err3 := m.setNRSTGPIO(false)
294+
err2 := m.setNRSTGPIO(false)
311295
time.Sleep(50 * time.Millisecond)
312-
err4 := m.setNRSTGPIO(true)
313-
errs := errors.Join(err1, err2, err3, err4)
296+
err3 := m.setNRSTGPIO(true)
297+
errs := errors.Join(err1, err2, err3)
314298
if errs != nil {
315299
return fmt.Errorf("modem reset: %w", errs)
316300
}
@@ -323,7 +307,6 @@ func (m *CC1200Modem) Close() error {
323307
m.stopRX()
324308
m.stopTX()
325309
m.nRST.Close()
326-
m.paEnable.Close()
327310
m.boot0.Close()
328311
if m.debugLog != nil {
329312
m.debugLog.Close()
@@ -479,10 +462,6 @@ func (m *CC1200Modem) startTX() error {
479462
if err != nil {
480463
return fmt.Errorf("start TX: %w", err)
481464
}
482-
err = m.setPAEnableGPIO(true)
483-
if err != nil {
484-
log.Printf("[DEBUG] Start TX PAEnable: %v", err)
485-
}
486465
m.mutex.Lock()
487466
m.txState = txTX
488467
m.mutex.Unlock()
@@ -497,10 +476,6 @@ func (m *CC1200Modem) stopTX() {
497476
if m.txState == txTX {
498477
m.mutex.Unlock()
499478
log.Print("[DEBUG] modem stopping TX")
500-
err := m.setPAEnableGPIO(false)
501-
if err != nil {
502-
log.Printf("[DEBUG] End TX PAEnable: %v", err)
503-
}
504479
m.mutex.Lock()
505480
m.txState = txIdle
506481
}

cmd/m17-gateway/gateway.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ type config struct {
3535
// modemPort string
3636
// modemSpeed int
3737
// nRSTPin int
38-
// paEnablePin int
3938
// boot0Pin int
4039
symbolsIn *os.File
4140
symbolsOut *os.File
@@ -152,7 +151,6 @@ func loadConfig(iniFile string, inFile string, outFile string) (config, error) {
152151
modemTypeErr,
153152
// modemSpeedErr,
154153
// nRSTPinErr,
155-
// paEnablePinErr,
156154
// boot0PinErr,
157155
callsignErr,
158156
reflectorModuleErr,
@@ -182,7 +180,6 @@ func loadConfig(iniFile string, inFile string, outFile string) (config, error) {
182180
// modemPort: modemPort,
183181
// modemSpeed: modemSpeed,
184182
// nRSTPin: nRSTPin,
185-
// paEnablePin: paEnablePin,
186183
// boot0Pin: boot0Pin,
187184
symbolsIn: symbolsIn,
188185
symbolsOut: symbolsOut,

cmd/m17-gateway/packaging/m17-gateway.ini.sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Type=cc1200
2828
Port=/dev/ttyAMA0
2929
Speed=460800
3030
NRSTPin=21
31-
PAEnablePin=18
3231
Boot0Pin=20
3332

3433
# Type=MMDVM

modem_gpio_dummy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
package m17
44

5-
func (m *CC1200Modem) gpioSetup(_, _, _ int) error {
5+
func (m *CC1200Modem) gpioSetup(_, _ int) error {
66
return nil
77
}

modem_gpio_linux.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,13 @@ import (
1010
"github.com/warthog618/go-gpiocdev"
1111
)
1212

13-
func (m *CC1200Modem) gpioSetup(nRSTPin, paEnablePin, boot0Pin int) error {
13+
func (m *CC1200Modem) gpioSetup(nRSTPin, boot0Pin int) error {
1414
var err error
1515
log.Print("[DEBUG] Setting up GPIO")
1616
m.nRST, err = gpiocdev.RequestLine("gpiochip0", nRSTPin, gpiocdev.AsOutput(1))
1717
if err != nil {
1818
return fmt.Errorf("request nRST line: %w", err)
1919
}
20-
m.paEnable, err = gpiocdev.RequestLine("gpiochip0", paEnablePin, gpiocdev.AsOutput(0))
21-
if err != nil {
22-
return fmt.Errorf("request paEnable line: %w", err)
23-
}
2420
m.boot0, err = gpiocdev.RequestLine("gpiochip0", boot0Pin, gpiocdev.AsOutput(0))
2521
if err != nil {
2622
return fmt.Errorf("request boot0 line: %w", err)

0 commit comments

Comments
 (0)