I made a lot more progress on the firmware!! 
As I said, the functions, declarations, and general use of the ESP-IDF are standardized, so it’s simple to build by consulting materials: docs, example codes, usage with some peripherals and components, AI, etc.
In this case, the use of I2C
and SPI communication is also well organized. The drivers for the components I use don’t give you headaches for this.
Previously, we had already been working on the ‘macros’ part, or rather the project HAL, even without knowing what it was. In the second image, there’s the keymap, made as a 7x7 matrix
for the calculator - what the keys do. That’s already connected to the names of each key. The scanning was done, a loop that identifies which keys were used, and the rendering of the items on the display
. Taking the data buffers and transitioning the communication with the ESP about what was pressed and how it will relay that to the screen.
I think it’s interesting to mention:
Explaining how key reading works with the MCP: each key is assigned by the matrix indices - row x column. The columns are set up with internal pull-up resistors, so when inactive they measure 3.3V (level 1). The ESP pulls the row to 0V (level 0), and when a key is pressed, it knows it because it reads !=0 from the column and matches it with the row it’s accessing to get the unique identifier for that key. That way you know 100% for sure what was pressed. And this cycle keeps running every few milliseconds.