aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/machine_rp2_2040.go
diff options
context:
space:
mode:
authorsoypat <[email protected]>2024-12-21 12:16:37 -0300
committersoypat <[email protected]>2024-12-21 12:16:37 -0300
commit7d4baf213a070765451a1928793524e01a3360b5 (patch)
treeb72eed7d0355c4a91e4c361911fdcf0518474a16 /src/machine/machine_rp2_2040.go
parent52983794d702af7a00833ae12b0d2e7175e46017 (diff)
downloadtinygo-7d4baf213a070765451a1928793524e01a3360b5.tar.gz
tinygo-7d4baf213a070765451a1928793524e01a3360b5.zip
rp2350 cleanup: unexport internal USB and clock package variable, consts and typesrp2350-cleanup
Diffstat (limited to 'src/machine/machine_rp2_2040.go')
-rw-r--r--src/machine/machine_rp2_2040.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/machine/machine_rp2_2040.go b/src/machine/machine_rp2_2040.go
index c82b08483..484d8e923 100644
--- a/src/machine/machine_rp2_2040.go
+++ b/src/machine/machine_rp2_2040.go
@@ -46,26 +46,26 @@ const (
)
const (
- ClkGPOUT0 clockIndex = iota // GPIO Muxing 0
- ClkGPOUT1 // GPIO Muxing 1
- ClkGPOUT2 // GPIO Muxing 2
- ClkGPOUT3 // GPIO Muxing 3
- ClkRef // Watchdog and timers reference clock
- ClkSys // Processors, bus fabric, memory, memory mapped registers
- ClkPeri // Peripheral clock for UART and SPI
- ClkUSB // USB clock
- ClkADC // ADC clock
- ClkRTC // Real time clock
- NumClocks
+ clkGPOUT0 clockIndex = iota // GPIO Muxing 0
+ clkGPOUT1 // GPIO Muxing 1
+ clkGPOUT2 // GPIO Muxing 2
+ clkGPOUT3 // GPIO Muxing 3
+ clkRef // Watchdog and timers reference clock
+ clkSys // Processors, bus fabric, memory, memory mapped registers
+ clkPeri // Peripheral clock for UART and SPI
+ clkUSB // USB clock
+ clkADC // ADC clock
+ clkRTC // Real time clock
+ numClocks
)
-func CalcClockDiv(srcFreq, freq uint32) uint32 {
+func calcClockDiv(srcFreq, freq uint32) uint32 {
// Div register is 24.8 int.frac divider so multiply by 2^8 (left shift by 8)
return uint32((uint64(srcFreq) << 8) / uint64(freq))
}
type clocksType struct {
- clk [NumClocks]clockType
+ clk [numClocks]clockType
resus struct {
ctrl volatile.Register32
status volatile.Register32
@@ -180,9 +180,9 @@ func irqSetMask(mask uint32, enabled bool) {
}
func (clks *clocksType) initRTC() {
- // ClkRTC = pllUSB (48MHz) / 1024 = 46875Hz
- clkrtc := clks.clock(ClkRTC)
- clkrtc.configure(0, // No GLMUX
+ // clkRTC = pllUSB (48MHz) / 1024 = 46875Hz
+ crtc := clks.clock(clkRTC)
+ crtc.configure(0, // No GLMUX
rp.CLOCKS_CLK_RTC_CTRL_AUXSRC_CLKSRC_PLL_USB,
48*MHz,
46875)