tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/sx126x/lora_rxtx/radio.go (about)

     1  //go:build !stm32wlx
     2  
     3  package main
     4  
     5  import (
     6  	"machine"
     7  
     8  	"tinygo.org/x/drivers/sx126x"
     9  )
    10  
    11  var (
    12  	spi                        = machine.SPI1
    13  	nssPin, busyPin, dio1Pin   = machine.GP13, machine.GP6, machine.GP7
    14  	rxPin, txLowPin, txHighPin = machine.GP9, machine.GP8, machine.GP8
    15  )
    16  
    17  func newRadioControl() sx126x.RadioController {
    18  	return sx126x.NewRadioControl(nssPin, busyPin, dio1Pin, rxPin, txLowPin, txHighPin)
    19  }
    20  
    21  func init() {
    22  	spi.Configure(machine.SPIConfig{
    23  		Mode:      0,
    24  		Frequency: 8 * 1e6,
    25  		SDO:       machine.SPI1_SDO_PIN,
    26  		SDI:       machine.SPI1_SDI_PIN,
    27  		SCK:       machine.SPI1_SCK_PIN,
    28  	})
    29  }