mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
b3da00ac1f
Similar to PWM, I2C can only be used on some pins. To automatically generate this information per board, we need to add extra comments that can then be interpreted by doc-gen for the tinygo.org website.
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
//go:build avr && atmega328pb
|
|
|
|
package machine
|
|
|
|
// Return the current CPU frequency in hertz.
|
|
func CPUFrequency() uint32 {
|
|
return 16000000
|
|
}
|
|
|
|
const (
|
|
// Note: start at port B because there is no port A.
|
|
portB Pin = iota * 8
|
|
portC
|
|
portD
|
|
portE
|
|
)
|
|
|
|
const (
|
|
PB0 = portB + 0
|
|
PB1 = portB + 1 // peripherals: Timer1 channel A
|
|
PB2 = portB + 2 // peripherals: Timer1 channel B
|
|
PB3 = portB + 3 // peripherals: Timer2 channel A
|
|
PB4 = portB + 4
|
|
PB5 = portB + 5
|
|
PB6 = portB + 6
|
|
PB7 = portB + 7
|
|
PC0 = portC + 0
|
|
PC1 = portC + 1
|
|
PC2 = portC + 2
|
|
PC3 = portC + 3
|
|
PC4 = portC + 4 // peripherals: I2C0 SDA
|
|
PC5 = portC + 5 // peripherals: I2C0 SCL
|
|
PC6 = portC + 6
|
|
PC7 = portC + 7
|
|
PD0 = portD + 0
|
|
PD1 = portD + 1
|
|
PD2 = portD + 2
|
|
PD3 = portD + 3 // peripherals: Timer2 channel B
|
|
PD4 = portD + 4
|
|
PD5 = portD + 5 // peripherals: Timer0 channel B
|
|
PD6 = portD + 6 // peripherals: Timer0 channel A
|
|
PD7 = portD + 7
|
|
PE0 = portE + 0 // peripherals: I2C1 SDA
|
|
PE1 = portE + 1 // peripherals: I2C1 SCL
|
|
PE2 = portE + 2
|
|
PE3 = portE + 3
|
|
PE4 = portE + 4
|
|
PE5 = portE + 5
|
|
PE6 = portE + 6
|
|
PE7 = portE + 7
|
|
)
|