
These all-caps constants aren't in the Go style, so rename it to CPUFrequency (which is more aligned with Go style). Additionally, make it a function so that it is possible to add support for changing the frequency in the future. Tested by running `make smoketest`. None of the outputs did change.
27 строки
401 Б
Go
27 строки
401 Б
Go
// +build arduino
|
|
|
|
package machine
|
|
|
|
// Return the current CPU frequency in hertz.
|
|
func CPUFrequency() uint32 {
|
|
return 16000000
|
|
}
|
|
|
|
// LED on the Arduino
|
|
const LED Pin = 13
|
|
|
|
// ADC on the Arduino
|
|
const (
|
|
ADC0 Pin = 0
|
|
ADC1 Pin = 1
|
|
ADC2 Pin = 2
|
|
ADC3 Pin = 3
|
|
ADC4 Pin = 4 // Used by TWI for SDA
|
|
ADC5 Pin = 5 // Used by TWI for SCL
|
|
)
|
|
|
|
// UART pins
|
|
const (
|
|
UART_TX_PIN Pin = 1
|
|
UART_RX_PIN Pin = 0
|
|
)
|