machine: move PinMode to central location
It is always implemented exactly the same way (as an uint8) so there is no reason to implement it in each target separately. This also makes it easier to add some documentation to it.
Этот коммит содержится в:
родитель
6f61b83ad5
коммит
2f1f8fb075
14 изменённых файлов: 5 добавлений и 25 удалений
|
@ -10,6 +10,11 @@ var (
|
|||
ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
|
||||
)
|
||||
|
||||
// PinMode sets the direction and pull mode of the pin. For example, PinOutput
|
||||
// sets the pin as an output and PinInputPullup sets the pin as an input with a
|
||||
// pull-up.
|
||||
type PinMode uint8
|
||||
|
||||
type PinConfig struct {
|
||||
Mode PinMode
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinAnalog PinMode = 1
|
||||
PinSERCOM PinMode = 2
|
||||
|
|
|
@ -20,8 +20,6 @@ func CPUFrequency() uint32 {
|
|||
return 120000000
|
||||
}
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinAnalog PinMode = 1
|
||||
PinSERCOM PinMode = 2
|
||||
|
|
|
@ -8,8 +8,6 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinInput PinMode = iota
|
||||
PinInputPullup
|
||||
|
|
|
@ -21,8 +21,6 @@ var (
|
|||
ErrInvalidSPIBus = errors.New("machine: invalid SPI bus")
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinOutput PinMode = iota
|
||||
PinInput
|
||||
|
|
|
@ -11,8 +11,6 @@ func CPUFrequency() uint32 {
|
|||
return 80000000 // 80MHz
|
||||
}
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinOutput PinMode = iota
|
||||
PinInput
|
||||
|
|
|
@ -12,8 +12,6 @@ func CPUFrequency() uint32 {
|
|||
return 16000000
|
||||
}
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinInput PinMode = iota
|
||||
PinOutput
|
||||
|
|
|
@ -30,8 +30,6 @@ const (
|
|||
// Make it easier to directly write to I/O RAM.
|
||||
var ioram = (*[0x400]volatile.Register8)(unsafe.Pointer(uintptr(0x04000000)))
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
// Set has not been implemented.
|
||||
func (p Pin) Set(value bool) {
|
||||
// do nothing
|
||||
|
|
|
@ -10,8 +10,6 @@ var (
|
|||
UART0 = UART{0}
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinInput PinMode = iota
|
||||
PinOutput
|
||||
|
|
|
@ -14,7 +14,6 @@ func CPUFrequency() uint32 {
|
|||
return 390000000
|
||||
}
|
||||
|
||||
type PinMode uint8
|
||||
type fpioaPullMode uint8
|
||||
type PinChange uint8
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ func CPUFrequency() uint32 {
|
|||
return 600000000
|
||||
}
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
// GPIO
|
||||
PinInput PinMode = iota
|
||||
|
|
|
@ -13,8 +13,6 @@ var (
|
|||
ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
|
||||
PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
|
||||
|
|
|
@ -37,8 +37,6 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
const (
|
||||
PinInput PinMode = iota
|
||||
PinInputPullUp
|
||||
|
|
|
@ -17,8 +17,6 @@ const (
|
|||
portJ
|
||||
)
|
||||
|
||||
type PinMode uint8
|
||||
|
||||
// Peripheral operations sequence:
|
||||
// 1. Enable the clock to the alternate function.
|
||||
// 2. Enable clock to corresponding GPIO
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче