├── Hardware ├── README.md ├── Emma_BOM.xlsx ├── Emma_Gerber.zip └── Emma_PickAndPlace.xlsx ├── Firmware └── SourceCode │ └── Emma_test │ ├── components │ ├── EmmaBSP │ │ ├── README.md │ │ ├── Buzzer │ │ │ ├── Buzzer.h │ │ │ ├── Buzzer.cpp │ │ │ └── Tone │ │ │ │ ├── esp32-hal-ledc.h │ │ │ │ ├── Tone.cpp │ │ │ │ └── esp32-hal-ledc.cpp │ │ ├── LvglPort │ │ │ ├── README.md │ │ │ ├── lv_port_indev.h │ │ │ ├── lv_port_disp.h │ │ │ ├── lv_port_disp.cpp │ │ │ ├── lv_port_indev.cpp │ │ │ └── lv_conf_temp.h │ │ ├── Encoder │ │ │ ├── Button │ │ │ │ ├── Button.h │ │ │ │ ├── LICENSE │ │ │ │ ├── Button.cpp │ │ │ │ └── README.md │ │ │ ├── Encoder.h │ │ │ └── Encoder.cpp │ │ ├── CMakeLists.txt │ │ ├── Emma.h │ │ ├── Emma.cpp │ │ └── Lcd │ │ │ └── LovyanGFX_Emma.hpp │ └── lv_conf.h │ ├── .gitignore │ ├── main │ ├── CMakeLists.txt │ └── Emma_test.cpp │ ├── dependencies.lock │ ├── hotplugSetup.sh │ ├── CMakeLists.txt │ ├── menuconfig.sh │ ├── flash.sh │ └── gitAcp.sh ├── Docs └── Emma_SCH.pdf ├── Pics └── IMG_5116.JPG ├── README.md ├── .gitmodules └── LICENSE /Hardware/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/README.md: -------------------------------------------------------------------------------- 1 | Emma BSP 2 | ====== -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | build 3 | sdkconfig.old 4 | -------------------------------------------------------------------------------- /Docs/Emma_SCH.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Forairaaaaa/Emma/HEAD/Docs/Emma_SCH.pdf -------------------------------------------------------------------------------- /Pics/IMG_5116.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Forairaaaaa/Emma/HEAD/Pics/IMG_5116.JPG -------------------------------------------------------------------------------- /Hardware/Emma_BOM.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Forairaaaaa/Emma/HEAD/Hardware/Emma_BOM.xlsx -------------------------------------------------------------------------------- /Hardware/Emma_Gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Forairaaaaa/Emma/HEAD/Hardware/Emma_Gerber.zip -------------------------------------------------------------------------------- /Hardware/Emma_PickAndPlace.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Forairaaaaa/Emma/HEAD/Hardware/Emma_PickAndPlace.xlsx -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "Emma_test.cpp" 2 | INCLUDE_DIRS "") -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Emma 2 | HMI Core Board based on ESP32-S3 3 | 4 | ![](https://github.com/Forairaaaaa/Emma/blob/main/Pics/IMG_5116.JPG?raw=true) 5 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/dependencies.lock: -------------------------------------------------------------------------------- 1 | manifest_hash: e0cfd1319bfb46d732ec9d319e9dc49e36898e504018c81401232151605e3547 2 | target: esp32s3 3 | version: 1.0.0 4 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/hotplugSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script is a setup to allow non-root users to access the device automatically 3 | # Should be run before the USB device attach 4 | # Details: https://github.com/dorssel/usbipd-win/wiki/WSL-support 5 | 6 | sudo service udev restart 7 | sudo udevadm control --reload 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | 2 | [submodule "Firmware/SourceCode/Emma_test/components/LovyanGFX"] 3 | path = Firmware/SourceCode/Emma_test/components/LovyanGFX 4 | url = https://github.com/lovyan03/LovyanGFX.git 5 | branch = develop 6 | [submodule "Firmware/SourceCode/Emma_test/components/lvgl"] 7 | path = Firmware/SourceCode/Emma_test/components/lvgl 8 | url = https://github.com/lvgl/lvgl.git 9 | branch = v8.3.4 10 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about build system see 2 | # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html 3 | # The following five lines of boilerplate have to be in your project's 4 | # CMakeLists in this exact order for cmake to work correctly 5 | cmake_minimum_required(VERSION 3.16) 6 | 7 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 8 | project(Emma_test) 9 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/menuconfig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### This is for lazzy shit like me to menuconfig the project 3 | 4 | # Configs 5 | IDF_PATH=$HOME/esp/esp-idf 6 | SERIAL_PORT=/dev/ttyACM0 7 | 8 | 9 | help() { 10 | sed -rn 's/^### ?//;T;p' "$0" 11 | } 12 | 13 | if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then 14 | help 15 | exit 1 16 | fi 17 | 18 | # Get idf 19 | . ${IDF_PATH}/export.sh 20 | 21 | # Build and flash and monitor 22 | idf.py menuconfig 23 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Buzzer/Buzzer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Buzzer.h 3 | * @author Forairaaaaa 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-12-04 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #pragma once 12 | 13 | #include "Emma.h" 14 | 15 | /** 16 | * Steal from Arduino esp32 :( 17 | */ 18 | void setToneChannel(uint8_t channel = 0); 19 | void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); 20 | void noTone(uint8_t _pin); 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/LvglPort/README.md: -------------------------------------------------------------------------------- 1 | git clone -b v8.3.4 --recursive https://github.com/lvgl/lvgl.git 2 | 3 | REQUIRES "esp_timer" 4 | 5 | 6 | 7 | Clone lvgl in "components/" 8 | 9 | idf menuconfig: 10 | 11 | ​ close building example 12 | 13 | ​ open building demo benchmark and wigets 14 | 15 | ​ close the first option "pass ... check..." shit 16 | 17 | cp "lv_conf_temp.h" as "lv_conf.h" next to "lvgl/" fold 18 | 19 | update the esp cmakelists in lvgl with "REQUIRES "esp_timer"" 20 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### This is for lazzy shit like me to build -> flash - > monitor project 3 | ### Use < usbipd wsl attach -a -b [BUSID] > on PowerShell to auto attach the board 4 | 5 | 6 | # Configs 7 | IDF_PATH=$HOME/esp/esp-idf 8 | SERIAL_PORT=/dev/ttyACM0 9 | 10 | 11 | # Help shit 12 | help() { 13 | sed -rn 's/^### ?//;T;p' "$0" 14 | } 15 | 16 | if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then 17 | help 18 | exit 1 19 | fi 20 | 21 | # Get idf 22 | . ${IDF_PATH}/export.sh 23 | 24 | # Build and flash and monitor 25 | idf.py -p ${SERIAL_PORT} flash monitor 26 | 27 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/gitAcp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### This is for lazzy shit like me to [git-add -> git-commit -> git push] 3 | 4 | 5 | # Help shit 6 | help() { 7 | sed -rn 's/^### ?//;T;p' "$0" 8 | } 9 | 10 | if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then 11 | help 12 | exit 1 13 | fi 14 | 15 | 16 | # Git add all 17 | git add . 18 | 19 | # Git commit 20 | echo "Commit message:" 21 | read 22 | git commit -a -m "${REPLY}" 23 | 24 | # Git push 25 | while true; do 26 | read -p "Do you wish to git push? [y/N] " yn 27 | case $yn in 28 | [Yy]* ) break;; 29 | [Nn]* ) echo "No push, exit"; exit;; 30 | * ) echo "No push, exit"; exit;; 31 | esac 32 | done 33 | git push 34 | 35 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Encoder/Button/Button.h: -------------------------------------------------------------------------------- 1 | /* 2 | Button - a small library for Arduino to handle button debouncing 3 | 4 | MIT licensed. 5 | */ 6 | 7 | #ifndef Button_h 8 | #define Button_h 9 | // #include "Arduino.h" 10 | #include 11 | 12 | class Button 13 | { 14 | public: 15 | Button(uint8_t pin = 0, uint16_t debounce_ms = 100); 16 | void setPin(uint8_t pin); 17 | void setDebounce(uint16_t ms); 18 | void begin(); 19 | bool read(); 20 | bool toggled(); 21 | bool pressed(); 22 | bool released(); 23 | bool has_changed(); 24 | 25 | const static bool PRESSED = 0; 26 | const static bool RELEASED = 1; 27 | 28 | private: 29 | uint8_t _pin; 30 | uint16_t _delay; 31 | bool _state; 32 | uint32_t _ignore_until; 33 | bool _has_changed; 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt of Emma BSP component 2 | 3 | # Source files directories 4 | set(EMMA_SRC_DIRS 5 | "." 6 | "Buzzer" 7 | "Buzzer/Tone" 8 | "Encoder" 9 | "Encoder/Button" 10 | "LvglPort" 11 | ) 12 | 13 | # Head files directories 14 | set(EMMA_INC_DIRS 15 | "." 16 | "Lcd" 17 | "Buzzer" 18 | "Buzzer/Tone" 19 | "Encoder" 20 | "Encoder/Button" 21 | "LvglPort" 22 | ) 23 | 24 | # Public component requirement 25 | set(EMMA_REQUIRES 26 | "LovyanGFX" 27 | "lvgl" 28 | ) 29 | 30 | # Private component requirement 31 | set(EMMA_PRIV_REQUIRES 32 | "spi_flash" 33 | "esp_timer" 34 | ) 35 | 36 | # Register component 37 | idf_component_register(SRC_DIRS ${EMMA_SRC_DIRS} 38 | INCLUDE_DIRS ${EMMA_INC_DIRS} 39 | REQUIRES ${EMMA_REQUIRES} 40 | PRIV_REQUIRES ${EMMA_PRIV_REQUIRES} 41 | ) 42 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Encoder/Encoder.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Encoder.h 3 | * @author Forairaaaaa 4 | * @brief Encoder driver by using GPIO lib 5 | * @version 0.1 6 | * @date 2022-12-06 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #pragma once 12 | 13 | #include "freertos/FreeRTOS.h" 14 | #include "freertos/task.h" 15 | #include "Button/Button.h" 16 | 17 | 18 | class ENCODER { 19 | private: 20 | int _pinA; 21 | int _pinB; 22 | int _pinBTN; 23 | TaskHandle_t _ecTaskHandle; 24 | unsigned int _ecTaskPriority; 25 | int _oldPosition; 26 | public: 27 | /* Button */ 28 | Button Btn; 29 | /* Public methods */ 30 | ENCODER(); 31 | ~ENCODER(); 32 | void Init(int pinA = -1, int pinB = -1, int pinBTN = -1); 33 | void Uninit(); 34 | int GetDirection(); 35 | int GetPosition(); 36 | void ResetPosition(); 37 | bool Moved(); 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/LvglPort/lv_port_indev.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @file lv_port_indev_templ.h 4 | * 5 | */ 6 | 7 | /*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/ 8 | #if 1 9 | 10 | #ifndef LV_PORT_INDEV_TEMPL_H 11 | #define LV_PORT_INDEV_TEMPL_H 12 | 13 | 14 | 15 | /********************* 16 | * INCLUDES 17 | *********************/ 18 | #include "lvgl/lvgl.h" 19 | #include "../Encoder/Encoder.h" 20 | 21 | /********************* 22 | * DEFINES 23 | *********************/ 24 | #define ENCODER_REVERSE 0 25 | 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | 30 | /********************** 31 | * GLOBAL PROTOTYPES 32 | **********************/ 33 | // void lv_port_indev_init(void); 34 | void lv_port_indev_init(ENCODER* pEncoder); 35 | 36 | /********************** 37 | * MACROS 38 | **********************/ 39 | 40 | 41 | #endif /*LV_PORT_INDEV_TEMPL_H*/ 42 | 43 | #endif /*Disable/Enable content*/ 44 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Buzzer/Buzzer.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Buzzer.cpp 3 | * @author Forairaaaaa 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-12-04 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #include "Buzzer.h" 12 | 13 | 14 | inline void EMMA::StartTone(unsigned int frequency, unsigned long duration) 15 | { 16 | tone(EMMA_PIN_BUZZER, frequency, duration); 17 | } 18 | 19 | inline void EMMA::StopTone() 20 | { 21 | noTone(EMMA_PIN_BUZZER); 22 | } 23 | 24 | /** 25 | * @brief Simple buzzer test 26 | * 27 | */ 28 | void EMMA::BuzzerTest() 29 | { 30 | printf(Cowsay("Beep Test :)", 34).c_str()); 31 | /* Play tones */ 32 | int f; 33 | for (f = 0; f < 2; f++) { 34 | StartTone(1000); 35 | delay(50); 36 | StopTone(); 37 | delay(20); 38 | } 39 | delay(400); 40 | for (f = 100; f < 3000; f += 100) { 41 | StartTone(f); 42 | delay(20); 43 | StopTone(); 44 | } 45 | for (f = 3000; f > 100; f -= 100) { 46 | StartTone(f); 47 | delay(20); 48 | StopTone(); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Encoder/Button/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Michael D K Adams 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/LvglPort/lv_port_disp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_port_disp_templ.h 3 | * 4 | */ 5 | 6 | /*Copy this file as "lv_port_disp.h" and set this value to "1" to enable content*/ 7 | #if 1 8 | 9 | #ifndef LV_PORT_DISP_TEMPL_H 10 | #define LV_PORT_DISP_TEMPL_H 11 | 12 | /********************* 13 | * INCLUDES 14 | *********************/ 15 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 16 | #include "lvgl.h" 17 | #else 18 | #include "lvgl/lvgl.h" 19 | #endif 20 | 21 | #include "Lcd/LovyanGFX_Emma.hpp" 22 | 23 | /********************* 24 | * DEFINES 25 | *********************/ 26 | 27 | #define MY_DISP_HOR_RES 240 28 | #define MY_DISP_VER_RES 240 29 | 30 | #define LV_VER_RES_MAX 240 31 | 32 | /********************** 33 | * TYPEDEFS 34 | **********************/ 35 | 36 | /********************** 37 | * GLOBAL PROTOTYPES 38 | **********************/ 39 | /* Initialize low level display driver */ 40 | void lv_port_disp_init(LGFX_Emma* pLgfxEmma); 41 | 42 | /* Enable updating the screen (the flushing process) when disp_flush() is called by LVGL 43 | */ 44 | void disp_enable_update(void); 45 | 46 | /* Disable updating the screen (the flushing process) when disp_flush() is called by LVGL 47 | */ 48 | void disp_disable_update(void); 49 | 50 | /********************** 51 | * MACROS 52 | **********************/ 53 | 54 | 55 | #endif /*LV_PORT_DISP_TEMPL_H*/ 56 | 57 | #endif /*Disable/Enable content*/ 58 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/main/Emma_test.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Emma_test.cpp 3 | * @author Forairaaaaa 4 | * @brief App entrance 5 | * @version 0.1 6 | * @date 2022-12-04 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #include "Emma.h" 12 | EMMA Emma; 13 | 14 | 15 | #include "lvgl.h" 16 | #include "lv_port_disp.h" 17 | #include "lv_port_indev.h" 18 | #include "demos/lv_demos.h" 19 | #include "examples/lv_examples.h" 20 | 21 | using namespace std; 22 | 23 | 24 | extern "C" void app_main(void) 25 | { 26 | Emma.Init(); 27 | 28 | printf(Emma.Cowsay("Meow~~").c_str()); 29 | Emma.Lcd.printf(Emma.Cowsay("Meow~~").c_str()); 30 | Emma.BuzzerTest(); 31 | 32 | 33 | delay(1000); 34 | lv_init(); 35 | lv_port_disp_init(&Emma.Lcd); 36 | lv_port_indev_init(&Emma.Encoder); 37 | 38 | 39 | lv_demo_keypad_encoder(); 40 | // lv_demo_benchmark(); 41 | // lv_demo_widgets(); 42 | // lv_demo_stress(); 43 | 44 | // lv_example_btn_3(); 45 | // lv_example_led_1(); 46 | // lv_example_roller_3(); 47 | // lv_example_meter_2(); 48 | // lv_example_chart_5(); 49 | // lv_example_colorwheel_1(); 50 | // lv_example_arc_1(); 51 | 52 | 53 | 54 | while (1) { 55 | lv_timer_handler(); 56 | delay(5); 57 | } 58 | 59 | 60 | 61 | 62 | while (1) { 63 | 64 | if (Emma.Encoder.Btn.pressed()) { 65 | Emma.Encoder.ResetPosition(); 66 | cout << Emma.Encoder.GetPosition() << endl; 67 | } 68 | 69 | if (Emma.Encoder.Moved()) 70 | cout << Emma.Encoder.GetPosition() << endl; 71 | 72 | 73 | 74 | delay(10); 75 | } 76 | 77 | 78 | while (1) { 79 | delay(5000); 80 | } 81 | } 82 | 83 | 84 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Buzzer/Tone/esp32-hal-ledc.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _ESP32_HAL_LEDC_H_ 16 | #define _ESP32_HAL_LEDC_H_ 17 | 18 | // #ifdef __cplusplus 19 | // extern "C" { 20 | // #endif 21 | 22 | #include 23 | #include 24 | #include "Buzzer.h" 25 | 26 | typedef enum { 27 | NOTE_C, NOTE_Cs, NOTE_D, NOTE_Eb, NOTE_E, NOTE_F, NOTE_Fs, NOTE_G, NOTE_Gs, NOTE_A, NOTE_Bb, NOTE_B, NOTE_MAX 28 | } note_t; 29 | 30 | //channel 0-15 resolution 1-16bits freq limits depend on resolution 31 | uint32_t ledcSetup(uint8_t channel, uint32_t freq, uint8_t resolution_bits); 32 | void ledcWrite(uint8_t channel, uint32_t duty); 33 | uint32_t ledcWriteTone(uint8_t channel, uint32_t freq); 34 | uint32_t ledcWriteNote(uint8_t channel, note_t note, uint8_t octave); 35 | uint32_t ledcRead(uint8_t channel); 36 | uint32_t ledcReadFreq(uint8_t channel); 37 | void ledcAttachPin(uint8_t pin, uint8_t channel); 38 | // void ledcDetachPin(uint8_t pin); 39 | uint32_t ledcChangeFrequency(uint8_t channel, uint32_t freq, uint8_t resolution_bits); 40 | 41 | 42 | // #ifdef __cplusplus 43 | // } 44 | // #endif 45 | 46 | #endif /* _ESP32_HAL_LEDC_H_ */ 47 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Encoder/Button/Button.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Button - a small library for Arduino to handle button debouncing 3 | 4 | MIT licensed. 5 | */ 6 | 7 | #include "Button.h" 8 | // #include 9 | #include "driver/gpio.h" 10 | #include "esp_timer.h" 11 | 12 | 13 | #define LOW 0 14 | #define HIGH 1 15 | 16 | #define millis() (esp_timer_get_time() / 1000LL) 17 | 18 | #define pinMode(_pin, INPUT_PULLUP) \ 19 | gpio_set_direction((gpio_num_t)_pin, GPIO_MODE_INPUT); \ 20 | gpio_pullup_en((gpio_num_t)_pin) 21 | 22 | #define digitalRead(_pin) gpio_get_level((gpio_num_t)_pin) 23 | 24 | 25 | 26 | Button::Button(uint8_t pin, uint16_t debounce_ms) 27 | : _pin(pin) 28 | , _delay(debounce_ms) 29 | , _state(HIGH) 30 | , _ignore_until(0) 31 | , _has_changed(false) 32 | { 33 | } 34 | 35 | void Button::begin() 36 | { 37 | pinMode(_pin, INPUT_PULLUP); 38 | } 39 | 40 | // 41 | // public methods 42 | // 43 | 44 | 45 | bool Button::read() 46 | { 47 | // ignore pin changes until after this delay time 48 | if (_ignore_until > millis()) 49 | { 50 | // ignore any changes during this period 51 | } 52 | 53 | // pin has changed 54 | else if (digitalRead(_pin) != _state) 55 | { 56 | _ignore_until = millis() + _delay; 57 | _state = !_state; 58 | _has_changed = true; 59 | } 60 | 61 | return _state; 62 | } 63 | 64 | // has the button been toggled from on -> off, or vice versa 65 | bool Button::toggled() 66 | { 67 | read(); 68 | return has_changed(); 69 | } 70 | 71 | // mostly internal, tells you if a button has changed after calling the read() function 72 | bool Button::has_changed() 73 | { 74 | if (_has_changed) 75 | { 76 | _has_changed = false; 77 | return true; 78 | } 79 | return false; 80 | } 81 | 82 | // has the button gone from off -> on 83 | bool Button::pressed() 84 | { 85 | return (read() == PRESSED && has_changed()); 86 | } 87 | 88 | // has the button gone from on -> off 89 | bool Button::released() 90 | { 91 | return (read() == RELEASED && has_changed()); 92 | } 93 | 94 | 95 | void Button::setPin(uint8_t pin) 96 | { 97 | _pin = pin; 98 | } 99 | 100 | void Button::setDebounce(uint16_t ms) 101 | { 102 | _delay = ms; 103 | } -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Emma.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Emma.h 3 | * @author Forairaaaaa 4 | * @brief Emma BSP 5 | * @version 0.1 6 | * @date 2022-12-04 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #pragma once 12 | #include 13 | #include 14 | #include "freertos/FreeRTOS.h" 15 | #include "freertos/task.h" 16 | #include "Lcd/LovyanGFX_Emma.hpp" 17 | #include "Encoder/Encoder.h" 18 | 19 | 20 | /* Configs */ 21 | #define BSP_VERISON "v2.1" 22 | /* GPIO map */ 23 | #define EMMA_PIN_BUZZER 46 24 | #define EMMA_PIN_RGB_LED 1 25 | #define EMMA_PIN_EC_BTN 2 26 | #define EMMA_PIN_EC_A 18 27 | #define EMMA_PIN_EC_B 3 28 | #define EMMA_PIN_LCD_RST 17 29 | #define EMMA_PIN_LCD_SDA 15 30 | #define EMMA_PIN_LCD_SCL 13 31 | #define EMMA_PIN_LCD_CS 21 32 | #define EMMA_PIN_LCD_DC 16 33 | #define EMMA_PIN_LCD_BL 14 34 | /* ANSI colors */ 35 | #define ANSI_BLACK 30 36 | #define ANSI_RED 31 37 | #define ANSI_GREEN 32 38 | #define ANSI_YELLOW 33 39 | #define ANSI_BLUE 34 40 | #define ANSI_MAGENTA 35 41 | #define ANSI_CYAN 36 42 | #define ANSI_WHITE 37 43 | 44 | 45 | /** 46 | * @brief Emma BSP class 47 | * 48 | */ 49 | class EMMA { 50 | private: 51 | 52 | public: 53 | const std::string Logo = R"( 54 | ______ __ __ __ __ ______ 55 | /\ ___\/\ "-./ \/\ "-./ \/\ __ \ 56 | \ \ __\\ \ \-./\ \ \ \-./\ \ \ __ \ 57 | \ \_____\ \_\ \ \_\ \_\ \ \_\ \_\ \_\ 58 | \/_____/\/_/ \/_/\/_/ \/_/\/_/\/_/ 59 | )"; 60 | const std::string Cow = R"( 61 | \ ^__^ 62 | \ (oo)\_______ 63 | (__)\ )\/\ 64 | ||----w | 65 | || || 66 | )"; 67 | 68 | /* LovyanGFX */ 69 | LGFX_Emma Lcd; 70 | /* Encoder */ 71 | ENCODER Encoder; 72 | 73 | /* Public methods */ 74 | void Init(bool enLcd = true, bool enEncoder = true, bool enLedRGB = true, bool enBuzzer = true); 75 | void PrintBoardInfo(bool printOnLcd = false); 76 | /* Cowsay */ 77 | std::string Cowsay(std::string whatCowSay, int ANSIcolor = 0); 78 | /* Buzzer */ 79 | inline void StartTone(unsigned int frequency, unsigned long duration = 0); 80 | inline void StopTone(); 81 | void BuzzerTest(); 82 | 83 | }; 84 | 85 | /* Pack like Arduino */ 86 | void delay(uint32_t ms); 87 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Emma.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Emma.cpp 3 | * @author Forairaaaaa 4 | * @brief Emma BSP 5 | * @version 0.1 6 | * @date 2022-12-04 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #include "Emma.h" 12 | #include "sdkconfig.h" 13 | #include "esp_chip_info.h" 14 | #include "esp_flash.h" 15 | #include "esp_log.h" 16 | 17 | 18 | 19 | /** 20 | * @brief BSP init 21 | * 22 | * @param enLcd 23 | * @param enEncoder 24 | * @param enLedRGB 25 | * @param enBuzzer 26 | */ 27 | void EMMA::Init(bool enLcd, bool enEncoder, bool enLedRGB, bool enBuzzer) 28 | { 29 | /* LCD init */ 30 | if (enLcd) { 31 | Lcd.init(); 32 | Lcd.fillScreen(TFT_BLACK); 33 | Lcd.setBrightness(100); 34 | // Lcd.setRotation(1); 35 | } 36 | 37 | /* Print infomations */ 38 | PrintBoardInfo(true); 39 | 40 | /* Encoder init */ 41 | if (enEncoder) { 42 | Encoder.Init(EMMA_PIN_EC_A, EMMA_PIN_EC_B, EMMA_PIN_EC_BTN); 43 | } 44 | 45 | 46 | } 47 | 48 | 49 | /** 50 | * @brief Print board's infomations 51 | * 52 | */ 53 | void EMMA::PrintBoardInfo(bool printOnLcd) 54 | { 55 | /* Print Logo */ 56 | printf("%s\n", Logo.c_str()); 57 | printf(" Emma HMI Core Boarad :)\n BSP %s\n", BSP_VERISON); 58 | 59 | /* Print chip information */ 60 | esp_chip_info_t chip_info; 61 | uint32_t flash_size; 62 | esp_chip_info(&chip_info); 63 | if(esp_flash_get_size(NULL, &flash_size) != ESP_OK) { 64 | printf("Get flash size failed"); 65 | return; 66 | } 67 | printf(" %luMB %s flash\n", flash_size / (1024 * 1024), 68 | (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); 69 | printf(" Minimum free heap size: %ld bytes\n\n", esp_get_minimum_free_heap_size()); 70 | 71 | /* Print infos on LCD */ 72 | if (printOnLcd) { 73 | Lcd.setCursor(0, 0); 74 | Lcd.printf(Logo.c_str()); 75 | Lcd.printf("\n Emma HMI Core Boarad :)\n BSP %s\n", BSP_VERISON); 76 | Lcd.printf(" %luMB %s flash\n", flash_size / (1024 * 1024), 77 | (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); 78 | Lcd.printf(" Minimum free heap size: %ld bytes\n\n", esp_get_minimum_free_heap_size()); 79 | } 80 | } 81 | 82 | 83 | /** 84 | * @brief Listen to the cow 85 | * 86 | * @param whatCowSay 87 | * @param ANSIcolor e.g. ANSI_BLUE 88 | * @return string that cow want to say 89 | */ 90 | std::string EMMA::Cowsay(std::string whatCowSay, int ANSIcolor) 91 | { 92 | std::string ret; 93 | 94 | /* Set corlor */ 95 | if (ANSIcolor != 0) 96 | ret = "\033[0;" + std::to_string(ANSIcolor) + "m"; 97 | 98 | /* Print dialog */ 99 | ret.append(" "); 100 | ret.append(whatCowSay.length() + 2, '_'); 101 | ret.append("\n< "); 102 | ret.append(whatCowSay); 103 | ret.append(" >\n "); 104 | ret.append(whatCowSay.length() + 2, '-'); 105 | ret.append(Cow); 106 | 107 | /* Reset color */ 108 | if (ANSIcolor != 0) 109 | ret.append("\033[0m\n"); 110 | else 111 | ret.append("\n"); 112 | 113 | return ret; 114 | } 115 | 116 | 117 | void delay(uint32_t ms) 118 | { 119 | vTaskDelay(ms / portTICK_PERIOD_MS); 120 | } 121 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Encoder/Encoder.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Encoder.cpp 3 | * @author Forairaaaaa 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-12-06 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #include "Encoder.h" 12 | #include "freertos/semphr.h" 13 | #include "driver/gpio.h" 14 | 15 | 16 | /* Use "Button" to handle encoder's gpio */ 17 | static Button _EcA; 18 | static Button _EcB; 19 | /* Semaphore for shared data */ 20 | static SemaphoreHandle_t _SemaphoreMutex; 21 | /* Values of encoder */ 22 | static int _EncoderPositoin; 23 | static int _EncoderDirection; 24 | static int _Ret; 25 | 26 | 27 | 28 | /** 29 | * @brief Encoder task 30 | * 31 | * @param param 32 | */ 33 | static void EncoderTask(void* param) 34 | { 35 | _EncoderPositoin = 0; 36 | _EncoderDirection = 0; 37 | while (1) { 38 | xSemaphoreTake(_SemaphoreMutex, portMAX_DELAY); 39 | /* If moved */ 40 | if (_EcA.pressed()) { 41 | _EncoderDirection = (_EcB.read() ? 1 : -1); 42 | _EncoderPositoin += _EncoderDirection; 43 | } 44 | else { 45 | _EncoderDirection = 0; 46 | } 47 | xSemaphoreGive(_SemaphoreMutex); 48 | vTaskDelay(5 / portTICK_PERIOD_MS); 49 | } 50 | vTaskDelete(NULL); 51 | } 52 | 53 | 54 | /** 55 | * @brief Construct a new Encoder:: Encoder object 56 | * 57 | */ 58 | ENCODER::ENCODER() 59 | { 60 | _pinA = -1; 61 | _pinB = -1; 62 | _pinBTN = -1; 63 | _ecTaskHandle = NULL; 64 | _ecTaskPriority = 1; 65 | _oldPosition = 0; 66 | } 67 | 68 | 69 | /** 70 | * @brief Destroy the Encoder:: Encoder object 71 | * 72 | */ 73 | ENCODER::~ENCODER() 74 | { 75 | Uninit(); 76 | } 77 | 78 | 79 | /** 80 | * @brief Init encoder, Should call SetPin() first 81 | * 82 | * @param enPullup 83 | */ 84 | void ENCODER::Init(int pinA, int pinB, int pinBTN) 85 | { 86 | _pinA = pinA; 87 | _pinB = pinB; 88 | _pinBTN = pinBTN; 89 | 90 | /* If no pin config */ 91 | if ((_pinA <= 0) || (_pinB <= 0) || (_pinBTN <= 0)) 92 | return; 93 | 94 | /* Init A, B by using "Button" */ 95 | _EcA.setPin(_pinA); 96 | _EcA.setDebounce(5); 97 | _EcA.begin(); 98 | _EcB.setPin(_pinB); 99 | _EcB.setDebounce(5); 100 | _EcB.begin(); 101 | /* Init button */ 102 | Btn.setPin(_pinBTN); 103 | Btn.begin(); 104 | 105 | /* Create encoder task */ 106 | _SemaphoreMutex = xSemaphoreCreateMutex(); 107 | xTaskCreate(EncoderTask, "Encoder", 1024, NULL, _ecTaskPriority, &_ecTaskHandle); 108 | } 109 | 110 | 111 | /** 112 | * @brief Uinit encoder 113 | * 114 | */ 115 | void ENCODER::Uninit() 116 | { 117 | vTaskDelete(_ecTaskHandle); 118 | gpio_reset_pin((gpio_num_t)_pinA); 119 | gpio_reset_pin((gpio_num_t)_pinB); 120 | gpio_reset_pin((gpio_num_t)_pinBTN); 121 | } 122 | 123 | 124 | /** 125 | * @brief Get encoder direction, mainly for internal use, high frequency call needed 126 | * 127 | * @return int 114514:timeout 128 | */ 129 | int ENCODER::GetDirection() 130 | { 131 | _Ret = 114514; 132 | if (xSemaphoreTake(_SemaphoreMutex, (TickType_t)100) == pdTRUE) { 133 | _Ret = _EncoderDirection; 134 | xSemaphoreGive(_SemaphoreMutex); 135 | } 136 | return _Ret; 137 | } 138 | 139 | 140 | /** 141 | * @brief Get encoder position 142 | * 143 | * @return int 114514:timeout 144 | */ 145 | int ENCODER::GetPosition() 146 | { 147 | _Ret = 114514; 148 | if (xSemaphoreTake(_SemaphoreMutex, (TickType_t)100) == pdTRUE) { 149 | _Ret = _EncoderPositoin; 150 | xSemaphoreGive(_SemaphoreMutex); 151 | } 152 | return _Ret; 153 | } 154 | 155 | 156 | /** 157 | * @brief Reset encoder position to 0 158 | * 159 | */ 160 | void ENCODER::ResetPosition() 161 | { 162 | if (xSemaphoreTake(_SemaphoreMutex, (TickType_t)100) == pdTRUE) { 163 | _oldPosition = 0; 164 | _EncoderPositoin = 0; 165 | xSemaphoreGive(_SemaphoreMutex); 166 | } 167 | } 168 | 169 | 170 | /** 171 | * @brief Is encider moved 172 | * 173 | * @return true 174 | * @return false 175 | */ 176 | bool ENCODER::Moved() 177 | { 178 | if (GetPosition() == _oldPosition) { 179 | return false; 180 | } 181 | else { 182 | _oldPosition = GetPosition(); 183 | return true; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Buzzer/Tone/Tone.cpp: -------------------------------------------------------------------------------- 1 | // #include 2 | #include "esp32-hal-ledc.h" 3 | #include "freertos/FreeRTOS.h" 4 | #include "freertos/task.h" 5 | #include "freertos/queue.h" 6 | #include "freertos/semphr.h" 7 | #include "esp_log.h" 8 | #include "Buzzer.h" 9 | 10 | #define TAG "Tone" 11 | 12 | static TaskHandle_t _tone_task = NULL; 13 | static QueueHandle_t _tone_queue = NULL; 14 | static uint8_t _channel = 0; 15 | 16 | typedef enum{ 17 | TONE_START, 18 | TONE_END, 19 | TONE_SET_CHANNEL 20 | } tone_cmd_t; 21 | 22 | typedef struct{ 23 | tone_cmd_t tone_cmd; 24 | uint8_t pin; 25 | unsigned int frequency; 26 | unsigned long duration; 27 | uint8_t channel; 28 | } tone_msg_t; 29 | 30 | static void tone_task(void*){ 31 | tone_msg_t tone_msg; 32 | while(1){ 33 | xQueueReceive(_tone_queue, &tone_msg, portMAX_DELAY); 34 | switch(tone_msg.tone_cmd){ 35 | case TONE_START: 36 | ESP_LOGD(TAG, "Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%lu ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration); 37 | 38 | ESP_LOGD(TAG, "Setup LED controll on channel %d", _channel); 39 | ledcAttachPin(tone_msg.pin, _channel); 40 | ledcWriteTone(_channel, tone_msg.frequency); 41 | 42 | if(tone_msg.duration){ 43 | delay(tone_msg.duration); 44 | // ledcDetachPin(tone_msg.pin); 45 | ledcWriteTone(_channel, 0); 46 | } 47 | break; 48 | 49 | case TONE_END: 50 | ESP_LOGD(TAG, "Task received from queue TONE_END: pin=%d", tone_msg.pin); 51 | // ledcDetachPin(tone_msg.pin); 52 | ledcWriteTone(_channel, 0); 53 | break; 54 | 55 | case TONE_SET_CHANNEL: 56 | ESP_LOGD(TAG, "Task received from queue TONE_SET_CHANNEL: channel=%d", tone_msg.channel); 57 | _channel = tone_msg.channel; 58 | break; 59 | 60 | default: ; // do nothing 61 | } // switch 62 | } // infinite loop 63 | } 64 | 65 | static int tone_init(){ 66 | if(_tone_queue == NULL){ 67 | ESP_LOGV(TAG, "Creating tone queue"); 68 | _tone_queue = xQueueCreate(128, sizeof(tone_msg_t)); 69 | if(_tone_queue == NULL){ 70 | ESP_LOGE(TAG, "Could not create tone queue"); 71 | return 0; // ERR 72 | } 73 | ESP_LOGV(TAG, "Tone queue created"); 74 | } 75 | 76 | if(_tone_task == NULL){ 77 | ESP_LOGV(TAG, "Creating tone task"); 78 | xTaskCreate( 79 | tone_task, // Function to implement the task 80 | "toneTask", // Name of the task 81 | 3500, // Stack size in words 82 | NULL, // Task input parameter 83 | 1, // Priority of the task 84 | &_tone_task // Task handle. 85 | ); 86 | if(_tone_task == NULL){ 87 | ESP_LOGE(TAG, "Could not create tone task"); 88 | return 0; // ERR 89 | } 90 | ESP_LOGV(TAG, "Tone task created"); 91 | } 92 | return 1; // OK 93 | } 94 | 95 | void setToneChannel(uint8_t channel){ 96 | ESP_LOGD(TAG, "channel=%d", channel); 97 | if(tone_init()){ 98 | tone_msg_t tone_msg = { 99 | .tone_cmd = TONE_SET_CHANNEL, 100 | .pin = 0, // Ignored 101 | .frequency = 0, // Ignored 102 | .duration = 0, // Ignored 103 | .channel = channel 104 | }; 105 | xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY); 106 | } 107 | } 108 | 109 | void noTone(uint8_t _pin){ 110 | ESP_LOGD(TAG, "noTone was called"); 111 | if(tone_init()){ 112 | tone_msg_t tone_msg = { 113 | .tone_cmd = TONE_END, 114 | .pin = _pin, 115 | .frequency = 0, // Ignored 116 | .duration = 0, // Ignored 117 | .channel = 0 // Ignored 118 | }; 119 | xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY); 120 | } 121 | } 122 | 123 | // parameters: 124 | // _pin - pin number which will output the signal 125 | // frequency - PWM frequency in Hz 126 | // duration - time in ms - how long will the signal be outputted. 127 | // If not provided, or 0 you must manually call noTone to end output 128 | void tone(uint8_t _pin, unsigned int frequency, unsigned long duration){ 129 | ESP_LOGD(TAG, "_pin=%d, frequency=%u Hz, duration=%lu ms", _pin, frequency, duration); 130 | if(tone_init()){ 131 | tone_msg_t tone_msg = { 132 | .tone_cmd = TONE_START, 133 | .pin = _pin, 134 | .frequency = frequency, 135 | .duration = duration, 136 | .channel = 0 // Ignored 137 | }; 138 | xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY); 139 | } 140 | } -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Encoder/Button/README.md: -------------------------------------------------------------------------------- 1 | Button 2 | ====== 3 | 4 | * Author: Michael Adams () 5 | * Copyright (C) 2016 Michael D K Adams. 6 | * Released under the MIT license. 7 | 8 | Button is a tiny library to make reading buttons very simple. It handles debouncing automatically, and monitoring of state. 9 | 10 | Motivation 11 | ---------- 12 | Ahh buttons. Ahh debouncing! Sometimes you really wish you could ignore all the mechanics of debouncing, reading inputs, monitoring state, and just say... `if (button.pressed())` and know that it'll only run once each time you press a button. 13 | 14 | Or how about `if (button.released())`, or `button.toggled()`. It is such a simple concept, but in practice you need to set up timers, monitor input puts, set pullups, etc etc. On anything more than the most simple example, that can become quite a headache. 15 | 16 | So fed up with all that I figured there had to be a better way. This library is the result. 17 | 18 | Features 19 | -------- 20 | * Super simple API. 21 | * Handles debouncing. 22 | * Sets the pin mode automatically. 23 | * Lets you write code that triggers: 24 | ** based on the pin state (high or low) 25 | ** when a button is pressed 26 | ** when a button is released 27 | ** or when a button changes (i.e. pressing or releasing) 28 | 29 | Requirements 30 | ------------ 31 | * An Arduino — http://arduino.cc/ 32 | * A button 33 | 34 | Installation 35 | ------------ 36 | Download the ZIP archive (https://github.com/madleech/Button/zipball/master), then open the Arduino IDE and choose Sketch > Include Library > Add .ZIP Library... and select your downloaded file. 37 | 38 | You should now see in File > Examples > Button entires for the basic\_usage example. 39 | 40 | Code Examples 41 | ------------- 42 | Here is the 'basic\_usage' example program, included in the download: 43 | 44 | ```C++ 45 | #include 46 | 47 | Button button1(2); // Connect your button between pin 2 and GND 48 | Button button2(3); // Connect your button between pin 3 and GND 49 | Button button3(4); // Connect your button between pin 4 and GND 50 | 51 | void setup() { 52 | button1.begin(); 53 | button2.begin(); 54 | button3.begin(); 55 | 56 | while (!Serial) { }; // for Leos 57 | Serial.begin(9600); 58 | } 59 | 60 | void loop() { 61 | if (button1.pressed()) 62 | Serial.println("Button 1 pressed"); 63 | 64 | if (button2.released()) 65 | Serial.println("Button 2 released"); 66 | 67 | if (button3.toggled()) { 68 | if (button3.read() == Button::PRESSED) 69 | Serial.println("Button 3 has been pressed"); 70 | else 71 | Serial.println("Button 3 has been released"); 72 | } 73 | } 74 | ``` 75 | 76 | Documentation 77 | ------------- 78 | **Button(int pin)** 79 | Creates a new Button. 80 | 81 | **void begin()** 82 | Call this in your `setup` method to setup the button. All it does is set the correct pin mode. 83 | 84 | **bool pressed()** 85 | Returns true when _and only when_ the button is pressed. Until the button is released (in the debounced-sense of the word) this function won't return true again. So in effect, it returns true only while you are pressing the button, or to put it another way, it fires on a rising edge. 86 | 87 | **bool released()** 88 | Like `pressed()`, but round the other way. So if you hold down a button, and then release it... that is when it fires. 89 | 90 | **bool toggled()** 91 | Returns true whenever the button is pressed or released, i.e., its position is toggled. To find out what the position actually is, you can use the `read()` function. 92 | 93 | **bool read()** 94 | Returns the current debounced state of the button, i.e. Button::PRESSED or Button::RELEASED. 95 | 96 | **bool has_changed()** 97 | Returns whether the position/state of the button has changed after calling the previous read() function. Unlikely to be used except by Super Gurus. 98 | 99 | Quirks and Things to Keep in Mind 100 | --------------------------------- 101 | **Highs and lows, lows and highs** 102 | The easiest way to connect a switch on an Arduino is to connect it between an input pin and ground, and use the internal pullup resistor to make sure it doesn't float. This is fine and dandy, but it can get a bit confusing, as a "pressed" button is logic level: low, while a "released" button is logic level: high. 103 | 104 | So to make it a bit more obvious what you're talking about, you can use a couple of handy shortcuts: `Button::PRESSED` and `Button::RELEASED` which map to the expected values. 105 | 106 | License 107 | ------- 108 | Copyright (c) 2016 Michael D K Adams. http://www.michael.net.nz/ 109 | 110 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 111 | 112 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 113 | 114 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Lcd/LovyanGFX_Emma.hpp: -------------------------------------------------------------------------------- 1 | // v1.0.0 を有効にします(v0からの移行期間の特別措置です。これを書かない場合は旧v0系で動作します。) 2 | #pragma once 3 | 4 | #define LGFX_USE_V1 5 | #include 6 | 7 | // ESP32でLovyanGFXを独自設定で利用する場合の設定例 8 | 9 | /// 独自の設定を行うクラスを、LGFX_Deviceから派生して作成します。 10 | class LGFX_Emma : public lgfx::LGFX_Device 11 | { 12 | /* 13 | クラス名は"LGFX"から別の名前に変更しても構いません。 14 | AUTODETECTと併用する場合は"LGFX"は使用されているため、LGFX以外の名前に変更してください。 15 | また、複数枚のパネルを同時使用する場合もそれぞれに異なる名前を付けてください。 16 | ※ クラス名を変更する場合はコンストラクタの名前も併せて同じ名前に変更が必要です。 17 | 18 | 名前の付け方は自由に決めて構いませんが、設定が増えた場合を想定し、 19 | 例えばESP32 DevKit-CでSPI接続のILI9341の設定を行った場合、 20 | LGFX_DevKitC_SPI_ILI9341 21 | のような名前にし、ファイル名とクラス名を一致させておくことで、利用時に迷いにくくなります。 22 | //*/ 23 | 24 | 25 | // 接続するパネルの型にあったインスタンスを用意します。 26 | //lgfx::Panel_GC9A01 _panel_instance; 27 | //lgfx::Panel_GDEW0154M09 _panel_instance; 28 | //lgfx::Panel_HX8357B _panel_instance; 29 | //lgfx::Panel_HX8357D _panel_instance; 30 | //lgfx::Panel_ILI9163 _panel_instance; 31 | // lgfx::Panel_ILI9341 _panel_instance; 32 | //lgfx::Panel_ILI9342 _panel_instance; 33 | //lgfx::Panel_ILI9481 _panel_instance; 34 | //lgfx::Panel_ILI9486 _panel_instance; 35 | //lgfx::Panel_ILI9488 _panel_instance; 36 | //lgfx::Panel_IT8951 _panel_instance; 37 | //lgfx::Panel_RA8875 _panel_instance; 38 | //lgfx::Panel_SH110x _panel_instance; // SH1106, SH1107 39 | //lgfx::Panel_SSD1306 _panel_instance; 40 | //lgfx::Panel_SSD1327 _panel_instance; 41 | //lgfx::Panel_SSD1331 _panel_instance; 42 | //lgfx::Panel_SSD1351 _panel_instance; // SSD1351, SSD1357 43 | //lgfx::Panel_SSD1963 _panel_instance; 44 | //lgfx::Panel_ST7735 _panel_instance; 45 | //lgfx::Panel_ST7735S _panel_instance; 46 | lgfx::Panel_ST7789 _panel_instance; 47 | //lgfx::Panel_ST7796 _panel_instance; 48 | 49 | 50 | // パネルを接続するバスの種類にあったインスタンスを用意します。 51 | lgfx::Bus_SPI _bus_instance; // SPIバスのインスタンス 52 | //lgfx::Bus_I2C _bus_instance; // I2Cバスのインスタンス (ESP32のみ) 53 | //lgfx::Bus_Parallel8 _bus_instance; // 8ビットパラレルバスのインスタンス (ESP32のみ) 54 | 55 | // バックライト制御が可能な場合はインスタンスを用意します。(必要なければ削除) 56 | lgfx::Light_PWM _light_instance; 57 | 58 | public: 59 | 60 | // コンストラクタを作成し、ここで各種設定を行います。 61 | // クラス名を変更した場合はコンストラクタも同じ名前を指定してください。 62 | LGFX_Emma(void) 63 | { 64 | { // バス制御の設定を行います。 65 | auto cfg = _bus_instance.config(); // バス設定用の構造体を取得します。 66 | 67 | // SPIバスの設定 68 | cfg.spi_host = SPI3_HOST; // 使用するSPIを選択 ESP32-S2,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST 69 | // ※ ESP-IDFバージョンアップに伴い、VSPI_HOST , HSPI_HOSTの記述は非推奨になるため、エラーが出る場合は代わりにSPI2_HOST , SPI3_HOSTを使用してください。 70 | cfg.spi_mode = 2; // SPI通信モードを設定 (0 ~ 3) 71 | cfg.freq_write = 80000000; // 送信時のSPIクロック (最大80MHz, 80MHzを整数で割った値に丸められます) 72 | cfg.freq_read = 16000000; // 受信時のSPIクロック 73 | cfg.spi_3wire = true; // 受信をMOSIピンで行う場合はtrueを設定 74 | cfg.use_lock = true; // トランザクションロックを使用する場合はtrueを設定 75 | cfg.dma_channel = SPI_DMA_CH_AUTO; // 使用するDMAチャンネルを設定 (0=DMA不使用 / 1=1ch / 2=ch / SPI_DMA_CH_AUTO=自動設定) 76 | // ※ ESP-IDFバージョンアップに伴い、DMAチャンネルはSPI_DMA_CH_AUTO(自動設定)が推奨になりました。1ch,2chの指定は非推奨になります。 77 | cfg.pin_sclk = 13; // SPIのSCLKピン番号を設定 78 | cfg.pin_mosi = 15; // SPIのMOSIピン番号を設定 79 | cfg.pin_miso = -1; // SPIのMISOピン番号を設定 (-1 = disable) 80 | cfg.pin_dc = 16; // SPIのD/Cピン番号を設定 (-1 = disable) 81 | // SDカードと共通のSPIバスを使う場合、MISOは省略せず必ず設定してください。 82 | //*/ 83 | 84 | 85 | _bus_instance.config(cfg); // 設定値をバスに反映します。 86 | _panel_instance.setBus(&_bus_instance); // バスをパネルにセットします。 87 | } 88 | 89 | { // 表示パネル制御の設定を行います。 90 | auto cfg = _panel_instance.config(); // 表示パネル設定用の構造体を取得します。 91 | 92 | cfg.pin_cs = 21; // CSが接続されているピン番号 (-1 = disable) 93 | cfg.pin_rst = 17; // RSTが接続されているピン番号 (-1 = disable) 94 | cfg.pin_busy = -1; // BUSYが接続されているピン番号 (-1 = disable) 95 | 96 | // ※ 以下の設定値はパネル毎に一般的な初期値が設定されていますので、不明な項目はコメントアウトして試してみてください。 97 | 98 | cfg.panel_width = 240; // 実際に表示可能な幅 99 | cfg.panel_height = 240; // 実際に表示可能な高さ 100 | cfg.offset_x = 0; // パネルのX方向オフセット量 101 | cfg.offset_y = 0; // パネルのY方向オフセット量 102 | cfg.offset_rotation = 0; // 回転方向の値のオフセット 0~7 (4~7は上下反転) 103 | cfg.dummy_read_pixel = 8; // ピクセル読出し前のダミーリードのビット数 104 | cfg.dummy_read_bits = 1; // ピクセル以外のデータ読出し前のダミーリードのビット数 105 | cfg.readable = true; // データ読出しが可能な場合 trueに設定 106 | cfg.invert = true; // パネルの明暗が反転してしまう場合 trueに設定 107 | cfg.rgb_order = false; // パネルの赤と青が入れ替わってしまう場合 trueに設定 108 | cfg.dlen_16bit = false; // 16bitパラレルやSPIでデータ長を16bit単位で送信するパネルの場合 trueに設定 109 | cfg.bus_shared = true; // SDカードとバスを共有している場合 trueに設定(drawJpgFile等でバス制御を行います) 110 | 111 | // 以下はST7735やILI9163のようにピクセル数が可変のドライバで表示がずれる場合にのみ設定してください。 112 | // cfg.memory_width = 240; // ドライバICがサポートしている最大の幅 113 | // cfg.memory_height = 320; // ドライバICがサポートしている最大の高さ 114 | 115 | _panel_instance.config(cfg); 116 | } 117 | 118 | //* 119 | { // バックライト制御の設定を行います。(必要なければ削除) 120 | auto cfg = _light_instance.config(); // バックライト設定用の構造体を取得します。 121 | 122 | cfg.pin_bl = 14; // バックライトが接続されているピン番号 123 | cfg.invert = false; // バックライトの輝度を反転させる場合 true 124 | cfg.freq = 44100; // バックライトのPWM周波数 125 | cfg.pwm_channel = 7; // 使用するPWMのチャンネル番号 126 | 127 | _light_instance.config(cfg); 128 | _panel_instance.setLight(&_light_instance); // バックライトをパネルにセットします。 129 | } 130 | //*/ 131 | 132 | setPanel(&_panel_instance); // 使用するパネルをセットします。 133 | } 134 | }; 135 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/Buzzer/Tone/esp32-hal-ledc.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // #include "esp32-hal.h" 16 | #include "soc/soc_caps.h" 17 | #include "driver/ledc.h" 18 | #include "esp32-hal-ledc.h" 19 | #include "esp_log.h" 20 | #include "driver/gpio.h" 21 | 22 | #define TAG "ledc" 23 | 24 | #ifdef SOC_LEDC_SUPPORT_HS_MODE 25 | #define LEDC_CHANNELS (SOC_LEDC_CHANNEL_NUM<<1) 26 | #else 27 | #define LEDC_CHANNELS (SOC_LEDC_CHANNEL_NUM) 28 | #endif 29 | 30 | //Use XTAL clock if possible to avoid timer frequency error when setting APB clock < 80 Mhz 31 | //Need to be fixed in ESP-IDF 32 | #ifdef SOC_LEDC_SUPPORT_XTAL_CLOCK 33 | #define LEDC_DEFAULT_CLK LEDC_USE_XTAL_CLK 34 | #else 35 | #define LEDC_DEFAULT_CLK LEDC_AUTO_CLK 36 | #endif 37 | 38 | #define LEDC_MAX_BIT_WIDTH SOC_LEDC_TIMER_BIT_WIDE_NUM 39 | 40 | /* 41 | * LEDC Chan to Group/Channel/Timer Mapping 42 | ** ledc: 0 => Group: 0, Channel: 0, Timer: 0 43 | ** ledc: 1 => Group: 0, Channel: 1, Timer: 0 44 | ** ledc: 2 => Group: 0, Channel: 2, Timer: 1 45 | ** ledc: 3 => Group: 0, Channel: 3, Timer: 1 46 | ** ledc: 4 => Group: 0, Channel: 4, Timer: 2 47 | ** ledc: 5 => Group: 0, Channel: 5, Timer: 2 48 | ** ledc: 6 => Group: 0, Channel: 6, Timer: 3 49 | ** ledc: 7 => Group: 0, Channel: 7, Timer: 3 50 | ** ledc: 8 => Group: 1, Channel: 0, Timer: 0 51 | ** ledc: 9 => Group: 1, Channel: 1, Timer: 0 52 | ** ledc: 10 => Group: 1, Channel: 2, Timer: 1 53 | ** ledc: 11 => Group: 1, Channel: 3, Timer: 1 54 | ** ledc: 12 => Group: 1, Channel: 4, Timer: 2 55 | ** ledc: 13 => Group: 1, Channel: 5, Timer: 2 56 | ** ledc: 14 => Group: 1, Channel: 6, Timer: 3 57 | ** ledc: 15 => Group: 1, Channel: 7, Timer: 3 58 | */ 59 | 60 | uint8_t channels_resolution[LEDC_CHANNELS] = {0}; 61 | 62 | uint32_t ledcSetup(uint8_t chan, uint32_t freq, uint8_t bit_num) 63 | { 64 | if(chan >= LEDC_CHANNELS || bit_num > LEDC_MAX_BIT_WIDTH){ 65 | ESP_LOGE("TAG", "No more LEDC channels available! (maximum %u) or bit width too big (maximum %u)", LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH); 66 | return 0; 67 | } 68 | 69 | uint8_t group=(chan/8), timer=((chan/2)%4); 70 | 71 | ledc_timer_config_t ledc_timer = { 72 | .speed_mode = (ledc_mode_t)group, 73 | .duty_resolution = (ledc_timer_bit_t)bit_num, 74 | .timer_num = (ledc_timer_t)timer, 75 | .freq_hz = freq, 76 | .clk_cfg = LEDC_DEFAULT_CLK 77 | }; 78 | if(ledc_timer_config(&ledc_timer) != ESP_OK) 79 | { 80 | ESP_LOGE("TAG", "ledc setup failed!"); 81 | return 0; 82 | } 83 | channels_resolution[chan] = bit_num; 84 | return ledc_get_freq((ledc_mode_t)group,(ledc_timer_t)timer); 85 | } 86 | 87 | void ledcWrite(uint8_t chan, uint32_t duty) 88 | { 89 | if(chan >= LEDC_CHANNELS){ 90 | return; 91 | } 92 | uint8_t group=(chan/8), channel=(chan%8); 93 | 94 | //Fixing if all bits in resolution is set = LEDC FULL ON 95 | uint32_t max_duty = (1 << channels_resolution[chan]) - 1; 96 | 97 | if((duty == max_duty) && (max_duty != 1)){ 98 | duty = max_duty + 1; 99 | } 100 | 101 | ledc_set_duty((ledc_mode_t)group, (ledc_channel_t)channel, duty); 102 | ledc_update_duty((ledc_mode_t)group, (ledc_channel_t)channel); 103 | } 104 | 105 | uint32_t ledcRead(uint8_t chan) 106 | { 107 | if(chan >= LEDC_CHANNELS){ 108 | return 0; 109 | } 110 | uint8_t group=(chan/8), channel=(chan%8); 111 | return ledc_get_duty((ledc_mode_t)group,(ledc_channel_t)channel); 112 | } 113 | 114 | uint32_t ledcReadFreq(uint8_t chan) 115 | { 116 | if(!ledcRead(chan)){ 117 | return 0; 118 | } 119 | uint8_t group=(chan/8), timer=((chan/2)%4); 120 | return ledc_get_freq((ledc_mode_t)group,(ledc_timer_t)timer); 121 | } 122 | 123 | uint32_t ledcWriteTone(uint8_t chan, uint32_t freq) 124 | { 125 | if(chan >= LEDC_CHANNELS){ 126 | return 0; 127 | } 128 | if(!freq){ 129 | ledcWrite(chan, 0); 130 | return 0; 131 | } 132 | 133 | uint8_t group=(chan/8), timer=((chan/2)%4); 134 | 135 | ledc_timer_config_t ledc_timer = { 136 | .speed_mode = (ledc_mode_t)group, 137 | .duty_resolution = (ledc_timer_bit_t)10, 138 | .timer_num = (ledc_timer_t)timer, 139 | .freq_hz = freq, 140 | .clk_cfg = LEDC_DEFAULT_CLK 141 | }; 142 | 143 | if(ledc_timer_config(&ledc_timer) != ESP_OK) 144 | { 145 | ESP_LOGE("TAG", "ledcSetup failed!"); 146 | return 0; 147 | } 148 | channels_resolution[chan] = 10; 149 | 150 | uint32_t res_freq = ledc_get_freq((ledc_mode_t)group,(ledc_timer_t)timer); 151 | ledcWrite(chan, 0x1FF); 152 | return res_freq; 153 | } 154 | 155 | uint32_t ledcWriteNote(uint8_t chan, note_t note, uint8_t octave){ 156 | const uint16_t noteFrequencyBase[12] = { 157 | // C C# D Eb E F F# G G# A Bb B 158 | 4186, 4435, 4699, 4978, 5274, 5588, 5920, 6272, 6645, 7040, 7459, 7902 159 | }; 160 | 161 | if(octave > 8 || note >= NOTE_MAX){ 162 | return 0; 163 | } 164 | uint32_t noteFreq = (uint32_t)noteFrequencyBase[note] / (uint32_t)(1 << (8-octave)); 165 | return ledcWriteTone(chan, noteFreq); 166 | } 167 | 168 | void ledcAttachPin(uint8_t pin, uint8_t chan) 169 | { 170 | if(chan >= LEDC_CHANNELS){ 171 | return; 172 | } 173 | uint8_t group=(chan/8), channel=(chan%8), timer=((chan/2)%4); 174 | 175 | ledc_channel_config_t ledc_channel = { 176 | .gpio_num = pin, 177 | .speed_mode = (ledc_mode_t)group, 178 | .channel = (ledc_channel_t)channel, 179 | .intr_type = LEDC_INTR_DISABLE, 180 | .timer_sel = (ledc_timer_t)timer, 181 | .duty = 0, 182 | .hpoint = 0 183 | }; 184 | ledc_channel_config(&ledc_channel); 185 | } 186 | 187 | // void ledcDetachPin(uint8_t pin) 188 | // { 189 | // pinMatrixOutDetach(pin, false, false); 190 | // gpio_matrix_out(pin, 0x100, false, false); 191 | // ESP_LOGE(TAG, ".... :("); 192 | // } 193 | 194 | uint32_t ledcChangeFrequency(uint8_t chan, uint32_t freq, uint8_t bit_num) 195 | { 196 | if(chan >= LEDC_CHANNELS || bit_num > LEDC_MAX_BIT_WIDTH){ 197 | ESP_LOGE("TAG", "LEDC channel not available! (maximum %u) or bit width too big (maximum %u)", LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH); 198 | return 0; 199 | } 200 | uint8_t group=(chan/8), timer=((chan/2)%4); 201 | 202 | ledc_timer_config_t ledc_timer = { 203 | .speed_mode = (ledc_mode_t)group, 204 | .duty_resolution = (ledc_timer_bit_t)bit_num, 205 | .timer_num = (ledc_timer_t)timer, 206 | .freq_hz = freq, 207 | .clk_cfg = LEDC_DEFAULT_CLK 208 | }; 209 | 210 | if(ledc_timer_config(&ledc_timer) != ESP_OK) 211 | { 212 | ESP_LOGE("TAG", "ledcChangeFrequency failed!"); 213 | return 0; 214 | } 215 | channels_resolution[chan] = bit_num; 216 | return ledc_get_freq((ledc_mode_t)group,(ledc_timer_t)timer); 217 | } 218 | 219 | static int8_t pin_to_channel[SOC_GPIO_PIN_COUNT] = { 0 }; 220 | static int cnt_channel = LEDC_CHANNELS; 221 | void analogWrite(uint8_t pin, int value) { 222 | // Use ledc hardware for internal pins 223 | if (pin < SOC_GPIO_PIN_COUNT) { 224 | if (pin_to_channel[pin] == 0) { 225 | if (!cnt_channel) { 226 | ESP_LOGE("TAG", "No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS); 227 | return; 228 | } 229 | pin_to_channel[pin] = cnt_channel--; 230 | ledcAttachPin(pin, cnt_channel); 231 | ledcSetup(cnt_channel, 1000, 8); 232 | } 233 | ledcWrite(pin_to_channel[pin] - 1, value); 234 | } 235 | } 236 | 237 | int8_t analogGetChannel(uint8_t pin) { 238 | return pin_to_channel[pin] - 1; 239 | } 240 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/LvglPort/lv_port_disp.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_port_disp_templ.c 3 | * 4 | */ 5 | 6 | /*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/ 7 | #if 1 8 | 9 | /********************* 10 | * INCLUDES 11 | *********************/ 12 | #include "lv_port_disp.h" 13 | #include 14 | 15 | #include "esp_log.h" 16 | 17 | /********************* 18 | * DEFINES 19 | *********************/ 20 | #ifndef MY_DISP_HOR_RES 21 | #warning Please define or replace the macro MY_DISP_HOR_RES with the actual screen width, default value 320 is used for now. 22 | #define MY_DISP_HOR_RES 320 23 | #endif 24 | 25 | #ifndef MY_DISP_VER_RES 26 | #warning Please define or replace the macro MY_DISP_HOR_RES with the actual screen height, default value 240 is used for now. 27 | #define MY_DISP_VER_RES 240 28 | #endif 29 | 30 | /********************** 31 | * TYPEDEFS 32 | **********************/ 33 | 34 | /********************** 35 | * STATIC PROTOTYPES 36 | **********************/ 37 | static void disp_init(void); 38 | 39 | static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p); 40 | //static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, 41 | // const lv_area_t * fill_area, lv_color_t color); 42 | 43 | /********************** 44 | * STATIC VARIABLES 45 | **********************/ 46 | static LGFX_Emma* _lgfxEmma = nullptr; 47 | 48 | /********************** 49 | * MACROS 50 | **********************/ 51 | 52 | /********************** 53 | * GLOBAL FUNCTIONS 54 | **********************/ 55 | 56 | void lv_port_disp_init(LGFX_Emma* pLgfxEmma) 57 | { 58 | _lgfxEmma = pLgfxEmma; 59 | 60 | /*------------------------- 61 | * Initialize your display 62 | * -----------------------*/ 63 | disp_init(); 64 | /*----------------------------- 65 | * Create a buffer for drawing 66 | *----------------------------*/ 67 | 68 | /** 69 | * LVGL requires a buffer where it internally draws the widgets. 70 | * Later this buffer will passed to your display driver's `flush_cb` to copy its content to your display. 71 | * The buffer has to be greater than 1 display row 72 | * 73 | * There are 3 buffering configurations: 74 | * 1. Create ONE buffer: 75 | * LVGL will draw the display's content here and writes it to your display 76 | * 77 | * 2. Create TWO buffer: 78 | * LVGL will draw the display's content to a buffer and writes it your display. 79 | * You should use DMA to write the buffer's content to the display. 80 | * It will enable LVGL to draw the next part of the screen to the other buffer while 81 | * the data is being sent form the first buffer. It makes rendering and flushing parallel. 82 | * 83 | * 3. Double buffering 84 | * Set 2 screens sized buffers and set disp_drv.full_refresh = 1. 85 | * This way LVGL will always provide the whole rendered screen in `flush_cb` 86 | * and you only need to change the frame buffer's address. 87 | */ 88 | 89 | // /* Example for 1) */ 90 | // static lv_disp_draw_buf_t draw_buf_dsc_1; 91 | // static lv_color_t buf_1[MY_DISP_HOR_RES * 10]; /*A buffer for 10 rows*/ 92 | // lv_disp_draw_buf_init(&draw_buf_dsc_1, buf_1, NULL, MY_DISP_HOR_RES * 10); /*Initialize the display buffer*/ 93 | 94 | // /* Example for 2) */ 95 | // static lv_disp_draw_buf_t draw_buf_dsc_2; 96 | // static lv_color_t buf_2_1[MY_DISP_HOR_RES * 10]; /*A buffer for 10 rows*/ 97 | // static lv_color_t buf_2_2[MY_DISP_HOR_RES * 10]; /*An other buffer for 10 rows*/ 98 | // lv_disp_draw_buf_init(&draw_buf_dsc_2, buf_2_1, buf_2_2, MY_DISP_HOR_RES * 10); /*Initialize the display buffer*/ 99 | 100 | // /* Example for 3) also set disp_drv.full_refresh = 1 below*/ 101 | // static lv_disp_draw_buf_t draw_buf_dsc_3; 102 | // static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*A screen sized buffer*/ 103 | // static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*Another screen sized buffer*/ 104 | // lv_disp_draw_buf_init(&draw_buf_dsc_3, buf_3_1, buf_3_2, 105 | // MY_DISP_VER_RES * LV_VER_RES_MAX); /*Initialize the display buffer*/ 106 | 107 | 108 | /* Apply buffer from PSRAM */ 109 | static lv_disp_draw_buf_t draw_buf_dsc_3; 110 | // lv_color_t * buf_3_1 = (lv_color_t *)heap_caps_malloc(MY_DISP_HOR_RES * MY_DISP_VER_RES * sizeof(lv_color_t), MALLOC_CAP_SPIRAM); 111 | // lv_color_t * buf_3_2 = (lv_color_t *)heap_caps_malloc(MY_DISP_HOR_RES * MY_DISP_VER_RES * sizeof(lv_color_t), MALLOC_CAP_SPIRAM); 112 | lv_color_t * buf_3_1 = (lv_color_t *)malloc(MY_DISP_HOR_RES * MY_DISP_VER_RES * sizeof(lv_color_t)); 113 | lv_color_t * buf_3_2 = (lv_color_t *)malloc(MY_DISP_HOR_RES * MY_DISP_VER_RES * sizeof(lv_color_t)); 114 | if ((buf_3_1 == NULL) || (buf_3_2 == NULL)) { 115 | ESP_LOGE("LvglPorting", "malloc from PSRAM failed"); 116 | return; 117 | } 118 | lv_disp_draw_buf_init(&draw_buf_dsc_3, buf_3_1, buf_3_2, 119 | MY_DISP_VER_RES * LV_VER_RES_MAX); /*Initialize the display buffer*/ 120 | 121 | 122 | /*----------------------------------- 123 | * Register the display in LVGL 124 | *----------------------------------*/ 125 | 126 | static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/ 127 | lv_disp_drv_init(&disp_drv); /*Basic initialization*/ 128 | 129 | /*Set up the functions to access to your display*/ 130 | 131 | /*Set the resolution of the display*/ 132 | disp_drv.hor_res = MY_DISP_HOR_RES; 133 | disp_drv.ver_res = MY_DISP_VER_RES; 134 | 135 | /*Used to copy the buffer's content to the display*/ 136 | disp_drv.flush_cb = disp_flush; 137 | 138 | /*Set a display buffer*/ 139 | disp_drv.draw_buf = &draw_buf_dsc_3; 140 | 141 | /*Required for Example 3)*/ 142 | disp_drv.full_refresh = 1; 143 | 144 | /* Fill a memory array with a color if you have GPU. 145 | * Note that, in lv_conf.h you can enable GPUs that has built-in support in LVGL. 146 | * But if you have a different GPU you can use with this callback.*/ 147 | //disp_drv.gpu_fill_cb = gpu_fill; 148 | 149 | /*Finally register the driver*/ 150 | lv_disp_drv_register(&disp_drv); 151 | } 152 | 153 | /********************** 154 | * STATIC FUNCTIONS 155 | **********************/ 156 | 157 | /*Initialize your display and the required peripherals.*/ 158 | static void disp_init(void) 159 | { 160 | /*You code here*/ 161 | _lgfxEmma->fillScreen(TFT_BLACK); 162 | _lgfxEmma->setBrightness(100); 163 | 164 | } 165 | 166 | volatile bool disp_flush_enabled = true; 167 | 168 | /* Enable updating the screen (the flushing process) when disp_flush() is called by LVGL 169 | */ 170 | void disp_enable_update(void) 171 | { 172 | disp_flush_enabled = true; 173 | } 174 | 175 | /* Disable updating the screen (the flushing process) when disp_flush() is called by LVGL 176 | */ 177 | void disp_disable_update(void) 178 | { 179 | disp_flush_enabled = false; 180 | } 181 | 182 | /*Flush the content of the internal buffer the specific area on the display 183 | *You can use DMA or any hardware acceleration to do this operation in the background but 184 | *'lv_disp_flush_ready()' has to be called when finished.*/ 185 | static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) 186 | { 187 | if(disp_flush_enabled) { 188 | /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/ 189 | 190 | // int32_t x; 191 | // int32_t y; 192 | // for(y = area->y1; y <= area->y2; y++) { 193 | // for(x = area->x1; x <= area->x2; x++) { 194 | // /*Put a pixel to the display. For example:*/ 195 | // /*put_px(x, y, *color_p)*/ 196 | // color_p++; 197 | // } 198 | // } 199 | 200 | uint32_t w = ( area->x2 - area->x1 + 1 ); 201 | uint32_t h = ( area->y2 - area->y1 + 1 ); 202 | _lgfxEmma->startWrite(); 203 | _lgfxEmma->setAddrWindow( area->x1, area->y1, w, h ); 204 | _lgfxEmma->pushColors( ( uint16_t * )&color_p->full, w * h, true ); 205 | _lgfxEmma->endWrite(); 206 | 207 | } 208 | 209 | /*IMPORTANT!!! 210 | *Inform the graphics library that you are ready with the flushing*/ 211 | lv_disp_flush_ready(disp_drv); 212 | } 213 | 214 | /*OPTIONAL: GPU INTERFACE*/ 215 | 216 | /*If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/ 217 | //static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, 218 | // const lv_area_t * fill_area, lv_color_t color) 219 | //{ 220 | // /*It's an example code which should be done by your GPU*/ 221 | // int32_t x, y; 222 | // dest_buf += dest_width * fill_area->y1; /*Go to the first line*/ 223 | // 224 | // for(y = fill_area->y1; y <= fill_area->y2; y++) { 225 | // for(x = fill_area->x1; x <= fill_area->x2; x++) { 226 | // dest_buf[x] = color; 227 | // } 228 | // dest_buf+=dest_width; /*Go to the next line*/ 229 | // } 230 | //} 231 | 232 | 233 | #else /*Enable this file at the top*/ 234 | 235 | /*This dummy typedef exists purely to silence -Wpedantic.*/ 236 | typedef int keep_pedantic_happy; 237 | #endif 238 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/LvglPort/lv_port_indev.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_port_indev_templ.c 3 | * 4 | */ 5 | 6 | /*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/ 7 | #if 1 8 | 9 | /********************* 10 | * INCLUDES 11 | *********************/ 12 | #include "lv_port_indev.h" 13 | 14 | /********************* 15 | * DEFINES 16 | *********************/ 17 | 18 | /********************** 19 | * TYPEDEFS 20 | **********************/ 21 | 22 | /********************** 23 | * STATIC PROTOTYPES 24 | **********************/ 25 | 26 | // static void touchpad_init(void); 27 | // static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); 28 | // static bool touchpad_is_pressed(void); 29 | // static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y); 30 | 31 | // static void mouse_init(void); 32 | // static void mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); 33 | // static bool mouse_is_pressed(void); 34 | // static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y); 35 | 36 | // static void keypad_init(void); 37 | // static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); 38 | // static uint32_t keypad_get_key(void); 39 | 40 | // static void encoder_init(void); 41 | static void encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); 42 | // static void encoder_handler(void); 43 | 44 | // static void button_init(void); 45 | // static void button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); 46 | // static int8_t button_get_pressed_id(void); 47 | // static bool button_is_pressed(uint8_t id); 48 | 49 | /********************** 50 | * STATIC VARIABLES 51 | **********************/ 52 | // lv_indev_t * indev_touchpad; 53 | // lv_indev_t * indev_mouse; 54 | // lv_indev_t * indev_keypad; 55 | lv_indev_t * indev_encoder; 56 | // lv_indev_t * indev_button; 57 | 58 | // static int32_t encoder_diff; 59 | // static lv_indev_state_t encoder_state; 60 | 61 | static ENCODER* _encoder = nullptr; 62 | static lv_group_t * _defaultGroup = nullptr; 63 | 64 | /********************** 65 | * MACROS 66 | **********************/ 67 | 68 | /********************** 69 | * GLOBAL FUNCTIONS 70 | **********************/ 71 | 72 | void lv_port_indev_init(ENCODER* pEncoder) 73 | { 74 | _encoder = pEncoder; 75 | 76 | 77 | /** 78 | * Here you will find example implementation of input devices supported by LittelvGL: 79 | * - Touchpad 80 | * - Mouse (with cursor support) 81 | * - Keypad (supports GUI usage only with key) 82 | * - Encoder (supports GUI usage only with: left, right, push) 83 | * - Button (external buttons to press points on the screen) 84 | * 85 | * The `..._read()` function are only examples. 86 | * You should shape them according to your hardware 87 | */ 88 | 89 | static lv_indev_drv_t indev_drv; 90 | 91 | /*------------------ 92 | * Touchpad 93 | * -----------------*/ 94 | 95 | /*Initialize your touchpad if you have*/ 96 | // touchpad_init(); 97 | 98 | // /*Register a touchpad input device*/ 99 | // lv_indev_drv_init(&indev_drv); 100 | // indev_drv.type = LV_INDEV_TYPE_POINTER; 101 | // indev_drv.read_cb = touchpad_read; 102 | // indev_touchpad = lv_indev_drv_register(&indev_drv); 103 | 104 | /*------------------ 105 | * Mouse 106 | * -----------------*/ 107 | 108 | /*Initialize your mouse if you have*/ 109 | // mouse_init(); 110 | 111 | // /*Register a mouse input device*/ 112 | // lv_indev_drv_init(&indev_drv); 113 | // indev_drv.type = LV_INDEV_TYPE_POINTER; 114 | // indev_drv.read_cb = mouse_read; 115 | // indev_mouse = lv_indev_drv_register(&indev_drv); 116 | 117 | // /*Set cursor. For simplicity set a HOME symbol now.*/ 118 | // lv_obj_t * mouse_cursor = lv_img_create(lv_scr_act()); 119 | // lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME); 120 | // lv_indev_set_cursor(indev_mouse, mouse_cursor); 121 | 122 | /*------------------ 123 | * Keypad 124 | * -----------------*/ 125 | 126 | /*Initialize your keypad or keyboard if you have*/ 127 | // keypad_init(); 128 | 129 | // /*Register a keypad input device*/ 130 | // lv_indev_drv_init(&indev_drv); 131 | // indev_drv.type = LV_INDEV_TYPE_KEYPAD; 132 | // indev_drv.read_cb = keypad_read; 133 | // indev_keypad = lv_indev_drv_register(&indev_drv); 134 | 135 | /*Later you should create group(s) with `lv_group_t * group = lv_group_create()`, 136 | *add objects to the group with `lv_group_add_obj(group, obj)` 137 | *and assign this input device to group to navigate in it: 138 | *`lv_indev_set_group(indev_keypad, group);`*/ 139 | 140 | /*------------------ 141 | * Encoder 142 | * -----------------*/ 143 | 144 | /*Initialize your encoder if you have*/ 145 | // encoder_init(); 146 | 147 | /*Register a encoder input device*/ 148 | lv_indev_drv_init(&indev_drv); 149 | indev_drv.type = LV_INDEV_TYPE_ENCODER; 150 | indev_drv.read_cb = encoder_read; 151 | indev_encoder = lv_indev_drv_register(&indev_drv); 152 | 153 | /*Later you should create group(s) with `lv_group_t * group = lv_group_create()`, 154 | *add objects to the group with `lv_group_add_obj(group, obj)` 155 | *and assign this input device to group to navigate in it: 156 | *`lv_indev_set_group(indev_encoder, group);`*/ 157 | 158 | /* Reset default group and add encoder in */ 159 | _defaultGroup = lv_group_create(); 160 | lv_group_set_default(_defaultGroup); 161 | lv_indev_set_group(indev_encoder, _defaultGroup); 162 | 163 | /*------------------ 164 | * Button 165 | * -----------------*/ 166 | 167 | /*Initialize your button if you have*/ 168 | // button_init(); 169 | 170 | // /*Register a button input device*/ 171 | // lv_indev_drv_init(&indev_drv); 172 | // indev_drv.type = LV_INDEV_TYPE_BUTTON; 173 | // indev_drv.read_cb = button_read; 174 | // indev_button = lv_indev_drv_register(&indev_drv); 175 | 176 | // /*Assign buttons to points on the screen*/ 177 | // static const lv_point_t btn_points[2] = { 178 | // {10, 10}, /*Button 0 -> x:10; y:10*/ 179 | // {40, 100}, /*Button 1 -> x:40; y:100*/ 180 | // }; 181 | // lv_indev_set_button_points(indev_button, btn_points); 182 | } 183 | 184 | /********************** 185 | * STATIC FUNCTIONS 186 | **********************/ 187 | 188 | // /*------------------ 189 | // * Touchpad 190 | // * -----------------*/ 191 | 192 | // /*Initialize your touchpad*/ 193 | // static void touchpad_init(void) 194 | // { 195 | // /*Your code comes here*/ 196 | // } 197 | 198 | // /*Will be called by the library to read the touchpad*/ 199 | // static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) 200 | // { 201 | // static lv_coord_t last_x = 0; 202 | // static lv_coord_t last_y = 0; 203 | 204 | // /*Save the pressed coordinates and the state*/ 205 | // if(touchpad_is_pressed()) { 206 | // touchpad_get_xy(&last_x, &last_y); 207 | // data->state = LV_INDEV_STATE_PR; 208 | // } 209 | // else { 210 | // data->state = LV_INDEV_STATE_REL; 211 | // } 212 | 213 | // /*Set the last pressed coordinates*/ 214 | // data->point.x = last_x; 215 | // data->point.y = last_y; 216 | // } 217 | 218 | // /*Return true is the touchpad is pressed*/ 219 | // static bool touchpad_is_pressed(void) 220 | // { 221 | // /*Your code comes here*/ 222 | 223 | // return false; 224 | // } 225 | 226 | // /*Get the x and y coordinates if the touchpad is pressed*/ 227 | // static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y) 228 | // { 229 | // /*Your code comes here*/ 230 | 231 | // (*x) = 0; 232 | // (*y) = 0; 233 | // } 234 | 235 | // /*------------------ 236 | // * Mouse 237 | // * -----------------*/ 238 | 239 | // /*Initialize your mouse*/ 240 | // static void mouse_init(void) 241 | // { 242 | // /*Your code comes here*/ 243 | // } 244 | 245 | // /*Will be called by the library to read the mouse*/ 246 | // static void mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) 247 | // { 248 | // /*Get the current x and y coordinates*/ 249 | // mouse_get_xy(&data->point.x, &data->point.y); 250 | 251 | // /*Get whether the mouse button is pressed or released*/ 252 | // if(mouse_is_pressed()) { 253 | // data->state = LV_INDEV_STATE_PR; 254 | // } 255 | // else { 256 | // data->state = LV_INDEV_STATE_REL; 257 | // } 258 | // } 259 | 260 | // /*Return true is the mouse button is pressed*/ 261 | // static bool mouse_is_pressed(void) 262 | // { 263 | // /*Your code comes here*/ 264 | 265 | // return false; 266 | // } 267 | 268 | // /*Get the x and y coordinates if the mouse is pressed*/ 269 | // static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y) 270 | // { 271 | // /*Your code comes here*/ 272 | 273 | // (*x) = 0; 274 | // (*y) = 0; 275 | // } 276 | 277 | // /*------------------ 278 | // * Keypad 279 | // * -----------------*/ 280 | 281 | // /*Initialize your keypad*/ 282 | // static void keypad_init(void) 283 | // { 284 | // /*Your code comes here*/ 285 | // } 286 | 287 | // /*Will be called by the library to read the mouse*/ 288 | // static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) 289 | // { 290 | // static uint32_t last_key = 0; 291 | 292 | // /*Get the current x and y coordinates*/ 293 | // mouse_get_xy(&data->point.x, &data->point.y); 294 | 295 | // /*Get whether the a key is pressed and save the pressed key*/ 296 | // uint32_t act_key = keypad_get_key(); 297 | // if(act_key != 0) { 298 | // data->state = LV_INDEV_STATE_PR; 299 | 300 | // /*Translate the keys to LVGL control characters according to your key definitions*/ 301 | // switch(act_key) { 302 | // case 1: 303 | // act_key = LV_KEY_NEXT; 304 | // break; 305 | // case 2: 306 | // act_key = LV_KEY_PREV; 307 | // break; 308 | // case 3: 309 | // act_key = LV_KEY_LEFT; 310 | // break; 311 | // case 4: 312 | // act_key = LV_KEY_RIGHT; 313 | // break; 314 | // case 5: 315 | // act_key = LV_KEY_ENTER; 316 | // break; 317 | // } 318 | 319 | // last_key = act_key; 320 | // } 321 | // else { 322 | // data->state = LV_INDEV_STATE_REL; 323 | // } 324 | 325 | // data->key = last_key; 326 | // } 327 | 328 | // /*Get the currently being pressed key. 0 if no key is pressed*/ 329 | // static uint32_t keypad_get_key(void) 330 | // { 331 | // /*Your code comes here*/ 332 | 333 | // return 0; 334 | // } 335 | 336 | /*------------------ 337 | * Encoder 338 | * -----------------*/ 339 | 340 | /*Initialize your keypad*/ 341 | // static void encoder_init(void) 342 | // { 343 | // /*Your code comes here*/ 344 | // } 345 | 346 | /*Will be called by the library to read the encoder*/ 347 | static void encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) 348 | { 349 | // data->enc_diff = encoder_diff; 350 | // data->state = encoder_state; 351 | 352 | /* Update encoder */ 353 | if (!_encoder->Btn.read()) { 354 | _encoder->ResetPosition(); 355 | data->state = LV_INDEV_STATE_PR; 356 | return; 357 | } 358 | #if ENCODER_REVERSE 359 | data->enc_diff -= _encoder->GetPosition(); 360 | #else 361 | data->enc_diff += _encoder->GetPosition(); 362 | #endif 363 | _encoder->ResetPosition(); 364 | data->state = LV_INDEV_STATE_REL; 365 | 366 | } 367 | 368 | /*Call this function in an interrupt to process encoder events (turn, press)*/ 369 | // static void encoder_handler(void) 370 | // { 371 | // /*Your code comes here*/ 372 | 373 | // encoder_diff += 0; 374 | // encoder_state = LV_INDEV_STATE_REL; 375 | // } 376 | 377 | // /*------------------ 378 | // * Button 379 | // * -----------------*/ 380 | 381 | // /*Initialize your buttons*/ 382 | // static void button_init(void) 383 | // { 384 | // /*Your code comes here*/ 385 | // } 386 | 387 | // /*Will be called by the library to read the button*/ 388 | // static void button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) 389 | // { 390 | 391 | // static uint8_t last_btn = 0; 392 | 393 | // /*Get the pressed button's ID*/ 394 | // int8_t btn_act = button_get_pressed_id(); 395 | 396 | // if(btn_act >= 0) { 397 | // data->state = LV_INDEV_STATE_PR; 398 | // last_btn = btn_act; 399 | // } 400 | // else { 401 | // data->state = LV_INDEV_STATE_REL; 402 | // } 403 | 404 | // /*Save the last pressed button's ID*/ 405 | // data->btn_id = last_btn; 406 | // } 407 | 408 | // /*Get ID (0, 1, 2 ..) of the pressed button*/ 409 | // static int8_t button_get_pressed_id(void) 410 | // { 411 | // uint8_t i; 412 | 413 | // /*Check to buttons see which is being pressed (assume there are 2 buttons)*/ 414 | // for(i = 0; i < 2; i++) { 415 | // /*Return the pressed button's ID*/ 416 | // if(button_is_pressed(i)) { 417 | // return i; 418 | // } 419 | // } 420 | 421 | // /*No button pressed*/ 422 | // return -1; 423 | // } 424 | 425 | // /*Test if `id` button is pressed or not*/ 426 | // static bool button_is_pressed(uint8_t id) 427 | // { 428 | 429 | // /*Your code comes here*/ 430 | 431 | // return false; 432 | // } 433 | 434 | #else /*Enable this file at the top*/ 435 | 436 | /*This dummy typedef exists purely to silence -Wpedantic.*/ 437 | typedef int keep_pedantic_happy; 438 | #endif 439 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/lv_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_conf.h 3 | * Configuration file for v8.3.4 4 | */ 5 | 6 | /* 7 | * Copy this file as `lv_conf.h` 8 | * 1. simply next to the `lvgl` folder 9 | * 2. or any other places and 10 | * - define `LV_CONF_INCLUDE_SIMPLE` 11 | * - add the path as include path 12 | */ 13 | 14 | /* clang-format off */ 15 | #if 1 /*Set it to "1" to enable content*/ 16 | 17 | #ifndef LV_CONF_H 18 | #define LV_CONF_H 19 | 20 | #include 21 | 22 | /*==================== 23 | COLOR SETTINGS 24 | *====================*/ 25 | 26 | /*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ 27 | #define LV_COLOR_DEPTH 16 28 | 29 | /*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ 30 | #define LV_COLOR_16_SWAP 0 31 | 32 | /*Enable features to draw on transparent background. 33 | *It's required if opa, and transform_* style properties are used. 34 | *Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/ 35 | #define LV_COLOR_SCREEN_TRANSP 0 36 | 37 | /* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. 38 | * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ 39 | #define LV_COLOR_MIX_ROUND_OFS 0 40 | 41 | /*Images pixels with this color will not be drawn if they are chroma keyed)*/ 42 | #define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ 43 | 44 | /*========================= 45 | MEMORY SETTINGS 46 | *=========================*/ 47 | 48 | /*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ 49 | #define LV_MEM_CUSTOM 1 50 | #if LV_MEM_CUSTOM == 0 51 | /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ 52 | #define LV_MEM_SIZE (72U * 1024U) /*[bytes]*/ 53 | 54 | /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ 55 | #define LV_MEM_ADR 0 /*0: unused*/ 56 | /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ 57 | #if LV_MEM_ADR == 0 58 | #undef LV_MEM_POOL_INCLUDE 59 | #undef LV_MEM_POOL_ALLOC 60 | #endif 61 | 62 | #else /*LV_MEM_CUSTOM*/ 63 | #define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ 64 | #define LV_MEM_CUSTOM_ALLOC malloc 65 | #define LV_MEM_CUSTOM_FREE free 66 | #define LV_MEM_CUSTOM_REALLOC realloc 67 | #endif /*LV_MEM_CUSTOM*/ 68 | 69 | /*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. 70 | *You will see an error log message if there wasn't enough buffers. */ 71 | #define LV_MEM_BUF_MAX_NUM 16 72 | 73 | /*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ 74 | #define LV_MEMCPY_MEMSET_STD 0 75 | 76 | /*==================== 77 | HAL SETTINGS 78 | *====================*/ 79 | 80 | /*Default display refresh period. LVG will redraw changed areas with this period time*/ 81 | #define LV_DISP_DEF_REFR_PERIOD 16 /*[ms]*/ 82 | 83 | /*Input device read period in milliseconds*/ 84 | #define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ 85 | 86 | /*Use a custom tick source that tells the elapsed time in milliseconds. 87 | *It removes the need to manually update the tick with `lv_tick_inc()`)*/ 88 | #define LV_TICK_CUSTOM 1 89 | #if LV_TICK_CUSTOM 90 | // #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ 91 | // #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ 92 | /*If using lvgl as ESP32 component*/ 93 | #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" 94 | #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) 95 | #endif /*LV_TICK_CUSTOM*/ 96 | 97 | /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. 98 | *(Not so important, you can adjust it to modify default sizes and spaces)*/ 99 | #define LV_DPI_DEF 130 /*[px/inch]*/ 100 | 101 | /*======================= 102 | * FEATURE CONFIGURATION 103 | *=======================*/ 104 | 105 | /*------------- 106 | * Drawing 107 | *-----------*/ 108 | 109 | /*Enable complex draw engine. 110 | *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ 111 | #define LV_DRAW_COMPLEX 1 112 | #if LV_DRAW_COMPLEX != 0 113 | 114 | /*Allow buffering some shadow calculation. 115 | *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` 116 | *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ 117 | #define LV_SHADOW_CACHE_SIZE 0 118 | 119 | /* Set number of maximally cached circle data. 120 | * The circumference of 1/4 circle are saved for anti-aliasing 121 | * radius * 4 bytes are used per circle (the most often used radiuses are saved) 122 | * 0: to disable caching */ 123 | #define LV_CIRCLE_CACHE_SIZE 4 124 | #endif /*LV_DRAW_COMPLEX*/ 125 | 126 | /** 127 | * "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer 128 | * and blend it as an image with the given opacity. 129 | * Note that `bg_opa`, `text_opa` etc don't require buffering into layer) 130 | * The widget can be buffered in smaller chunks to avoid using large buffers. 131 | * 132 | * - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it 133 | * - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated. 134 | * 135 | * Both buffer sizes are in bytes. 136 | * "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers 137 | * and can't be drawn in chunks. So these settings affects only widgets with opacity. 138 | */ 139 | #define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) 140 | #define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024) 141 | 142 | /*Default image cache size. Image caching keeps the images opened. 143 | *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) 144 | *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. 145 | *However the opened images might consume additional RAM. 146 | *0: to disable caching*/ 147 | #define LV_IMG_CACHE_DEF_SIZE 0 148 | 149 | /*Number of stops allowed per gradient. Increase this to allow more stops. 150 | *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ 151 | #define LV_GRADIENT_MAX_STOPS 2 152 | 153 | /*Default gradient buffer size. 154 | *When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again. 155 | *LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes. 156 | *If the cache is too small the map will be allocated only while it's required for the drawing. 157 | *0 mean no caching.*/ 158 | #define LV_GRAD_CACHE_DEF_SIZE 0 159 | 160 | /*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display) 161 | *LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface 162 | *The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */ 163 | #define LV_DITHER_GRADIENT 0 164 | #if LV_DITHER_GRADIENT 165 | /*Add support for error diffusion dithering. 166 | *Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing. 167 | *The increase in memory consumption is (24 bits * object's width)*/ 168 | #define LV_DITHER_ERROR_DIFFUSION 0 169 | #endif 170 | 171 | /*Maximum buffer size to allocate for rotation. 172 | *Only used if software rotation is enabled in the display driver.*/ 173 | #define LV_DISP_ROT_MAX_BUF (10*1024) 174 | 175 | /*------------- 176 | * GPU 177 | *-----------*/ 178 | 179 | /*Use Arm's 2D acceleration library Arm-2D */ 180 | #define LV_USE_GPU_ARM2D 0 181 | 182 | /*Use STM32's DMA2D (aka Chrom Art) GPU*/ 183 | #define LV_USE_GPU_STM32_DMA2D 0 184 | #if LV_USE_GPU_STM32_DMA2D 185 | /*Must be defined to include path of CMSIS header of target processor 186 | e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ 187 | #define LV_GPU_DMA2D_CMSIS_INCLUDE 188 | #endif 189 | 190 | /*Use SWM341's DMA2D GPU*/ 191 | #define LV_USE_GPU_SWM341_DMA2D 0 192 | #if LV_USE_GPU_SWM341_DMA2D 193 | #define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h" 194 | #endif 195 | 196 | /*Use NXP's PXP GPU iMX RTxxx platforms*/ 197 | #define LV_USE_GPU_NXP_PXP 0 198 | #if LV_USE_GPU_NXP_PXP 199 | /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) 200 | * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS 201 | * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. 202 | *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() 203 | */ 204 | #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 205 | #endif 206 | 207 | /*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ 208 | #define LV_USE_GPU_NXP_VG_LITE 0 209 | 210 | /*Use SDL renderer API*/ 211 | #define LV_USE_GPU_SDL 0 212 | #if LV_USE_GPU_SDL 213 | #define LV_GPU_SDL_INCLUDE_PATH 214 | /*Texture cache size, 8MB by default*/ 215 | #define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8) 216 | /*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/ 217 | #define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6)) 218 | #endif 219 | 220 | /*------------- 221 | * Logging 222 | *-----------*/ 223 | 224 | /*Enable the log module*/ 225 | #define LV_USE_LOG 0 226 | #if LV_USE_LOG 227 | 228 | /*How important log should be added: 229 | *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information 230 | *LV_LOG_LEVEL_INFO Log important events 231 | *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem 232 | *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail 233 | *LV_LOG_LEVEL_USER Only logs added by the user 234 | *LV_LOG_LEVEL_NONE Do not log anything*/ 235 | #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN 236 | 237 | /*1: Print the log with 'printf'; 238 | *0: User need to register a callback with `lv_log_register_print_cb()`*/ 239 | #define LV_LOG_PRINTF 0 240 | 241 | /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ 242 | #define LV_LOG_TRACE_MEM 1 243 | #define LV_LOG_TRACE_TIMER 1 244 | #define LV_LOG_TRACE_INDEV 1 245 | #define LV_LOG_TRACE_DISP_REFR 1 246 | #define LV_LOG_TRACE_EVENT 1 247 | #define LV_LOG_TRACE_OBJ_CREATE 1 248 | #define LV_LOG_TRACE_LAYOUT 1 249 | #define LV_LOG_TRACE_ANIM 1 250 | 251 | #endif /*LV_USE_LOG*/ 252 | 253 | /*------------- 254 | * Asserts 255 | *-----------*/ 256 | 257 | /*Enable asserts if an operation is failed or an invalid data is found. 258 | *If LV_USE_LOG is enabled an error message will be printed on failure*/ 259 | #define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ 260 | #define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ 261 | #define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ 262 | #define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ 263 | #define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ 264 | 265 | /*Add a custom handler when assert happens e.g. to restart the MCU*/ 266 | #define LV_ASSERT_HANDLER_INCLUDE 267 | #define LV_ASSERT_HANDLER while(1); /*Halt by default*/ 268 | 269 | /*------------- 270 | * Others 271 | *-----------*/ 272 | 273 | /*1: Show CPU usage and FPS count*/ 274 | #define LV_USE_PERF_MONITOR 0 275 | #if LV_USE_PERF_MONITOR 276 | #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT 277 | #endif 278 | 279 | /*1: Show the used memory and the memory fragmentation 280 | * Requires LV_MEM_CUSTOM = 0*/ 281 | #define LV_USE_MEM_MONITOR 0 282 | #if LV_USE_MEM_MONITOR 283 | #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT 284 | #endif 285 | 286 | /*1: Draw random colored rectangles over the redrawn areas*/ 287 | #define LV_USE_REFR_DEBUG 0 288 | 289 | /*Change the built in (v)snprintf functions*/ 290 | #define LV_SPRINTF_CUSTOM 0 291 | #if LV_SPRINTF_CUSTOM 292 | #define LV_SPRINTF_INCLUDE 293 | #define lv_snprintf snprintf 294 | #define lv_vsnprintf vsnprintf 295 | #else /*LV_SPRINTF_CUSTOM*/ 296 | #define LV_SPRINTF_USE_FLOAT 0 297 | #endif /*LV_SPRINTF_CUSTOM*/ 298 | 299 | #define LV_USE_USER_DATA 1 300 | 301 | /*Garbage Collector settings 302 | *Used if lvgl is bound to higher level language and the memory is managed by that language*/ 303 | #define LV_ENABLE_GC 0 304 | #if LV_ENABLE_GC != 0 305 | #define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ 306 | #endif /*LV_ENABLE_GC*/ 307 | 308 | /*===================== 309 | * COMPILER SETTINGS 310 | *====================*/ 311 | 312 | /*For big endian systems set to 1*/ 313 | #define LV_BIG_ENDIAN_SYSTEM 0 314 | 315 | /*Define a custom attribute to `lv_tick_inc` function*/ 316 | #define LV_ATTRIBUTE_TICK_INC 317 | 318 | /*Define a custom attribute to `lv_timer_handler` function*/ 319 | #define LV_ATTRIBUTE_TIMER_HANDLER 320 | 321 | /*Define a custom attribute to `lv_disp_flush_ready` function*/ 322 | #define LV_ATTRIBUTE_FLUSH_READY 323 | 324 | /*Required alignment size for buffers*/ 325 | #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 326 | 327 | /*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). 328 | * E.g. __attribute__((aligned(4)))*/ 329 | #define LV_ATTRIBUTE_MEM_ALIGN 330 | 331 | /*Attribute to mark large constant arrays for example font's bitmaps*/ 332 | #define LV_ATTRIBUTE_LARGE_CONST 333 | 334 | /*Compiler prefix for a big array declaration in RAM*/ 335 | #define LV_ATTRIBUTE_LARGE_RAM_ARRAY 336 | 337 | /*Place performance critical functions into a faster memory (e.g RAM)*/ 338 | #define LV_ATTRIBUTE_FAST_MEM 339 | 340 | /*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ 341 | #define LV_ATTRIBUTE_DMA 342 | 343 | /*Export integer constant to binding. This macro is used with constants in the form of LV_ that 344 | *should also appear on LVGL binding API such as Micropython.*/ 345 | #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ 346 | 347 | /*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ 348 | #define LV_USE_LARGE_COORD 0 349 | 350 | /*================== 351 | * FONT USAGE 352 | *===================*/ 353 | 354 | /*Montserrat fonts with ASCII range and some symbols using bpp = 4 355 | *https://fonts.google.com/specimen/Montserrat*/ 356 | #define LV_FONT_MONTSERRAT_8 0 357 | #define LV_FONT_MONTSERRAT_10 0 358 | #define LV_FONT_MONTSERRAT_12 0 359 | #define LV_FONT_MONTSERRAT_14 1 360 | #define LV_FONT_MONTSERRAT_16 0 361 | #define LV_FONT_MONTSERRAT_18 0 362 | #define LV_FONT_MONTSERRAT_20 0 363 | #define LV_FONT_MONTSERRAT_22 0 364 | #define LV_FONT_MONTSERRAT_24 0 365 | #define LV_FONT_MONTSERRAT_26 0 366 | #define LV_FONT_MONTSERRAT_28 0 367 | #define LV_FONT_MONTSERRAT_30 0 368 | #define LV_FONT_MONTSERRAT_32 0 369 | #define LV_FONT_MONTSERRAT_34 0 370 | #define LV_FONT_MONTSERRAT_36 0 371 | #define LV_FONT_MONTSERRAT_38 0 372 | #define LV_FONT_MONTSERRAT_40 0 373 | #define LV_FONT_MONTSERRAT_42 0 374 | #define LV_FONT_MONTSERRAT_44 0 375 | #define LV_FONT_MONTSERRAT_46 0 376 | #define LV_FONT_MONTSERRAT_48 0 377 | 378 | /*Demonstrate special features*/ 379 | #define LV_FONT_MONTSERRAT_12_SUBPX 0 380 | #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ 381 | #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ 382 | #define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ 383 | 384 | /*Pixel perfect monospace fonts*/ 385 | #define LV_FONT_UNSCII_8 0 386 | #define LV_FONT_UNSCII_16 0 387 | 388 | /*Optionally declare custom fonts here. 389 | *You can use these fonts as default font too and they will be available globally. 390 | *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ 391 | #define LV_FONT_CUSTOM_DECLARE 392 | 393 | /*Always set a default font*/ 394 | #define LV_FONT_DEFAULT &lv_font_montserrat_14 395 | 396 | /*Enable handling large font and/or fonts with a lot of characters. 397 | *The limit depends on the font size, font face and bpp. 398 | *Compiler error will be triggered if a font needs it.*/ 399 | #define LV_FONT_FMT_TXT_LARGE 0 400 | 401 | /*Enables/disables support for compressed fonts.*/ 402 | #define LV_USE_FONT_COMPRESSED 0 403 | 404 | /*Enable subpixel rendering*/ 405 | #define LV_USE_FONT_SUBPX 0 406 | #if LV_USE_FONT_SUBPX 407 | /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ 408 | #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ 409 | #endif 410 | 411 | /*Enable drawing placeholders when glyph dsc is not found*/ 412 | #define LV_USE_FONT_PLACEHOLDER 1 413 | 414 | /*================= 415 | * TEXT SETTINGS 416 | *=================*/ 417 | 418 | /** 419 | * Select a character encoding for strings. 420 | * Your IDE or editor should have the same character encoding 421 | * - LV_TXT_ENC_UTF8 422 | * - LV_TXT_ENC_ASCII 423 | */ 424 | #define LV_TXT_ENC LV_TXT_ENC_UTF8 425 | 426 | /*Can break (wrap) texts on these chars*/ 427 | #define LV_TXT_BREAK_CHARS " ,.;:-_" 428 | 429 | /*If a word is at least this long, will break wherever "prettiest" 430 | *To disable, set to a value <= 0*/ 431 | #define LV_TXT_LINE_BREAK_LONG_LEN 0 432 | 433 | /*Minimum number of characters in a long word to put on a line before a break. 434 | *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ 435 | #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 436 | 437 | /*Minimum number of characters in a long word to put on a line after a break. 438 | *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ 439 | #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 440 | 441 | /*The control character to use for signalling text recoloring.*/ 442 | #define LV_TXT_COLOR_CMD "#" 443 | 444 | /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. 445 | *The direction will be processed according to the Unicode Bidirectional Algorithm: 446 | *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ 447 | #define LV_USE_BIDI 0 448 | #if LV_USE_BIDI 449 | /*Set the default direction. Supported values: 450 | *`LV_BASE_DIR_LTR` Left-to-Right 451 | *`LV_BASE_DIR_RTL` Right-to-Left 452 | *`LV_BASE_DIR_AUTO` detect texts base direction*/ 453 | #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO 454 | #endif 455 | 456 | /*Enable Arabic/Persian processing 457 | *In these languages characters should be replaced with an other form based on their position in the text*/ 458 | #define LV_USE_ARABIC_PERSIAN_CHARS 0 459 | 460 | /*================== 461 | * WIDGET USAGE 462 | *================*/ 463 | 464 | /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ 465 | 466 | #define LV_USE_ARC 1 467 | 468 | #define LV_USE_BAR 1 469 | 470 | #define LV_USE_BTN 1 471 | 472 | #define LV_USE_BTNMATRIX 1 473 | 474 | #define LV_USE_CANVAS 1 475 | 476 | #define LV_USE_CHECKBOX 1 477 | 478 | #define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ 479 | 480 | #define LV_USE_IMG 1 /*Requires: lv_label*/ 481 | 482 | #define LV_USE_LABEL 1 483 | #if LV_USE_LABEL 484 | #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ 485 | #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ 486 | #endif 487 | 488 | #define LV_USE_LINE 1 489 | 490 | #define LV_USE_ROLLER 1 /*Requires: lv_label*/ 491 | #if LV_USE_ROLLER 492 | #define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ 493 | #endif 494 | 495 | #define LV_USE_SLIDER 1 /*Requires: lv_bar*/ 496 | 497 | #define LV_USE_SWITCH 1 498 | 499 | #define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ 500 | #if LV_USE_TEXTAREA != 0 501 | #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ 502 | #endif 503 | 504 | #define LV_USE_TABLE 1 505 | 506 | /*================== 507 | * EXTRA COMPONENTS 508 | *==================*/ 509 | 510 | /*----------- 511 | * Widgets 512 | *----------*/ 513 | #define LV_USE_ANIMIMG 1 514 | 515 | #define LV_USE_CALENDAR 1 516 | #if LV_USE_CALENDAR 517 | #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 518 | #if LV_CALENDAR_WEEK_STARTS_MONDAY 519 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} 520 | #else 521 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} 522 | #endif 523 | 524 | #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} 525 | #define LV_USE_CALENDAR_HEADER_ARROW 1 526 | #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 527 | #endif /*LV_USE_CALENDAR*/ 528 | 529 | #define LV_USE_CHART 1 530 | 531 | #define LV_USE_COLORWHEEL 1 532 | 533 | #define LV_USE_IMGBTN 1 534 | 535 | #define LV_USE_KEYBOARD 1 536 | 537 | #define LV_USE_LED 1 538 | 539 | #define LV_USE_LIST 1 540 | 541 | #define LV_USE_MENU 1 542 | 543 | #define LV_USE_METER 1 544 | 545 | #define LV_USE_MSGBOX 1 546 | 547 | #define LV_USE_SPAN 1 548 | #if LV_USE_SPAN 549 | /*A line text can contain maximum num of span descriptor */ 550 | #define LV_SPAN_SNIPPET_STACK_SIZE 64 551 | #endif 552 | 553 | #define LV_USE_SPINBOX 1 554 | 555 | #define LV_USE_SPINNER 1 556 | 557 | #define LV_USE_TABVIEW 1 558 | 559 | #define LV_USE_TILEVIEW 1 560 | 561 | #define LV_USE_WIN 1 562 | 563 | /*----------- 564 | * Themes 565 | *----------*/ 566 | 567 | /*A simple, impressive and very complete theme*/ 568 | #define LV_USE_THEME_DEFAULT 1 569 | #if LV_USE_THEME_DEFAULT 570 | 571 | /*0: Light mode; 1: Dark mode*/ 572 | #define LV_THEME_DEFAULT_DARK 0 573 | 574 | /*1: Enable grow on press*/ 575 | #define LV_THEME_DEFAULT_GROW 1 576 | 577 | /*Default transition time in [ms]*/ 578 | #define LV_THEME_DEFAULT_TRANSITION_TIME 80 579 | #endif /*LV_USE_THEME_DEFAULT*/ 580 | 581 | /*A very simple theme that is a good starting point for a custom theme*/ 582 | #define LV_USE_THEME_BASIC 1 583 | 584 | /*A theme designed for monochrome displays*/ 585 | #define LV_USE_THEME_MONO 1 586 | 587 | /*----------- 588 | * Layouts 589 | *----------*/ 590 | 591 | /*A layout similar to Flexbox in CSS.*/ 592 | #define LV_USE_FLEX 1 593 | 594 | /*A layout similar to Grid in CSS.*/ 595 | #define LV_USE_GRID 1 596 | 597 | /*--------------------- 598 | * 3rd party libraries 599 | *--------------------*/ 600 | 601 | /*File system interfaces for common APIs */ 602 | 603 | /*API for fopen, fread, etc*/ 604 | #define LV_USE_FS_STDIO 0 605 | #if LV_USE_FS_STDIO 606 | #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 607 | #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ 608 | #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 609 | #endif 610 | 611 | /*API for open, read, etc*/ 612 | #define LV_USE_FS_POSIX 0 613 | #if LV_USE_FS_POSIX 614 | #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 615 | #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ 616 | #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 617 | #endif 618 | 619 | /*API for CreateFile, ReadFile, etc*/ 620 | #define LV_USE_FS_WIN32 0 621 | #if LV_USE_FS_WIN32 622 | #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 623 | #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ 624 | #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 625 | #endif 626 | 627 | /*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ 628 | #define LV_USE_FS_FATFS 0 629 | #if LV_USE_FS_FATFS 630 | #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 631 | #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 632 | #endif 633 | 634 | /*PNG decoder library*/ 635 | #define LV_USE_PNG 0 636 | 637 | /*BMP decoder library*/ 638 | #define LV_USE_BMP 0 639 | 640 | /* JPG + split JPG decoder library. 641 | * Split JPG is a custom format optimized for embedded systems. */ 642 | #define LV_USE_SJPG 0 643 | 644 | /*GIF decoder library*/ 645 | #define LV_USE_GIF 0 646 | 647 | /*QR code library*/ 648 | #define LV_USE_QRCODE 0 649 | 650 | /*FreeType library*/ 651 | #define LV_USE_FREETYPE 0 652 | #if LV_USE_FREETYPE 653 | /*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ 654 | #define LV_FREETYPE_CACHE_SIZE (16 * 1024) 655 | #if LV_FREETYPE_CACHE_SIZE >= 0 656 | /* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */ 657 | /* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */ 658 | /* if font size >= 256, must be configured as image cache */ 659 | #define LV_FREETYPE_SBIT_CACHE 0 660 | /* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */ 661 | /* (0:use system defaults) */ 662 | #define LV_FREETYPE_CACHE_FT_FACES 0 663 | #define LV_FREETYPE_CACHE_FT_SIZES 0 664 | #endif 665 | #endif 666 | 667 | /*Rlottie library*/ 668 | #define LV_USE_RLOTTIE 0 669 | 670 | /*FFmpeg library for image decoding and playing videos 671 | *Supports all major image formats so do not enable other image decoder with it*/ 672 | #define LV_USE_FFMPEG 0 673 | #if LV_USE_FFMPEG 674 | /*Dump input information to stderr*/ 675 | #define LV_FFMPEG_DUMP_FORMAT 0 676 | #endif 677 | 678 | /*----------- 679 | * Others 680 | *----------*/ 681 | 682 | /*1: Enable API to take snapshot for object*/ 683 | #define LV_USE_SNAPSHOT 0 684 | 685 | /*1: Enable Monkey test*/ 686 | #define LV_USE_MONKEY 0 687 | 688 | /*1: Enable grid navigation*/ 689 | #define LV_USE_GRIDNAV 0 690 | 691 | /*1: Enable lv_obj fragment*/ 692 | #define LV_USE_FRAGMENT 0 693 | 694 | /*1: Support using images as font in label or span widgets */ 695 | #define LV_USE_IMGFONT 0 696 | 697 | /*1: Enable a published subscriber based messaging system */ 698 | #define LV_USE_MSG 0 699 | 700 | /*1: Enable Pinyin input method*/ 701 | /*Requires: lv_keyboard*/ 702 | #define LV_USE_IME_PINYIN 0 703 | #if LV_USE_IME_PINYIN 704 | /*1: Use default thesaurus*/ 705 | /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/ 706 | #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 707 | /*Set the maximum number of candidate panels that can be displayed*/ 708 | /*This needs to be adjusted according to the size of the screen*/ 709 | #define LV_IME_PINYIN_CAND_TEXT_NUM 6 710 | 711 | /*Use 9 key input(k9)*/ 712 | #define LV_IME_PINYIN_USE_K9_MODE 1 713 | #if LV_IME_PINYIN_USE_K9_MODE == 1 714 | #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 715 | #endif // LV_IME_PINYIN_USE_K9_MODE 716 | #endif 717 | 718 | /*================== 719 | * EXAMPLES 720 | *==================*/ 721 | 722 | /*Enable the examples to be built with the library*/ 723 | #define LV_BUILD_EXAMPLES 1 724 | 725 | /*=================== 726 | * DEMO USAGE 727 | ====================*/ 728 | 729 | /*Show some widget. It might be required to increase `LV_MEM_SIZE` */ 730 | #define LV_USE_DEMO_WIDGETS 1 731 | #if LV_USE_DEMO_WIDGETS 732 | #define LV_DEMO_WIDGETS_SLIDESHOW 0 733 | #endif 734 | 735 | /*Demonstrate the usage of encoder and keyboard*/ 736 | #define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 737 | 738 | /*Benchmark your system*/ 739 | #define LV_USE_DEMO_BENCHMARK 1 740 | #if LV_USE_DEMO_BENCHMARK 741 | /*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/ 742 | #define LV_DEMO_BENCHMARK_RGB565A8 0 743 | #endif 744 | 745 | /*Stress test for LVGL*/ 746 | #define LV_USE_DEMO_STRESS 1 747 | 748 | /*Music player demo*/ 749 | #define LV_USE_DEMO_MUSIC 0 750 | #if LV_USE_DEMO_MUSIC 751 | #define LV_DEMO_MUSIC_SQUARE 0 752 | #define LV_DEMO_MUSIC_LANDSCAPE 0 753 | #define LV_DEMO_MUSIC_ROUND 0 754 | #define LV_DEMO_MUSIC_LARGE 0 755 | #define LV_DEMO_MUSIC_AUTO_PLAY 0 756 | #endif 757 | 758 | /*--END OF LV_CONF_H--*/ 759 | 760 | #endif /*LV_CONF_H*/ 761 | 762 | #endif /*End of "Content enable"*/ 763 | -------------------------------------------------------------------------------- /Firmware/SourceCode/Emma_test/components/EmmaBSP/LvglPort/lv_conf_temp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_conf.h 3 | * Configuration file for v8.3.4 4 | */ 5 | 6 | /* 7 | * Copy this file as `lv_conf.h` 8 | * 1. simply next to the `lvgl` folder 9 | * 2. or any other places and 10 | * - define `LV_CONF_INCLUDE_SIMPLE` 11 | * - add the path as include path 12 | */ 13 | 14 | /* clang-format off */ 15 | #if 1 /*Set it to "1" to enable content*/ 16 | 17 | #ifndef LV_CONF_H 18 | #define LV_CONF_H 19 | 20 | #include 21 | 22 | /*==================== 23 | COLOR SETTINGS 24 | *====================*/ 25 | 26 | /*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ 27 | #define LV_COLOR_DEPTH 16 28 | 29 | /*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ 30 | #define LV_COLOR_16_SWAP 0 31 | 32 | /*Enable features to draw on transparent background. 33 | *It's required if opa, and transform_* style properties are used. 34 | *Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/ 35 | #define LV_COLOR_SCREEN_TRANSP 0 36 | 37 | /* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. 38 | * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ 39 | #define LV_COLOR_MIX_ROUND_OFS 0 40 | 41 | /*Images pixels with this color will not be drawn if they are chroma keyed)*/ 42 | #define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ 43 | 44 | /*========================= 45 | MEMORY SETTINGS 46 | *=========================*/ 47 | 48 | /*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ 49 | #define LV_MEM_CUSTOM 1 50 | #if LV_MEM_CUSTOM == 0 51 | /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ 52 | #define LV_MEM_SIZE (72U * 1024U) /*[bytes]*/ 53 | 54 | /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ 55 | #define LV_MEM_ADR 0 /*0: unused*/ 56 | /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ 57 | #if LV_MEM_ADR == 0 58 | #undef LV_MEM_POOL_INCLUDE 59 | #undef LV_MEM_POOL_ALLOC 60 | #endif 61 | 62 | #else /*LV_MEM_CUSTOM*/ 63 | #define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ 64 | #define LV_MEM_CUSTOM_ALLOC malloc 65 | #define LV_MEM_CUSTOM_FREE free 66 | #define LV_MEM_CUSTOM_REALLOC realloc 67 | #endif /*LV_MEM_CUSTOM*/ 68 | 69 | /*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. 70 | *You will see an error log message if there wasn't enough buffers. */ 71 | #define LV_MEM_BUF_MAX_NUM 16 72 | 73 | /*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ 74 | #define LV_MEMCPY_MEMSET_STD 0 75 | 76 | /*==================== 77 | HAL SETTINGS 78 | *====================*/ 79 | 80 | /*Default display refresh period. LVG will redraw changed areas with this period time*/ 81 | #define LV_DISP_DEF_REFR_PERIOD 16 /*[ms]*/ 82 | 83 | /*Input device read period in milliseconds*/ 84 | #define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ 85 | 86 | /*Use a custom tick source that tells the elapsed time in milliseconds. 87 | *It removes the need to manually update the tick with `lv_tick_inc()`)*/ 88 | #define LV_TICK_CUSTOM 1 89 | #if LV_TICK_CUSTOM 90 | // #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ 91 | // #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ 92 | /*If using lvgl as ESP32 component*/ 93 | #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" 94 | #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) 95 | #endif /*LV_TICK_CUSTOM*/ 96 | 97 | /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. 98 | *(Not so important, you can adjust it to modify default sizes and spaces)*/ 99 | #define LV_DPI_DEF 130 /*[px/inch]*/ 100 | 101 | /*======================= 102 | * FEATURE CONFIGURATION 103 | *=======================*/ 104 | 105 | /*------------- 106 | * Drawing 107 | *-----------*/ 108 | 109 | /*Enable complex draw engine. 110 | *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ 111 | #define LV_DRAW_COMPLEX 1 112 | #if LV_DRAW_COMPLEX != 0 113 | 114 | /*Allow buffering some shadow calculation. 115 | *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` 116 | *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ 117 | #define LV_SHADOW_CACHE_SIZE 0 118 | 119 | /* Set number of maximally cached circle data. 120 | * The circumference of 1/4 circle are saved for anti-aliasing 121 | * radius * 4 bytes are used per circle (the most often used radiuses are saved) 122 | * 0: to disable caching */ 123 | #define LV_CIRCLE_CACHE_SIZE 4 124 | #endif /*LV_DRAW_COMPLEX*/ 125 | 126 | /** 127 | * "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer 128 | * and blend it as an image with the given opacity. 129 | * Note that `bg_opa`, `text_opa` etc don't require buffering into layer) 130 | * The widget can be buffered in smaller chunks to avoid using large buffers. 131 | * 132 | * - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it 133 | * - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated. 134 | * 135 | * Both buffer sizes are in bytes. 136 | * "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers 137 | * and can't be drawn in chunks. So these settings affects only widgets with opacity. 138 | */ 139 | #define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) 140 | #define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024) 141 | 142 | /*Default image cache size. Image caching keeps the images opened. 143 | *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) 144 | *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. 145 | *However the opened images might consume additional RAM. 146 | *0: to disable caching*/ 147 | #define LV_IMG_CACHE_DEF_SIZE 0 148 | 149 | /*Number of stops allowed per gradient. Increase this to allow more stops. 150 | *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ 151 | #define LV_GRADIENT_MAX_STOPS 2 152 | 153 | /*Default gradient buffer size. 154 | *When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again. 155 | *LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes. 156 | *If the cache is too small the map will be allocated only while it's required for the drawing. 157 | *0 mean no caching.*/ 158 | #define LV_GRAD_CACHE_DEF_SIZE 0 159 | 160 | /*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display) 161 | *LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface 162 | *The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */ 163 | #define LV_DITHER_GRADIENT 0 164 | #if LV_DITHER_GRADIENT 165 | /*Add support for error diffusion dithering. 166 | *Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing. 167 | *The increase in memory consumption is (24 bits * object's width)*/ 168 | #define LV_DITHER_ERROR_DIFFUSION 0 169 | #endif 170 | 171 | /*Maximum buffer size to allocate for rotation. 172 | *Only used if software rotation is enabled in the display driver.*/ 173 | #define LV_DISP_ROT_MAX_BUF (10*1024) 174 | 175 | /*------------- 176 | * GPU 177 | *-----------*/ 178 | 179 | /*Use Arm's 2D acceleration library Arm-2D */ 180 | #define LV_USE_GPU_ARM2D 0 181 | 182 | /*Use STM32's DMA2D (aka Chrom Art) GPU*/ 183 | #define LV_USE_GPU_STM32_DMA2D 0 184 | #if LV_USE_GPU_STM32_DMA2D 185 | /*Must be defined to include path of CMSIS header of target processor 186 | e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ 187 | #define LV_GPU_DMA2D_CMSIS_INCLUDE 188 | #endif 189 | 190 | /*Use SWM341's DMA2D GPU*/ 191 | #define LV_USE_GPU_SWM341_DMA2D 0 192 | #if LV_USE_GPU_SWM341_DMA2D 193 | #define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h" 194 | #endif 195 | 196 | /*Use NXP's PXP GPU iMX RTxxx platforms*/ 197 | #define LV_USE_GPU_NXP_PXP 0 198 | #if LV_USE_GPU_NXP_PXP 199 | /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) 200 | * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS 201 | * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. 202 | *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() 203 | */ 204 | #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 205 | #endif 206 | 207 | /*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ 208 | #define LV_USE_GPU_NXP_VG_LITE 0 209 | 210 | /*Use SDL renderer API*/ 211 | #define LV_USE_GPU_SDL 0 212 | #if LV_USE_GPU_SDL 213 | #define LV_GPU_SDL_INCLUDE_PATH 214 | /*Texture cache size, 8MB by default*/ 215 | #define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8) 216 | /*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/ 217 | #define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6)) 218 | #endif 219 | 220 | /*------------- 221 | * Logging 222 | *-----------*/ 223 | 224 | /*Enable the log module*/ 225 | #define LV_USE_LOG 0 226 | #if LV_USE_LOG 227 | 228 | /*How important log should be added: 229 | *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information 230 | *LV_LOG_LEVEL_INFO Log important events 231 | *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem 232 | *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail 233 | *LV_LOG_LEVEL_USER Only logs added by the user 234 | *LV_LOG_LEVEL_NONE Do not log anything*/ 235 | #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN 236 | 237 | /*1: Print the log with 'printf'; 238 | *0: User need to register a callback with `lv_log_register_print_cb()`*/ 239 | #define LV_LOG_PRINTF 0 240 | 241 | /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ 242 | #define LV_LOG_TRACE_MEM 1 243 | #define LV_LOG_TRACE_TIMER 1 244 | #define LV_LOG_TRACE_INDEV 1 245 | #define LV_LOG_TRACE_DISP_REFR 1 246 | #define LV_LOG_TRACE_EVENT 1 247 | #define LV_LOG_TRACE_OBJ_CREATE 1 248 | #define LV_LOG_TRACE_LAYOUT 1 249 | #define LV_LOG_TRACE_ANIM 1 250 | 251 | #endif /*LV_USE_LOG*/ 252 | 253 | /*------------- 254 | * Asserts 255 | *-----------*/ 256 | 257 | /*Enable asserts if an operation is failed or an invalid data is found. 258 | *If LV_USE_LOG is enabled an error message will be printed on failure*/ 259 | #define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ 260 | #define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ 261 | #define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ 262 | #define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ 263 | #define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ 264 | 265 | /*Add a custom handler when assert happens e.g. to restart the MCU*/ 266 | #define LV_ASSERT_HANDLER_INCLUDE 267 | #define LV_ASSERT_HANDLER while(1); /*Halt by default*/ 268 | 269 | /*------------- 270 | * Others 271 | *-----------*/ 272 | 273 | /*1: Show CPU usage and FPS count*/ 274 | #define LV_USE_PERF_MONITOR 1 275 | #if LV_USE_PERF_MONITOR 276 | #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT 277 | #endif 278 | 279 | /*1: Show the used memory and the memory fragmentation 280 | * Requires LV_MEM_CUSTOM = 0*/ 281 | #define LV_USE_MEM_MONITOR 0 282 | #if LV_USE_MEM_MONITOR 283 | #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT 284 | #endif 285 | 286 | /*1: Draw random colored rectangles over the redrawn areas*/ 287 | #define LV_USE_REFR_DEBUG 0 288 | 289 | /*Change the built in (v)snprintf functions*/ 290 | #define LV_SPRINTF_CUSTOM 0 291 | #if LV_SPRINTF_CUSTOM 292 | #define LV_SPRINTF_INCLUDE 293 | #define lv_snprintf snprintf 294 | #define lv_vsnprintf vsnprintf 295 | #else /*LV_SPRINTF_CUSTOM*/ 296 | #define LV_SPRINTF_USE_FLOAT 0 297 | #endif /*LV_SPRINTF_CUSTOM*/ 298 | 299 | #define LV_USE_USER_DATA 1 300 | 301 | /*Garbage Collector settings 302 | *Used if lvgl is bound to higher level language and the memory is managed by that language*/ 303 | #define LV_ENABLE_GC 0 304 | #if LV_ENABLE_GC != 0 305 | #define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ 306 | #endif /*LV_ENABLE_GC*/ 307 | 308 | /*===================== 309 | * COMPILER SETTINGS 310 | *====================*/ 311 | 312 | /*For big endian systems set to 1*/ 313 | #define LV_BIG_ENDIAN_SYSTEM 0 314 | 315 | /*Define a custom attribute to `lv_tick_inc` function*/ 316 | #define LV_ATTRIBUTE_TICK_INC 317 | 318 | /*Define a custom attribute to `lv_timer_handler` function*/ 319 | #define LV_ATTRIBUTE_TIMER_HANDLER 320 | 321 | /*Define a custom attribute to `lv_disp_flush_ready` function*/ 322 | #define LV_ATTRIBUTE_FLUSH_READY 323 | 324 | /*Required alignment size for buffers*/ 325 | #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 326 | 327 | /*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). 328 | * E.g. __attribute__((aligned(4)))*/ 329 | #define LV_ATTRIBUTE_MEM_ALIGN 330 | 331 | /*Attribute to mark large constant arrays for example font's bitmaps*/ 332 | #define LV_ATTRIBUTE_LARGE_CONST 333 | 334 | /*Compiler prefix for a big array declaration in RAM*/ 335 | #define LV_ATTRIBUTE_LARGE_RAM_ARRAY 336 | 337 | /*Place performance critical functions into a faster memory (e.g RAM)*/ 338 | #define LV_ATTRIBUTE_FAST_MEM 339 | 340 | /*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ 341 | #define LV_ATTRIBUTE_DMA 342 | 343 | /*Export integer constant to binding. This macro is used with constants in the form of LV_ that 344 | *should also appear on LVGL binding API such as Micropython.*/ 345 | #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ 346 | 347 | /*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ 348 | #define LV_USE_LARGE_COORD 0 349 | 350 | /*================== 351 | * FONT USAGE 352 | *===================*/ 353 | 354 | /*Montserrat fonts with ASCII range and some symbols using bpp = 4 355 | *https://fonts.google.com/specimen/Montserrat*/ 356 | #define LV_FONT_MONTSERRAT_8 0 357 | #define LV_FONT_MONTSERRAT_10 0 358 | #define LV_FONT_MONTSERRAT_12 0 359 | #define LV_FONT_MONTSERRAT_14 1 360 | #define LV_FONT_MONTSERRAT_16 0 361 | #define LV_FONT_MONTSERRAT_18 0 362 | #define LV_FONT_MONTSERRAT_20 0 363 | #define LV_FONT_MONTSERRAT_22 0 364 | #define LV_FONT_MONTSERRAT_24 0 365 | #define LV_FONT_MONTSERRAT_26 0 366 | #define LV_FONT_MONTSERRAT_28 0 367 | #define LV_FONT_MONTSERRAT_30 0 368 | #define LV_FONT_MONTSERRAT_32 0 369 | #define LV_FONT_MONTSERRAT_34 0 370 | #define LV_FONT_MONTSERRAT_36 0 371 | #define LV_FONT_MONTSERRAT_38 0 372 | #define LV_FONT_MONTSERRAT_40 0 373 | #define LV_FONT_MONTSERRAT_42 0 374 | #define LV_FONT_MONTSERRAT_44 0 375 | #define LV_FONT_MONTSERRAT_46 0 376 | #define LV_FONT_MONTSERRAT_48 0 377 | 378 | /*Demonstrate special features*/ 379 | #define LV_FONT_MONTSERRAT_12_SUBPX 0 380 | #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ 381 | #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ 382 | #define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ 383 | 384 | /*Pixel perfect monospace fonts*/ 385 | #define LV_FONT_UNSCII_8 0 386 | #define LV_FONT_UNSCII_16 0 387 | 388 | /*Optionally declare custom fonts here. 389 | *You can use these fonts as default font too and they will be available globally. 390 | *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ 391 | #define LV_FONT_CUSTOM_DECLARE 392 | 393 | /*Always set a default font*/ 394 | #define LV_FONT_DEFAULT &lv_font_montserrat_14 395 | 396 | /*Enable handling large font and/or fonts with a lot of characters. 397 | *The limit depends on the font size, font face and bpp. 398 | *Compiler error will be triggered if a font needs it.*/ 399 | #define LV_FONT_FMT_TXT_LARGE 0 400 | 401 | /*Enables/disables support for compressed fonts.*/ 402 | #define LV_USE_FONT_COMPRESSED 0 403 | 404 | /*Enable subpixel rendering*/ 405 | #define LV_USE_FONT_SUBPX 0 406 | #if LV_USE_FONT_SUBPX 407 | /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ 408 | #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ 409 | #endif 410 | 411 | /*Enable drawing placeholders when glyph dsc is not found*/ 412 | #define LV_USE_FONT_PLACEHOLDER 1 413 | 414 | /*================= 415 | * TEXT SETTINGS 416 | *=================*/ 417 | 418 | /** 419 | * Select a character encoding for strings. 420 | * Your IDE or editor should have the same character encoding 421 | * - LV_TXT_ENC_UTF8 422 | * - LV_TXT_ENC_ASCII 423 | */ 424 | #define LV_TXT_ENC LV_TXT_ENC_UTF8 425 | 426 | /*Can break (wrap) texts on these chars*/ 427 | #define LV_TXT_BREAK_CHARS " ,.;:-_" 428 | 429 | /*If a word is at least this long, will break wherever "prettiest" 430 | *To disable, set to a value <= 0*/ 431 | #define LV_TXT_LINE_BREAK_LONG_LEN 0 432 | 433 | /*Minimum number of characters in a long word to put on a line before a break. 434 | *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ 435 | #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 436 | 437 | /*Minimum number of characters in a long word to put on a line after a break. 438 | *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ 439 | #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 440 | 441 | /*The control character to use for signalling text recoloring.*/ 442 | #define LV_TXT_COLOR_CMD "#" 443 | 444 | /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. 445 | *The direction will be processed according to the Unicode Bidirectional Algorithm: 446 | *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ 447 | #define LV_USE_BIDI 0 448 | #if LV_USE_BIDI 449 | /*Set the default direction. Supported values: 450 | *`LV_BASE_DIR_LTR` Left-to-Right 451 | *`LV_BASE_DIR_RTL` Right-to-Left 452 | *`LV_BASE_DIR_AUTO` detect texts base direction*/ 453 | #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO 454 | #endif 455 | 456 | /*Enable Arabic/Persian processing 457 | *In these languages characters should be replaced with an other form based on their position in the text*/ 458 | #define LV_USE_ARABIC_PERSIAN_CHARS 0 459 | 460 | /*================== 461 | * WIDGET USAGE 462 | *================*/ 463 | 464 | /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ 465 | 466 | #define LV_USE_ARC 1 467 | 468 | #define LV_USE_BAR 1 469 | 470 | #define LV_USE_BTN 1 471 | 472 | #define LV_USE_BTNMATRIX 1 473 | 474 | #define LV_USE_CANVAS 1 475 | 476 | #define LV_USE_CHECKBOX 1 477 | 478 | #define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ 479 | 480 | #define LV_USE_IMG 1 /*Requires: lv_label*/ 481 | 482 | #define LV_USE_LABEL 1 483 | #if LV_USE_LABEL 484 | #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ 485 | #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ 486 | #endif 487 | 488 | #define LV_USE_LINE 1 489 | 490 | #define LV_USE_ROLLER 1 /*Requires: lv_label*/ 491 | #if LV_USE_ROLLER 492 | #define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ 493 | #endif 494 | 495 | #define LV_USE_SLIDER 1 /*Requires: lv_bar*/ 496 | 497 | #define LV_USE_SWITCH 1 498 | 499 | #define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ 500 | #if LV_USE_TEXTAREA != 0 501 | #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ 502 | #endif 503 | 504 | #define LV_USE_TABLE 1 505 | 506 | /*================== 507 | * EXTRA COMPONENTS 508 | *==================*/ 509 | 510 | /*----------- 511 | * Widgets 512 | *----------*/ 513 | #define LV_USE_ANIMIMG 1 514 | 515 | #define LV_USE_CALENDAR 1 516 | #if LV_USE_CALENDAR 517 | #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 518 | #if LV_CALENDAR_WEEK_STARTS_MONDAY 519 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} 520 | #else 521 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} 522 | #endif 523 | 524 | #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} 525 | #define LV_USE_CALENDAR_HEADER_ARROW 1 526 | #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 527 | #endif /*LV_USE_CALENDAR*/ 528 | 529 | #define LV_USE_CHART 1 530 | 531 | #define LV_USE_COLORWHEEL 1 532 | 533 | #define LV_USE_IMGBTN 1 534 | 535 | #define LV_USE_KEYBOARD 1 536 | 537 | #define LV_USE_LED 1 538 | 539 | #define LV_USE_LIST 1 540 | 541 | #define LV_USE_MENU 1 542 | 543 | #define LV_USE_METER 1 544 | 545 | #define LV_USE_MSGBOX 1 546 | 547 | #define LV_USE_SPAN 1 548 | #if LV_USE_SPAN 549 | /*A line text can contain maximum num of span descriptor */ 550 | #define LV_SPAN_SNIPPET_STACK_SIZE 64 551 | #endif 552 | 553 | #define LV_USE_SPINBOX 1 554 | 555 | #define LV_USE_SPINNER 1 556 | 557 | #define LV_USE_TABVIEW 1 558 | 559 | #define LV_USE_TILEVIEW 1 560 | 561 | #define LV_USE_WIN 1 562 | 563 | /*----------- 564 | * Themes 565 | *----------*/ 566 | 567 | /*A simple, impressive and very complete theme*/ 568 | #define LV_USE_THEME_DEFAULT 1 569 | #if LV_USE_THEME_DEFAULT 570 | 571 | /*0: Light mode; 1: Dark mode*/ 572 | #define LV_THEME_DEFAULT_DARK 0 573 | 574 | /*1: Enable grow on press*/ 575 | #define LV_THEME_DEFAULT_GROW 1 576 | 577 | /*Default transition time in [ms]*/ 578 | #define LV_THEME_DEFAULT_TRANSITION_TIME 80 579 | #endif /*LV_USE_THEME_DEFAULT*/ 580 | 581 | /*A very simple theme that is a good starting point for a custom theme*/ 582 | #define LV_USE_THEME_BASIC 1 583 | 584 | /*A theme designed for monochrome displays*/ 585 | #define LV_USE_THEME_MONO 1 586 | 587 | /*----------- 588 | * Layouts 589 | *----------*/ 590 | 591 | /*A layout similar to Flexbox in CSS.*/ 592 | #define LV_USE_FLEX 1 593 | 594 | /*A layout similar to Grid in CSS.*/ 595 | #define LV_USE_GRID 1 596 | 597 | /*--------------------- 598 | * 3rd party libraries 599 | *--------------------*/ 600 | 601 | /*File system interfaces for common APIs */ 602 | 603 | /*API for fopen, fread, etc*/ 604 | #define LV_USE_FS_STDIO 0 605 | #if LV_USE_FS_STDIO 606 | #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 607 | #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ 608 | #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 609 | #endif 610 | 611 | /*API for open, read, etc*/ 612 | #define LV_USE_FS_POSIX 0 613 | #if LV_USE_FS_POSIX 614 | #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 615 | #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ 616 | #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 617 | #endif 618 | 619 | /*API for CreateFile, ReadFile, etc*/ 620 | #define LV_USE_FS_WIN32 0 621 | #if LV_USE_FS_WIN32 622 | #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 623 | #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ 624 | #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 625 | #endif 626 | 627 | /*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ 628 | #define LV_USE_FS_FATFS 0 629 | #if LV_USE_FS_FATFS 630 | #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ 631 | #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ 632 | #endif 633 | 634 | /*PNG decoder library*/ 635 | #define LV_USE_PNG 0 636 | 637 | /*BMP decoder library*/ 638 | #define LV_USE_BMP 0 639 | 640 | /* JPG + split JPG decoder library. 641 | * Split JPG is a custom format optimized for embedded systems. */ 642 | #define LV_USE_SJPG 0 643 | 644 | /*GIF decoder library*/ 645 | #define LV_USE_GIF 0 646 | 647 | /*QR code library*/ 648 | #define LV_USE_QRCODE 0 649 | 650 | /*FreeType library*/ 651 | #define LV_USE_FREETYPE 0 652 | #if LV_USE_FREETYPE 653 | /*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ 654 | #define LV_FREETYPE_CACHE_SIZE (16 * 1024) 655 | #if LV_FREETYPE_CACHE_SIZE >= 0 656 | /* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */ 657 | /* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */ 658 | /* if font size >= 256, must be configured as image cache */ 659 | #define LV_FREETYPE_SBIT_CACHE 0 660 | /* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */ 661 | /* (0:use system defaults) */ 662 | #define LV_FREETYPE_CACHE_FT_FACES 0 663 | #define LV_FREETYPE_CACHE_FT_SIZES 0 664 | #endif 665 | #endif 666 | 667 | /*Rlottie library*/ 668 | #define LV_USE_RLOTTIE 0 669 | 670 | /*FFmpeg library for image decoding and playing videos 671 | *Supports all major image formats so do not enable other image decoder with it*/ 672 | #define LV_USE_FFMPEG 0 673 | #if LV_USE_FFMPEG 674 | /*Dump input information to stderr*/ 675 | #define LV_FFMPEG_DUMP_FORMAT 0 676 | #endif 677 | 678 | /*----------- 679 | * Others 680 | *----------*/ 681 | 682 | /*1: Enable API to take snapshot for object*/ 683 | #define LV_USE_SNAPSHOT 0 684 | 685 | /*1: Enable Monkey test*/ 686 | #define LV_USE_MONKEY 0 687 | 688 | /*1: Enable grid navigation*/ 689 | #define LV_USE_GRIDNAV 0 690 | 691 | /*1: Enable lv_obj fragment*/ 692 | #define LV_USE_FRAGMENT 0 693 | 694 | /*1: Support using images as font in label or span widgets */ 695 | #define LV_USE_IMGFONT 0 696 | 697 | /*1: Enable a published subscriber based messaging system */ 698 | #define LV_USE_MSG 0 699 | 700 | /*1: Enable Pinyin input method*/ 701 | /*Requires: lv_keyboard*/ 702 | #define LV_USE_IME_PINYIN 0 703 | #if LV_USE_IME_PINYIN 704 | /*1: Use default thesaurus*/ 705 | /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/ 706 | #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 707 | /*Set the maximum number of candidate panels that can be displayed*/ 708 | /*This needs to be adjusted according to the size of the screen*/ 709 | #define LV_IME_PINYIN_CAND_TEXT_NUM 6 710 | 711 | /*Use 9 key input(k9)*/ 712 | #define LV_IME_PINYIN_USE_K9_MODE 1 713 | #if LV_IME_PINYIN_USE_K9_MODE == 1 714 | #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 715 | #endif // LV_IME_PINYIN_USE_K9_MODE 716 | #endif 717 | 718 | /*================== 719 | * EXAMPLES 720 | *==================*/ 721 | 722 | /*Enable the examples to be built with the library*/ 723 | #define LV_BUILD_EXAMPLES 1 724 | 725 | /*=================== 726 | * DEMO USAGE 727 | ====================*/ 728 | 729 | /*Show some widget. It might be required to increase `LV_MEM_SIZE` */ 730 | #define LV_USE_DEMO_WIDGETS 1 731 | #if LV_USE_DEMO_WIDGETS 732 | #define LV_DEMO_WIDGETS_SLIDESHOW 0 733 | #endif 734 | 735 | /*Demonstrate the usage of encoder and keyboard*/ 736 | #define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 737 | 738 | /*Benchmark your system*/ 739 | #define LV_USE_DEMO_BENCHMARK 1 740 | #if LV_USE_DEMO_BENCHMARK 741 | /*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/ 742 | #define LV_DEMO_BENCHMARK_RGB565A8 0 743 | #endif 744 | 745 | /*Stress test for LVGL*/ 746 | #define LV_USE_DEMO_STRESS 1 747 | 748 | /*Music player demo*/ 749 | #define LV_USE_DEMO_MUSIC 0 750 | #if LV_USE_DEMO_MUSIC 751 | #define LV_DEMO_MUSIC_SQUARE 0 752 | #define LV_DEMO_MUSIC_LANDSCAPE 0 753 | #define LV_DEMO_MUSIC_ROUND 0 754 | #define LV_DEMO_MUSIC_LARGE 0 755 | #define LV_DEMO_MUSIC_AUTO_PLAY 0 756 | #endif 757 | 758 | /*--END OF LV_CONF_H--*/ 759 | 760 | #endif /*LV_CONF_H*/ 761 | 762 | #endif /*End of "Content enable"*/ 763 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------