Switch default frequency to 4MHz

Let's use the same default frequency everywhere, for consistency.
It could be any frequency, but 4MHz is already used for other chips and
it seems like a reasonable frequency to me (not too fast for most chips
but still reasonably fast). Oh, and 4MHz is slow enough that it can be
inspected by a Saleae Logic 4 (that sadly has been discontinued).
This commit is contained in:
Ayke van Laethem
2020-10-18 20:34:07 +02:00
committed by Ron Evans
parent 47dc76fc34
commit 06564cbdb2
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ type SPIConfig struct {
// Configure and make the SPI peripheral ready to use.
func (spi SPI) Configure(config SPIConfig) error {
if config.Frequency == 0 {
config.Frequency = 1e6 // default to 1MHz
config.Frequency = 4e6 // default to 4MHz
}
// Configure the SPI clock. This assumes a peripheral clock of 80MHz.
+1 -1
View File
@@ -123,7 +123,7 @@ func (spi SPI) Configure(config SPIConfig) error {
// set default frequency
if config.Frequency == 0 {
config.Frequency = 4000000
config.Frequency = 4000000 // 4MHz
}
// div = (SPI_CFG(dev)->f_sys / (2 * frequency)) - 1;
+1 -1
View File
@@ -442,7 +442,7 @@ func (spi SPI) Configure(config SPIConfig) error {
// Set default frequency.
if config.Frequency == 0 {
config.Frequency = 500000
config.Frequency = 4000000 // 4MHz
}
baudr := CPUFrequency() / config.Frequency