Fish and Pond

Think of your mind like a pond full of fish and each fish is a feeling. Try to be the pond, not the fish. Life is nothing but time given to us, short or long. For all of us, a day is long and a year is short. We use our days to trade for years. We trade our time for food, clothes, houses and cars. In the end, time is the only thing we do not have....

March 6, 2022 · 1 min · un01s

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

Cron is fun

March 2, 2022 · 0 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