Skip to content

Commit f52ecf3

Browse files
aykevldeadprogram
authored andcommitted
machine: use NoPin constant where appropriate
In some cases, regular integers were used. But we have a constant to explicitly say these pins are undefined: `NoPin`. So use this. A better solution would be to not require these constants, like with the proposal in #3152. This change is just a slight improvement over the current state.
1 parent 725864d commit f52ecf3

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/machine/board_macropad-rp2040.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const (
5252
I2C0_SDA_PIN = GPIO20
5353
I2C0_SCL_PIN = GPIO21
5454

55-
I2C1_SDA_PIN = 31 // not pinned out
56-
I2C1_SCL_PIN = 31 // not pinned out
55+
I2C1_SDA_PIN = NoPin // not pinned out
56+
I2C1_SCL_PIN = NoPin // not pinned out
5757
)
5858

5959
// SPI default pins
@@ -65,9 +65,9 @@ const (
6565
// Default Serial In Bus 1 for SPI communications
6666
SPI1_SDI_PIN = GPIO28 // Rx
6767

68-
SPI0_SCK_PIN = 31 // not pinned out
69-
SPI0_SDO_PIN = 31 // not pinned out
70-
SPI0_SDI_PIN = 31 // not pinned out
68+
SPI0_SCK_PIN = NoPin // not pinned out
69+
SPI0_SDO_PIN = NoPin // not pinned out
70+
SPI0_SDI_PIN = NoPin // not pinned out
7171
)
7272

7373
// UART pins

src/machine/board_mdbt50qrx.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const (
1818

1919
// MDBT50Q-RX dongle does not have pins broken out for the peripherals below,
2020
// however the machine_nrf*.go implementations of I2C/SPI/etc expect the pin
21-
// constants to be defined, so we are defining them all as 0
21+
// constants to be defined, so we are defining them all as NoPin
2222
const (
23-
UART_TX_PIN = 0
24-
UART_RX_PIN = 0
25-
SDA_PIN = 0
26-
SCL_PIN = 0
27-
SPI0_SCK_PIN = 0
28-
SPI0_SDO_PIN = 0
29-
SPI0_SDI_PIN = 0
23+
UART_TX_PIN = NoPin
24+
UART_RX_PIN = NoPin
25+
SDA_PIN = NoPin
26+
SCL_PIN = NoPin
27+
SPI0_SCK_PIN = NoPin
28+
SPI0_SDO_PIN = NoPin
29+
SPI0_SDI_PIN = NoPin
3030
)
3131

3232
// USB CDC identifiers

0 commit comments

Comments
 (0)