-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrfm69.go
executable file
·575 lines (516 loc) · 17.8 KB
/
rfm69.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
/*
Go Language Raspberry Pi Interface
(c) Copyright David Thorpe 2016-2018
All Rights Reserved
Documentation http://djthorpe.github.io/gopi/
For Licensing and Usage information, please see LICENSE.md
*/
package sensors
import (
"context"
"time"
"github.com/djthorpe/gopi"
)
////////////////////////////////////////////////////////////////////////////////
// RFM69 TYPES
type (
RFMMode uint8
RFMDataMode uint8
RFMModulation uint8
RFMPacketFormat uint8
RFMPacketCoding uint8
RFMPacketFilter uint8
RFMPacketCRC uint8
RFMAFCMode uint8
RFMAFCRoutine uint8
RFMTXStart uint8
RFMLNAImpedance uint8
RFMLNAGain uint8
RFMRXBWFrequency uint8
RFMRXBWCutoff uint8
)
////////////////////////////////////////////////////////////////////////////////
// RFM69 INTERFACE
type RFM69 interface {
gopi.Driver
// Reset Registers from device (after a reset)
ResetRegisters() error
// Mode, Data Mode and Modulation
Mode() RFMMode
DataMode() RFMDataMode
SetMode(device_mode RFMMode) error
SetDataMode(data_mode RFMDataMode) error
Modulation() RFMModulation
SetModulation(modulation RFMModulation) error
// Bitrate & Frequency
Bitrate() uint
FreqCarrier() uint
FreqDeviation() uint
SetBitrate(bits_per_second uint) error
SetFreqCarrier(hertz uint) error
SetFreqDeviation(hertz uint) error
// Listen Mode and Sequencer
SetSequencer(enabled bool) error
SequencerEnabled() bool
SetListenOn(value bool) error
ListenOn() bool
// Packets
PacketFormat() RFMPacketFormat
PacketCoding() RFMPacketCoding
PacketFilter() RFMPacketFilter
PacketCRC() RFMPacketCRC
SetPacketFormat(packet_format RFMPacketFormat) error
SetPacketCoding(packet_coding RFMPacketCoding) error
SetPacketFilter(packet_filter RFMPacketFilter) error
SetPacketCRC(packet_crc RFMPacketCRC) error
// Addresses
NodeAddress() uint8
BroadcastAddress() uint8
SetNodeAddress(value uint8) error
SetBroadcastAddress(value uint8) error
// Payload & Preamble
PreambleSize() uint16
PayloadSize() uint8
SetPreambleSize(preamble_size uint16) error
SetPayloadSize(payload_size uint8) error
// Encryption Key & Sync Words for Packet mode
AESKey() []byte
SetAESKey(key []byte) error
SyncWord() []byte
SetSyncWord(word []byte) error
SyncTolerance() uint8
SetSyncTolerance(bits uint8) error
// AFC
AFC() uint
AFCMode() RFMAFCMode
AFCRoutine() RFMAFCRoutine
SetAFCRoutine(afc_routine RFMAFCRoutine) error
SetAFCMode(afc_mode RFMAFCMode) error
TriggerAFC() error
// Low Noise Amplifier Settings
LNAImpedance() RFMLNAImpedance
LNAGain() RFMLNAGain
LNACurrentGain() (RFMLNAGain, error)
SetLNA(impedance RFMLNAImpedance, gain RFMLNAGain) error
// Channel Filter Settings
RXFilterFrequency() RFMRXBWFrequency
RXFilterCutoff() RFMRXBWCutoff
SetRXFilter(RFMRXBWFrequency, RFMRXBWCutoff) error
// FIFO
FIFOThreshold() uint8
SetFIFOThreshold(fifo_threshold uint8) error
ReadFIFO(ctx context.Context) ([]byte, error)
WriteFIFO(data []byte) error
ClearFIFO() error
// ReadPayload listens for a packet and returns it. If the data is
// read then it will also return true if the CRC value was
// correct, or false otherwise
ReadPayload(ctx context.Context) ([]byte, bool, error)
// WritePayload writes a packet a number of times, with a delay between each
// when the repeat is greater than zero
WritePayload(data []byte, repeat uint, delay time.Duration) error
// MeasureTemperature and return after calibration
MeasureTemperature(calibration float32) (float32, error)
/*
// OOK Parameters
SetOOK(ook_threshold_type RFMOOKThresholdType, ook_threshold_step RFMOOKThresholdStep, ook_threshold_dec RFMOOKThresholdDecrement) error
// FIFO
FIFOFillCondition() bool
SetFIFOFillCondition(fifo_fill_condition bool) error
// Other
SetTXStart(tx_start RFMTXStart) error
TXStart() RFMTXStart
// Methods
ReadFEIHertz() (float64, error)
ClearAFC() error
CalibrateRCOsc() error
*/
}
////////////////////////////////////////////////////////////////////////////////
// RFM69 CONSTS
const (
// RFM69 Mode
RFM_MODE_SLEEP RFMMode = 0x00
RFM_MODE_STDBY RFMMode = 0x01
RFM_MODE_FS RFMMode = 0x02
RFM_MODE_TX RFMMode = 0x03
RFM_MODE_RX RFMMode = 0x04
RFM_MODE_MAX RFMMode = 0x07
)
const (
// RFM69 Data Mode
RFM_DATAMODE_PACKET RFMDataMode = 0x00
RFM_DATAMODE_CONTINUOUS_NOSYNC RFMDataMode = 0x02
RFM_DATAMODE_CONTINUOUS_SYNC RFMDataMode = 0x03
RFM_DATAMODE_MAX RFMDataMode = 0x03
)
const (
// RFM69 Packet format
RFM_PACKET_FORMAT_FIXED RFMPacketFormat = 0x00 // Fixed Packet Format
RFM_PACKET_FORMAT_VARIABLE RFMPacketFormat = 0x01 // Variable Packet Format
)
const (
// RFM69 Packet coding
RFM_PACKET_CODING_NONE RFMPacketCoding = 0x00 // No Packet Coding
RFM_PACKET_CODING_MANCHESTER RFMPacketCoding = 0x01 // Manchester
RFM_PACKET_CODING_WHITENING RFMPacketCoding = 0x02 // Whitening
RFM_PACKET_CODING_MAX RFMPacketCoding = 0x03 // Mask
)
const (
// RFM69 Packet filtering
RFM_PACKET_FILTER_NONE RFMPacketFilter = 0x00 // Promiscious mode
RFM_PACKET_FILTER_NODE RFMPacketFilter = 0x01 // Matches Node
RFM_PACKET_FILTER_BROADCAST RFMPacketFilter = 0x02 // Matches Node or Broadcast
RFM_PACKET_FILTER_MAX RFMPacketFilter = 0x03 // Mask
)
const (
// RFM69 Packet CRC
RFM_PACKET_CRC_OFF RFMPacketCRC = 0x00 // CRC off
RFM_PACKET_CRC_AUTOCLEAR_OFF RFMPacketCRC = 0x01 // CRC on
RFM_PACKET_CRC_AUTOCLEAR_ON RFMPacketCRC = 0x02 // CRC on
)
const (
// RFM69 Modulation
RFM_MODULATION_FSK RFMModulation = 0x00 // 00000 FSK no shaping
RFM_MODULATION_FSK_BT_1P0 RFMModulation = 0x01 // 01000 FSK Guassian filter, BT=1.0
RFM_MODULATION_FSK_BT_0P5 RFMModulation = 0x02 // 10000 FSK Gaussian filter, BT=0.5
RFM_MODULATION_FSK_BT_0P3 RFMModulation = 0x03 // 11000 FSK Gaussian filter, BT=0.3
RFM_MODULATION_OOK RFMModulation = 0x08 // 00001 OOK no shaping
RFM_MODULATION_OOK_BR RFMModulation = 0x09 // 01001 OOK Filtering with f(cutoff) = BR
RFM_MODULATION_OOK_2BR RFMModulation = 0x0A // 01010 OOK Filtering with f(cutoff) = 2BR
RFM_MODULATION_MAX RFMModulation = 0x0A
)
const (
// Automatic Frequency Correction Mode
RFM_AFCMODE_OFF RFMAFCMode = 0x00 // AFC is performed only when triggered
RFM_AFCMODE_ON RFMAFCMode = 0x01 // AFC register is not cleared before a new AFC phase
RFM_AFCMODE_AUTOCLEAR RFMAFCMode = 0x03 // AFC register is cleared before a new AFC phase
RFM_AFCMODE_MASK RFMAFCMode = 0x03
)
const (
// Automatic Frequency Correction Routine
RFM_AFCROUTINE_STANDARD RFMAFCRoutine = 0x00 // Standard AFC Routine
RFM_AFCROUTINE_IMPROVED RFMAFCRoutine = 0x01 // Improved AFC Routine
RFM_AFCROUTINE_MASK RFMAFCRoutine = 0x01
)
const (
// RFM69 TX Start Condition
RFM_TXSTART_FIFOLEVEL RFMTXStart = 0x00 // When FIFO threshold is exceeded
RFM_TXSTART_FIFONOTEMPTY RFMTXStart = 0x01 // When FIFO is not empty
RFM_TXSTART_MAX RFMTXStart = 0x01 // Mask
)
const (
// Low Noise Amplifier Impedance
RFM_LNA_IMPEDANCE_50 RFMLNAImpedance = 0x00 // 50 Ohms
RFM_LNA_IMPEDANCE_100 RFMLNAImpedance = 0x01 // 100 Ohms
RFM_LNA_IMPEDANCE_MAX RFMLNAImpedance = 0x01
)
const (
// Low Noise Amplifier Gain
RFM_LNA_GAIN_AUTO RFMLNAGain = 0x00 // Gain set by internal AGC Loop
RFM_LNA_GAIN_G1 RFMLNAGain = 0x01 // Highest gain
RFM_LNA_GAIN_G2 RFMLNAGain = 0x02 // Highest gain minus 6dB
RFM_LNA_GAIN_G3 RFMLNAGain = 0x03 // Highest gain minus 12dB
RFM_LNA_GAIN_G4 RFMLNAGain = 0x04 // Highest gain minus 24dB
RFM_LNA_GAIN_G5 RFMLNAGain = 0x05 // Highest gain minus 36dB
RFM_LNA_GAIN_G6 RFMLNAGain = 0x06 // Highest gain minus 48dB
RFM_LNA_GAIN_MAX RFMLNAGain = 0x07 // Gain mask
)
const (
RFM_RXBW_CUTOFF_16 RFMRXBWCutoff = 0x00
RFM_RXBW_CUTOFF_8 RFMRXBWCutoff = 0x01
RFM_RXBW_CUTOFF_4 RFMRXBWCutoff = 0x02
RFM_RXBW_CUTOFF_2 RFMRXBWCutoff = 0x03
RFM_RXBW_CUTOFF_1 RFMRXBWCutoff = 0x04
RFM_RXBW_CUTOFF_0P5 RFMRXBWCutoff = 0x05
RFM_RXBW_CUTOFF_0P25 RFMRXBWCutoff = 0x06
RFM_RXBW_CUTOFF_0P125 RFMRXBWCutoff = 0x07
RFM_RXBW_CUTOFF_MAX RFMRXBWCutoff = RFM_RXBW_CUTOFF_0P125
)
const (
RFM_RXBW_FREQUENCY_FSK_2P6 RFMRXBWFrequency = 2<<3 | 7
RFM_RXBW_FREQUENCY_FSK_3P1 RFMRXBWFrequency = 1<<3 | 7
RFM_RXBW_FREQUENCY_FSK_3P9 RFMRXBWFrequency = 0<<3 | 7
RFM_RXBW_FREQUENCY_FSK_5P2 RFMRXBWFrequency = 2<<3 | 6
RFM_RXBW_FREQUENCY_FSK_6P3 RFMRXBWFrequency = 1<<3 | 6
RFM_RXBW_FREQUENCY_FSK_7P8 RFMRXBWFrequency = 0<<3 | 6
RFM_RXBW_FREQUENCY_FSK_10P4 RFMRXBWFrequency = 2<<3 | 5
RFM_RXBW_FREQUENCY_FSK_12P5 RFMRXBWFrequency = 1<<3 | 5
RFM_RXBW_FREQUENCY_FSK_15P6 RFMRXBWFrequency = 0<<3 | 5
RFM_RXBW_FREQUENCY_FSK_20P8 RFMRXBWFrequency = 2<<3 | 4
RFM_RXBW_FREQUENCY_FSK_25P0 RFMRXBWFrequency = 1<<3 | 4
RFM_RXBW_FREQUENCY_FSK_31P3 RFMRXBWFrequency = 0<<3 | 4
RFM_RXBW_FREQUENCY_FSK_41P7 RFMRXBWFrequency = 2<<3 | 3
RFM_RXBW_FREQUENCY_FSK_50P0 RFMRXBWFrequency = 1<<3 | 3
RFM_RXBW_FREQUENCY_FSK_62P5 RFMRXBWFrequency = 0<<3 | 3
RFM_RXBW_FREQUENCY_FSK_83P3 RFMRXBWFrequency = 2<<3 | 2
RFM_RXBW_FREQUENCY_FSK_100P0 RFMRXBWFrequency = 1<<3 | 2
RFM_RXBW_FREQUENCY_FSK_125P0 RFMRXBWFrequency = 0<<3 | 2
RFM_RXBW_FREQUENCY_FSK_166P7 RFMRXBWFrequency = 2<<3 | 1
RFM_RXBW_FREQUENCY_FSK_200P0 RFMRXBWFrequency = 1<<3 | 1
RFM_RXBW_FREQUENCY_FSK_250P0 RFMRXBWFrequency = 0<<3 | 1
RFM_RXBW_FREQUENCY_FSK_333P3 RFMRXBWFrequency = 2<<3 | 0
RFM_RXBW_FREQUENCY_FSK_400P0 RFMRXBWFrequency = 1<<3 | 0
RFM_RXBW_FREQUENCY_FSK_500P0 RFMRXBWFrequency = 0<<3 | 0
RFM_RXBW_FREQUENCY_MAX RFMRXBWFrequency = 0x1F
)
const (
RFM_RXBW_FREQUENCY_OOK_1P3 = RFM_RXBW_FREQUENCY_FSK_2P6
RFM_RXBW_FREQUENCY_OOK_1P6 = RFM_RXBW_FREQUENCY_FSK_3P1
RFM_RXBW_FREQUENCY_OOK_2P0 = RFM_RXBW_FREQUENCY_FSK_3P9
RFM_RXBW_FREQUENCY_OOK_2P6 = RFM_RXBW_FREQUENCY_FSK_5P2
RFM_RXBW_FREQUENCY_OOK_3P1 = RFM_RXBW_FREQUENCY_FSK_6P3
RFM_RXBW_FREQUENCY_OOK_3P9 = RFM_RXBW_FREQUENCY_FSK_7P8
RFM_RXBW_FREQUENCY_OOK_5P2 = RFM_RXBW_FREQUENCY_FSK_10P4
RFM_RXBW_FREQUENCY_OOK_6P3 = RFM_RXBW_FREQUENCY_FSK_12P5
RFM_RXBW_FREQUENCY_OOK_7P8 = RFM_RXBW_FREQUENCY_FSK_15P6
RFM_RXBW_FREQUENCY_OOK_10P4 = RFM_RXBW_FREQUENCY_FSK_20P8
RFM_RXBW_FREQUENCY_OOK_12P5 = RFM_RXBW_FREQUENCY_FSK_25P0
RFM_RXBW_FREQUENCY_OOK_15P6 = RFM_RXBW_FREQUENCY_FSK_31P3
RFM_RXBW_FREQUENCY_OOK_20P8 = RFM_RXBW_FREQUENCY_FSK_41P7
RFM_RXBW_FREQUENCY_OOK_25P0 = RFM_RXBW_FREQUENCY_FSK_50P0
RFM_RXBW_FREQUENCY_OOK_31P3 = RFM_RXBW_FREQUENCY_FSK_62P5
RFM_RXBW_FREQUENCY_OOK_41P7 = RFM_RXBW_FREQUENCY_FSK_83P3
RFM_RXBW_FREQUENCY_OOK_50P0 = RFM_RXBW_FREQUENCY_FSK_100P0
RFM_RXBW_FREQUENCY_OOK_62P5 = RFM_RXBW_FREQUENCY_FSK_125P0
RFM_RXBW_FREQUENCY_OOK_83P3 = RFM_RXBW_FREQUENCY_FSK_166P7
RFM_RXBW_FREQUENCY_OOK_100P0 = RFM_RXBW_FREQUENCY_FSK_200P0
RFM_RXBW_FREQUENCY_OOK_125P0 = RFM_RXBW_FREQUENCY_FSK_250P0
RFM_RXBW_FREQUENCY_OOK_166P7 = RFM_RXBW_FREQUENCY_FSK_333P3
RFM_RXBW_FREQUENCY_OOK_200P0 = RFM_RXBW_FREQUENCY_FSK_400P0
RFM_RXBW_FREQUENCY_OOK_250P0 = RFM_RXBW_FREQUENCY_FSK_500P0
)
////////////////////////////////////////////////////////////////////////////////
// RFM69 STRINGIFY
func (m RFMMode) String() string {
switch m {
case RFM_MODE_SLEEP:
return "RFM_MODE_SLEEP"
case RFM_MODE_STDBY:
return "RFM_MODE_STDBY"
case RFM_MODE_FS:
return "RFM_MODE_FS"
case RFM_MODE_TX:
return "RFM_MODE_TX"
case RFM_MODE_RX:
return "RFM_MODE_RX"
default:
return "[?? Invalid RFMMode value]"
}
}
func (m RFMDataMode) String() string {
switch m {
case RFM_DATAMODE_PACKET:
return "RFM_DATAMODE_PACKET"
case RFM_DATAMODE_CONTINUOUS_NOSYNC:
return "RFM_DATAMODE_CONTINUOUS_NOSYNC"
case RFM_DATAMODE_CONTINUOUS_SYNC:
return "RFM_DATAMODE_CONTINUOUS_SYNC"
default:
return "[?? Invalid RFMDataMode value]"
}
}
func (m RFMModulation) String() string {
switch m {
case RFM_MODULATION_FSK:
return "RFM_MODULATION_FSK"
case RFM_MODULATION_FSK_BT_1P0:
return "RFM_MODULATION_FSK_BT_1P0"
case RFM_MODULATION_FSK_BT_0P5:
return "RFM_MODULATION_FSK_BT_0P5"
case RFM_MODULATION_FSK_BT_0P3:
return "RFM_MODULATION_FSK_BT_0P3"
case RFM_MODULATION_OOK:
return "RFM_MODULATION_OOK"
case RFM_MODULATION_OOK_BR:
return "RFM_MODULATION_OOK_BR"
case RFM_MODULATION_OOK_2BR:
return "RFM_MODULATION_OOK_2BR"
default:
return "[?? Invalid RFMModulation value]"
}
}
func (f RFMPacketFormat) String() string {
switch f {
case RFM_PACKET_FORMAT_FIXED:
return "RFM_PACKET_FORMAT_FIXED"
case RFM_PACKET_FORMAT_VARIABLE:
return "RFM_PACKET_FORMAT_VARIABLE"
default:
return "[?? Invalid RFMPacketFormat value]"
}
}
func (c RFMPacketCoding) String() string {
switch c {
case RFM_PACKET_CODING_NONE:
return "RFM_PACKET_CODING_NONE"
case RFM_PACKET_CODING_MANCHESTER:
return "RFM_PACKET_CODING_MANCHESTER"
case RFM_PACKET_CODING_WHITENING:
return "RFM_PACKET_CODING_WHITENING"
default:
return "[?? Invalid RFMPacketCoding value]"
}
}
func (f RFMPacketFilter) String() string {
switch f {
case RFM_PACKET_FILTER_NONE:
return "RFM_PACKET_FILTER_NONE"
case RFM_PACKET_FILTER_NODE:
return "RFM_PACKET_FILTER_NODE"
case RFM_PACKET_FILTER_BROADCAST:
return "RFM_PACKET_FILTER_BROADCAST"
default:
return "[?? Invalid RFMPacketFilter value]"
}
}
func (c RFMPacketCRC) String() string {
switch c {
case RFM_PACKET_CRC_OFF:
return "RFM_PACKET_CRC_OFF"
case RFM_PACKET_CRC_AUTOCLEAR_OFF:
return "RFM_PACKET_CRC_AUTOCLEAR_OFF"
case RFM_PACKET_CRC_AUTOCLEAR_ON:
return "RFM_PACKET_CRC_AUTOCLEAR_ON"
default:
return "[?? Invalid RFMPacketCRC value]"
}
}
func (m RFMAFCMode) String() string {
switch m {
case RFM_AFCMODE_OFF:
return "RFM_AFCMODE_OFF"
case RFM_AFCMODE_ON:
return "RFM_AFCMODE_ON"
case RFM_AFCMODE_AUTOCLEAR:
return "RFM_AFCMODE_AUTOCLEAR"
default:
return "[?? Invalid RFMAFCMode value]"
}
}
func (r RFMAFCRoutine) String() string {
switch r {
case RFM_AFCROUTINE_STANDARD:
return "RFM_AFCROUTINE_STANDARD"
case RFM_AFCROUTINE_IMPROVED:
return "RFM_AFCROUTINE_IMPROVED"
default:
return "[?? Invalid RFMAFCRoutine value]"
}
}
func (v RFMTXStart) String() string {
switch v {
case RFM_TXSTART_FIFOLEVEL:
return "RFM_TXSTART_FIFOLEVEL"
case RFM_TXSTART_FIFONOTEMPTY:
return "RFM_TXSTART_FIFONOTEMPTY"
default:
return "[?? Invalid RFMTXStart value]"
}
}
func (v RFMLNAImpedance) String() string {
switch v {
case RFM_LNA_IMPEDANCE_50:
return "RFM_LNA_IMPEDANCE_50"
case RFM_LNA_IMPEDANCE_100:
return "RFM_LNA_IMPEDANCE_100"
default:
return "[?? Invalid RFMLNAImpedance value]"
}
}
func (v RFMLNAGain) String() string {
switch v {
case RFM_LNA_GAIN_AUTO:
return "RFM_LNA_GAIN_AUTO"
case RFM_LNA_GAIN_G1:
return "RFM_LNA_GAIN_G1"
case RFM_LNA_GAIN_G2:
return "RFM_LNA_GAIN_G2"
case RFM_LNA_GAIN_G3:
return "RFM_LNA_GAIN_G3"
case RFM_LNA_GAIN_G4:
return "RFM_LNA_GAIN_G4"
case RFM_LNA_GAIN_G5:
return "RFM_LNA_GAIN_G5"
case RFM_LNA_GAIN_G6:
return "RFM_LNA_GAIN_G6"
default:
return "[?? Invalid RFMLNAGain value]"
}
}
func (v RFMRXBWCutoff) String() string {
switch v {
case RFM_RXBW_CUTOFF_16:
return "RFM_RXBW_CUTOFF_16"
case RFM_RXBW_CUTOFF_8:
return "RFM_RXBW_CUTOFF_8"
case RFM_RXBW_CUTOFF_4:
return "RFM_RXBW_CUTOFF_4"
case RFM_RXBW_CUTOFF_2:
return "RFM_RXBW_CUTOFF_2"
case RFM_RXBW_CUTOFF_1:
return "RFM_RXBW_CUTOFF_1"
case RFM_RXBW_CUTOFF_0P5:
return "RFM_RXBW_CUTOFF_0P5"
case RFM_RXBW_CUTOFF_0P25:
return "RFM_RXBW_CUTOFF_0P25"
case RFM_RXBW_CUTOFF_0P125:
return "RFM_RXBW_CUTOFF_0P125"
default:
return "[?? Invalid RFMRXBWCutoff value]"
}
}
func (v RFMRXBWFrequency) String() string {
switch v {
case RFM_RXBW_FREQUENCY_FSK_2P6:
return "RFM_RXBW_FREQUENCY_FSK_2P6,RFM_RXBW_FREQUENCY_OOK_1P3"
case RFM_RXBW_FREQUENCY_FSK_3P1:
return "RFM_RXBW_FREQUENCY_FSK_3P1,RFM_RXBW_FREQUENCY_OOK_1P6"
case RFM_RXBW_FREQUENCY_FSK_3P9:
return "RFM_RXBW_FREQUENCY_FSK_3P9,RFM_RXBW_FREQUENCY_OOK_2P0"
case RFM_RXBW_FREQUENCY_FSK_5P2:
return "RFM_RXBW_FREQUENCY_FSK_5P2,RFM_RXBW_FREQUENCY_OOK_2P6"
case RFM_RXBW_FREQUENCY_FSK_6P3:
return "RFM_RXBW_FREQUENCY_FSK_6P3,RFM_RXBW_FREQUENCY_OOK_3P1"
case RFM_RXBW_FREQUENCY_FSK_7P8:
return "RFM_RXBW_FREQUENCY_FSK_7P8,RFM_RXBW_FREQUENCY_OOK_3P9"
case RFM_RXBW_FREQUENCY_FSK_10P4:
return "RFM_RXBW_FREQUENCY_FSK_10P4,RFM_RXBW_FREQUENCY_OOK_5P2"
case RFM_RXBW_FREQUENCY_FSK_12P5:
return "RFM_RXBW_FREQUENCY_FSK_12P5,RFM_RXBW_FREQUENCY_OOK_6P3"
case RFM_RXBW_FREQUENCY_FSK_15P6:
return "RFM_RXBW_FREQUENCY_FSK_15P6,RFM_RXBW_FREQUENCY_OOK_7P8"
case RFM_RXBW_FREQUENCY_FSK_20P8:
return "RFM_RXBW_FREQUENCY_FSK_20P8,RFM_RXBW_FREQUENCY_OOK_10P4"
case RFM_RXBW_FREQUENCY_FSK_25P0:
return "RFM_RXBW_FREQUENCY_FSK_25P0,RFM_RXBW_FREQUENCY_OOK_12P5"
case RFM_RXBW_FREQUENCY_FSK_31P3:
return "RFM_RXBW_FREQUENCY_FSK_31P3,RFM_RXBW_FREQUENCY_OOK_15P6"
case RFM_RXBW_FREQUENCY_FSK_41P7:
return "RFM_RXBW_FREQUENCY_FSK_41P7,RFM_RXBW_FREQUENCY_OOK_20P8"
case RFM_RXBW_FREQUENCY_FSK_50P0:
return "RFM_RXBW_FREQUENCY_FSK_50P0,RFM_RXBW_FREQUENCY_OOK_25P0"
case RFM_RXBW_FREQUENCY_FSK_62P5:
return "RFM_RXBW_FREQUENCY_FSK_62P5,RFM_RXBW_FREQUENCY_OOK_31P3"
case RFM_RXBW_FREQUENCY_FSK_83P3:
return "RFM_RXBW_FREQUENCY_FSK_83P3,RFM_RXBW_FREQUENCY_OOK_41P7"
case RFM_RXBW_FREQUENCY_FSK_100P0:
return "RFM_RXBW_FREQUENCY_FSK_100P0,RFM_RXBW_FREQUENCY_OOK_50P0"
case RFM_RXBW_FREQUENCY_FSK_125P0:
return "RFM_RXBW_FREQUENCY_FSK_125P0,RFM_RXBW_FREQUENCY_OOK_62P5"
case RFM_RXBW_FREQUENCY_FSK_166P7:
return "RFM_RXBW_FREQUENCY_FSK_166P7,RFM_RXBW_FREQUENCY_OOK_83P3"
case RFM_RXBW_FREQUENCY_FSK_200P0:
return "RFM_RXBW_FREQUENCY_FSK_200P0,RFM_RXBW_FREQUENCY_OOK_100P0"
case RFM_RXBW_FREQUENCY_FSK_250P0:
return "RFM_RXBW_FREQUENCY_FSK_250P0,RFM_RXBW_FREQUENCY_OOK_125P0"
case RFM_RXBW_FREQUENCY_FSK_333P3:
return "RFM_RXBW_FREQUENCY_FSK_333P3,RFM_RXBW_FREQUENCY_OOK_166P7"
case RFM_RXBW_FREQUENCY_FSK_400P0:
return "RFM_RXBW_FREQUENCY_FSK_400P0,RFM_RXBW_FREQUENCY_OOK_200P0"
case RFM_RXBW_FREQUENCY_FSK_500P0:
return "RFM_RXBW_FREQUENCY_FSK_500P0,RFM_RXBW_FREQUENCY_OOK_250P0"
default:
return "[?? Invalid RFMRXBFrequency value]"
}
}