Files
tinygo/src/machine/machine_nrf52840_simulator.go
T
Ayke van Laethem edaf877056 machine: use pointer receiver in simulated PWM peripherals
I only discovered this issue after a while. All the baremetal PWM
implementations use pointers to a PWM instance, instead of the PWM
instance itself. For consistency (and because it's a better idea in
general), the simulated PWMs need to work the same.
2025-05-01 15:08:08 +02:00

61 lines
1.4 KiB
Go

//go:build !baremetal && (bluemicro840 || circuitplay_bluefruit || clue_alpha || feather_nrf52840_sense || feather_nrf52840 || itsybitsy_nrf52840 || mdbt50qrx || nano_33_ble || nicenano || nrf52840_mdk || particle_3rd_gen || pca10056 || pca10059 || rak4631 || reelboard || xiao_ble)
// Simulator support for nrf52840 based boards.
package machine
// Channel values below are nil, so that they get filled in on the first use.
// This is the same as what happens on baremetal.
var PWM0 = &timerType{
instance: 0,
frequency: 16e6,
bits: 15,
prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128},
channelPins: [][]Pin{
nil, // channel 0
nil, // channel 1
nil, // channel 2
nil, // channel 3
},
}
var PWM1 = &timerType{
instance: 1,
frequency: 16e6,
bits: 15,
prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128},
channelPins: [][]Pin{
nil, // channel 0
nil, // channel 1
nil, // channel 2
nil, // channel 3
},
}
var PWM2 = &timerType{
instance: 2,
frequency: 16e6,
bits: 15,
prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128},
channelPins: [][]Pin{
nil, // channel 0
nil, // channel 1
nil, // channel 2
nil, // channel 3
},
}
var PWM3 = &timerType{
instance: 3,
frequency: 16e6,
bits: 15,
prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128},
channelPins: [][]Pin{
nil, // channel 0
nil, // channel 1
nil, // channel 2
nil, // channel 3
},
}