Skip to content

Commit 586c88e

Browse files
committed
Move RP2 clock settings into structure, with machine default
* Addresses #4673: input oscillator frequency can be changed for an individual board by filling in a custom PLL configuration
1 parent b700e4b commit 586c88e

27 files changed

+110
-109
lines changed

src/machine/board_ae_rp2040.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ const (
3131
GP27 Pin = GPIO27
3232
GP28 Pin = GPIO28
3333
GP29 Pin = GPIO29
34-
35-
// Onboard crystal oscillator frequency, in MHz.
36-
xoscFreq = 12 // MHz
3734
)
3835

36+
// System clock configuration
37+
var clockCfg = defaultSystemClockCfg
38+
3939
// I2C Default pins on Raspberry Pico.
4040
const (
4141
I2C0_SDA_PIN = GP4

src/machine/board_badger2040-w.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ SPI0_CS_PIN Pin = QSPI_CS
6868
*/
6969
)
7070

71-
// Onboard crystal oscillator frequency, in MHz.
72-
const (
73-
xoscFreq = 12 // MHz
74-
)
71+
// System clock configuration
72+
var clockCfg = defaultSystemClockCfg
7573

7674
// USB CDC identifiers
7775
const (

src/machine/board_badger2040.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ SPI0_CS_PIN Pin = QSPI_CS
6767
*/
6868
)
6969

70-
// Onboard crystal oscillator frequency, in MHz.
71-
const (
72-
xoscFreq = 12 // MHz
73-
)
70+
// System clock configuration
71+
var clockCfg = defaultSystemClockCfg
7472

7573
// USB CDC identifiers
7674
const (

src/machine/board_challenger_rp2040.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ package machine
44

55
const (
66
LED = GPIO24
7-
8-
// Onboard crystal oscillator frequency, in MHz.
9-
xoscFreq = 12 // MHz
107
)
118

9+
// System clock configuration
10+
var clockCfg = defaultSystemClockCfg
11+
1212
// GPIO Pins
1313
const (
1414
D5 = GPIO2

src/machine/board_feather_rp2040.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
package machine
44

5-
// Onboard crystal oscillator frequency, in MHz.
6-
const xoscFreq = 12 // MHz
5+
// System clock configuration
6+
var clockCfg = defaultSystemClockCfg
77

88
// GPIO Pins
99
const (

src/machine/board_gopher-badge.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ const (
6161
SPI1_SDI_PIN Pin = NoPin
6262
)
6363

64-
// Onboard crystal oscillator frequency, in MHz.
65-
const (
66-
xoscFreq = 12 // MHz
67-
)
64+
// System clock configuration
65+
var clockCfg = defaultSystemClockCfg
6866

6967
// USB CDC identifiers
7068
const (

src/machine/board_kb2040.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
package machine
44

5-
// Onboard crystal oscillator frequency, in MHz.
6-
const xoscFreq = 12 // MHz
5+
// System clock configuration
6+
var clockCfg = defaultSystemClockCfg
77

88
// GPIO Pins
99
const (

src/machine/board_macropad-rp2040.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ package machine
44

55
const (
66
NeopixelCount = 12
7-
8-
// Onboard crystal oscillator frequency, in MHz.
9-
xoscFreq = 12 // MHz
107
)
118

9+
// System clock configuration
10+
var clockCfg = defaultSystemClockCfg
11+
1212
const (
1313
SWITCH = GPIO0
1414
BUTTON = GPIO0

src/machine/board_nano-rp2040.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,8 @@ const (
9595
NINA_SOFT_FLOWCONTROL = false
9696
)
9797

98-
// Onboard crystal oscillator frequency, in MHz.
99-
const (
100-
xoscFreq = 12 // MHz
101-
)
98+
// System clock configuration
99+
var clockCfg = defaultSystemClockCfg
102100

103101
// USB CDC identifiers
104102
// https://github.com/arduino/ArduinoCore-mbed/blob/master/variants/NANO_RP2040_CONNECT/pins_arduino.h

src/machine/board_pico.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ const (
3333

3434
// Onboard LED
3535
LED Pin = GPIO25
36-
37-
// Onboard crystal oscillator frequency, in MHz.
38-
xoscFreq = 12 // MHz
3936
)
4037

38+
// System clock configuration
39+
var clockCfg = defaultSystemClockCfg
40+
4141
// I2C Default pins on Raspberry Pico.
4242
const (
4343
I2C0_SDA_PIN = GP4

0 commit comments

Comments
 (0)