Monday, October 21, 2024
23,000 days
Today, it is 23,000 days ago that I was born. I decided to celebrate this special day by treat my colleagues on (small) cake. On Tuesday, January 25, 2022, I celebrated that I was 22,000 days old. On Sunday, 18 July 2027, I will be 24,000 days old.Thursday, October 17, 2024
Links
- Finding all convex tangrams
- Van Der Poel 3D Wooden Brain Teaser Puzzle Solution
- 3D-Puzzle Van der Poel
- Willem van der Poel
Wednesday, October 16, 2024
Mushrooms on tree stump
This morning, just before leaving for work, I took some photographs in our backgarden of the mushrooms that appeared on the tree stump of the chestnut tree that we cut down two years ago. I have no idea what kind of mushroom it is, but I guess that it is a member of the family of polyporacae.Monday, October 14, 2024
C/2023 A3 (Tsuchinshan-ATLAS)
This evening, Conny and I biked to the country road called Borweg. (This road is named after a stronghold build by an Italian named Bernardino Cernaego who married Anna van Scheven as is mentioned on May 20, 1585.) We went there in the hope to catch a glimse of the comet C/2023 A3 (Tsuchinshan-ATLAS). When we arrived it was too light at the horizon. After some time, I thought to see a faint light with some line going up to the left. I took some pictures, one of which is shown below, in which the faint light of the comet is visible.Sunday, October 13, 2024
Wind direction graph
I noticed that the wind direction graph that is shown when you select 'Expertpluim' at the Weer- en klimaatpluim en Expertpluim page on the website of the Royal Netherlands Meteorological Institute, now has been improved like I did on July 29, 2022. I noticed that they did not use the solution (more a hack) that I used on my page. I have not figured out how they implemented it. Maybe there is now an option in the HighChart library for this.Saturday, October 12, 2024
Going into the city
When I biked on the road called Spoordijkstraat, which means railroad dike, I noticed some plants growing up against the sheet pile that was installed in the past year for the bike 'highway' running from Hengelo to Enschede. The YouTube video Bouwteamproject Aanleg F35, traject: Twekkelerzoom - Centraal station, Enschede shows an animation of the design of the bike path and the sheet pile starting from 0:59. Below one of the pictures I took.
At 13:44:26, I bought the booklet AKI Schilderlichting 2008 written by Joris Geurts, Kars Persoon, Kees Smits, and Elly Strik in Dutch and German, and published by AKI-ArtEZ Enschede in 2008 from Het Goed for € 0.50.
At TETEM art space, I saw the Model Collapse exhibition by Cyanne van den Houten and Ymer Marinus, who are part of the Telemagic collective. Before I entered the immersive exhibition, I was told that the exhibition is not about AI, as the title of it refers to concept of model collapse, but about how to get an AI like ChatGPT, but about how to get there. According to the description it 'depict the landscape from which generative AI emerges. Revealing its self-consuming origins in extraction of the earth's resources and data through relics, artifacts and stories from the past.' I was anticipating to learn some more about how these Large Language Models are created, but when I entered the exhibition I was a bit confused about it. There was a large screen with some text and about ten statue like objects with lights, buttons and displays. On was covered with a small displays that I found quite interesting.
At Fotogalerie Objectief, I saw the exhibition People Matter with photographs by Peter van Tuil and Frans Rentlink. From Peter van Tuil there were photographs from his books Ergens: Malaga 2023 and HUIS & HABITAT: Pieter en WillyPeter. The later is about the reclusive artist Pieter Derksen. Ingrid Hendriksen also took pictures of him with some text in English, which can be viewed at: (At home with Pieter Derksen: The reclusive artist. Frans Rentlink had a series of portrets of the surrealistic painter Charles du Bois and a friend of him called Johan.
At Concordia, it was quite busy with people visiting the Sustainable Fashion Experience Enschede. I first looked in the front room, where the exhibition Joystick by Madison Bycroft (on Instagram) was held. Next, I walked around the area where Kira Fröse and Marthe Zink are working on the Doublet #6 exhibition and then I went upstairs to have a second look at the Triangle in Square, but there was someone making some recording, so I did not walk around. I felt like the video's being displayed looked different. Then I heard some singing downstairs and it turned out that the gay men's chorus Soorten & Maten were practice singing the song 'Hotel California' (if I am not mistaken) as a warm-up for the performance they were going to give later. I presume as part of the opening of the exhibition It gets better by Tim Vischer, which is part of the Rainbow Days event. I left before the opening (also not being aware when it was).
Friday, October 11, 2024
Magnolia seeds
Last Monday, I already harvested one of the berries from a seed pod that had partly opened. I kept it on my laptop. I continued checking the other pods. On Thursday morning, I closed my laptop not realizing that the berry was there. When I opened it in the evening, I noticed that it had crushed the berry and revealed the seed. I placed the seed in a small pot with potting soil. This morning, I wanted to show the pods to Conny, but when I did so, the end of the branch with the pods, broke off, probably from the location where the flower used to start. I noticed that there already where two cracks at in the two remaining pods. In the evening, I opened the cracks, took out the berries, and opened them to remove the seeds. I tasted a bit of one of the berries, but it did not taste nice. (I immediatelly wondered wether they are poisonous, but this seems not to be the case.) I potted those two seeds as well. I have wrapped the pots in plastic bags and placed them in our shed.Tuesday, October 8, 2024
Link
- luxOS is a portable work-in-progress microkernel written from scratch.
Sunday, October 6, 2024
Seed pods in magnolia
This afternoon, after we went on a walk in the neighbourhood, I spend some time trimming some bushes in the front garden with a hedge trimmer. I also did some work on the magnolia and spotted some red seed pods as can be seen in the picture below.I am thinking about when to harvest them. If I harvest them now, the seeds might not be mature enough. It looks like the fruits have not come out yet. If I wait too long, the seeds might be eaten by some birds and I will not be able to harvest the seeds. In 2013, it was on November 25 that we harvested the berries. I think, I am going to keep an eye on it for the coming week.
Saturday, October 5, 2024
Still life of the harvest
Below a still life of part of the harvest that I received this morning from Herenboeren Usseler Es or what I took from the giveaway table where other members can donate part of their harvest or where vegetables are harvested but not given out because they are too small or left over from a previous issue.The picture shows:
- A bag with some flour.
- Two fennels
- A sweet potato
- Two small pumpkins
- A red onion
- Two leeks
- Two (orange) pumpkins
- A courgette
- A red chicory (a cross between Belgian endive and Radicchio Rosso, I read somewhere)
State machines with a switch statement
While developing embedded software, you often have to deal with state machines, to implement non-blocking behaviour. If for example, one of the tasks for your embedded software is to read data from some UART and send it to another UART, you could have a function like:
void echo_infinite(UART *in, UART *out) { while (1) { while (!data_available(in)) { // wait } char ch; ch = read_byte(in); while (!ready_for_sending(out)) { // wait } write_byte(out, ch); } }
The above function will never terminate. That is no problem if that is the only thing your device has to do, but totally not acceptable, if your device has to do something else as well, for example, have a blinking LED. The traditional solution is to use a state machine and call the function implementing the state machine from the (never terminating) main loop. In case there is just one such task, one can make use of static define variables for the local variables. Otherwise, one has to define a struct for each such task and pass this as an argument. (See the page Machine independent implementation of Cooperative Multi-threading in C for how this could be done.) If you want to implement the above function echo_infinite as a state machine, you get something like::
void echo_state_machine(UART *in, UART *out) { static char ch; static int state = 0; switch (state) { case 0: if (data_available(in)) { ch = read_byte(in); state = 1; } break; case 1: if (ready_for_sending(out)) { write_byte(out, ch); state = 0; } break; } }
This code looks rather different from the above code. For this simple case, with only two states, it is probably not that difficult, but in case you have something like ten states, it can quickly turn into Spagetti code, that is difficult to follow, could have dupplicated code, and could have subtile bugs. In case the function implementing your task had no switch-statements and there is but one instance of your task, one could write the following code using some defines that are going to be explained below:
void echo_async(UART *in, UART *out) { START_ASYNC while (1) { while (!data_available(in)) { WAIT } static char ch; ch = read_byte(in); while (!ready_for_sending(out)) { WAIT } write_byte(out, ch); } END_ASYNC }
Notice that this code looks very much like the initial version. Note the use of static before the definition of the local variable ch. The defines one has to use, are the following:
#define START_ASYNC static int state = 0; switch (state) { case 0: #define WAIT state = __LINE__; return; case __LINE__: #define END_ASYNC }
These defines make use of the fact that the 'case' statements belonging to 'switch' statement may occur everywhere in the block following the 'switch'. In a sense, the 'switch' statement acts like a kind of 'goto' that can jump everywhere in the code belonging to it. It also makes use of the fact that the '__LINE__' macro returns the number of the current line. Note that they are replaced with the line number of the line where 'WAIT' is used, not where it is defined, according to the standard rules of how the C-preprocessor works. See the program D241005.c for an example that uses the above functions, where the functions echo_stm and echo_async are called a hunderd times, which is not always enough to print the string "Hello World!". The programs accepts a number as an argument to be used for initializing the random generator. (Find a number that makes all the functions print the whole text.) After the above two functions are called from main, the function echo_infinite is called, which never terminates, meaning that the program has to be terminated for it to end.
If one does want to use a 'switch'-statement in the code, one could use a combination of a switch statement at the start of the function and 'goto'-statements to labels matching the various places to wait. This does recuire one to number the states explicitly, which requires some additional work and bookkeeping, but it could help when implementing unit tests. When using C++, one can replace the static variables with private members of the class the method belongs to. This technique can be used to define iterators that are implemented as co-routines that yield results whenever needed. For a example, see the next method of the class InlineIncludesIterator in the program kaem_parser.cpp. For a more detailed description of all the possible ways to implement co-routines, see also: Coroutines in C.
Link
Thursday, October 3, 2024
Cutting pumpkins
Today I took pruning shears to work for the first time. After work at Herenboeren Usseler Es I helped cut and collect the pumpkins. The pruning shears were actually a bit oversized until we got to the 'family pumpkin', so called because of their size. This type of pumpkins were grown by Isabel Duinisveld from pumpkin seeds that she bought from the Marina Di Chioggia pumpkins in 2014. Isabel helped start Herenboeren Usseler Es last year.ESP32-S3 I²C
In Chapter 27 of ESP32-S3 Technical Reference Manual describes the hardware components and registers that are used for the I²C bus. (On September 2, I wrote before about I²C.) For accessing the registers from C, the include file i2c_struct.h can be used. According to Table 4-3, one has to cast the address 0x6000F000 to i2c_dev_t* to access the 'I2C Controller 0' and the address 0x60029000 to access 'I2C Controller 1'. The include file i2c_ll.h gives all kind of helper functions to registers. Section 27.5 describes how the different command registers have to be used to send read and write I²C commands. It seems that the function i2c_ll_master_write_cmd_reg can be used to set the command. This function uses a value of the type i2c_ll_hw_cmd_t, which can be used to specify the various parts of the command. For examples how this function can be called, see the files i2c.c and i2c_master.c.Link
Sunday, September 29, 2024
Hackfest: Day 2
At 11:00, I attended the lecture Building your own ISP _or_ How to become sovereign on the internet by Nick Bouwhuis (on YouTube in Dutch). At 12:00, I gave my lecture The live-bootstrap project. I spend some talking with various people including some of the makers at their booths, such as:- Marimbatron: A Digital Marimba Prototyping Project by FabLap Enschede.
- Printing - analogue and digital - WOWLab
- Firefly Zero: A modern handheld game console.
- ubports.com: Ubuntu Touch for smartphones and tablets.
On the way home, I bought some gerkins and sour herring for the curly kail hotchpotch Conny had prepared.
Links
- Feldera: Incremental Computation Engine
- GodotOceanWaves using inverse Fourier transform of directional ocean-wave spectra.
Saturday, September 28, 2024
Hackfest: Day 1
Around 12, I arrived at Hackfest, which is held here in Enschede. I met several people, I had not seen before. At 13:00, I joined the lecture You Need a Hackerspace! by Mitch Altman (on YouTube). At 14:00, I joined the lecture Introductie MQTT, Tasmota & Node-RED by Ad (CrazyA) (on YouTube, in Dutch). At 15:00, I joined the lecture Dutch (home) computer history by Bart van den Akker from Home Computer Museum (on YouTube in Dutch) with some interesting facts about the Dutch history with respect to home computers. I learned that the Netherlands was the first to have an educational television series by Teleac in 1978 about the mircoprocessor given by Chriet Titulaer. The lecture also mentioned the Aesthedes a computer graphics or computer-aided design system that was introduced to the market in 1984. I talked with some old friends and missed the first part of the lecture Ravi the theatre robot by Edwin Dertien, a very interesting talk (on YouTube). Afterwards, I talked a bit with him. The last talk, I went to see was 28 kinds of uncertainty in science and technology, by Frau Heisenberg (on YouTube in Dutch). It was not very long, but quite funny. At 19:30, I followed with half a eye, the demoscene showcase by Okkie. Between 20:30 and 22:00, I also watched the live coding for fun with TIC-80. There were four people joining in this. Some had more experience than others. It looked like fun but I do not know if I would like to join in the next time. For the recording (with music) see: HackFest Byte Jam 2024.Friday, September 27, 2024
Link
Thursday, September 26, 2024
World of Industry, Technology & Science
I visited the World of Industry, Technology & Science exhibition the Jaarbeurs in Utrecht. I spend a large part of my time there flashing firmware to the gadget of the World of Electronics, an environmental sensor with a solar cell that can be placed outside and is ready to send measurement data to openSenseMap. Visitors who had registered for the gadget had to visit a number of stands to collect the various parts and then have the firmware flashed. The gadget is build around a SMT32L072RZ and has the following sensors: temperature, humidity, a microphone (to measure sound levels), and a volatile organic compound gas sensort, with the posibility to add a SEN5x environmental sensor node for HVAC and air quality applications. I took a floor plan home.After the exhibition, I walked into the center and visited the Steven Sterk bookshop, where at 17:48, I bought the book Brieven, dagboeken en een geheime liefde with letters, diary notes, and a novel by Laurie Langenbach with an introduction by Rutger Vahl, written in Dutch and published by Singel Uitgeverijen in 2017, ISBN:9789029511834, for € 12.50.
Link
Wednesday, September 25, 2024
Link
Sunday, September 22, 2024
Japanese newspaper
Some days ago, we received a bottle of Nin Jion Pei Pa Koa that we had ordered online. It came with a box with a Japanese paper. Today, I found the link https://www.chunichi.co.jp/chuspo printed on the front page, which is the 'last' for English readers. Japanese number the pages in the reverse order. On the first pages the text on the lines runs from top to bottom and the lines run from right-to-left. On the latter pages the text on the lines runs from left-to-right with lines going top-down. The link is to the website of the Japanese paper Chunichi Shimbun. It is the issue from April 2 this year. On page 16, I recognize a sudoku puzzle. It looks like there are also a Shogi and a Majong related puzzles.Saturday, September 21, 2024
Link
Friday, September 20, 2024
Link
Thursday, September 19, 2024
Self-driving wheelchairs
Today, in the news, there was an item about self-driving wheelchairs on Amsterdam Airprot Schiphol. These are produced by WHILL Inc.. They have some repositories on GitHub. There is a repository about fiducual markers, which also has a reference to fiducuals on ROS.org. With fiducial markers placed on the ceiling, it is possible to determine the position of a wheelchair using a small camera. I also had to think about Dynamicaland where markers are used to determine the location of documents and/or cards on a table.Wednesday, September 18, 2024
Tombstone diagram for live-bootstrap
In the past weeks, I have been working on generating tombstone diagrams (or T-diagrams) for Live-bootstrap based on the output produced by strace. I have published the results here on github. You can zoom and pan with the mouse. If you click on a process (T-shaped) or a file, it will show additional information. If you click on a link in the additional information, the process or file will be centered in the diagram and highlighted with a yellow back-ground.Sunday, September 15, 2024
GOGBOT: Day 4
This afternoon, I did my last volunteer shift for this year of the GOGBOT festival. I took the role of a guard/guide at Grote Kerk (the Large Church) again, but now it was during the day instead of during the evening as on the first day. I think a different type of public came to visit the church. More elderly people and familis with young children. Going from the bright outside into a dark church caused many to not enter the mail hall of the church afraid to tripping. I told people that there were no thresholds and/or that the floor was flat. Some people, primarily young children, found the lights of the Depth Array work scarry. However, I did notice a wide range in reactions.Saturday, September 14, 2024
GOGBOT: Day 3
I again did a volunteer shift at GOGBOT handing out program flyers near the entrences. At 16:07, I bought the book P.L.A.N.E.T.A.R.T. The History of Kees de Groot and PLANETART 1978 - 2004 written by Lars van der Miesen in English and published by PLANETART Publishers in 2024, ISBN:97890903888144, from underbelly for € 20.00. It is the catalogue with the exhibition PLANETART ARCHIVES X Kees de Groot 1978-2003 and the online PLANETART Archive.Friday, September 13, 2024
GOGBOT: Day 2
This afternoon, I did my second volunteer shift at the information desk. There were not many people. I did watch Kees de Groot finish his art work. After the shift, I went to Rijksmuseum Twenthe where I (rather quickly) walked through the exhibition Gogbot x RMT (also called: The Tec Divide, where I saw the following art works:- A Bestiary of the Anthropocene, Disnovation.org, 2021.
- Technosamanic Systems: New Cosmological Models for Survival, Suzanne Treister, 2020 - Now.
- You are Light an Cabbage, Diana Gheorghiu, 2023.
- Irma Watched over by Machines, Troika, 2019.
- Forest filled with pines and electronics, Troika, 2022.
- Calculating Empires: A Genealogogy of Technology and Power, 1500 - 2025, Kate Crawford & Vladan Joler. (Very large and detailed inforgraphic.)
- Retraining Laziness, T(n)C / Tina Kult and Agnes Varnai, in collaboration with Madeline Hall, 2023.
- 564 Tracs (
Not a love songis usually a love song), Miloš Trakilovió, 2023. - A Boring Dystopia, Matthias Planitzer, 2023.
- The Materiality of a Natural Disaster, Hilda Hellström, 2012.
- SnsOnik II, Patrice "Pit" Hubert & Snsitiv Collective. (Quite interesting!)
- Breaking the News, Franc.
- Wishing Well, SasaHara, 2024.
- In Vitro (trailer), Larissa Sansour & Søren Lind. (Short film.)
- Make It Fit, Tingyi Jiang. (A performance.)
- Understanding Other(s), Julie Goslinga. (Short film)
Thursday, September 12, 2024
Books
At 13:50:19, I bought the following three books from charity shop Het Goed:- Xaveer De Geyter Architects: After-sprawl : Onderzoek naar de hedendaagse stad written by Geert Bekaert in Dutch and published by NAi Publishers in January 2002, ISBN:9789056622640,, for € 2.80.
- Don't Eat The Yellow Snow: Pop Music Wisdom written by Marcus Kraft in English and published by Laurence King Publishing in 2013, ISBN:9789063692889, for € 3.40.
- Edwin Kragten: Houtskooltekeningen 2006-2008 written by Adriën Cozijnsen in Dutch, ISBN:9789081029438, for € 1.50.
GOGBOT: Day 1
This year I am volunteering again for the GOGBOT festival. In the evening, I took the role of a guard/guide at Grote Kerk (the Large Church) where in the main hall there were two large artworks:- Depth Array by Robin Beekman, which I had already see earlier this year at Raidiant Voids on February 2. (I feel that the work did less well in the large hall of the church than it did there. Also, I feel that due to the large volumes of people that could just freely walk through the room, it would have been beter if the sequence of effects were restricted to those best showing the 'depth' effect.)
- ATEM (German for breath) by AUSGANG studio. (With an interfall of about half an hour, the work would perform some special operation for the people who got 'inside' the work. I found it a bit of a pity that it did not do this more often, because many people got dissappointed that they had to wait a long time to have an opportunity to experience it.)
Friday, September 6, 2024
Amsterdam
On the way to Amsterdam, I first visted Utrecht where I went to bookshop Steven Sterk and Aleph books. In Amsterdam, I took the Metro line M52 to Rokin and walked to bookshop Scheltema. The section with ramsj books has moved to a different location on the top floor and has been reorganized, which felt like an improvement. I few floors lower, I found the book Strange Code: Esoteric Languages That Make Programming Fun Again by Ronald T. Kneusel and when I paged through the Chapter 10, which about Brainfuck, I found my name printed on page 293 with a link to my pages about it. Next, I paid a short visited to bookshop De Slegte, walked over the open air bookmarket on Het Spui, and visited the American Book Center. From there I walked to Galerie Ron Mandos to see the exhibition Best of Graduates 2024. I found the works of the following graduates noteworthy in the order I saw them:- Juwan Moon
- Pieke Pleijers
- Tijn Gerards
- Lea van Vlodrop
- Mayte Breed
- Sabine Woudenberg
- Katarzyna Baldyga
- Jens Buis
- Paula Miuh
- Rafaëlla Witteman
- Michał Kucharski
- Sam Reekers
- Miranda Devita Kistler
- Amber Schaafsma
- Josquin van Elburg
- Jesse Andriesse
- Martijn Verzijl
Next, I walked to gallery andriesse & eyck to see the exhibition Colour Changes in Two and Three Dimensions 1979-2014 with works by Peter Struycken. Besides Peter Struycken, I talked with several people who I already knew. I also met with the artist Wilfried Lansink.
Thursday, September 5, 2024
Chestnut and musterd seeds
At 12:19, Conny gave my a large chestnut she just found on the street. This evening, I went to Herenboeren Usserler Es to help, with about twenty other members, to harvest the musterd seeds. We had to strip the pods with the seeds from the leaves and break open the pods. We used some sieves to seperate the seeds from the pods and bits of branches. The result needed more processing. We guessed that we had harvest about 4 kilo of musterd seeds. We were also allowed to get ourselves some buckwheat plants. They did not contain much seeds and might need some more time before they are to be harvest.Wednesday, September 4, 2024
Hokuyo URG-04LX-UGO01 lidar
I am trying to get some data from a URG-04LX-UG01, which is a URG-04LX Scanning Laser Range Finder (Speccification that has a mirco-USB port. The scan area is a 240° semicircle with a maximum radius of 4 meter. The pitch angle is 0.36° and the sensor outputs the distance measured at 683 different angles. The laser beam diameter is less than 1 cm at 1 meter distance. I read that the angular resolution is configurable by the host. URG Series: Communication Protocol Specification.After the usual trouble, I managed to build the hokuyoaist_example program from the gbiggs/HokuyoAIST github repository. For this you first need to install Doxygen, Sphinx, the Sphinx Breathe plugin and Flexiport: Flexible communication library. Note that the later needs to be installed (with make install) before running cmake for HokuyoAIST. When I run the program, without any arguments, it does return a lot of messages, including error messages, but I do not see anything that looks like data. On linux you can also just simply connect to it with minicom using the following command:
minicom -D /dev/ttyACM0 -b 19200You can use the keystroke sequence 'Ctrl-A z u' to add a carriage return after each life-feed as the sensor will only return line-feed characters. Now you can enter command such as 'VV', 'PP', 'II' and 'GD0100020002' (followed by an enter) to retrieve information or data from the device. I looked into the code and I discovered a bug in the method hokuyoaist::ScanData::as_string where an unsigned integer was initialized with -1. When I changed that to 0, the program does show data. If you are given it clustring value (with the '-c' command line option) the range should be a multiple of this, otherwise an error is reported.
Tombstone diagram experiment
Today, I have been experimenting with visualizing Live-bootstrap using tombstone diagrams (or T-diagrams) where each T-shaped diagram represents on process that is executed. Below the result of this experiment, which only rather incomplete and not well aligned. It is incomplete because it only gives the initial thirdteen processes. Also I still have to add connect lines. I am thinking about calculate all the coordinates based on the positions of the elements based on the widths of the texts. I also have to think about how to list the input files. Some of processes have multiple input files, which can be a mixture of files produced by other steps and given input files. Some input files are used as input for multiple processes. The grey boxes are used to visualize the execution of processes by other process. Dragging and zooming with the mouse can be used to view the whole diagram.
Tuesday, September 3, 2024
Link
Monday, September 2, 2024
I²C for BadgerOS (Part 3)
From studying all the files, yesterday and the day before, I am still puzzled with some things. I went back to the Hackerhotel 2024 CH32V003 firmware repository and noticed that the function I2C1_EV_IRQHandler in the i2c_slave.h is nowhere called in the code. I presume that it is called from 'hidden' part of the firmware that is provided as a binary. I wanted to know if multiple I2C_STAR1_ values can be set. The code suggest that it might be the case, using multiple parallel if-statements and the bitwise-and operator. When I googled for I2C1_EV_IRQHandler, I found that it is also used in code to program microcontrollers from STMicroelectronics. There the use of chained if-else-statements seems to suggest to always at most one flag is set. (This is not particular good code design, to use bit-flags for excluding values. Maybe designed with the idea of that in the future they might occur at the same time.) So, if I understand it correctly there are two types of interactions on the I²C bus:- A write operation of a number of bytes, where the first byte specifies the starting position and all following bytes are data written to the locations (registers) starting from the specified position going up.
- A read operation of number of bytes, starting from the last specified position going up, where typically the position is set with a write operation with zero data bytes.
The code of the function i2c_master_cmd_begin_static is not so easy to understand. One reason that is that it not only called from the function i2c_master_cmd_begin but also from the function i2c_isr_handler_default, which is the interupt handler that is called when reading, when the command is longer than the size of the FIFO hardware buffers, and/or when other events occur. The function starts with some code for dealing with a read command. The low-level function i2c_ll_read_rxfifo is used to read information from the FIFO read buffer that is filled during receiving the data over the I²C bus. For the ESP32C6 this is done by reading from a certain memory location that maps on a hardware register and which, I presume, also removes the value from the buffer. In the while-loop, the commands are processed, calling the function i2c_ll_write_cmd_reg to tell the hardware about the function to perform.
Is there anything to improve on this implementation? I wonder if instead of using a linked list for storing information about the command, where the elements are allocated one-by-one, it would be possible to use an array that is allocated on the stack or as a global variable. It states that the function i2c_master_cmd_begin only return after all the commands have been sent out (or when the specified time-out period is reached). I also guess, that when this needs to be implemented in BadgerOS, that some of the primitives, such as the locking and the event queues, that are used, need to be replaced by equivalent primitives in the kernel of BadgerOS. As the I²C bus is usually used to read out input and output devices on the badge, that the code to access those devices will need to be implemented as a service running within the kernel and that the process (that has the 'focus') will have access to those through a system call implemented by the kernel. When that is the case, the code cannot be 'blocking' in anyway and probably has to run in parallel with other code that communicates with peripheral, such as for example, WIFI. I do not have a clear picture how that should be implemented.