I want to run my ESP32-board with a battery. To get more battery life, I wanted to read values from sensors when the device is in deepsleep via the UltraLow Coprocessor.
Is that possible in Micropython without writing assembly code?
How to read from sensors with ULP in deepsleep?
-
- Posts: 6
- Joined: Sun Jan 27, 2019 11:50 am
Re: How to read from sensors with ULP in deepsleep?
No, you still have to write ULP assembly code unfortunately.
However, it is somewhat easier to use ULP in MicroPython since it's possible to compile ULP assembly at runtime with Thomas Waldmann's py-esp-ulp MicroPython library. This simplifies the build process a little.
There has been some discussion around allowing some subset of MicroPython to target ULP assembly (with a particular decorator over a function perhaps?) but this is quite a lot of work for not a lot of value. The ULP directives are quite primitive so it would be an awkward compilation step from Python to ULP.
So yeah, right now it's still some work figuring out how to use the obscure ULP syntax to interact with your sensors...
However, it is somewhat easier to use ULP in MicroPython since it's possible to compile ULP assembly at runtime with Thomas Waldmann's py-esp-ulp MicroPython library. This simplifies the build process a little.
There has been some discussion around allowing some subset of MicroPython to target ULP assembly (with a particular decorator over a function perhaps?) but this is quite a lot of work for not a lot of value. The ULP directives are quite primitive so it would be an awkward compilation step from Python to ULP.
So yeah, right now it's still some work figuring out how to use the obscure ULP syntax to interact with your sensors...