@@ -309,6 +309,33 @@ func (d *Device) SetDioIrqParams(irqMask, dio1Mask, dio2Mask, dio3Mask uint16) {
309309 d .ExecSetCommand (SX126X_CMD_SET_DIO_IRQ_PARAMS , p [:])
310310}
311311
312+ // SetDio2AsRfSwitchCtrl configures if DIO2 is used to control an external RF switch.
313+ // When controlling the external RX switch, the pin DIO2 will toggle according to
314+ // the internal state machine (DIO2 = 0 in SLEEP, STDBY_RX, STDBY_XOSC, FS and RX modes,
315+ // DIO2 = 1 in TX mode). Otherwise DIO2 is free to be used as an IRQ.
316+ func (d * Device ) SetDio2AsRfSwitchCtrl (enable bool ) {
317+ p := [1 ]uint8 {SX126X_DIO2_AS_IRQ }
318+ if enable {
319+ p [0 ] = SX126X_DIO2_AS_RF_SWITCH
320+ }
321+ d .ExecSetCommand (SX126X_CMD_SET_DIO2_AS_RF_SWITCH_CTRL , p [:])
322+ }
323+
324+ // SetDio3AsTcxoCtrl configures the DIO3 as an external TCXO voltage reference.
325+ // After TCXO control is set, it is recommended to perform full calibration (CALIBRATE_ALL command).
326+ // voltage: output voltage on DIO3 pin
327+ // delay: time for the TCXO to stabilize
328+ func (d * Device ) SetDio3AsTcxoCtrl (voltage Dio3OutputVoltage , delay time.Duration ) {
329+ timeout := delay / (15625 * time .Nanosecond )
330+ var p [5 ]uint8
331+ p [0 ] = uint8 (voltage )
332+ p [1 ] = uint8 ((timeout >> 24 ) & 0xFF )
333+ p [2 ] = uint8 ((timeout >> 16 ) & 0xFF )
334+ p [3 ] = uint8 ((timeout >> 8 ) & 0xFF )
335+ p [4 ] = uint8 ((timeout >> 0 ) & 0xFF )
336+ d .ExecSetCommand (SX126X_CMD_SET_DIO3_AS_TCXO_CTRL , p [:])
337+ }
338+
312339// GetIrqStatus returns IRQ status
313340func (d * Device ) GetIrqStatus () (irqStatus uint16 ) {
314341 r := d .ExecGetCommand (SX126X_CMD_GET_IRQ_STATUS , 2 )
0 commit comments