Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
[submodule "lib/picolibc"]
path = lib/picolibc
url = https://github.com/keith-packard/picolibc.git
[submodule "lib/stm32-svd"]
path = lib/stm32-svd
url = https://github.com/tinygo-org/stm32-svd
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ gen-device-kendryte: build/gen-device-svd
GO111MODULE=off $(GO) fmt ./src/device/kendryte

gen-device-stm32: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/STMicro lib/cmsis-svd/data/STMicro/ src/device/stm32/
./build/gen-device-svd -source=https://github.com/tinygo-org/stm32-svd lib/stm32-svd/svd src/device/stm32/
GO111MODULE=off $(GO) fmt ./src/device/stm32


Expand Down
1 change: 1 addition & 0 deletions lib/stm32-svd
Submodule stm32-svd added at 9ec998
57 changes: 0 additions & 57 deletions src/device/stm32/stm32-moder-bitfields.go

This file was deleted.

88 changes: 0 additions & 88 deletions src/device/stm32/stm32f103xx-bitfields.go

This file was deleted.

28 changes: 0 additions & 28 deletions src/device/stm32/stm32f4-altfunc-bitfields.go

This file was deleted.

18 changes: 9 additions & 9 deletions src/machine/board_feather-stm32f405.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ var (
UART1 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART3,
AltFuncSelector: stm32.AF7_USART1_2_3,
AltFuncSelector: AF7_USART1_2_3,
}
UART2 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART6,
AltFuncSelector: stm32.AF8_USART4_5_6,
AltFuncSelector: AF8_USART4_5_6,
}
UART3 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART1,
AltFuncSelector: stm32.AF7_USART1_2_3,
AltFuncSelector: AF7_USART1_2_3,
}
UART0 = UART1
)
Expand Down Expand Up @@ -181,15 +181,15 @@ const (
var (
SPI1 = SPI{
Bus: stm32.SPI2,
AltFuncSelector: stm32.AF5_SPI1_SPI2,
AltFuncSelector: AF5_SPI1_SPI2,
}
SPI2 = SPI{
Bus: stm32.SPI3,
AltFuncSelector: stm32.AF6_SPI3,
AltFuncSelector: AF6_SPI3,
}
SPI3 = SPI{
Bus: stm32.SPI1,
AltFuncSelector: stm32.AF5_SPI1_SPI2,
AltFuncSelector: AF5_SPI1_SPI2,
}
SPI0 = SPI1
)
Expand Down Expand Up @@ -229,15 +229,15 @@ const (
var (
I2C1 = I2C{
Bus: stm32.I2C1,
AltFuncSelector: stm32.AF4_I2C1_2_3,
AltFuncSelector: AF4_I2C1_2_3,
}
I2C2 = I2C{
Bus: stm32.I2C2,
AltFuncSelector: stm32.AF4_I2C1_2_3,
AltFuncSelector: AF4_I2C1_2_3,
}
I2C3 = I2C{
Bus: stm32.I2C1,
AltFuncSelector: stm32.AF4_I2C1_2_3,
AltFuncSelector: AF4_I2C1_2_3,
}
I2C0 = I2C1
)
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_lgt92.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
// Console UART (LPUSART1)
UART0 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.LPUSART1,
Bus: stm32.LPUART1,
AltFuncSelector: 6,
}

Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_stm32f4disco.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
UART0 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART2,
AltFuncSelector: stm32.AF7_USART1_2_3,
AltFuncSelector: AF7_USART1_2_3,
}
UART1 = &UART0
)
Expand Down Expand Up @@ -62,7 +62,7 @@ const (
var (
SPI0 = SPI{
Bus: stm32.SPI1,
AltFuncSelector: stm32.AF5_SPI1_SPI2,
AltFuncSelector: AF5_SPI1_SPI2,
}
SPI1 = &SPI0
)
6 changes: 3 additions & 3 deletions src/machine/machine_stm32_i2c.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build stm32,!stm32f103xx,!stm32f407,!stm32f7x2,!stm32l0
// +build stm32,!stm32f103,!stm32f407,!stm32f7x2,!stm32l0

package machine

Expand Down Expand Up @@ -110,10 +110,10 @@ type (
)

func (sa address7Bit) toRead() uint32 {
return uint32(((uint8(sa) << 1) | uint8(stm32.I2C_OAR1_ADD0)) & 0xFF)
return uint32(((uint8(sa) << 1) | 1) & 0xFF)
}
func (sa address7Bit) toWrite() uint32 {
return uint32(((uint8(sa) << 1) & ^(uint8(stm32.I2C_OAR1_ADD0))) & 0xFF)
return uint32((uint8(sa) << 1) & 0xFF)
}
func (sa address7Bit) bitSize() uint8 { return 7 } // 7-bit addresses

Expand Down
Loading