all: do not use machine.TWI_FREQ_* constants

These constants were always a bit weird:

  * they use an uncommon name (TWI instead of I2C)
  * they don't follow Go naming conventions (CamelCase)
  * the constants don't provide much value: their name is their value
    (100KHZ => 100e3).

Therefore, I propose we remove them and replace them with regular
numeric constants.
This commit is contained in:
Ayke van Laethem
2021-02-06 11:21:37 +01:00
parent c64d7920dc
commit 16d2b71820
6 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ var (
func main() {
i2c.Configure(machine.I2CConfig{Frequency: machine.TWI_FREQ_400KHZ})
i2c.Configure(machine.I2CConfig{Frequency: 400e3})
sensor.Configure()
for {
+1 -1
View File
@@ -14,7 +14,7 @@ func main() {
// use 3.3V (and may be damaged by 5V).
machine.I2C0.Configure(machine.I2CConfig{
Frequency: machine.TWI_FREQ_400KHZ,
Frequency: 400e3,
})
lcd := hd44780i2c.New(machine.I2C0, 0x27) // some modules have address 0x3F
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func main() {
err := machine.I2C0.Configure(machine.I2CConfig{
Frequency: machine.TWI_FREQ_400KHZ,
Frequency: 400e3,
})
if err != nil {
panic(err)
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func main() {
err := machine.I2C0.Configure(machine.I2CConfig{
Frequency: machine.TWI_FREQ_400KHZ,
Frequency: 400e3,
})
if err != nil {
panic(err)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
func main() {
machine.I2C0.Configure(machine.I2CConfig{
Frequency: machine.TWI_FREQ_400KHZ,
Frequency: 400e3,
})
display := ssd1306.NewI2C(machine.I2C0)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func main() {
machine.I2C0.Configure(machine.I2CConfig{
Frequency: machine.TWI_FREQ_400KHZ,
Frequency: 400e3,
})
thermo := tmp102.New(machine.I2C0)