Toit Imports

Toitlang uses import to use code from other libraries. local import starting with . $ tree . └── my_lib ├── my_lib.toit ├── other.toit └── sub └── sub.toit Assume we are importing sub.toit into my_lib.toit. import .sub.sub Shorten version: import .sub global import import math Then for customizations, import math as m import math show sin cos

March 3, 2022 · 1 min · un01s

Reading Toit Code (002)

After toit_start(), we have toit_esp32.cc to read. The first one is toit::start(). Toit here is just a namespace. As we know that toit supports OTA (over-the-air update) through WiFi and esp32 device is set to be a station (STA instead of AP). What we have here is as follows: RtcMemory::set_up(); FlashRegistry::set_up(); OS::set_up(); esp_partition_find_first(); setup_program(support_ota); Scheduler::ExitState exit_state; VM vm; vm.load_platform_event_sources(); int groud_id = vm.scheduler()->next_group_id(); exit_state = vm.scheduler()->run_boot_program(program, null, group_id); OS::tear_down(); FlashRegistry::tear_down(); After these, esp32 may go to deep sleep....

March 1, 2022 · 1 min · un01s

Reading Toit Code (001)

When I started to port the code to ESP32S3 following the example of ESP32C3, I realized I had to read the code closely. Here are the notes along the way. Where does the code get started on esp32? Based on esp-idf, Toit (I like to pronounce it as tight) creates a new platform with a new programming language for developers. For the code to start on the esp32 device, check all the files inside toolchains/esp32/....

February 25, 2022 · 1 min · un01s

Use Jaguar to update

Use an Airport to setup a WiFi network. Then download the binary of Jaguar. Run the following commands one after another. The second command requires the WiFi credentials. Use CTRL+C to stop the third one. To run the forth and the fifth command, put your computer on the same WiFi network as the esp32 device. $./jag setup $./jag flash $./jag monitor $./jag scan $./jag run hello.toit

January 17, 2022 · 1 min · un01s

Toit on m5core2

Build some examples in toit and flash it to M5Core2. There is no problem to follow the steps in one toit discussion. While trying the step4 for ft63xx. Found a typo in package.yaml. mpu6886 should be ft63xx. Another issue is that the touch seems not working after unplugging the USB cable. Will investigate further. Will try jaguar tool later.

January 15, 2022 · 1 min · un01s