### ESP32 Board Setup Configurations (C++) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/TFT_eSPI/README.md Provides example setup files for various ESP32 variants including ESP32-S2, ESP32-S3, and ESP32-C3, with specific configurations for ILI9341 and ILI9488 displays, including parallel interface support for S3. ```cpp // Example: Setup70_ESP32_S2_ILI9341.h #define ILI9341_DRIVER #define TFT_WIDTH 240 #define TFT_HEIGHT 320 #define TFT_MOSI 23 #define TFT_SCLK 18 #define TFT_CS 5 #define TFT_DC 17 #define TFT_RST 16 ``` ```cpp // Example: Setup70b_ESP32_S3_ILI9341.h #define ILI9341_DRIVER #define TFT_WIDTH 240 #define TFT_HEIGHT 320 #define TFT_MOSI 35 #define TFT_SCLK 36 #define TFT_CS 34 #define TFT_DC 37 #define TFT_RST 38 ``` ```cpp // Example: Setup70c_ESP32_C3_ILI9341.h #define ILI9341_DRIVER #define TFT_WIDTH 240 #define TFT_HEIGHT 320 #define TFT_MOSI 7 #define TFT_SCLK 6 #define TFT_CS 10 #define TFT_DC 9 #define TFT_RST 5 ``` ```cpp // Example: Setup70d_ILI9488_S3_Parallel.h #define ILI9488_DRIVER #define TFT_WIDTH 320 #define TFT_HEIGHT 480 // Parallel interface pins #define TFT_P0 35 #define TFT_P1 36 #define TFT_P2 37 #define TFT_P3 38 #define TFT_P4 39 #define TFT_P5 40 #define TFT_P6 41 #define TFT_P7 42 #define TFT_P8 45 #define TFT_P9 46 #define TFT_CS 48 #define TFT_DC 47 #define TFT_RST -1 // Set to -1 if not connected ``` -------------------------------- ### TinyIRSender Usage Example Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremote/README.md Provides a basic example of using the TinyIRSender library to send IR signals. The setup function sends an NEC protocol command with specified parameters. ```c++ #include "TinyIRSender.hpp" void setup() { sendNEC(3, 0, 11, 2); // Send address 0 and command 11 on pin 3 with 2 repeats. } void loop() {} ``` -------------------------------- ### Simple Blink Example with FastLED Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/FastLED/README.md A basic Arduino sketch demonstrating how to initialize FastLED and control a single LED. It sets up the LED strip, turns on the first LED to white, shows it, delays, turns it off, shows it again, and delays. This example is suitable for beginners to get started with FastLED. ```cpp #include #define NUM_LEDS 60 CRGB leds[NUM_LEDS]; void setup() { FastLED.addLeds(leds, NUM_LEDS); } void loop() { leds[0] = CRGB::White; FastLED.show(); delay(30); leds[0] = CRGB::Black; FastLED.show(); delay(30); } ``` -------------------------------- ### ESP32 Audio Playback Setup and Control (C++) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/ESP32-audioI2S/README.md This C++ code snippet demonstrates the setup and basic control for the ESP32-audioI2S library. It initializes the necessary hardware (SD card, WiFi, I2S pins), connects to a WiFi network, and then initiates audio playback from either an SD card or a network stream. It also shows how to set the volume and includes commented-out examples for different audio sources and text-to-speech. ```c++ #include "Arduino.h" #include "WiFi.h" #include "Audio.h" #include "SD.h" #include "FS.h" // Digital I/O used #define SD_CS 5 #define SPI_MOSI 23 #define SPI_MISO 19 #define SPI_SCK 18 #define I2S_DOUT 25 #define I2S_BCLK 27 #define I2S_LRC 26 Audio audio; String ssid = "*******"; String password = "*******"; void setup() { pinMode(SD_CS, OUTPUT); digitalWrite(SD_CS, HIGH); SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI); Serial.begin(115200); SD.begin(SD_CS); WiFi.disconnect(); WiFi.mode(WIFI_STA); WiFi.begin(ssid.c_str(), password.c_str()); while (WiFi.status() != WL_CONNECTED) delay(1500); audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); audio.setVolume(21); // 0...21 // audio.connecttoFS(SD, "/320k_test.mp3"); // audio.connecttohost("http://www.wdr.de/wdrlive/media/einslive.m3u"); // audio.connecttohost("http://macslons-irish-pub-radio.com/media.asx"); // audio.connecttohost("http://mp3.ffh.de/radioffh/hqlivestream.aac"); // 128k aac audio.connecttohost("http://mp3.ffh.de/radioffh/hqlivestream.mp3"); // 128k mp3 // audio.connecttohost("https://github.com/schreibfaul1/ESP32-audioI2S/raw/master/additional_info/Testfiles/sample1.m4a"); // m4a // audio.connecttohost("https://github.com/schreibfaul1/ESP32-audioI2S/raw/master/additional_info/Testfiles/test_16bit_stereo.wav"); // wav // audio.connecttospeech("Wenn die Hunde schlafen, kann der Wolf gut Schafe stehlen.", "de"); } void loop() { audio.loop(); } // optional void audio_info(const char *info){ Serial.print("info "); Serial.println(info); } void audio_id3data(const char *info){ //id3 metadata Serial.print("id3data ");Serial.println(info); } void audio_eof_mp3(const char *info){ //end of file Serial.print("eof_mp3 ");Serial.println(info); } void audio_showstation(const char *info){ Serial.print("station ");Serial.println(info); } void audio_showstreamtitle(const char *info){ Serial.print("streamtitle ");Serial.println(info); } void audio_bitrate(const char *info){ Serial.print("bitrate ");Serial.println(info); } void audio_commercial(const char *info){ //duration in sec Serial.print("commercial ");Serial.println(info); } void audio_icyurl(const char *info){ //homepage Serial.print("icyurl ");Serial.println(info); } void audio_lasthost(const char *info){ //stream URL played Serial.print("lasthost ");Serial.println(info); } void audio_eof_speech(const char *info){ Serial.print("eof_speech ");Serial.println(info); } ``` -------------------------------- ### Basic Grid Navigation in LVGL Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/others/gridnav/index.rst Demonstrates fundamental grid navigation principles in LVGL. This example is written in C and serves as a starting point for understanding grid layouts. ```c #include "lv_examples.h" void lv_example_gridnav_1(void) { lv_obj_t * cont = lv_cont_create(lv_scr_act(), NULL); lv_obj_set_size(cont, 200, 200); lv_obj_center(cont); lv_layout_grid_def_t grid_layout; lv_layout_grid_init(&grid_layout, LV_GRID_FR(1), LV_GRID_FR(1)); grid_layout.row_dsc[0] = LV_GRID_FR(1); grid_layout.column_dsc[0] = LV_GRID_FR(1); grid_layout.column_dsc[1] = LV_GRID_FR(1); grid_layout.column_dsc[2] = LV_GRID_FR(1); grid_layout.row_dsc[1] = LV_GRID_FR(1); grid_layout.row_dsc[2] = LV_GRID_FR(1); lv_obj_set_layout(cont, &grid_layout); uint32_t i = 0; for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { lv_obj_t * btn = lv_btn_create(cont, NULL); lv_obj_set_grid_cell(btn, LV_GRID_ALIGN_STRETCH, col, 1, LV_GRID_ALIGN_STRETCH, row, 1); lv_obj_t * label = lv_label_create(btn, NULL); lv_label_set_text_fmt(label, "%d", i++); lv_obj_center(label); } } } ``` -------------------------------- ### Lightweighted List from Table Example (C) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/widgets/table/index.rst Shows how to create a lightweight list using the table widget. This example is in C and utilizes the LVGL library. ```c void lv_example_table_2(void) { /*Create table*/ lv_obj_t * table = lv_table_create(lv_screen_active()); lv_table_set_col_cnt(table, 2); lv_table_set_row_cnt(table, 5); /*Add style to the table*/ lv_style_t style; lv_style_init(&style); lv_style_set_border_width(table, 1); lv_style_set_pad_all(table, 5); /*Set cell values for a list-like appearance*/ lv_table_set_cell_value(table, 0, 0, "Item 1"); lv_table_set_cell_value(table, 1, 0, "Item 2"); lv_table_set_cell_value(table, 2, 0, "Item 3"); lv_table_set_cell_value(table, 3, 0, "Item 4"); lv_table_set_cell_value(table, 4, 0, "Item 5"); /*Set table size and position*/ lv_obj_set_size(table, 150, 200); lv_obj_center(table); } ``` -------------------------------- ### Audio Playback with Arduino (SPIFFS/SD) Source: https://context7.com/xinyuan-lilygo/t-embed-cc1101/llms.txt This example shows how to play MP3 audio files from either SPIFFS or an SD card using the Audio library and I2S output. It includes setup for the audio amplifier, SPIFFS/SD initialization, and I2S pin configuration. The `audio.loop()` function must be called continuously in the main loop. A callback function `audio_eof_mp3` is provided to handle track completion. ```cpp #include "Arduino.h" #include "Audio.h" #include "SPIFFS.h" #include "SD.h" #include "SPI.h" #define BOARD_PWR_EN 15 #define SD_CS 13 #define SPI_MOSI 9 #define SPI_MISO 10 #define SPI_SCK 11 #define I2S_DOUT 7 #define I2S_BCLK 46 #define I2S_LRC 40 Audio audio; void setup() { Serial.begin(115200); // Power on audio amp pinMode(BOARD_PWR_EN, OUTPUT); digitalWrite(BOARD_PWR_EN, HIGH); // Initialize SPIFFS if (!SPIFFS.begin(true)) { Serial.println("SPIFFS Mount Failed"); return; } // Initialize SD card (optional) SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI); SD.begin(SD_CS); // Configure I2S audio output audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); audio.setVolume(21); // 0-21 // Play from SPIFFS audio.connecttoFS(SPIFFS, "/music.mp3"); // Or play from SD card: // audio.connecttoFS(SD, "/music.mp3"); // Or stream from URL: // audio.connecttohost("http://stream.example.com/radio.mp3"); Serial.println("Audio playback started"); } void loop() { audio.loop(); // Must be called in loop delay(1); } // Callback when track ends void audio_eof_mp3(const char *info) { Serial.printf("Track ended: %s\n", info); // Play next track or loop audio.connecttoFS(SPIFFS, "/next.mp3"); } ``` -------------------------------- ### Include Custom TFT_eSPI Setup Select File (C++) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/TFT_eSPI/README.md This code snippet shows an advanced method for managing TFT_eSPI setups by using a custom setup select file. This allows for easier switching between different configurations without directly editing the main library's setup select file. ```c++ #include <../TFT_eSPI_Setups/my_setup_select.h> ``` -------------------------------- ### IRTechnibelAc Calibration and Setup Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRTechnibelAc.html Includes methods for platform calibration and hardware setup required for sending IR messages. ```APIDOC ## IRTechnibelAc Calibration and Setup ### Description Provides functionality to calibrate the system for accurate IR signal timing and to set up the necessary hardware for transmission. ### Method int8_t calibrate(void) void begin(void) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp // Calibrate the system ac.calibrate(); // Begin IR transmission setup ac.begin(); ``` ### Response #### Success Response (200) - **calibrate**: (int8_t) - Result of the calibration process. #### Response Example N/A ``` -------------------------------- ### C++ Code Block Splitting Example Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/RadioLib/CONTRIBUTING.md Shows how to split code into logical blocks, even for single lines, to enhance human readability. This example demonstrates creating a buffer, reading data, and null-terminating it. ```c++ // build a temporary buffer (first block) uint8_t* data = new uint8_t[len + 1]; if(!data) { return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED); } // read the received data (second block) state = readData(data, len); // add null terminator (third block) data[len] = 0; ``` -------------------------------- ### Include Custom TFT_eSPI Setup File (C++) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/TFT_eSPI/README.md This code snippet demonstrates how to include a custom TFT_eSPI setup file from a separate directory. It uses relative pathing to point to the custom setup, ensuring that user configurations are not lost during library updates. ```c++ #include <../TFT_eSPI_Setups/my_custom_setup.h> ``` -------------------------------- ### Simple Table Example (C) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/widgets/table/index.rst Demonstrates the creation and basic usage of a simple table widget. This example is written in C and requires the LVGL library. ```c void lv_example_table_1(void) { /*Create table*/ lv_obj_t * table = lv_table_create(lv_screen_active()); lv_table_set_col_cnt(table, 2); lv_table_set_row_cnt(table, 3); /*Add style to the table*/ lv_style_t style; lv_style_init(&style); lv_style_set_border_width(table, 1); lv_style_set_pad_all(table, 5); /*Set cell value*/ lv_table_set_cell_value(table, 0, 0, "Header 1"); lv_table_set_cell_value(table, 0, 1, "Header 2"); lv_table_set_cell_value(table, 1, 0, "Row 1, Col 1"); lv_table_set_cell_value(table, 1, 1, "Row 1, Col 2"); lv_table_set_cell_value(table, 2, 0, "Row 2, Col 1"); lv_table_set_cell_value(table, 2, 1, "Row 2, Col 2"); /*Set table size and position*/ lv_obj_set_size(table, 200, 150); lv_obj_center(table); } ``` -------------------------------- ### Install ArduinoUnit for Testing Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/NDEF/README.md Instructions for installing the ArduinoUnit testing framework by cloning the repository and creating a symbolic link to the library directory. This is used for running unit tests on the NDEF logic. ```bash cd ~ git clone git@github.com:mmurdoch/arduinounit.git cd ~/Documents/Arduino/libraries/ ln -s ~/arduinounit/src ArduinoUnit ``` -------------------------------- ### Standard RadioLib Library Build and Install with CMake Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/RadioLib/CMakeLists.txt This snippet defines the standard build and installation process for the RadioLib library. It finds all C++ source files, creates a static library named 'RadioLib', sets up include directories for build and installation, and then installs the library and header files to the appropriate system locations using `GNUInstallDirs`. ```cmake if(CMAKE_SCRIPT_MODE_FILE) message(FATAL_ERROR "Attempted to build RadioLib in script mode") endif() project(radiolib) file(GLOB_RECURSE RADIOLIB_SOURCES "src/*.cpp" ) add_library(RadioLib ${RADIOLIB_SOURCES}) target_include_directories(RadioLib PUBLIC $ $) include(GNUInstallDirs) install(TARGETS RadioLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/RadioLib FILES_MATCHING PATTERN "*.h" ) ``` -------------------------------- ### Tileview Example 1 (C) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/widgets/tileview/index.rst Demonstrates the basic usage of a tileview widget in C. This example likely initializes and displays a tileview, allowing for navigation between different tiles. No external dependencies are explicitly mentioned for this core widget functionality. ```c #include "lv_examples.h" #include "lvgl/lvgl.h" void lv_example_tileview_1(void) { lv_obj_t * tv = lv_tileview_create(lv_scr_act(), NULL); lv_conf_t * conf = lv_conf_get_default(); lv_theme_t * theme = lv_theme_get_builtin_style(conf->theme); lv_tileview_set_style(tv, LV_TILEVIEW_STYLE_BG, theme->tileview.bg); lv_tileview_set_style(tv, LV_TILEVIEW_STYLE_BTN_REL, theme->tileview.btn_rel); lv_tileview_set_style(tv, LV_TILEVIEW_STYLE_BTN_PR, theme->tileview.btn_pr); lv_obj_t * tile1 = lv_tileview_add_tile(tv, 0, 0, LV_DIR_ALL, NULL); lv_obj_t * tile2 = lv_tileview_add_tile(tv, 1, 0, LV_DIR_ALL, NULL); lv_obj_t * tile3 = lv_tileview_add_tile(tv, 0, 1, LV_DIR_ALL, NULL); lv_obj_t * tile4 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_ALL, NULL); lv_obj_t * label = lv_label_create(tile1, NULL); lv_label_set_text(label, "Tile 1"); label = lv_label_create(tile2, NULL); lv_label_set_text(label, "Tile 2"); label = lv_label_create(tile3, NULL); lv_label_set_text(label, "Tile 3"); label = lv_label_create(tile4, NULL); lv_label_set_text(label, "Tile 4"); lv_tileview_set_prev_tile(tv, tile1); } ``` -------------------------------- ### Styling Scrollbars Example (C) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/scroll/index.rst Shows how to customize the appearance of scrollbars using LittlevGL's styling system. This allows for changes in color, width, and other visual properties. ```c /* Code for lv_example_scroll_4 */ #include "lv_examples.h" void lv_example_scroll_4(void) { static lv_style_t style_scrollbar; lv_style_init(&style_scrollbar); lv_style_set_bg_color(&style_scrollbar, LV_COLOR_BLUE); lv_style_set_radius(&style_scrollbar, 5); lv_obj_t * scr = lv_scr_act(); lv_obj_t * list = lv_list_create(scr, NULL); lv_obj_set_size(list, 200, 200); lv_obj_center(list); lv_list_add_text(list, "Item 1"); lv_list_add_text(list, "Item 2"); lv_list_add_text(list, "Item 3"); lv_list_add_text(list, "Item 4"); lv_list_add_text(list, "Item 5"); lv_list_add_text(list, "Item 6"); lv_list_add_text(list, "Item 7"); lv_list_add_text(list, "Item 8"); lv_list_add_text(list, "Item 9"); lv_list_add_text(list, "Item 10"); lv_obj_set_style_local_scrollbar_style(list, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, &style_scrollbar); lv_obj_set_style_local_scrollbar_width(list, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 10); } ``` -------------------------------- ### Nested Grid Navigations in LVGL Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/others/gridnav/index.rst This C example demonstrates how to implement nested grid navigations within LVGL. It shows how to manage focus and interaction when grids are placed inside other grids. ```c #include "lv_examples.h" void lv_example_gridnav_3(void) { lv_obj_t * parent_cont = lv_cont_create(lv_scr_act(), NULL); lv_obj_set_size(parent_cont, 300, 300); lv_obj_center(parent_cont); lv_layout_grid_def_t parent_grid; lv_layout_grid_init(&parent_grid, LV_GRID_FR(1), LV_GRID_FR(1)); parent_grid.column_dsc[0] = LV_GRID_FR(2); parent_grid.column_dsc[1] = LV_GRID_FR(1); parent_grid.row_dsc[0] = LV_GRID_FR(1); parent_grid.row_dsc[1] = LV_GRID_FR(1); lv_obj_set_layout(parent_cont, &parent_grid); lv_obj_t * child_cont = lv_cont_create(parent_cont, NULL); lv_obj_set_grid_cell(child_cont, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_STRETCH, 0, 2); lv_layout_grid_def_t child_grid; lv_layout_grid_init(&child_grid, LV_GRID_FR(1), LV_GRID_FR(1)); child_grid.column_dsc[0] = LV_GRID_FR(1); child_grid.column_dsc[1] = LV_GRID_FR(1); child_grid.row_dsc[0] = LV_GRID_FR(1); child_grid.row_dsc[1] = LV_GRID_FR(1); lv_obj_set_layout(child_cont, &child_grid); for (int i = 0; i < 4; i++) { lv_obj_t * btn = lv_btn_create(child_cont, NULL); lv_obj_set_grid_cell(btn, LV_GRID_ALIGN_STRETCH, i % 2, 1, LV_GRID_ALIGN_STRETCH, i / 2, 1); lv_obj_t * label = lv_label_create(btn, NULL); lv_label_set_text_fmt(label, "Child %d", i + 1); lv_obj_center(label); } lv_obj_t * sibling_cont = lv_cont_create(parent_cont, NULL); lv_obj_set_grid_cell(sibling_cont, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_STRETCH, 0, 2); lv_obj_t * label_sibling = lv_label_create(sibling_cont, NULL); lv_label_set_text(label_sibling, "Sibling"); lv_obj_center(label_sibling); } ``` -------------------------------- ### begin() Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRKelonAc.html Sets up the necessary hardware to begin sending IR messages. ```APIDOC ## begin() ### Description Set up hardware to be able to send a message. ### Method void ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters N/A ``` -------------------------------- ### Setup Hardware for Sending IR Messages Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRDaikinESP.html The begin() function prepares the hardware to send IR messages. This function should be called after the IRDaikinESP object is constructed. ```cpp void IRDaikinESP::begin( void ) ``` -------------------------------- ### LED with Custom Style (C) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/widgets/led/index.rst Demonstrates how to create and style an LED widget using the LVGL library. This example shows basic LED creation and customization, suitable for visual feedback in embedded applications. ```c #include "lv_examples.h" #include "lv_drivers/display/tft.h" #include "lv_drivers/indev/evdev.h" void lv_example_led_1(void) { lv_obj_t * led1 = lv_led_create(lv_scr_act(), NULL); lv_obj_set_size(led1, 50, 50); lv_obj_align(led1, NULL, LV_ALIGN_CENTER, 0, 0); /*Set a custom style*/ static lv_style_t style; lv_style_init(&style); lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_RED); lv_style_set_bg_color(&style, LV_STATE_USER_1, LV_COLOR_GREEN); lv_style_set_bg_color(&style, LV_STATE_USER_2, LV_COLOR_BLUE); lv_led_set_style(led1, &style); /*Turn on the LED with a specific color*/ lv_led_on(led1); lv_led_set_color(led1, LV_STATE_USER_1, LV_COLOR_GREEN); /*You can also turn it off*/ //lv_led_off(led1); /*And set it to a different color*/ //lv_led_set_color(led1, LV_STATE_USER_2, LV_COLOR_BLUE); } ``` -------------------------------- ### Simple Navigation on a List Widget in LVGL Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/others/gridnav/index.rst Provides a straightforward example of navigation within a list widget using LVGL. This C code focuses on basic user interaction and focus management for list items. ```c #include "lv_examples.h" void lv_example_gridnav_4(void) { lv_obj_t * list = lv_list_create(lv_scr_act(), NULL); lv_obj_set_size(list, 200, 200); lv_obj_center(list); lv_list_add_btn(list, NULL, "Item 1"); lv_list_add_btn(list, NULL, "Item 2"); lv_list_add_btn(list, NULL, "Item 3"); lv_list_add_btn(list, NULL, "Item 4"); lv_list_add_btn(list, NULL, "Item 5"); lv_obj_set_style_pad_all(list, 10, 0); } ``` -------------------------------- ### Begin Hardware Setup (C++) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRTranscoldAc.html Initializes the necessary hardware components to enable the sending of IR messages. This method should be called after the IRTranscoldAc object is constructed. ```cpp void begin(void); ``` -------------------------------- ### Take Snapshot with LittlevGL Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/others/snapshot/index.rst This C code snippet demonstrates how to take a snapshot using the LittlevGL graphics library. It's a straightforward example for capturing the current display state. No specific external dependencies beyond LittlevGL are mentioned. ```c #include "lv_examples.h" #include "lvgl.h" void lv_example_snapshot_1(void) { /*Create a window in this example*/ lv_obj_t * win = lv_win_create(NULL, "Snapshot Example"); /*Add a label to the window*/ lv_obj_t * label = lv_label_create(win); lv_label_set_text(label, "This is a snapshot example."); lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); /*Create a snapshot of the window*/ lv_obj_snapshot_exec(win, NULL); } ``` -------------------------------- ### Initialize IRTrotecESP Hardware Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRTrotecESP.html The begin() function sets up the necessary hardware for sending IR messages. It does not take any parameters and has a void return type. ```cpp void IRTrotecESP::begin(void) ``` -------------------------------- ### Set and Get Schedule Timer Start (Minutes) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/ir__Argo_8h_source.html Functions to set and retrieve the start time in minutes for a scheduled timer. This allows users to define specific times for the AC to begin operation. ```cpp void setScheduleTimerStartMinutes(const uint16_t startTimeMinutes); ​​​​uint16_t getScheduleTimerStartMinutes(void) const; ``` -------------------------------- ### Grid Navigation on a List Widget in LVGL Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/others/gridnav/index.rst Illustrates how to implement grid navigation specifically for a list widget in LVGL. This C code example shows how to manage focus and selection within a list presented in a grid. ```c #include "lv_examples.h" void lv_example_gridnav_2(void) { lv_obj_t * list = lv_list_create(lv_scr_act(), NULL); lv_obj_set_size(list, 200, 200); lv_obj_center(list); lv_list_add_btn(list, NULL, "Button 1"); lv_list_add_btn(list, NULL, "Button 2"); lv_list_add_btn(list, NULL, "Button 3"); lv_list_add_btn(list, NULL, "Button 4"); lv_list_add_btn(list, NULL, "Button 5"); lv_list_add_btn(list, NULL, "Button 6"); lv_obj_set_style_grid_column_num(list, 2, 0); lv_obj_set_style_grid_row_pad(list, 10, 0); lv_obj_set_style_grid_column_pad(list, 10, 0); lv_obj_set_style_pad_all(list, 10, 0); } ``` -------------------------------- ### AC Timer Settings Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRMitsubishiAC.html Endpoints for getting and setting the start and stop times for the A/C unit, as well as general timer settings. ```APIDOC ## GET /api/ac/startClock ### Description Get the desired start time of the A/C unit. ### Method GET ### Endpoint /api/ac/startClock ### Parameters None ### Response #### Success Response (200) - **clock** (uint8_t) - The current start time setting. #### Response Example ```json { "clock": 10 } ``` ## POST /api/ac/startClock ### Description Set the desired start time of the A/C unit. ### Method POST ### Endpoint /api/ac/startClock ### Parameters #### Request Body - **clock** (uint8_t) - Required - The desired start time for the A/C unit. ### Request Example ```json { "clock": 12 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ## GET /api/ac/stopClock ### Description Get the desired stop time of the A/C unit. ### Method GET ### Endpoint /api/ac/stopClock ### Parameters None ### Response #### Success Response (200) - **clock** (uint8_t) - The current stop time setting. #### Response Example ```json { "clock": 23 } ``` ## POST /api/ac/stopClock ### Description Set the desired stop time of the A/C unit. ### Method POST ### Endpoint /api/ac/stopClock ### Parameters #### Request Body - **clock** (uint8_t) - Required - The desired stop time for the A/C unit. ### Request Example ```json { "clock": 18 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ## GET /api/ac/timer ### Description Get the timers active setting of the A/C. ### Method GET ### Endpoint /api/ac/timer ### Parameters None ### Response #### Success Response (200) - **timer** (uint8_t) - The current timer setting. #### Response Example ```json { "timer": 1 } ``` ## POST /api/ac/timer ### Description Set the timers active setting of the A/C. ### Method POST ### Endpoint /api/ac/timer ### Parameters #### Request Body - **timer** (uint8_t) - Required - The desired timer setting for the A/C unit. ### Request Example ```json { "timer": 0 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### IRDelonghiAc::begin Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRDelonghiAc.html Sets up the necessary hardware to enable sending IR messages. ```APIDOC ## IRDelonghiAc::begin ### Description Initializes the hardware for sending IR signals. ### Method void ### Endpoint N/A (Member function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp myAc.begin(); ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Begin IR Transmission Setup Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRHaierAC.html Sets up the hardware required to send IR messages using the IRHaierAC object. This method should be called after instantiation and before sending any commands. It prepares the system for IR signal transmission. ```cpp void IRHaierAC::begin(void) { // Implementation details for hardware setup } ``` -------------------------------- ### Get Schedule Timer Start Time - C++ Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRArgoAC__WREM3.html Retrieves the scheduled ON time for the timer, represented as the number of minutes from midnight. The return type is uint16_t. ```cpp uint16_t IRArgoAC_WREM3::getScheduleTimerStartMinutes() const; ``` -------------------------------- ### Setup Hardware for IR Sending Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRDaikin152.html The begin() function initializes the necessary hardware components to enable the sending of IR messages. This function should be called after the IRDaikin152 object is constructed. ```cpp void IRDaikin152::begin( void ) ``` -------------------------------- ### Get IR Panasonic AC On Timer Value Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/ir__Panasonic_8h_source.html Retrieves the time value set for the On Timer of the air conditioner. This function is useful for checking scheduled start times. ```cpp uint16_t getOnTimer(void) { // Implementation details for getting on timer value return 0; // Placeholder } ``` -------------------------------- ### IRCarrierAc64 Begin Function Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRCarrierAc64.html The begin() function initializes the necessary hardware components to enable the sending of IR messages using the IRCarrierAc64 class. It takes no parameters and returns void. ```cpp void begin(void) ``` -------------------------------- ### IRHaierAC::begin Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRHaierAC.html Sets up the necessary hardware components to enable sending IR messages. ```APIDOC ## IRHaierAC::begin ### Description Initializes the hardware for IR transmission. ### Method `void begin(void)` ### Endpoint N/A (Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp myAc.begin(); ``` ### Response #### Success Response (200) None (void method) #### Response Example None ``` -------------------------------- ### Set and Get Delay Timer (Minutes) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/ir__Argo_8h_source.html Methods for setting and retrieving the delay in minutes for a timer. These functions are crucial for implementing delayed start or stop functionalities for the air conditioner. ```cpp void setDelayTimerMinutes(const uint16_t delayMinutes); ​​​​uint16_t getDelayTimerMinutes(void) const; ``` -------------------------------- ### IRTechnibelAc::begin Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRTechnibelAc.html Sets up the hardware to enable sending IR messages. ```APIDOC ## IRTechnibelAc::begin ### Description Set up hardware to be able to send a message. ### Method void ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters N/A ``` -------------------------------- ### Set Schedule Timer Start Time Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRArgoAC__WREM3.html Sets the time when the schedule timer should turn the device on. The time is specified in minutes from midnight, rounded to 10-minute increments. For example, 13:38 becomes 820 minutes (representing 13:40). ```C++ void IRArgoAC_WREM3::setScheduleTimerStartMinutes(const uint16_t startTimeMinutes) ``` -------------------------------- ### C++ Single-Line Comment Formatting Example Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/RadioLib/CONTRIBUTING.md Illustrates the required format for single-line comments in RadioLib. Each comment must start on a new line, preceded by `// ` (including a space), and the comment text should begin with a lowercase letter. ```c++ // this function does something foo("bar"); // here it does something else foo(12345); ``` -------------------------------- ### Initialize IR Hardware Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRTcl112Ac.html The begin() function sets up the necessary hardware components to enable the sending of IR messages. This function should be called once before any sending operations. ```cpp void IRTcl112Ac::begin( void ) ``` -------------------------------- ### Enable IR Reception Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRrecv.html Initializes and starts the IR capture mechanism. This function configures the necessary hardware (timers, interrupts) to begin receiving IR signals. An optional parameter can enable a pull-up resistor on the receive pin if required by the hardware setup. ```cpp #include // Enable IR reception with default settings myIRrecv.enableIRIn(); // Enable IR reception with pull-up resistor myIRrecv.enableIRIn(true); ``` -------------------------------- ### IRWhirlpoolAc::begin() Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRWhirlpoolAc.html Initializes the hardware required for sending IR messages to the Whirlpool AC unit. ```APIDOC ## IRWhirlpoolAc::begin() ### Description Set up hardware to be able to send a message. ### Method void ### Endpoint N/A (Class method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` // No request body for this method ``` ### Response #### Success Response (void) This method does not return a value. #### Response Example N/A ``` -------------------------------- ### AVR Pin Definitions for FastLED Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/FastLED/PORTING.md Example of pin definitions for AVR microcontrollers within the FastLED library. It uses macros like _FL_IO and _FL_DEFPIN to map logical pin numbers to physical port registers and bits. This is crucial for enabling hardware pin support. ```c++ #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) _FL_IO(A); _FL_IO(B); _FL_IO(C); _FL_IO(D); #define MAX_PIN 31 _FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 3, B); _FL_DEFPIN(4, 4, B); _FL_DEFPIN(5, 5, B); _FL_DEFPIN(6, 6, B); _FL_DEFPIN(7, 7, B); _FL_DEFPIN(8, 0, D); _FL_DEFPIN(9, 1, D); _FL_DEFPIN(10, 2, D); _FL_DEFPIN(11, 3, D); _FL_DEFPIN(12, 4, D); _FL_DEFPIN(13, 5, D); _FL_DEFPIN(14, 6, D); _FL_DEFPIN(15, 7, D); _FL_DEFPIN(16, 0, C); _FL_DEFPIN(17, 1, C); _FL_DEFPIN(18, 2, C); _FL_DEFPIN(19, 3, C); _FL_DEFPIN(20, 4, C); _FL_DEFPIN(21, 5, C); _FL_DEFPIN(22, 6, C); _FL_DEFPIN(23, 7, C); _FL_DEFPIN(24, 0, A); _FL_DEFPIN(25, 1, A); _FL_DEFPIN(26, 2, A); _FL_DEFPIN(27, 3, A); _FL_DEFPIN(28, 4, A); _FL_DEFPIN(29, 5, A); _FL_DEFPIN(30, 6, A); _FL_DEFPIN(31, 7, A); #define HAS_HARDWARE_PIN_SUPPORT 1 ``` -------------------------------- ### Get Boolean Settings (e.g., Power, Hold, Ion) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRNeoclimaAc.html These methods retrieve the current state of various boolean settings for the air conditioner. They return true if the setting is active (on) and false otherwise. Examples include power, hold, ion filter, light, sleep, horizontal swing, vertical swing, and turbo modes. ```cpp bool IRNeoclimaAc::getHold(void) const; bool IRNeoclimaAc::getIon(void) const; bool IRNeoclimaAc::getLight(void) const; bool IRNeoclimaAc::getPower(void) const; bool IRNeoclimaAc::getSleep(void) const; bool IRNeoclimaAc::getSwingH(void) const; bool IRNeoclimaAc::getSwingV(void) const; bool IRNeoclimaAc::getTurbo(void) const; ``` -------------------------------- ### IRTranscoldAc::begin Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRTranscoldAc.html Sets up the necessary hardware to enable the sending of IR messages. ```APIDOC ## IRTranscoldAc::begin ### Description Set up hardware to be able to send a message. ### Method void ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Parameters N/A ``` -------------------------------- ### IRArgoACBase begin() Method Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRArgoACBase.html Sets up the hardware necessary for sending IR messages using the IRArgoACBase class. This function should be called before attempting to transmit any data. ```cpp template void IRArgoACBase< T >::begin( void ) ``` -------------------------------- ### Initialize and Run Keypad and Encoder Demo in LVGL Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/demos/keypad_encoder/README.md This code snippet demonstrates the initialization and execution of the keypad and encoder demo after the main LVGL library and its drivers have been set up. It's crucial for enabling touchpad-less navigation. ```c lv_init(); // Initialize drivers here lv_demo_keypad_encoder(); ``` -------------------------------- ### Initialize Sanyo A/C Hardware (C++) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRSanyoAc.html Sets up the necessary hardware to enable sending Sanyo A/C messages. This function should be called once after object instantiation. ```cpp void IRSanyoAc::begin(void) { // Implementation details for hardware initialization } ``` -------------------------------- ### Floating Button Example (C) Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/lvgl/examples/scroll/index.rst Demonstrates how to create a floating button, typically positioned in a corner or overlaying other content. This example likely uses LittlevGL's widget system. ```c /* Code for lv_example_scroll_3 */ #include "lv_examples.h" void lv_example_scroll_3(void) { lv_obj_t * scr = lv_scr_act(); lv_obj_t * list = lv_list_create(scr, NULL); lv_obj_set_size(list, 200, 200); lv_obj_center(list); lv_list_add_text(list, "Item 1"); lv_list_add_text(list, "Item 2"); lv_list_add_text(list, "Item 3"); lv_list_add_text(list, "Item 4"); lv_list_add_text(list, "Item 5"); lv_list_add_text(list, "Item 6"); lv_list_add_text(list, "Item 7"); lv_list_add_text(list, "Item 8"); lv_obj_t * btn = lv_btn_create(scr, NULL); lv_obj_set_size(btn, 50, 50); lv_obj_set_pos(btn, lv_obj_get_width(scr) - 60, lv_obj_get_height(scr) - 60); lv_obj_set_style_local_bg_color(btn, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); lv_obj_set_style_local_radius(btn, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 50); lv_obj_t * label = lv_label_create(btn, NULL); lv_label_set_text(label, "+"); lv_obj_set_center(label); } ``` -------------------------------- ### IRArgoAC_WREM3 Constructor Source: https://github.com/xinyuan-lilygo/t-embed-cc1101/blob/master/lib/IRremoteESP8266/docs/doxygen/html/classIRArgoAC__WREM3.html Initializes the IRArgoAC_WREM3 class with specified GPIO pin, inversion, and modulation settings. ```APIDOC ## IRArgoAC_WREM3 Constructor ### Description Class constructor for initializing the IR remote. ### Method CONSTRUCTOR ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **pin** (uint16_t) - Required - GPIO to be used when sending. * **inverted** (bool) - Optional - Is the output signal to be inverted? Defaults to `false`. * **use_modulation** (bool) - Optional - Is frequency modulation to be used? Defaults to `true`. ### Request Example ```json { "pin": 12, "inverted": false, "use_modulation": true } ``` ### Response #### Success Response (200) None (Constructor) #### Response Example None ```