github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/board_nucleof103rb.go (about)

     1  //go:build nucleof103rb
     2  
     3  package machine
     4  
     5  import (
     6  	"device/stm32"
     7  	"runtime/interrupt"
     8  )
     9  
    10  const (
    11  	LED         = LED_BUILTIN
    12  	LED_BUILTIN = LED_GREEN
    13  	LED_GREEN   = PA5
    14  )
    15  
    16  const (
    17  	BUTTON      = BUTTON_USER
    18  	BUTTON_USER = PC13
    19  )
    20  
    21  // UART pins
    22  const (
    23  	UART_TX_PIN     = PA2
    24  	UART_RX_PIN     = PA3
    25  	UART_ALT_TX_PIN = PD5
    26  	UART_ALT_RX_PIN = PD6
    27  )
    28  
    29  var (
    30  	// USART2 is the hardware serial port connected to the onboard ST-LINK
    31  	// debugger to be exposed as virtual COM port over USB on Nucleo boards.
    32  	UART2  = &_UART2
    33  	_UART2 = UART{
    34  		Buffer: NewRingBuffer(),
    35  		Bus:    stm32.USART2,
    36  	}
    37  	DefaultUART = UART2
    38  )
    39  
    40  func init() {
    41  	UART2.Interrupt = interrupt.New(stm32.IRQ_USART2, _UART2.handleInterrupt)
    42  }
    43  
    44  // SPI pins
    45  const (
    46  	SPI0_SCK_PIN = PA5
    47  	SPI0_SDI_PIN = PA6
    48  	SPI0_SDO_PIN = PA7
    49  )
    50  
    51  // I2C pins
    52  const (
    53  	I2C0_SCL_PIN = PB6
    54  	I2C0_SDA_PIN = PB7
    55  )