Replies: 1 comment 2 replies
-
You almost had it. bus.device
--cs=gpio.Pin 15
--frequency=10_000_000 When an argument is on a separate line, then it doesn't need the parentheses. The bus.device
--cs=gpio.Pin // Error: pin needs an argument.
15 // Error: device doesn't take any unnamed argument.
--frequency=10_000_000 Basically, the compiler couldn't know that the 15 was for the Minor note: for simplicity the documentation allocates the pin directly and doesn't hold on to it. This means that there is no way to close it at a later point. It would be cleaner to cs := gpio.Pin 15
device := bus.device --cs=cs --frequency=10_000_000
try:
...
finally:
device.close
cs.close I wouldn't start with this, though. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hardware Setup (ESP32-C3):
MISO: GPIO5
MOSI: GPIO6
CLK: GPIO10
CS: GPIO4
Sensor: MAX31865 (PT1000 temperature sensor)
Attempted SPI Syntax Variations:
Error:
sensor := bus.device --cs=gpio.Pin 4 --frequency=1_000_000
Errors:
Found Documentation:
Official Toit Docs:
Show bus.device --cs=gpio.Pin 15 --frequency=10_000_000
But: Compiler doesn't accept this syntax!
Needed: Correct syntax for bus.device with CS pin and frequency parameters!
Beta Was this translation helpful? Give feedback.
All reactions