├── main ├── CMakeLists.txt ├── component.mk ├── include │ ├── ui.h │ ├── sound.h │ ├── cta.h │ ├── home.h │ ├── crypto.h │ ├── wifi.h │ ├── power.h │ ├── touch.h │ ├── mpu.h │ ├── clock.h │ ├── mic.h │ └── led_bar.h ├── sound.c ├── home.c ├── cta.c ├── crypto.c ├── images │ ├── color_map.c │ └── gauge_hand.c ├── mic.c ├── mpu.c ├── wifi.c ├── main.c ├── touch.c ├── power.c ├── clock.c └── led_bar.c ├── components └── esp32-fft │ ├── CMakeLists.txt │ ├── component.mk │ ├── LICENSE │ ├── include │ └── fft.h │ ├── README.md │ └── fft.c ├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── CMakeLists.txt ├── partitions_16MB.csv ├── LICENSE ├── platformio.ini ├── CONTRIBUTING.md ├── README.md ├── THIRD-PARTY-LICENSES.txt └── sdkconfig.defaults /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( SRC_DIRS "." "images" "sounds" 2 | INCLUDE_DIRS "include" ) 3 | -------------------------------------------------------------------------------- /components/esp32-fft/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set( COMPONENT_SRCDIRS . ) 2 | set( COMPONENT_ADD_INCLUDEDIRS "./include" ) 3 | 4 | register_component() -------------------------------------------------------------------------------- /main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.pio 2 | **/.vscode 3 | **/.DS_Store 4 | 5 | **/build 6 | **/sdkconfig 7 | **/sdkconfig.old 8 | **/sdkconfig.core2foraws 9 | 10 | **/__pycache__ 11 | *.py[cod] 12 | 13 | **/*.key 14 | **/*.pem -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "components/esp-cryptoauthlib"] 2 | path = components/esp-cryptoauthlib 3 | url = https://github.com/m5stack/esp-cryptoauthlib 4 | [submodule "components/Core2-for-AWS-IoT-Kit"] 5 | path = components/Core2-for-AWS-IoT-Kit 6 | url = https://github.com/m5stack/Core2-for-AWS-IoT-Kit.git 7 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required( VERSION 3.10.2 ) 4 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 5 | 6 | if( NOT CONFIG_SOFTWARE_CRYPTO_SUPPORT ) 7 | set( EXCLUDE_COMPONENTS esp-cryptoauthlib ) 8 | endif() 9 | 10 | project( Factory_Firmware-Core2_for_AWS 2.3.0 ) 11 | -------------------------------------------------------------------------------- /partitions_16MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, , 0x6000, 3 | phy_init, data, phy, , 0x1000, 4 | factory, app, factory, , 4M, 5 | otadata, data, ota, , 0x2000, 6 | ota_0, app, ota_0, , 4M, 7 | ota_1, app, ota_1, , 4M, 8 | storage, data, nvs, , 0x6000, 9 | spiffs, data, spiffs, , 3900K, -------------------------------------------------------------------------------- /components/esp32-fft/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_SRCDIRS := . 11 | # CFLAGS += -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | 16 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; AWS IoT Kit Hardware Features Demo PlatformIO Configuration File 2 | [platformio] 3 | src_dir = main 4 | 5 | [env:core2foraws] 6 | platform = espressif32@3.5.0 7 | framework = espidf 8 | board = m5stack-core2 9 | monitor_speed = 115200 10 | upload_speed = 2000000 11 | board_build.f_flash = 80000000L 12 | 13 | ; If PlatformIO does not auto-detect the port the device is virtually mounted to, 14 | ; uncomment the line below to set the upload_port (remove the ";") and paste the 15 | ; copied port you identified from PIO Quick Access menu --> PIO Home --> Devices 16 | ; after the equal sign. You do not need to add quotes 17 | ;(e.g. upload_port = /dev/cu.SLAB_USBtoUART). 18 | ; 19 | ; upload_port = 20 | 21 | 22 | ; Custom partition file 23 | board_build.partitions = partitions_16MB.csv 24 | 25 | ; Files to include in upload to non-volitile storage (flash) 26 | board_build.embed_txtfiles = 27 | 28 | 29 | ; Please visit documentation for the other PlatformIO 30 | ; configuration options and examples 31 | ; http://docs.platformio.org/page/projectconf.html -------------------------------------------------------------------------------- /components/esp32-fft/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Robin Scheibler 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /main/include/ui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * clock.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | extern lv_obj_t *tab_view; -------------------------------------------------------------------------------- /main/include/sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * sound.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | void sound_task( void *arg ); -------------------------------------------------------------------------------- /main/include/cta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * cta.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define CTA_TAB_NAME "CTA" 29 | 30 | void display_cta_tab( lv_obj_t *tv ); -------------------------------------------------------------------------------- /main/include/home.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * home.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define HOME_TAB_NAME "HOME" 29 | 30 | void display_home_tab( lv_obj_t *tv ); -------------------------------------------------------------------------------- /main/include/crypto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * crypto.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define CRYPTO_TAB_NAME "ATECC608-CRYPTO" 29 | 30 | void display_crypto_tab( lv_obj_t *tv ); -------------------------------------------------------------------------------- /main/include/wifi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * wifi.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define WIFI_TAB_NAME "ESP32-D0WD-WI-FI" 29 | 30 | extern TaskHandle_t wifi_handle; 31 | 32 | void display_wifi_tab( lv_obj_t *tv ); 33 | -------------------------------------------------------------------------------- /main/include/power.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * power.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define POWER_TAB_NAME "AXP192-POWER" 29 | 30 | extern lv_obj_t *power_tab; 31 | 32 | void display_power_tab(); 33 | void battery_task( void *pvParameters ); -------------------------------------------------------------------------------- /main/include/touch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * touch.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define TOUCH_TAB_NAME "FT6336U-TOUCH" 29 | 30 | extern TaskHandle_t touch_handle; 31 | 32 | void display_touch_tab( lv_obj_t *tv ); 33 | void reset_touch_bg(); -------------------------------------------------------------------------------- /main/include/mpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * mpu.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define MPU_TAB_NAME "MPU6886-MPU" 29 | 30 | extern TaskHandle_t MPU_handle; 31 | 32 | void display_mpu_tab( lv_obj_t *tv ); 33 | void MPU_task( void *pvParameters ); 34 | -------------------------------------------------------------------------------- /main/include/clock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * clock.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define CLOCK_TAB_NAME "BM85633-CLOCK" 29 | 30 | extern lv_obj_t *clock_tab; 31 | TaskHandle_t clock_handle; 32 | 33 | void display_clock_tab(); 34 | void update_roller_time(); 35 | void clock_task( void *pvParameters ); -------------------------------------------------------------------------------- /main/include/mic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * mic.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define MICROPHONE_TAB_NAME "SPM1423-MIC" 29 | 30 | extern TaskHandle_t mic_handle, FFT_handle; 31 | 32 | void display_microphone_tab( lv_obj_t *tv ); 33 | void microphoneTask( void *pvParameters ); 34 | void fft_show_task( void *pvParameters ); 35 | -------------------------------------------------------------------------------- /main/include/led_bar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * led_bar.h 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #define LED_BAR_TAB_NAME "SK6812-LED_BAR" 29 | 30 | extern TaskHandle_t led_bar_animation_handle, led_bar_solid_handle; 31 | 32 | typedef struct Colors 33 | { 34 | uint8_t red; 35 | uint8_t blue; 36 | uint8_t green; 37 | } colors; 38 | 39 | void display_LED_bar_tab( lv_obj_t *tv ); 40 | void update_color(); 41 | void sk6812_solid_task( void *pvParameters ); 42 | void sk6812_animation_task( void *pvParameters ); 43 | 44 | -------------------------------------------------------------------------------- /main/sound.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * sound.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | 28 | #include "freertos/FreeRTOS.h" 29 | #include "freertos/task.h" 30 | #include "freertos/semphr.h" 31 | 32 | #include "core2forAWS.h" 33 | 34 | #include "sound.h" 35 | 36 | void sound_task( void *pvParameters ) 37 | { 38 | esp_err_t err = core2foraws_audio_speaker_enable( true ); 39 | if ( err == ESP_OK ) 40 | { 41 | extern const unsigned char music[ 120264 ]; 42 | core2foraws_audio_speaker_write( ( const uint8_t * )music, 120264 ); 43 | core2foraws_audio_speaker_enable( false ); 44 | } 45 | 46 | vTaskDelete( NULL ); // Deletes the current task from FreeRTOS task list and the FreeRTOS idle task will remove from memory. 47 | } -------------------------------------------------------------------------------- /components/esp32-fft/include/fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | ESP32 FFT 4 | ========= 5 | 6 | This provides a vanilla radix-2 FFT implementation and a test example. 7 | 8 | Author 9 | ------ 10 | 11 | This code was written by [Robin Scheibler](http://www.robinscheibler.org) during rainy days in October 2017. 12 | 13 | License 14 | ------- 15 | 16 | Copyright (c) 2017 Robin Scheibler 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a copy 19 | of this software and associated documentation files (the "Software"), to deal 20 | in the Software without restriction, including without limitation the rights 21 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | copies of the Software, and to permit persons to whom the Software is 23 | furnished to do so, subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in all 26 | copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 | SOFTWARE. 35 | 36 | */ 37 | #ifndef __FFT_H__ 38 | #define __FFT_H__ 39 | 40 | typedef enum 41 | { 42 | FFT_REAL, 43 | FFT_COMPLEX 44 | } fft_type_t; 45 | 46 | typedef enum 47 | { 48 | FFT_FORWARD, 49 | FFT_BACKWARD 50 | } fft_direction_t; 51 | 52 | #define FFT_OWN_INPUT_MEM 1 53 | #define FFT_OWN_OUTPUT_MEM 2 54 | 55 | typedef struct 56 | { 57 | int size; // FFT size 58 | float *input; // pointer to input buffer 59 | float *output; // pointer to output buffer 60 | float *twiddle_factors; // pointer to buffer holding twiddle factors 61 | fft_type_t type; // real or complex 62 | fft_direction_t direction; // forward or backward 63 | unsigned int flags; // FFT flags 64 | } fft_config_t; 65 | 66 | fft_config_t *fft_init(int size, fft_type_t type, fft_direction_t direction, float *input, float *output); 67 | void fft_destroy(fft_config_t *config); 68 | void fft_execute(fft_config_t *config); 69 | void fft(float *input, float *output, float *twiddle_factors, int n); 70 | void ifft(float *input, float *output, float *twiddle_factors, int n); 71 | void rfft(float *x, float *y, float *twiddle_factors, int n); 72 | void irfft(float *x, float *y, float *twiddle_factors, int n); 73 | void fft_primitive(float *x, float *y, int n, int stride, float *twiddle_factors, int tw_stride); 74 | void split_radix_fft(float *x, float *y, int n, int stride, float *twiddle_factors, int tw_stride); 75 | void ifft_primitive(float *input, float *output, int n, int stride, float *twiddle_factors, int tw_stride); 76 | void fft8(float *input, int stride_in, float *output, int stride_out); 77 | void fft4(float *input, int stride_in, float *output, int stride_out); 78 | 79 | #endif // __FFT_H__ 80 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *main* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > Effective March 6, 2023, AWS will end support for AWS IoT Kit, a program that guided builders on how to develop simple IoT applications with AWS Partner reference hardware and tutorials. AWS IoT Kit’s reference hardware kit is made and sold by our manufacturing partner, M5Stack Technology Co., Ltd. (https://m5stack.com/), who will continue to offer and support the kit and related software for interested customers. 2 | 3 | # M5Stack Core2 for AWS IoT Kit Factory Firmware 4 | 5 | Factory firmware for the M5Stack Core2 for AWS IoT Kit. Use this repository to restore your device to the original program or to investigate and freely modify.This application was written to be easy to understand and replicate instead of efficiency. View the API reference for using the included board support package. 6 | 7 | ## Cloning 8 | This repo uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to bring in dependent components. 9 | 10 | Note: If you download the ZIP file provided by GitHub UI, you will not get the contents of the submodules. Since the downloaded zip will also not be a git repository, you will not be able to compile the code since that is a toolchain requirement. You must clone the repository using the instructions below. 11 | 12 | If using Windows, because this repository and its submodules contain symbolic links, set `core.symlinks` to true with the following command: 13 | ``` 14 | git config --global core.symlinks true 15 | ``` 16 | In addition to this, either enable [Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) or, whenever using a git command that writes to the system (e.g. `git pull`, `git clone`, and `git submodule update --init --recursive`), use a console elevated as administrator so that git can properly create symbolic links for this repository. Otherwise, symbolic links will be written as normal files with the symbolic links' paths in them as text. [This](https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/) gives more explanation. 17 | 18 | To clone using HTTPS: 19 | ``` 20 | git clone https://github.com/m5stack/Factory_Firmware-Core2_for_AWS.git --recurse-submodules 21 | ``` 22 | Using SSH: 23 | ``` 24 | git clone git@github.com:m5stack/Factory_Firmware-Core2_for_AWS.git --recurse-submodules 25 | ``` 26 | 27 | If you have downloaded the repo without using the `--recurse-submodules` argument, you need to run: 28 | ``` 29 | git submodule update --init --recursive 30 | ``` 31 | 32 | ## Important files/folders 33 | 34 | ### main/main.c 35 | 36 | This is the entry point for your application. Start by investigating and/or modifying this file for your needs. 37 | 38 | ### components/Core2-for-AWS-IoT-Kit 39 | 40 | This is the location of the [board support package](https://github.com/m5stack/Core2-for-AWS-IoT-Kit). These include drivers and helper libraries for controlling the on-board peripherals on the device. 41 | 42 | ### components/esp-cryptoauthlib 43 | 44 | This is a [ported cryptoauthlib](https://github.com/espressif/esp-cryptoauthlib) from Espressif. This fork is a specific port for the Core2 for AWS reference hardware. This library enables use of the on-board secure element and is tightly integrated with the ESP-IDF. The name of the folder should not be modified. 45 | 46 | ### partitions_16mb.csv 47 | 48 | This is the partition table recommended for most applications. It provides sufficient file system sizes for storing Wi-Fi credentials, the user application, OTA updates, additional file storage, and storage for SPIFFS in the on-board flash. This utilizes the internal + external flash memory. 49 | 50 | ## Security 51 | 52 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. 53 | 54 | ## License 55 | 56 | This library is licensed under the MIT-0 License. See the LICENSE file. 57 | 58 | -------------------------------------------------------------------------------- /main/home.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * home.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "freertos/FreeRTOS.h" 30 | #include "freertos/task.h" 31 | #include "freertos/semphr.h" 32 | 33 | #include "esp_log.h" 34 | 35 | #include "core2forAWS.h" 36 | 37 | #include "home.h" 38 | 39 | static const char *TAG = HOME_TAB_NAME; 40 | 41 | void display_home_tab( lv_obj_t *tv ) 42 | { 43 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes the core2foraws_display_semaphore mutex. This blocks any other task attempting to take it before it's free'd from executing. 44 | 45 | lv_obj_t *home_tab = lv_tabview_add_tab( tv, HOME_TAB_NAME ); // Create a LVGL tabview 46 | 47 | /* Create the title within the tab */ 48 | static lv_style_t title_style; 49 | lv_style_init( &title_style ); 50 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 51 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 52 | 53 | lv_obj_t *tab_title_label = lv_label_create( home_tab, NULL ); 54 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 55 | lv_label_set_static_text( tab_title_label, "M5Stack\nCore2 for AWS IoT Kit" ); 56 | lv_label_set_align( tab_title_label, LV_LABEL_ALIGN_CENTER ); 57 | lv_obj_align( tab_title_label, home_tab, LV_ALIGN_IN_TOP_MID, 0, 50 ); 58 | 59 | lv_obj_t *body_label = lv_label_create( home_tab, NULL ); 60 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 61 | lv_label_set_static_text( body_label, "Swipe through to learn about some of the hardware features." ); 62 | lv_obj_set_width( body_label, 280 ); 63 | lv_obj_align( body_label, home_tab, LV_ALIGN_CENTER, 0 , 10 ); 64 | 65 | lv_obj_t *arrow_label = lv_label_create( home_tab, NULL ); 66 | lv_label_set_recolor( arrow_label, true ); 67 | size_t arrow_buf_len = snprintf ( NULL, 0, 68 | "#ff9900 %1$s %1$s %1$s# #232f3e SWIPE # #ff9900 %1$s %1$s %1$s# #232f3e SWIPE #", 69 | LV_SYMBOL_LEFT ); 70 | char arrow_buf[ ++arrow_buf_len ]; 71 | snprintf ( arrow_buf, arrow_buf_len, 72 | "#ff9900 %1$s %1$s %1$s# #232f3e SWIPE # #ff9900 %1$s %1$s %1$s# #232f3e SWIPE #", 73 | LV_SYMBOL_LEFT ); 74 | lv_label_set_text( arrow_label, arrow_buf ); 75 | lv_label_set_long_mode( arrow_label, LV_LABEL_LONG_SROLL_CIRC ); 76 | lv_label_set_anim_speed( arrow_label, 50 ); 77 | lv_obj_set_size( arrow_label, 290, 20 ); 78 | lv_label_set_align( arrow_label, LV_LABEL_ALIGN_CENTER ); 79 | lv_obj_align( arrow_label, home_tab, LV_ALIGN_IN_BOTTOM_MID, 0 , -40 ); 80 | xSemaphoreGive( core2foraws_display_semaphore ); 81 | 82 | ESP_LOGI( TAG, "\n\nWelcome to your M5Stack Core2 for AWS IoT Kit reference hardware! Visit https://aws-iot-kit-docs.m5stack.com/en/ to view the tutorials and start learning how to build IoT solutions using AWS services.\n\n" ); 83 | } -------------------------------------------------------------------------------- /main/cta.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * home.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "freertos/FreeRTOS.h" 30 | #include "freertos/semphr.h" 31 | 32 | #include "esp_log.h" 33 | 34 | #include "core2forAWS.h" 35 | 36 | #include "cta.h" 37 | 38 | static const char *TAG = CTA_TAB_NAME; 39 | 40 | void display_cta_tab( lv_obj_t *tv ) 41 | { 42 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes the core2foraws_display_semaphore mutex. This blocks any other task attempting to take it before it's free'd from executing. 43 | 44 | lv_obj_t *cta_tab = lv_tabview_add_tab( tv, CTA_TAB_NAME ); // Create a LVGL tabview 45 | 46 | /* Create the main body object and set background within the tab*/ 47 | lv_obj_t *cta_bg = lv_obj_create( cta_tab, NULL ); 48 | lv_obj_align( cta_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 49 | lv_obj_set_size( cta_bg, 290, 190 ); 50 | lv_obj_set_click( cta_bg, false ); 51 | 52 | /* Create the title within the tab */ 53 | static lv_style_t title_style; 54 | lv_style_init( &title_style ); 55 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 56 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 57 | 58 | lv_obj_t *tab_title_label = lv_label_create( cta_tab, NULL ); 59 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 60 | lv_label_set_static_text( tab_title_label, "Next Steps" ); 61 | lv_label_set_align( tab_title_label, LV_LABEL_ALIGN_CENTER ); 62 | lv_obj_align( tab_title_label, cta_tab, LV_ALIGN_IN_TOP_MID, 0, 50 ); 63 | 64 | /* Create the main body object and set background within the tab*/ 65 | static lv_style_t bg_style; 66 | lv_style_init( &bg_style ); 67 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 35, 47, 62 ) ); 68 | lv_obj_add_style( cta_bg, LV_OBJ_PART_MAIN, &bg_style ); 69 | 70 | lv_obj_t *cta_label = lv_label_create( cta_tab, NULL ); 71 | lv_label_set_long_mode( cta_label, LV_LABEL_LONG_BREAK ); 72 | lv_label_set_text( cta_label, "Get hands-on experience building IoT solutions and learn about the AWS IoT Kit program:" ); 73 | lv_obj_set_width( cta_label, 260 ); 74 | lv_obj_align( cta_label, cta_tab, LV_ALIGN_CENTER, 0 , 10 ); 75 | 76 | static lv_style_t cta_style; 77 | lv_style_init( &cta_style ); 78 | lv_style_set_text_color( &cta_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 79 | lv_obj_add_style( cta_label, LV_OBJ_PART_MAIN, &cta_style ); 80 | 81 | /* Create the title within the tab */ 82 | static lv_style_t url_style; 83 | lv_style_init( &url_style ); 84 | lv_style_set_text_color( &url_style, LV_STATE_DEFAULT, lv_color_make( 255, 153, 0 ) ); 85 | lv_style_set_text_font( &url_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 86 | 87 | lv_obj_t *url_label = lv_label_create( cta_tab, NULL ); 88 | lv_obj_add_style( url_label, LV_OBJ_PART_MAIN, &url_style ); 89 | lv_label_set_text( url_label, "https://aws-iot-kit-docs.m5stack.com/en/" ); 90 | lv_obj_align( url_label, cta_tab, LV_ALIGN_IN_BOTTOM_MID, 0, -40 ); 91 | 92 | xSemaphoreGive( core2foraws_display_semaphore ); 93 | } -------------------------------------------------------------------------------- /THIRD-PARTY-LICENSES.txt: -------------------------------------------------------------------------------- 1 | ** ESP-CRYPTOAUTHLIB; version None -- 2 | https://github.com/espressif/esp-cryptoauthlib 3 | Copyright 2018 Espressif Systems (Shanghai) PTE LTD 4 | copyright (c) 2015-2020 Microchip Technology Inc. and its subsidiaries. 5 | 6 | (c) 2015-2021 Microchip Technology Inc. and its subsidiaries. 7 | 8 | Subject to your compliance with these terms, you may use the Microchip Software 9 | and any derivatives exclusively with Microchip products. It is your 10 | responsibility to comply with third party license terms applicable to your 11 | use of third party software (including open source software) that may 12 | accompany Microchip Software. 13 | 14 | Redistribution of this Microchip Software in source or binary form is allowed 15 | and must include the above terms of use and the following disclaimer with the 16 | distribution and accompanying materials. 17 | 18 | THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER 19 | EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED 20 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A 21 | PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, 22 | SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE 23 | OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF 24 | MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. 25 | TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL 26 | CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF 27 | FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. 28 | 29 | ------ 30 | 31 | ** Core 2 for AWS IoT Kit BSP; version 2 -- 32 | https://github.com/m5stack/Core2-for-AWS-IoT-Kit/tree/BSP-dev 33 | 34 | Copyright (c) 2021 LVGL LLC (https://github.com/lvgl/) 35 | Copyright (c) 2021 Rop Gonggrijp (https://github.com/ropg) 36 | Copyright (c) 2021 Mika Tuupola (https://github.com/tuupola) 37 | Copyright (c) 2021 Ruslan V. Uss (https://github.com/UncleRus/) 38 | Copyright (c) 2021 Amazon Web Services (https://aws.amazon.com/) 39 | Copyright (c) 2021 M5Stack (https://m5stack.com) 40 | 41 | The MIT License (MIT) 42 | 43 | Permission is hereby granted, free of charge, to any person obtaining a copy 44 | of this software and associated documentation files (the "Software"), to deal 45 | in the Software without restriction, including without limitation the rights 46 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 47 | copies of the Software, and to permit persons to whom the Software is 48 | furnished to do so, subject to the following conditions: 49 | 50 | The above copyright notice and this permission notice shall be included in all 51 | copies or substantial portions of the Software. 52 | 53 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 54 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 55 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 56 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 57 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 58 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 59 | SOFTWARE. 60 | 61 | ------ 62 | 63 | ** ESP32 FFT -- 64 | https://github.com/fakufaku/esp32-fft 65 | 66 | Copyright (c) 2017 Robin Scheibler 67 | 68 | The MIT License (MIT) 69 | 70 | Permission is hereby granted, free of charge, to any person obtaining a copy 71 | of this software and associated documentation files (the "Software"), to deal 72 | in the Software without restriction, including without limitation the rights 73 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 74 | copies of the Software, and to permit persons to whom the Software is 75 | furnished to do so, subject to the following conditions: 76 | 77 | The above copyright notice and this permission notice shall be included in all 78 | copies or substantial portions of the Software. 79 | 80 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 81 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 82 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 83 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 84 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 85 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 86 | SOFTWARE. -------------------------------------------------------------------------------- /components/esp32-fft/README.md: -------------------------------------------------------------------------------- 1 | ESP-IDF FFT Component 2 | ========= 3 | 4 | This [fork](https://github.com/fakufaku/esp32-fft) provides an ESP-IDF component that can be independently used 5 | in a project as a component and easily consumed and added to a code pipeline via git submodules. 6 | 7 | This library provides a vanilla radix-2 FFT APIs that can be incorporated into your project. 8 | 9 | Author 10 | ------ 11 | 12 | This code was written by [Robin Scheibler](http://www.robinscheibler.org) during rainy days in October 2017. 13 | 14 | 15 | Example 16 | ------- 17 | 18 | #include "fft.h" 19 | 20 | ... 21 | 22 | // Create the FFT config structure 23 | fft_config_t *real_fft_plan = fft_init(NFFT, FFT_REAL, FFT_FORWARD, NULL, NULL); 24 | 25 | // Fill array with some data 26 | for (k = 0 ; k < fft_analysis->size ; k++) 27 | real_fft_plan->input[k] = (float)k; 28 | 29 | // Execute transformation 30 | fft_execute(real_fft_plan); 31 | 32 | // Now do something with the output 33 | printf("DC component : %f\n", real_fft_plan->output[0]); // DC is at [0] 34 | for (k = 1 ; k < real_fft_plan->size / 2 ; k++) 35 | printf("%d-th freq : %f+j%f\n", k, real_fft_plan->output[2*k], real_fft_plan->output[2*k+1]); 36 | printf("Middle component : %f\n", real_fft_plan->output[1]); // N/2 is real and stored at [1] 37 | 38 | // Don't forget to clean up at the end to free all the memory that was allocated 39 | fft_destroy(real_fft_plan) 40 | 41 | 42 | Documentation 43 | ------------- 44 | 45 | 1. Create the FFT configuration by running 46 | `fft_init`. 47 | 48 | fft_config_t *fft_init(int size, fft_type_t type, fft_direction_t direction, float *input, float *output) 49 | 50 | Parameters 51 | ---------- 52 | size : int 53 | The FFT size (should be a power of two), if not, returns NULL. 54 | type : fft_type_t 55 | The type of FFT, FFT_REAL or FFT_COMPLEX 56 | direction : fft_direction_t 57 | The direction, FFT_FORWARD or FFT_BACKWARD (inverse transformation) 58 | input : float * 59 | A pointer to a buffer of the correct size. If NULL, a buffer is allocated dynamically 60 | output : float * 61 | A pointer to a buffer of the correct size. If NULL, a buffer is allocated dynamically. 62 | 63 | Returns 64 | ------- 65 | A pointer to an `fft_config_t` structure that holds pointers to the buffers and 66 | all the necessary configuration options. 67 | 68 | 2. Fill data in the `input` buffer 69 | 70 | 3. Call `fft_execute` to run the FFT 71 | 72 | 4. Use the transformed data located in the `output` buffer 73 | 74 | 5. Possibly free up memory by calling `fft_destroy` on the configuration structure 75 | 76 | ### Note about Inverse Real FFT 77 | 78 | When doing an inverse real FFT, the data in the input buffer is destroyed. 79 | 80 | ### Buffer sizes and data organization 81 | 82 | * For `FFT_REAL` FFTs (forward as well as backward) of size `NFFT`, the buffer is of size `NFFT`. 83 | Then, the input data is organized as 84 | 85 | Input : [ x[0], x[1], x[2], ..., x[NFFT-1] ] 86 | Output : [ X[0], X[NFFT/2], Re(X[1]), Im(X[1]), ..., Re(X[NFFT/2-1]), Im(X[NFFT/2-1]) ] 87 | 88 | * For `FFT_COMPLEX` of size `NFFT`, the buffer is of size `2 * NFFT` as both real and imaginary parts should be saved. 89 | 90 | Input : [ Re(x[0]), Im(x[0]), ..., Re(x[NFFT-1]), Im(x[NFFT-1]) ] 91 | Output : [ Re(X[0]), Im(X[0]), ..., Re(X[NFFT-1]), Im(X[NFFT-1]) ] 92 | 93 | License 94 | ------- 95 | 96 | This software is released under the MIT license. 97 | 98 | Copyright (c) 2017 Robin Scheibler 99 | 100 | Permission is hereby granted, free of charge, to any person obtaining a copy 101 | of this software and associated documentation files (the "Software"), to deal 102 | in the Software without restriction, including without limitation the rights 103 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 104 | copies of the Software, and to permit persons to whom the Software is 105 | furnished to do so, subject to the following conditions: 106 | 107 | The above copyright notice and this permission notice shall be included in all 108 | copies or substantial portions of the Software. 109 | 110 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 111 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 112 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 113 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 114 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 115 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 116 | SOFTWARE. 117 | -------------------------------------------------------------------------------- /main/crypto.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * crypto.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "freertos/FreeRTOS.h" 31 | #include "freertos/task.h" 32 | #include "freertos/semphr.h" 33 | 34 | #include "esp_log.h" 35 | 36 | #include "core2forAWS.h" 37 | 38 | #include "crypto.h" 39 | 40 | static const char *TAG = CRYPTO_TAB_NAME; 41 | 42 | void display_crypto_tab( lv_obj_t *tv ) 43 | { 44 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes (blocks) the core2foraws_display_semaphore mutex from being used by another task. 45 | 46 | lv_obj_t *crypto_tab = lv_tabview_add_tab( tv, CRYPTO_TAB_NAME ); // Create a LVGL tabview 47 | 48 | /* Create the main body object and set background within the tab*/ 49 | static lv_style_t bg_style; 50 | lv_obj_t *crypto_bg = lv_obj_create( crypto_tab, NULL ); 51 | lv_obj_align( crypto_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 52 | lv_obj_set_size( crypto_bg, 290, 190 ); 53 | lv_obj_set_click( crypto_bg, false ); 54 | lv_style_init( &bg_style ); 55 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 4, 151, 150 ) ); 56 | lv_obj_add_style( crypto_bg, LV_OBJ_PART_MAIN, &bg_style ); 57 | 58 | /* Create the title within the main body object */ 59 | static lv_style_t title_style; 60 | lv_style_init( &title_style ); 61 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 62 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 63 | lv_obj_t *tab_title_label = lv_label_create( crypto_bg, NULL ); 64 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 65 | lv_label_set_static_text( tab_title_label, "ATECC608 Crypto-Auth" ); 66 | lv_obj_align( tab_title_label, crypto_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 67 | 68 | /* Create the sensor information label object */ 69 | lv_obj_t *body_label = lv_label_create( crypto_bg, NULL ); 70 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 71 | lv_label_set_static_text( body_label, "The ATECC608 comes with pre-provisioned static certificates, along with Elliptic Curve Digital Signature Algorithm (ECDSA) sign/verify capability." ); 72 | lv_obj_set_width( body_label, 252 ); 73 | lv_obj_align( body_label, crypto_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 74 | 75 | static lv_style_t body_style; 76 | lv_style_init( &body_style ); 77 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 78 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 79 | 80 | xSemaphoreGive( core2foraws_display_semaphore ); 81 | 82 | char *device_serial = heap_caps_malloc( CRYPTO_SERIAL_STR_SIZE, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM ); // Dynamically allocate enough memory to store the serial number string. ATCA_SERIAL_NUM_SIZE is the size of the hexadecimal serial number, which has two bytes per value and a string needs a trailing null terminator at the end. 83 | esp_err_t ret = core2foraws_crypto_serial_get( device_serial ); // Gets the serial number. If successful, it will return ATCA_SUCCESS, which has a value of 0. 84 | if ( ret == ESP_OK ) 85 | { 86 | char sn_pretext[] = "Serial # "; 87 | size_t sn_pretext_len = strlen( sn_pretext ); 88 | char sn_label_text[ CRYPTO_SERIAL_STR_SIZE + sn_pretext_len - 1 ]; 89 | snprintf( sn_label_text, CRYPTO_SERIAL_STR_SIZE + sn_pretext_len - 1, "%s%s", sn_pretext, device_serial ); 90 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 91 | lv_obj_t *serial_label = lv_label_create( crypto_bg, NULL ); 92 | lv_label_set_text( serial_label, sn_label_text ); 93 | lv_label_set_align( serial_label, LV_LABEL_ALIGN_CENTER ); 94 | lv_obj_align( serial_label, crypto_bg, LV_ALIGN_IN_BOTTOM_MID, 0, -14 ); 95 | lv_obj_add_style( serial_label, LV_OBJ_PART_MAIN, &body_style ); 96 | xSemaphoreGive( core2foraws_display_semaphore ); 97 | heap_caps_free( device_serial ); 98 | } 99 | else 100 | { 101 | ESP_LOGE( TAG, "Secure element failure. Error code: %d", ret ); 102 | } 103 | } -------------------------------------------------------------------------------- /main/images/color_map.c: -------------------------------------------------------------------------------- 1 | const unsigned char color_map[768] = { 2 | 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x04 , 0x00 , 3 | 0x01 , 0x07 , 0x00 , 0x01 , 0x09 , 0x00 , 0x01 , 0x0D , 0x00 , 0x02 , 0x10 , 0x00 , 0x02 , 0x14 , 0x00 , 0x01 , 4 | 0x17 , 0x00 , 0x02 , 0x1C , 0x00 , 0x02 , 0x20 , 0x00 , 0x02 , 0x24 , 0x00 , 0x03 , 0x28 , 0x00 , 0x03 , 0x2D , 5 | 0x00 , 0x03 , 0x32 , 0x00 , 0x04 , 0x37 , 0x00 , 0x05 , 0x3C , 0x00 , 0x04 , 0x42 , 0x00 , 0x05 , 0x46 , 0x00 , 6 | 0x05 , 0x4D , 0x00 , 0x06 , 0x51 , 0x00 , 0x06 , 0x57 , 0x00 , 0x06 , 0x5D , 0x00 , 0x07 , 0x62 , 0x00 , 0x07 , 7 | 0x68 , 0x00 , 0x07 , 0x6E , 0x00 , 0x09 , 0x74 , 0x00 , 0x08 , 0x7A , 0x00 , 0x09 , 0x7F , 0x00 , 0x09 , 0x86 , 8 | 0x00 , 0x0A , 0x8B , 0x00 , 0x0A , 0x91 , 0x00 , 0x0B , 0x97 , 0x00 , 0x0B , 0x9D , 0x00 , 0x0C , 0xA2 , 0x00 , 9 | 0x0C , 0xA8 , 0x00 , 0x0C , 0xAD , 0x00 , 0x0D , 0xB2 , 0x00 , 0x0D , 0xB7 , 0x00 , 0x0E , 0xBC , 0x00 , 0x0E , 10 | 0xC2 , 0x00 , 0x0E , 0xC7 , 0x00 , 0x0E , 0xCB , 0x00 , 0x0F , 0xD0 , 0x00 , 0x0F , 0xD5 , 0x00 , 0x10 , 0xD9 , 11 | 0x00 , 0x0F , 0xDD , 0x00 , 0x10 , 0xE2 , 0x00 , 0x11 , 0xE5 , 0x00 , 0x11 , 0xE8 , 0x00 , 0x11 , 0xEC , 0x00 , 12 | 0x11 , 0xEF , 0x00 , 0x11 , 0xF1 , 0x00 , 0x11 , 0xF5 , 0x00 , 0x11 , 0xF6 , 0x00 , 0x12 , 0xF9 , 0x00 , 0x11 , 13 | 0xFA , 0x00 , 0x11 , 0xFC , 0x00 , 0x12 , 0xFD , 0x00 , 0x12 , 0xFE , 0x00 , 0x12 , 0xFF , 0x00 , 0x12 , 0xFF , 14 | 0x01 , 0x12 , 0xFF , 0x04 , 0x12 , 0xFE , 0x06 , 0x12 , 0xFE , 0x09 , 0x11 , 0xFD , 0x0B , 0x11 , 0xFB , 0x0E , 15 | 0x11 , 0xFB , 0x11 , 0x11 , 0xF8 , 0x14 , 0x10 , 0xF7 , 0x17 , 0x0F , 0xF5 , 0x1B , 0x0F , 0xF2 , 0x1E , 0x0E , 16 | 0xEF , 0x22 , 0x0E , 0xED , 0x26 , 0x0D , 0xE9 , 0x29 , 0x0C , 0xE7 , 0x2D , 0x0B , 0xE3 , 0x32 , 0x0A , 0xE0 , 17 | 0x36 , 0x09 , 0xDC , 0x3A , 0x08 , 0xD7 , 0x3F , 0x07 , 0xD4 , 0x44 , 0x07 , 0xCF , 0x48 , 0x06 , 0xCB , 0x4C , 18 | 0x04 , 0xC6 , 0x51 , 0x04 , 0xC2 , 0x55 , 0x02 , 0xBD , 0x5A , 0x02 , 0xB8 , 0x5F , 0x01 , 0xB4 , 0x63 , 0x00 , 19 | 0xAF , 0x68 , 0x00 , 0xAA , 0x6D , 0x00 , 0xA5 , 0x73 , 0x00 , 0xA0 , 0x78 , 0x00 , 0x9A , 0x7C , 0x00 , 0x95 , 20 | 0x81 , 0x00 , 0x90 , 0x86 , 0x00 , 0x8A , 0x8B , 0x00 , 0x85 , 0x90 , 0x00 , 0x7E , 0x96 , 0x00 , 0x78 , 0x9B , 21 | 0x00 , 0x73 , 0xA0 , 0x00 , 0x6E , 0xA5 , 0x00 , 0x68 , 0xA9 , 0x00 , 0x63 , 0xAF , 0x00 , 0x5D , 0xB3 , 0x00 , 22 | 0x57 , 0xB8 , 0x00 , 0x53 , 0xBC , 0x00 , 0x4D , 0xC1 , 0x00 , 0x48 , 0xC5 , 0x00 , 0x43 , 0xCA , 0x00 , 0x3D , 23 | 0xCE , 0x00 , 0x38 , 0xD3 , 0x00 , 0x33 , 0xD6 , 0x00 , 0x2F , 0xDA , 0x00 , 0x2B , 0xDE , 0x00 , 0x26 , 0xE2 , 24 | 0x00 , 0x22 , 0xE6 , 0x00 , 0x1D , 0xE8 , 0x00 , 0x1A , 0xEC , 0x00 , 0x16 , 0xEF , 0x00 , 0x12 , 0xF2 , 0x00 , 25 | 0x0E , 0xF5 , 0x00 , 0x0B , 0xF7 , 0x00 , 0x09 , 0xF9 , 0x00 , 0x06 , 0xFC , 0x00 , 0x04 , 0xFE , 0x00 , 0x01 , 26 | 0xFF , 0x01 , 0x00 , 0xFF , 0x03 , 0x00 , 0xFF , 0x05 , 0x00 , 0xFF , 0x07 , 0x00 , 0xFF , 0x0A , 0x00 , 0xFF , 27 | 0x0D , 0x00 , 0xFF , 0x10 , 0x00 , 0xFF , 0x13 , 0x00 , 0xFF , 0x16 , 0x00 , 0xFF , 0x19 , 0x00 , 0xFF , 0x1C , 28 | 0x00 , 0xFF , 0x21 , 0x00 , 0xFF , 0x24 , 0x00 , 0xFF , 0x28 , 0x00 , 0xFF , 0x2C , 0x00 , 0xFF , 0x31 , 0x00 , 29 | 0xFF , 0x35 , 0x00 , 0xFF , 0x38 , 0x00 , 0xFF , 0x3D , 0x00 , 0xFF , 0x41 , 0x00 , 0xFF , 0x46 , 0x00 , 0xFF , 30 | 0x4B , 0x00 , 0xFF , 0x50 , 0x00 , 0xFF , 0x54 , 0x00 , 0xFF , 0x59 , 0x00 , 0xFF , 0x5D , 0x00 , 0xFF , 0x63 , 31 | 0x00 , 0xFF , 0x67 , 0x00 , 0xFF , 0x6C , 0x00 , 0xFF , 0x71 , 0x00 , 0xFF , 0x76 , 0x00 , 0xFF , 0x7B , 0x00 , 32 | 0xFF , 0x81 , 0x00 , 0xFF , 0x85 , 0x00 , 0xFD , 0x8A , 0x00 , 0xFC , 0x8F , 0x00 , 0xFB , 0x95 , 0x00 , 0xFA , 33 | 0x9A , 0x00 , 0xF8 , 0x9E , 0x00 , 0xF8 , 0xA3 , 0x00 , 0xF6 , 0xA7 , 0x00 , 0xF5 , 0xAD , 0x00 , 0xF4 , 0xB1 , 34 | 0x00 , 0xF3 , 0xB6 , 0x00 , 0xF1 , 0xBA , 0x00 , 0xF0 , 0xBF , 0x00 , 0xF0 , 0xC4 , 0x00 , 0xEE , 0xC8 , 0x00 , 35 | 0xED , 0xCD , 0x00 , 0xEC , 0xD0 , 0x00 , 0xEB , 0xD4 , 0x00 , 0xEB , 0xD8 , 0x00 , 0xE9 , 0xDD , 0x00 , 0xE8 , 36 | 0xE0 , 0x00 , 0xE8 , 0xE4 , 0x00 , 0xE7 , 0xE7 , 0x00 , 0xE7 , 0xEB , 0x00 , 0xE6 , 0xED , 0x00 , 0xE6 , 0xF0 , 37 | 0x00 , 0xE5 , 0xF4 , 0x00 , 0xE4 , 0xF7 , 0x00 , 0xE4 , 0xF9 , 0x00 , 0xE4 , 0xFB , 0x00 , 0xE4 , 0xFE , 0x00 , 38 | 0xE4 , 0xFF , 0x01 , 0xE4 , 0xFF , 0x02 , 0xE5 , 0xFF , 0x05 , 0xE4 , 0xFF , 0x07 , 0xE5 , 0xFF , 0x0B , 0xE4 , 39 | 0xFF , 0x0D , 0xE4 , 0xFF , 0x10 , 0xE5 , 0xFF , 0x13 , 0xE5 , 0xFF , 0x16 , 0xE6 , 0xFF , 0x1A , 0xE5 , 0xFF , 40 | 0x1D , 0xE5 , 0xFF , 0x21 , 0xE6 , 0xFF , 0x24 , 0xE6 , 0xFF , 0x29 , 0xE7 , 0xFF , 0x2C , 0xE7 , 0xFF , 0x30 , 41 | 0xE8 , 0xFF , 0x34 , 0xE8 , 0xFF , 0x39 , 0xE9 , 0xFF , 0x3D , 0xE9 , 0xFF , 0x41 , 0xE9 , 0xFF , 0x46 , 0xEA , 42 | 0xFF , 0x4A , 0xEB , 0xFF , 0x50 , 0xEB , 0xFF , 0x54 , 0xEC , 0xFF , 0x59 , 0xEC , 0xFF , 0x5E , 0xED , 0xFF , 43 | 0x62 , 0xED , 0xFF , 0x67 , 0xEE , 0xFF , 0x6C , 0xEF , 0xFF , 0x71 , 0xEF , 0xFF , 0x76 , 0xF0 , 0xFF , 0x7B , 44 | 0xF0 , 0xFF , 0x80 , 0xF0 , 0xFF , 0x85 , 0xF1 , 0xFF , 0x8A , 0xF2 , 0xFF , 0x8F , 0xF2 , 0xFF , 0x94 , 0xF3 , 45 | 0xFF , 0x99 , 0xF3 , 0xFF , 0x9D , 0xF4 , 0xFF , 0xA3 , 0xF5 , 0xFF , 0xA7 , 0xF5 , 0xFF , 0xAC , 0xF6 , 0xFF , 46 | 0xB1 , 0xF6 , 0xFF , 0xB5 , 0xF6 , 0xFF , 0xBA , 0xF7 , 0xFF , 0xBE , 0xF8 , 0xFF , 0xC3 , 0xF8 , 0xFF , 0xC7 , 47 | 0xF9 , 0xFF , 0xCB , 0xF9 , 0xFF , 0xD0 , 0xFA , 0xFF , 0xD4 , 0xFB , 0xFF , 0xD8 , 0xFB , 0xFF , 0xDC , 0xFB , 48 | 0xFF , 0xDF , 0xFC , 0xFF , 0xE2 , 0xFC , 0xFF , 0xE6 , 0xFC , 0xFF , 0xEA , 0xFD , 0xFF , 0xEC , 0xFD , 0xFF , 49 | 0xF0 , 0xFD , 0xFF , 0xF3 , 0xFE , 0xFF , 0xF6 , 0xFE , 0xFF , 0xF8 , 0xFF , 0xFF , 0xFB , 0xFF , 0xFF , 0xFD , 50 | }; -------------------------------------------------------------------------------- /sdkconfig.defaults: -------------------------------------------------------------------------------- 1 | # 2 | # Enable TLS asymmetric in/out content length 3 | # 4 | CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y 5 | 6 | # 7 | # Partition Table 8 | # 9 | CONFIG_PARTITION_TABLE_CUSTOM=y 10 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_16MB.csv" 11 | CONFIG_PARTITION_TABLE_FILENAME="partitions_16MB.csv" 12 | CONFIG_PARTITION_TABLE_OFFSET=0x8000 13 | CONFIG_PARTITION_TABLE_MD5=y 14 | # end of Partition Table 15 | 16 | # 17 | # Serial flasher config 18 | # 19 | CONFIG_ESPTOOLPY_FLASHMODE_DIO=y 20 | CONFIG_ESPTOOLPY_FLASHMODE="dio" 21 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 22 | CONFIG_ESPTOOLPY_FLASHFREQ="80m" 23 | CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y 24 | CONFIG_ESPTOOLPY_FLASHSIZE="16MB" 25 | CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y 26 | 27 | # 28 | # ESP32-specific 29 | # 30 | CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y 31 | CONFIG_ESP32_REV_MIN_3=y 32 | CONFIG_ESP32_REV_MIN=3 33 | CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y 34 | CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 35 | CONFIG_ESP32_SPIRAM_SUPPORT=y 36 | 37 | # 38 | # SPI RAM config 39 | # 40 | CONFIG_SPIRAM_TYPE_AUTO=y 41 | CONFIG_SPIRAM_SIZE=-1 42 | CONFIG_SPIRAM_SPEED_80M=y 43 | CONFIG_SPIRAM=y 44 | CONFIG_SPIRAM_BOOT_INIT=y 45 | CONFIG_SPIRAM_USE_MALLOC=y 46 | CONFIG_SPIRAM_MEMTEST=y 47 | CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 48 | CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y 49 | CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 50 | CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y 51 | CONFIG_SPIRAM_CACHE_WORKAROUND= 52 | CONFIG_SPIRAM_BANKSWITCH_ENABLE=y 53 | CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 54 | CONFIG_D0WD_PSRAM_CLK_IO=17 55 | CONFIG_D0WD_PSRAM_CS_IO=16 56 | 57 | # 58 | # Component config 59 | # 60 | 61 | # 62 | # Bluetooth 63 | # 64 | CONFIG_BT_ENABLED=y 65 | CONFIG_BT_NIMBLE_ENABLED=y 66 | CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y 67 | CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n 68 | CONFIG_BTDM_CTRL_MODE_BTDM=n 69 | 70 | # 71 | # ESP-TLS 72 | # 73 | CONFIG_ESP_TLS_USING_MBEDTLS=y 74 | CONFIG_ESP_TLS_USE_SECURE_ELEMENT=y 75 | 76 | # 77 | # LWIP 78 | # 79 | CONFIG_LWIP_LOCAL_HOSTNAME="Core2ForAWS" 80 | 81 | # 82 | # mbedTLS 83 | # 84 | CONFIG_SSL_USING_MBEDTLS=y 85 | CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y 86 | CONFIG_MBEDTLS_THREADING_ALT= 87 | CONFIG_MBEDTLS_THREADING_PTHREAD=y 88 | CONFIG_MBEDTLS_HARDWARE_MPI=y 89 | CONFIG_MBEDTLS_THREADING_C=y 90 | 91 | # 92 | # Certificate Bundle 93 | # 94 | CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y 95 | CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y 96 | 97 | # 98 | # Certificates 99 | # 100 | CONFIG_MBEDTLS_PEM_PARSE_C=y 101 | CONFIG_MBEDTLS_PEM_WRITE_C=y 102 | CONFIG_MBEDTLS_X509_CRL_PARSE_C=y 103 | CONFIG_MBEDTLS_X509_CSR_PARSE_C=y 104 | CONFIG_MBEDTLS_ECP_C=y 105 | CONFIG_MBEDTLS_ECDH_C=y 106 | CONFIG_MBEDTLS_ECDSA_C=y 107 | CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y 108 | CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y 109 | CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y 110 | CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y 111 | CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y 112 | CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y 113 | CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y 114 | CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y 115 | CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y 116 | CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y 117 | CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y 118 | CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y 119 | CONFIG_MBEDTLS_ECP_NIST_OPTIM=y 120 | 121 | # 122 | # SPI Flash driver 123 | # 124 | CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y 125 | CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y 126 | CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y 127 | 128 | # 129 | # Core2 for AWS hardware features 130 | # 131 | CONFIG_SOFTWARE_BSP_SUPPORT=y 132 | CONFIG_SOFTWARE_AUDIO_SUPPORT=y 133 | CONFIG_SOFTWARE_CRYPTO_SUPPORT=y 134 | CONFIG_SOFTWARE_DISPLAY_SUPPORT=y 135 | CONFIG_SOFTWARE_BUTTON_SUPPORT=y 136 | CONFIG_SOFTWARE_MOTION_SUPPORT=y 137 | CONFIG_SOFTWARE_RTC_SUPPORT=y 138 | CONFIG_SOFTWARE_RGB_LED_SUPPORT=y 139 | CONFIG_SOFTWARE_SDCARD_SUPPORT=y 140 | CONFIG_SOFTWARE_EXPPORTS_SUPPORT=y 141 | CONFIG_SOFTWARE_WIFI_SUPPORT=y 142 | 143 | # 144 | # LVGL configuration 145 | # 146 | CONFIG_LV_HOR_RES_MAX=320 147 | CONFIG_LV_VER_RES_MAX=240 148 | CONFIG_LV_COLOR_DEPTH_16=y 149 | CONFIG_LV_COLOR_DEPTH=16 150 | CONFIG_LV_COLOR_16_SWAP=y 151 | 152 | # 153 | # Indev device settings 154 | # 155 | CONFIG_LV_INDEV_DEF_READ_PERIOD=20 156 | 157 | # 158 | # Feature usage 159 | # 160 | CONFIG_LV_USE_USER_DATA=y 161 | 162 | # 163 | # Font usage 164 | # 165 | 166 | # 167 | # Enable built-in fonts 168 | # 169 | CONFIG_LV_FONT_MONTSERRAT_14=y 170 | CONFIG_LV_FONT_MONTSERRAT_16=y 171 | CONFIG_LV_FONT_MONTSERRAT_18=y 172 | CONFIG_LV_FONT_MONTSERRAT_20=y 173 | 174 | CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_14=y 175 | CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_16=y 176 | CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_18=y 177 | CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_20=y 178 | 179 | # 180 | # LVGL ESP Drivers 181 | # 182 | 183 | # 184 | # I2C Port Settings 185 | # 186 | CONFIG_LV_I2C=y 187 | 188 | # 189 | # LVGL TFT Display controller 190 | # 191 | CONFIG_LV_PREDEFINED_DISPLAY_M5CORE2=y 192 | CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341=y 193 | CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI=y 194 | CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT=y 195 | CONFIG_LV_TFT_DISPLAY_SPI_HSPI=y 196 | CONFIG_LV_TFT_DISPLAY_SPI_TRANS_MODE_DIO=y 197 | CONFIG_LV_TFT_DISPLAY_SPI_HALF_DUPLEX=y 198 | CONFIG_LV_INVERT_COLORS=y 199 | CONFIG_LV_DISP_BACKLIGHT_OFF=y 200 | 201 | # 202 | # Display Pin Assignments 203 | # 204 | CONFIG_LV_DISP_SPI_MOSI=23 205 | CONFIG_LV_DISPLAY_USE_SPI_MISO=y 206 | CONFIG_LV_DISP_SPI_MISO=38 207 | CONFIG_LV_DISP_SPI_INPUT_DELAY_NS=0 208 | CONFIG_LV_DISP_SPI_CLK=18 209 | CONFIG_LV_DISPLAY_USE_SPI_CS=y 210 | CONFIG_LV_DISP_SPI_CS=5 211 | CONFIG_LV_DISPLAY_USE_DC=y 212 | CONFIG_LV_DISP_PIN_DC=15 213 | CONFIG_LV_DISP_PIN_BUSY=35 214 | 215 | # 216 | # LVGL Touch controller 217 | # 218 | CONFIG_LV_TOUCH_CONTROLLER=2 219 | CONFIG_LV_TOUCH_CONTROLLER_FT6X06=y 220 | CONFIG_LV_I2C_TOUCH=y 221 | 222 | # 223 | # Touchpanel Configuration (FT6X06) 224 | # 225 | CONFIG_LV_FT6X36_COORDINATES_QUEUE=y 226 | 227 | CONFIG_LV_I2C_TOUCH_PORT_0=y 228 | CONFIG_LV_I2C_TOUCH_PORT=0 229 | 230 | # 231 | # I2C Port Settings 232 | # 233 | 234 | # 235 | # I2C Port 0 236 | # 237 | CONFIG_I2C_MANAGER_0_SDA=21 238 | CONFIG_I2C_MANAGER_0_SCL=22 239 | CONFIG_I2C_MANAGER_0_FREQ_HZ=100000 240 | CONFIG_I2C_MANAGER_0_TIMEOUT=940 241 | CONFIG_I2C_MANAGER_0_LOCK_TIMEOUT=1000 242 | CONFIG_I2C_MANAGER_0_PULLUPS=y 243 | 244 | # 245 | # I2C Port 1 246 | # 247 | CONFIG_I2C_MANAGER_1_SDA=32 248 | CONFIG_I2C_MANAGER_1_SCL=33 249 | CONFIG_I2C_MANAGER_1_FREQ_HZ=400000 250 | CONFIG_I2C_MANAGER_1_TIMEOUT=200 251 | CONFIG_I2C_MANAGER_1_LOCK_TIMEOUT=280 252 | 253 | # 254 | # esp-cryptoauthlib 255 | # 256 | CONFIG_ATECC608A_TNG=y 257 | CONFIG_ATCA_MBEDTLS_ECDSA=y 258 | CONFIG_ATCA_MBEDTLS_ECDSA_SIGN=y 259 | CONFIG_ATCA_MBEDTLS_ECDSA_VERIFY=y 260 | CONFIG_ATCA_I2C_SDA_PIN=21 261 | CONFIG_ATCA_I2C_SCL_PIN=22 262 | CONFIG_ATCA_I2C_ADDRESS=0x6A -------------------------------------------------------------------------------- /main/mic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * mic.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "freertos/FreeRTOS.h" 30 | #include "freertos/task.h" 31 | #include "freertos/semphr.h" 32 | #include "freertos/queue.h" 33 | 34 | #include "driver/i2s.h" 35 | 36 | #include "core2forAWS.h" 37 | 38 | #include "mic.h" 39 | #include "fft.h" 40 | 41 | TaskHandle_t mic_handle, FFT_handle; 42 | 43 | static const char *TAG = MICROPHONE_TAB_NAME; 44 | 45 | #define CANVAS_WIDTH 240 46 | #define CANVAS_HEIGHT 60 47 | 48 | static long map( long x, long in_min, long in_max, long out_min, long out_max ) 49 | { 50 | long divisor = ( in_max - in_min ); 51 | if ( divisor == 0 ) 52 | { 53 | return -1; 54 | } 55 | return ( x - in_min ) * ( out_max - out_min ) / divisor + out_min; 56 | } 57 | 58 | void display_microphone_tab( lv_obj_t *tv ) 59 | { 60 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes the core2foraws_display_semaphore mutex. This blocks any other task attempting to take it before it's free'd from executing. 61 | 62 | lv_obj_t *mic_tab = lv_tabview_add_tab( tv, MICROPHONE_TAB_NAME ); // Create a LVGL tabview 63 | 64 | /* Create the main body object and set background within the tab*/ 65 | static lv_style_t bg_style; 66 | lv_obj_t *mic_bg = lv_obj_create( mic_tab, NULL ); 67 | lv_obj_align( mic_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 68 | lv_obj_set_size( mic_bg, 290, 190 ); 69 | lv_obj_set_click ( mic_bg, false ); 70 | lv_style_init( &bg_style ); 71 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 72 | lv_obj_add_style( mic_bg, LV_OBJ_PART_MAIN, &bg_style ); 73 | 74 | /* Create the title within the main body object */ 75 | static lv_style_t title_style; 76 | lv_style_init( &title_style ); 77 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 78 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_LIME ); 79 | lv_obj_t *tab_title_label = lv_label_create( mic_bg, NULL ); 80 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 81 | lv_label_set_static_text( tab_title_label, "SPM1423 Microphone" ); 82 | lv_obj_align( tab_title_label, mic_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 83 | 84 | /* Create the sensor information label object */ 85 | lv_obj_t *body_label = lv_label_create( mic_bg, NULL ); 86 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 87 | lv_label_set_static_text( body_label, "The SPM1423 is an enhanced far-field MEMS microphone.\n\nSay \"Hi Kit\"" ); 88 | lv_obj_set_width( body_label, 252 ); 89 | lv_obj_align( body_label, mic_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 90 | 91 | static lv_style_t body_style; 92 | lv_style_init( &body_style ); 93 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 94 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 95 | 96 | xSemaphoreGive( core2foraws_display_semaphore ); 97 | 98 | xTaskCreatePinnedToCore( fft_show_task, "fftShowTask", 4096 * 2, ( void * )mic_tab, 1, &FFT_handle, 1 ); 99 | } 100 | 101 | void microphoneTask( void* pvParameters ) 102 | { 103 | vTaskSuspend( NULL ); 104 | 105 | static int8_t i2s_readraw_buff[ 1024 ]; 106 | size_t bytesread; 107 | int16_t *buffptr; 108 | double data = 0; 109 | uint8_t *fft_dis_buff = NULL; 110 | core2foraws_audio_mic_enable( true ); 111 | QueueHandle_t queue = ( QueueHandle_t ) pvParameters; 112 | 113 | for ( ; ; ) 114 | { 115 | fft_dis_buff = ( uint8_t * )heap_caps_malloc( CANVAS_HEIGHT * sizeof( uint8_t ), MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM ); 116 | memset( fft_dis_buff, 0, CANVAS_HEIGHT ); 117 | fft_config_t *real_fft_plan = fft_init( 512, FFT_REAL, FFT_FORWARD, NULL, NULL ); 118 | i2s_read( I2S_NUM_0, ( char * )i2s_readraw_buff, 1024, &bytesread, pdMS_TO_TICKS( 100 ) ); 119 | buffptr = ( int16_t * )i2s_readraw_buff; 120 | for ( uint16_t count_n = 0; count_n < real_fft_plan->size; count_n++ ) 121 | { 122 | real_fft_plan->input[ count_n ] = ( float )map( buffptr[ count_n ], INT16_MIN, INT16_MAX, -1000, 1000 ); 123 | } 124 | fft_execute( real_fft_plan ); 125 | 126 | for ( uint16_t count_n = 1; count_n < CANVAS_HEIGHT; count_n++ ) 127 | { 128 | data = sqrt( real_fft_plan->output[ 2 * count_n ] * real_fft_plan->output[ 2 * count_n ] + real_fft_plan->output[ 2 * count_n + 1 ] * real_fft_plan->output[ 2 * count_n + 1 ] ); 129 | fft_dis_buff[ CANVAS_HEIGHT - count_n ] = map( data, 0, 2000, 0, 256 ); 130 | } 131 | fft_destroy( real_fft_plan ); 132 | if ( xQueueSend( queue, &fft_dis_buff, 0 ) != pdPASS ) 133 | { 134 | free( fft_dis_buff ); 135 | } 136 | } 137 | vTaskDelete( NULL ); // Should never get to here... 138 | } 139 | 140 | void fft_show_task( void *pvParameters ) 141 | { 142 | QueueHandle_t mic_queue = xQueueCreate( 2, sizeof( uint8_t * ) ); 143 | xTaskCreatePinnedToCore( microphoneTask, "microphoneTask", 4096 * 2, ( void * ) mic_queue, 1, &mic_handle, 1 ); 144 | 145 | vTaskSuspend( NULL ); 146 | static uint16_t position_data = 0; 147 | uint16_t color_position; 148 | uint8_t *fft_dis_buff = heap_caps_malloc( sizeof( uint8_t ) * CANVAS_HEIGHT, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM ); 149 | 150 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 151 | lv_obj_t *canvas = lv_canvas_create( ( lv_obj_t * )pvParameters, NULL ); 152 | lv_color_t *cbuf = heap_caps_malloc( LV_CANVAS_BUF_SIZE_TRUE_COLOR( CANVAS_WIDTH, CANVAS_HEIGHT ), MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM ); 153 | lv_canvas_set_buffer( canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR ); 154 | lv_canvas_fill_bg( canvas, LV_COLOR_BLACK, LV_OPA_COVER ); 155 | lv_obj_align( canvas, ( lv_obj_t * )pvParameters, LV_ALIGN_IN_BOTTOM_MID, 0, -18 ); 156 | xSemaphoreGive( core2foraws_display_semaphore ); 157 | 158 | extern const unsigned char color_map[ 768 ]; 159 | 160 | for ( ; ; ) 161 | { 162 | if ( mic_queue != NULL ) 163 | { 164 | xQueueReceive( mic_queue, &fft_dis_buff, 0 ); 165 | for( uint16_t count_y = 0; count_y < CANVAS_HEIGHT; count_y++ ) 166 | { 167 | color_position = fft_dis_buff[ count_y ]; 168 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 169 | lv_canvas_set_px( canvas, position_data, count_y, 170 | LV_COLOR_MAKE( color_map[ color_position * 3 + 0 ], color_map[ color_position * 3 + 1 ], color_map[ color_position * 3 + 2 ] ) ); 171 | xSemaphoreGive( core2foraws_display_semaphore ); 172 | } 173 | position_data ++; 174 | if ( position_data == CANVAS_WIDTH ) 175 | { 176 | position_data = 0; 177 | } 178 | } 179 | vTaskDelay( pdMS_TO_TICKS( 10 ) ); 180 | } 181 | } -------------------------------------------------------------------------------- /main/mpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * mpu.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "freertos/FreeRTOS.h" 32 | #include "freertos/task.h" 33 | #include "freertos/semphr.h" 34 | 35 | #include "esp_log.h" 36 | 37 | #include "core2forAWS.h" 38 | 39 | #include "mpu.h" 40 | 41 | /* 42 | If you want to use Sebastian Madgwick's algorithym to calculate roll, pitch, yaw, add the libs from: 43 | https://x-io.co.uk/open-source-imu-and-ahrs-algorithms/ 44 | 45 | Note that since there is no magnometer (and it wouldn't work correctly due to magnets in the housing) 46 | there will be a drift in the Yaw. The drift cannot be correct without creating a custom algorithm to 47 | serve as a filter for the drift. Uncomment the commented code below. You will need to make modifications 48 | to the imu-and-ahrs-algorithms library for it to write to the pitch, yaw, roll pointers. 49 | 50 | Note: Sebastian Madgwick's algorithym implementation library is GPL licensed. 51 | */ 52 | 53 | // #include "MahonyAHRS.h" 54 | 55 | // #define DEGREES_TO_RADIANS M_PI/180 56 | // #define RADIANS_TO_DEGREES 180/M_PI 57 | 58 | TaskHandle_t MPU_handle; 59 | 60 | static const char *TAG = MPU_TAB_NAME; 61 | 62 | LV_IMG_DECLARE( gauge_hand ); 63 | 64 | void display_mpu_tab(lv_obj_t *tv) 65 | { 66 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes the core2foraws_display_semaphore mutex. This blocks any other task attempting to take it before it's free'd from executing. 67 | 68 | lv_obj_t *mpu_tab = lv_tabview_add_tab(tv, MPU_TAB_NAME); // Create a LVGL tabview 69 | /* Create the main body object and set background within the tab*/ 70 | static lv_style_t bg_style; 71 | lv_obj_t *mpu_bg = lv_obj_create( mpu_tab, NULL ); 72 | lv_obj_align( mpu_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 73 | lv_obj_set_size( mpu_bg, 290, 190 ); 74 | lv_obj_set_click( mpu_bg, false ); 75 | lv_style_init( &bg_style ); 76 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 169, 0, 103 ) ); 77 | lv_obj_add_style( mpu_bg, LV_OBJ_PART_MAIN, &bg_style ); 78 | 79 | /* Create the title within the main body object */ 80 | static lv_style_t title_style; 81 | lv_style_init( &title_style ); 82 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 83 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 84 | lv_obj_t *tab_title_label = lv_label_create( mpu_bg, NULL ); 85 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 86 | lv_label_set_static_text( tab_title_label, "MPU6886 IMU Sensor" ); 87 | lv_obj_align( tab_title_label, mpu_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 88 | 89 | /* Create the sensor information label object */ 90 | lv_obj_t *body_label = lv_label_create( mpu_bg, NULL ); 91 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 92 | lv_label_set_static_text( body_label, "The Inertial Measurement Unit (IMU) senses the motion of the device." ); 93 | lv_obj_set_width( body_label, 120 ); 94 | lv_obj_align( body_label, mpu_bg, LV_ALIGN_IN_LEFT_MID, 20, 0 ); 95 | 96 | static lv_style_t body_style; 97 | lv_style_init( &body_style ); 98 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 99 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 100 | 101 | /* Create the sensor color legend */ 102 | lv_obj_t *lgnd_bg = lv_obj_create( mpu_bg, NULL ); 103 | lv_obj_set_size( lgnd_bg, 200, 24 ); 104 | lv_obj_align( lgnd_bg, mpu_bg, LV_ALIGN_IN_BOTTOM_MID, 0, -10 ); 105 | lv_obj_t *legend_label = lv_label_create( lgnd_bg, NULL ); 106 | lv_label_set_recolor( legend_label, true ); // Enable recoloring of the text within the label with color HEX 107 | lv_label_set_static_text( legend_label, "#ff0000 Rot_X# #008000 Rot_Y# #0000ff Rot_Z#" ); 108 | lv_label_set_align( legend_label, LV_LABEL_ALIGN_CENTER ); 109 | lv_obj_align( legend_label, lgnd_bg, LV_ALIGN_CENTER, 0, 0 ); 110 | lv_obj_set_style_local_bg_color( lgnd_bg, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 111 | 112 | /* Create a gauge */ 113 | static lv_color_t gauge_needle_colors[ 3 ]; 114 | gauge_needle_colors[ 0 ] = LV_COLOR_RED; 115 | gauge_needle_colors[ 1 ] = LV_COLOR_GREEN; 116 | gauge_needle_colors[ 2 ] = LV_COLOR_BLUE; 117 | 118 | LV_IMG_DECLARE( gauge_hand ); 119 | 120 | lv_obj_t *gauge = lv_gauge_create( mpu_bg, NULL ); 121 | lv_obj_set_click( gauge, false ); 122 | lv_obj_set_size( gauge, 106, 106 ); 123 | lv_gauge_set_scale( gauge, 300, 10, 0 ); 124 | lv_gauge_set_range( gauge, -400, 400 ); 125 | lv_gauge_set_critical_value( gauge, 2001 ); 126 | lv_gauge_set_needle_count( gauge, 3, gauge_needle_colors ); 127 | lv_gauge_set_needle_img( gauge, &gauge_hand, 5, 4 ); 128 | lv_obj_set_style_local_image_recolor_opa(gauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER ); 129 | 130 | lv_obj_align( gauge, NULL, LV_ALIGN_IN_RIGHT_MID, -20, 0 ); 131 | xSemaphoreGive( core2foraws_display_semaphore ); 132 | 133 | /* 134 | Create a task to read the MPU values running on the 2nd Core. 135 | Pass in pointer to the gauge object to display value on the gauge. 136 | */ 137 | xTaskCreatePinnedToCore( MPU_task, "MPUTask", 2048, ( void * ) gauge, 1, &MPU_handle, 1 ); 138 | } 139 | 140 | void MPU_task( void *pvParameters ) 141 | { 142 | float calib_gx = 0.00; 143 | float calib_gy = 0.00; 144 | float calib_gz = 0.00; 145 | 146 | float calib_ax = 0.00; 147 | float calib_ay = 0.00; 148 | float calib_az = 0.00; 149 | 150 | core2foraws_motion_accel_get( &calib_ax, &calib_ay, &calib_az ); 151 | core2foraws_motion_gyro_get( &calib_gx, &calib_gy, &calib_gz ); 152 | 153 | vTaskSuspend( NULL ); 154 | 155 | for ( ; ; ) 156 | { 157 | float gx, gy, gz; 158 | float ax, ay, az; 159 | core2foraws_motion_accel_get( &ax, &ay, &az ); 160 | core2foraws_motion_gyro_get( &gx, &gy, &gz ); 161 | 162 | 163 | // float pitch, roll, yaw; 164 | // MahonyAHRSupdateIMU( gx * DEGREES_TO_RADIANS, gy * DEGREES_TO_RADIANS, gz * DEGREES_TO_RADIANS, ax, ay, az, &pitch, &roll, &yaw ); 165 | // ESP_LOGI( TAG, "Pitch: %.6f Roll: %.6f Yaw: %.6f | Raw Accel: X-%.6f Y-%.6f Z-%.6f | Gyro: X-%.6f Y-%.6fZ- %.6f", pitch, yaw, roll, ax, ay, az, gx, gy, gz ); 166 | 167 | ESP_LOGI( TAG, "Raw Accel: X-%.6f Y-%.6f Z-%.6f | Gyro: X-%.6f Y-%.6fZ- %.6f", ax, ay, az, gx, gy, gz ); 168 | 169 | lv_obj_t *gauges = ( lv_obj_t * )pvParameters; 170 | 171 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 172 | lv_gauge_set_value( gauges, 0, ( int ) ( gx-calib_gx )); 173 | lv_gauge_set_value( gauges, 1, ( int ) ( gy-calib_gy )); 174 | lv_gauge_set_value( gauges, 2, ( int ) ( gz-calib_gz )); 175 | xSemaphoreGive( core2foraws_display_semaphore ); 176 | 177 | vTaskDelay( pdMS_TO_TICKS( 30 ) ); 178 | } 179 | vTaskDelete( NULL ); // Should never get to here... 180 | } -------------------------------------------------------------------------------- /main/wifi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * wifi.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "freertos/FreeRTOS.h" 30 | #include "freertos/task.h" 31 | #include "freertos/semphr.h" 32 | 33 | #include "esp_log.h" 34 | #include "esp_wifi.h" 35 | #include "esp_log.h" 36 | #include "esp_event.h" 37 | 38 | #include "core2forAWS.h" 39 | 40 | #include "wifi.h" 41 | 42 | #define DEFAULT_SCAN_LIST_SIZE 6 43 | 44 | TaskHandle_t wifi_handle; 45 | 46 | static lv_obj_t *mbox; 47 | static lv_style_t modal_style; 48 | 49 | static const char *TAG = "WIFI_SCAN"; 50 | 51 | static void wifi_scan_task( void *pvParameters ); 52 | static void mbox_event_cb( lv_obj_t *obj, lv_event_t evt ); 53 | static void event_handler( lv_obj_t *obj, lv_event_t event ); 54 | 55 | void display_wifi_tab( lv_obj_t *tv ) 56 | { 57 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 58 | 59 | lv_obj_t *wifi_tab = lv_tabview_add_tab( tv, WIFI_TAB_NAME ); 60 | 61 | /* Create the main body object and set background within the tab*/ 62 | lv_obj_t *wifi_bg = lv_obj_create( wifi_tab, NULL ); 63 | lv_obj_align( wifi_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 64 | lv_obj_set_size( wifi_bg, 290, 190 ); 65 | lv_obj_set_click( wifi_bg, false ); 66 | 67 | /* Create the main body object and set background within the tab*/ 68 | static lv_style_t bg_style; 69 | lv_style_init( &bg_style ); 70 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 0, 82, 118 ) ); 71 | lv_obj_add_style( wifi_bg, LV_OBJ_PART_MAIN, &bg_style ); 72 | 73 | /* Create the title within the main body object */ 74 | static lv_style_t title_style; 75 | lv_style_init( &title_style ); 76 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 77 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 78 | lv_obj_t *tab_title_label = lv_label_create( wifi_bg, NULL ); 79 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 80 | lv_label_set_static_text( tab_title_label, "Wi-Fi Scan (2.4GHz)" ); 81 | lv_obj_align( tab_title_label, wifi_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 82 | 83 | /* Create the sensor information label object */ 84 | lv_obj_t *body_label = lv_label_create( wifi_bg, NULL ); 85 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 86 | lv_label_set_static_text( body_label, "Built-in 2.4GHz Wi-Fi and Bluetooth shared radio." ); 87 | lv_obj_set_width( body_label, 252 ); 88 | lv_obj_align( body_label, wifi_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 89 | 90 | static lv_style_t body_style; 91 | lv_style_init( &body_style ); 92 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 93 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 94 | 95 | /*Create a list of available Wi-Fi Access Points*/ 96 | lv_obj_t *ap_list = lv_list_create( wifi_bg, NULL ); 97 | lv_obj_set_size( ap_list, 260, 90 ); 98 | lv_obj_align( ap_list, wifi_bg, LV_ALIGN_IN_BOTTOM_MID, 0, -10 ); 99 | lv_list_set_edge_flash( ap_list, true ); 100 | 101 | /* Set the background for the popup modal */ 102 | lv_style_init( &modal_style ); 103 | lv_style_set_bg_color( &modal_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 104 | 105 | xSemaphoreGive( core2foraws_display_semaphore ); 106 | xTaskCreatePinnedToCore( wifi_scan_task, "WiFiScanTask", configMINIMAL_STACK_SIZE * 4, (void*)ap_list, 1, &wifi_handle, 1 ); 107 | } 108 | 109 | static void opa_anim( void *bg, lv_anim_value_t v ) 110 | { 111 | lv_obj_set_style_local_bg_opa( bg, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v ); 112 | } 113 | 114 | static void mbox_event_cb( lv_obj_t *obj, lv_event_t evt ) 115 | { 116 | if ( evt == LV_EVENT_DELETE && obj == mbox ) 117 | { 118 | /* Delete the parent modal background */ 119 | lv_obj_del_async( lv_obj_get_parent( mbox ) ); 120 | mbox = NULL; /* happens before object is actually deleted! */ 121 | } 122 | else if ( evt == LV_EVENT_VALUE_CHANGED ) 123 | { 124 | /* Button was clicked */ 125 | lv_msgbox_start_auto_close( mbox, 0 ); 126 | } 127 | } 128 | 129 | static void event_handler( lv_obj_t *obj, lv_event_t event ) 130 | { 131 | if ( event == LV_EVENT_CLICKED ) 132 | { 133 | printf( "Clicked: %s\n", lv_list_get_btn_text( obj ) ); 134 | lv_obj_t *obj = lv_obj_create( lv_scr_act(), NULL ); 135 | lv_obj_reset_style_list( obj, LV_OBJ_PART_MAIN ); 136 | lv_obj_add_style( obj, LV_OBJ_PART_MAIN, &modal_style ); 137 | lv_obj_set_pos( obj, 0, 0 ); 138 | lv_obj_set_size( obj, LV_HOR_RES, LV_VER_RES ); 139 | 140 | static const char *btns1[] = { "Ok", "" }; 141 | 142 | /* Create the message box as a child of the modal background */ 143 | mbox = lv_msgbox_create( obj, NULL ); 144 | lv_msgbox_add_btns( mbox, btns1 ); 145 | lv_msgbox_set_text( mbox, "Visit https://aws-iot-kit-docs.m5stack.com/en/\n first to start building IoT apps" ); 146 | lv_obj_align( mbox, NULL, LV_ALIGN_CENTER, 0, 0 ); 147 | lv_obj_set_event_cb( mbox, mbox_event_cb ); 148 | 149 | /* Fade the message box in with an animation */ 150 | lv_anim_t a; 151 | lv_anim_init( &a ); 152 | lv_anim_set_var( &a, obj ); 153 | lv_anim_set_time( &a, 500 ); 154 | lv_anim_set_values( &a, LV_OPA_TRANSP, LV_OPA_50 ); 155 | lv_anim_set_exec_cb( &a, ( lv_anim_exec_xcb_t )opa_anim ); 156 | lv_anim_start( &a ); 157 | } 158 | } 159 | 160 | static void wifi_scan_task( void *pvParameters ) 161 | { 162 | vTaskSuspend( NULL ); 163 | 164 | /*Add buttons to the list*/ 165 | lv_obj_t *list_btn; 166 | 167 | uint16_t number = DEFAULT_SCAN_LIST_SIZE; 168 | wifi_ap_record_t ap_info[ DEFAULT_SCAN_LIST_SIZE ]; 169 | uint16_t ap_count = 0; 170 | memset( ap_info, 0, sizeof( ap_info ) ); 171 | 172 | while( 1 ) 173 | { 174 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 175 | lv_list_clean( ( lv_obj_t * )pvParameters ); 176 | xSemaphoreGive( core2foraws_display_semaphore ); 177 | 178 | esp_wifi_scan_start( NULL, true ); 179 | ESP_ERROR_CHECK( esp_wifi_scan_get_ap_records( &number, ap_info ) ); 180 | ESP_ERROR_CHECK( esp_wifi_scan_get_ap_num( &ap_count ) ); 181 | 182 | ESP_LOGI( TAG, "Total APs scanned = %u", ap_count ); 183 | 184 | for ( int i = 0; ( i < DEFAULT_SCAN_LIST_SIZE ) && ( i < ap_count ); i++ ) 185 | { 186 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 187 | list_btn = lv_list_add_btn( ( lv_obj_t * )pvParameters, LV_SYMBOL_WIFI, ( char * )ap_info[ i ].ssid ); 188 | lv_obj_set_event_cb( list_btn, event_handler ); 189 | xSemaphoreGive( core2foraws_display_semaphore ); 190 | 191 | ESP_LOGI( TAG, "SSID \t\t%s", ap_info[ i ].ssid ); 192 | ESP_LOGI( TAG, "RSSI \t\t%d", ap_info[ i ].rssi ); 193 | ESP_LOGI( TAG, "Channel \t\t%d\n", ap_info[ i ].primary ); 194 | } 195 | vTaskSuspend( NULL ); 196 | } 197 | 198 | vTaskDelete( NULL ); // Should never get to here... 199 | } -------------------------------------------------------------------------------- /main/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * main.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "freertos/FreeRTOS.h" 32 | #include "freertos/task.h" 33 | #include "freertos/semphr.h" 34 | #include "freertos/queue.h" 35 | #include "freertos/event_groups.h" 36 | 37 | #include "esp_freertos_hooks.h" 38 | #include "esp_log.h" 39 | #include "esp_system.h" 40 | #include "esp_vfs_fat.h" 41 | #include "driver/gpio.h" 42 | #include "driver/spi_common.h" 43 | #include "sdmmc_cmd.h" 44 | #include "esp_wifi.h" 45 | #include "esp_event.h" 46 | #include "nvs_flash.h" 47 | 48 | #include "core2forAWS.h" 49 | 50 | #include "sound.h" 51 | #include "home.h" 52 | #include "wifi.h" 53 | #include "mpu.h" 54 | #include "mic.h" 55 | #include "clock.h" 56 | #include "power.h" 57 | #include "touch.h" 58 | #include "led_bar.h" 59 | #include "crypto.h" 60 | #include "cta.h" 61 | 62 | static const char *TAG = "MAIN"; 63 | 64 | static void ui_start(void); 65 | static void tab_event_cb(lv_obj_t *slider, lv_event_t event); 66 | 67 | static lv_obj_t *tab_view; 68 | TaskHandle_t FFT_handle, 69 | led_bar_animation_handle, 70 | led_bar_solid_handle, 71 | mic_handle, 72 | MPU_handle, 73 | touch_handle, 74 | wifi_handle; 75 | 76 | LV_IMG_DECLARE( powered_by_aws_logo ); 77 | 78 | void app_main( void ) 79 | { 80 | ESP_LOGI( TAG, "\n***************************************************\n M5Stack Core2 for AWS IoT Kit Factory Firmware\n***************************************************" ); 81 | 82 | esp_log_level_set( "gpio", ESP_LOG_NONE ); 83 | esp_log_level_set( "ILI9341", ESP_LOG_NONE ); 84 | 85 | core2foraws_init(); // Initializes the enabled hardware drivers and calls their respective initialization functions. 86 | 87 | ui_start(); // Starts all the sensor readings and shows them on the display using the LVGL library 88 | } 89 | 90 | static void ui_start( void ) 91 | { 92 | /* Displays the Powered by AWS logo */ 93 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes the core2foraws_display_semaphore mutex. This blocks any other task attempting to take it before it's free'd from executing. 94 | lv_obj_t *opener_scr = lv_scr_act(); // Create a new LVGL "screen". Screens can be though of as a window. 95 | lv_obj_t *aws_img_obj = lv_img_create( opener_scr, NULL ); // Creates an LVGL image object and assigns it as a child of the opener_scr parent screen. 96 | lv_img_set_src( aws_img_obj, &powered_by_aws_logo ); // Sets the image object with the image data from the powered_by_aws_logo file which contains hex pixel matrix of the image. 97 | lv_obj_align( aws_img_obj, NULL, LV_ALIGN_CENTER, 0, 0 ); // Aligns the image object to the center of the parent screen. 98 | lv_obj_set_style_local_bg_color( opener_scr, LV_OBJ_PART_MAIN, 0, LV_COLOR_WHITE ); // Sets the background color of the screen to white. 99 | xSemaphoreGive( core2foraws_display_semaphore ); // Frees the core2foraws_display_semaphore so that another task can use it. In this case, the higher priority guiTask will take it and then read the values to then display. 100 | 101 | /* 102 | You should release the core2foraws_display_semaphore semaphore before calling a blocking function like vTaskDelay because 103 | without doing so, no other task can access it that might need it. This includes the guiTask which 104 | writes the objects to the display itself over SPI. 105 | */ 106 | 107 | vTaskDelay( pdMS_TO_TICKS( 1500 ) ); // FreeRTOS scheduler block execution for 1.5 seconds to keep showing the Powered by AWS logo. 108 | 109 | xTaskCreatePinnedToCore( sound_task, "soundTask", 4096 * 2, NULL, 4, NULL, 1 ); 110 | 111 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); // Takes the core2foraws_display_semaphore mutex. This blocks any other task attempting to take it before it's free'd from executing. 112 | lv_obj_clean( opener_scr ); // Clear the aws_img_obj and remove from memory space. Currently no objects exist on the screen. 113 | lv_obj_t *core2forAWS_obj = lv_obj_create( NULL, NULL ); // Create an object to draw all with no parent 114 | lv_scr_load_anim( core2forAWS_obj, LV_SCR_LOAD_ANIM_MOVE_LEFT, 400, 0, false ); // Animates the loading of core2forAWS_obj as a slide into view from the left 115 | tab_view = lv_tabview_create( core2forAWS_obj, NULL ); // Creates the tab view to display different tabs with different hardware features 116 | lv_obj_set_event_cb( tab_view, tab_event_cb ); // Add a callback for whenever there is an event triggered on the tab_view object (e.g. a left-to-right swipe) 117 | lv_tabview_set_btns_pos( tab_view, LV_TABVIEW_TAB_POS_NONE ); // Hide the tab buttons so it looks like a clean screen 118 | 119 | xSemaphoreGive( core2foraws_display_semaphore ); // Frees the core2foraws_display_semaphore so that another task can use it. In this case, the higher priority guiTask will take it and then read the values to then display. 120 | 121 | /* 122 | Below creates all the display layers for the various peripheral tabs. Some of the tabs also starts the concurrent FreeRTOS tasks 123 | that read/write to the peripheral registers and displays the data from that peripheral. 124 | */ 125 | display_home_tab( tab_view ); 126 | display_clock_tab( tab_view, core2forAWS_obj ); 127 | display_mpu_tab( tab_view ); 128 | display_microphone_tab( tab_view ); 129 | display_LED_bar_tab( tab_view ); 130 | display_power_tab( tab_view, core2forAWS_obj ); 131 | display_touch_tab( tab_view ); 132 | display_crypto_tab( tab_view ); 133 | display_wifi_tab( tab_view ); 134 | display_cta_tab( tab_view ); 135 | } 136 | 137 | static void tab_event_cb( lv_obj_t *slider, lv_event_t event ) 138 | { 139 | if ( event == LV_EVENT_VALUE_CHANGED ) 140 | { 141 | lv_tabview_ext_t *ext = ( lv_tabview_ext_t * ) lv_obj_get_ext_attr( tab_view ); 142 | const char *tab_name = ext->tab_name_ptr[ lv_tabview_get_tab_act( tab_view ) ]; 143 | ESP_LOGI( TAG, "Current Active Tab: %s\n", tab_name ); 144 | 145 | vTaskSuspend( MPU_handle ); 146 | vTaskSuspend( mic_handle ); 147 | vTaskSuspend( FFT_handle ); 148 | vTaskSuspend( wifi_handle ); 149 | vTaskSuspend( touch_handle ); 150 | vTaskSuspend( led_bar_solid_handle ); 151 | vTaskResume( led_bar_animation_handle ); 152 | 153 | if ( strcmp( tab_name, CLOCK_TAB_NAME ) == 0 ) 154 | update_roller_time(); 155 | else if ( strcmp( tab_name, MPU_TAB_NAME ) == 0 ) 156 | vTaskResume( MPU_handle ); 157 | else if (strcmp( tab_name, MICROPHONE_TAB_NAME ) == 0 ) 158 | { 159 | vTaskResume( mic_handle ); 160 | vTaskResume( FFT_handle ); 161 | } 162 | else if ( strcmp( tab_name, LED_BAR_TAB_NAME ) == 0 ) 163 | { 164 | vTaskSuspend( led_bar_animation_handle ); 165 | vTaskResume( led_bar_solid_handle ); 166 | } 167 | else if ( strcmp( tab_name, TOUCH_TAB_NAME ) == 0 ) 168 | { 169 | reset_touch_bg(); 170 | vTaskResume( touch_handle ); 171 | } 172 | else if ( strcmp( tab_name, WIFI_TAB_NAME ) == 0 ) 173 | vTaskResume( wifi_handle ); 174 | } 175 | } -------------------------------------------------------------------------------- /main/touch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * touch.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | 27 | #include 28 | #include 29 | 30 | #include "freertos/FreeRTOS.h" 31 | #include "freertos/task.h" 32 | #include "freertos/semphr.h" 33 | 34 | #include "esp_log.h" 35 | 36 | #include "core2forAWS.h" 37 | 38 | #include "touch.h" 39 | 40 | TaskHandle_t touch_handle; 41 | 42 | static const char *TAG = TOUCH_TAB_NAME; 43 | 44 | // Should create a struct to pass pointers to events, but globals are easier to understand. 45 | static uint8_t r = 0, g = 70, b = 79; 46 | static lv_style_t bg_style; 47 | static lv_obj_t *touch_bg; 48 | static lv_obj_t *button_touch_label; 49 | 50 | static void touch_task( void *pvParameters ); 51 | 52 | void display_touch_tab( lv_obj_t *tv ) 53 | { 54 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 55 | 56 | lv_obj_t *touch_tab = lv_tabview_add_tab( tv, TOUCH_TAB_NAME ); 57 | 58 | /* Create the main body object and set background within the tab*/ 59 | touch_bg = lv_obj_create( touch_tab, NULL ); 60 | lv_obj_align( touch_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 61 | lv_obj_set_size( touch_bg, 290, 190 ); 62 | lv_obj_set_click( touch_bg, false ); 63 | lv_style_init( &bg_style ); 64 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( r, g, b ) ); 65 | lv_obj_add_style( touch_bg, LV_OBJ_PART_MAIN, &bg_style ); 66 | 67 | /* Create the title within the main body object */ 68 | static lv_style_t title_style; 69 | lv_style_init( &title_style ); 70 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 71 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 72 | lv_obj_t *tab_title_label = lv_label_create( touch_bg, NULL ); 73 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 74 | lv_label_set_static_text( tab_title_label, "FT6336U Capacitive Touch" ); 75 | lv_obj_align( tab_title_label, touch_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 76 | 77 | /* Create the sensor information label object */ 78 | lv_obj_t *body_label = lv_label_create( touch_bg, NULL ); 79 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK); 80 | lv_label_set_static_text( body_label, "The FT6336U is a capacitive touch panel controller that provides X and Y coordinates for touch input." 81 | "\n\n\n\nPress the touch buttons below." ); 82 | lv_obj_set_width( body_label, 252 ); 83 | lv_obj_align( body_label, touch_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 84 | 85 | static lv_style_t body_style; 86 | lv_style_init( &body_style ); 87 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 88 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 89 | 90 | button_touch_label = lv_label_create( touch_bg, NULL ); 91 | lv_label_set_text( button_touch_label, "No button tapped" ); 92 | lv_label_set_align( button_touch_label, LV_LABEL_ALIGN_CENTER ); 93 | lv_obj_align( button_touch_label, touch_bg, LV_ALIGN_CENTER, 0, 44 ); 94 | 95 | /*Create an array for the points of the line*/ 96 | static lv_point_t line_points[] = { {20, 0}, {70, 0} }; 97 | 98 | /*Create style*/ 99 | static lv_style_t red_line_style; 100 | lv_style_init( &red_line_style ); 101 | lv_style_set_line_width( &red_line_style, LV_STATE_DEFAULT, 6 ); 102 | lv_style_set_line_color( &red_line_style, LV_STATE_DEFAULT, LV_COLOR_RED ); 103 | lv_style_set_line_rounded( &red_line_style, LV_STATE_DEFAULT, true ); 104 | 105 | static lv_style_t green_line_style; 106 | lv_style_init( &green_line_style ); 107 | lv_style_set_line_width( &green_line_style, LV_STATE_DEFAULT, 6 ); 108 | lv_style_set_line_color( &green_line_style, LV_STATE_DEFAULT, LV_COLOR_GREEN ); 109 | lv_style_set_line_rounded( &green_line_style, LV_STATE_DEFAULT, true ); 110 | 111 | static lv_style_t blue_line_style; 112 | lv_style_init( &blue_line_style ); 113 | lv_style_set_line_width( &blue_line_style, LV_STATE_DEFAULT, 6 ); 114 | lv_style_set_line_color( &blue_line_style, LV_STATE_DEFAULT, LV_COLOR_BLUE ); 115 | lv_style_set_line_rounded( &blue_line_style, LV_STATE_DEFAULT, true ); 116 | 117 | /*Create a line and apply the new style*/ 118 | lv_obj_t *left_line = lv_line_create( touch_tab, NULL ); 119 | lv_line_set_points( left_line, line_points, 2 ); 120 | lv_obj_add_style( left_line, LV_LINE_PART_MAIN, &red_line_style ); 121 | lv_obj_align( left_line, NULL, LV_ALIGN_IN_LEFT_MID, 8, 108 ); 122 | 123 | lv_obj_t *middle_line = lv_line_create( touch_tab, NULL ); 124 | lv_line_set_points( middle_line, line_points, 2 ); 125 | lv_obj_add_style( middle_line, LV_LINE_PART_MAIN, &green_line_style ); 126 | lv_obj_align( middle_line, NULL, LV_ALIGN_CENTER, -12, 108 ); 127 | 128 | lv_obj_t *right_line = lv_line_create( touch_tab, NULL ); 129 | lv_line_set_points( right_line, line_points, 2 ); 130 | lv_obj_add_style( right_line, LV_LINE_PART_MAIN, &blue_line_style ); 131 | lv_obj_align( right_line, NULL, LV_ALIGN_IN_RIGHT_MID, -30, 108 ); 132 | 133 | xSemaphoreGive( core2foraws_display_semaphore ); 134 | 135 | xTaskCreatePinnedToCore( touch_task, "touchTask", configMINIMAL_STACK_SIZE * 3, NULL, 1, &touch_handle, 1 ); 136 | } 137 | 138 | void reset_touch_bg() 139 | { 140 | r=0x00, g=0x00, b=0x00; 141 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( r, g, b ) ); 142 | lv_obj_add_style( touch_bg, LV_OBJ_PART_MAIN, &bg_style ); 143 | } 144 | 145 | static void touch_task( void *pvParameters ) 146 | { 147 | 148 | vTaskSuspend( NULL ); 149 | 150 | for( ; ; ) 151 | { 152 | bool button_event = false; 153 | core2foraws_button_tapped( BUTTON_LEFT, &button_event ); 154 | if ( button_event ) 155 | { 156 | ESP_LOGI( TAG, "Left button was tapped" ); 157 | r += 0x10; 158 | 159 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 160 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( r, g, b ) ); 161 | lv_obj_add_style( touch_bg, LV_OBJ_PART_MAIN, &bg_style ); 162 | 163 | lv_label_set_text( button_touch_label, "Left button" ); 164 | xSemaphoreGive( core2foraws_display_semaphore ); 165 | } 166 | 167 | core2foraws_button_tapped( BUTTON_MIDDLE, &button_event ); 168 | if ( button_event ) 169 | { 170 | ESP_LOGI( TAG, "Middle button was tapped" ); 171 | g += 0x10; 172 | 173 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 174 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( r, g, b ) ); 175 | lv_obj_add_style( touch_bg, LV_OBJ_PART_MAIN, &bg_style ); 176 | 177 | lv_label_set_text( button_touch_label, "Middle button" ); 178 | xSemaphoreGive( core2foraws_display_semaphore ); 179 | } 180 | 181 | core2foraws_button_tapped( BUTTON_RIGHT, &button_event ); 182 | if ( button_event ) 183 | { 184 | ESP_LOGI( TAG, "Right button was tapped" ); 185 | b += 0x10; 186 | 187 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 188 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( r, g, b ) ); 189 | lv_obj_add_style( touch_bg, LV_OBJ_PART_MAIN, &bg_style ); 190 | 191 | lv_label_set_text( button_touch_label, "Right button" ); 192 | xSemaphoreGive( core2foraws_display_semaphore ); 193 | } 194 | 195 | vTaskDelay( pdMS_TO_TICKS( 30) ); 196 | } 197 | 198 | vTaskDelete( NULL ); // Should never get to here... 199 | } -------------------------------------------------------------------------------- /main/power.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * power.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "freertos/FreeRTOS.h" 30 | #include "freertos/task.h" 31 | #include "freertos/semphr.h" 32 | 33 | #include "esp_log.h" 34 | 35 | #include "core2forAWS.h" 36 | 37 | #include "power.h" 38 | 39 | static void led_event_handler( lv_obj_t *obj, lv_event_t event ); 40 | static void vibration_event_handler( lv_obj_t *obj, lv_event_t event ); 41 | static void brightness_event_handler( lv_obj_t *slider, lv_event_t event ); 42 | 43 | static const char *TAG = POWER_TAB_NAME; 44 | 45 | lv_obj_t *power_tab; 46 | TaskHandle_t power_handle; 47 | 48 | void display_power_tab( lv_obj_t *tv, lv_obj_t *core2forAWS_screen_obj ) 49 | { 50 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 51 | 52 | power_tab = lv_tabview_add_tab( tv, POWER_TAB_NAME ); // Create a LVGL tabview 53 | 54 | /* Create the main body object and set background within the tab*/ 55 | static lv_style_t bg_style; 56 | lv_obj_t *power_bg = lv_obj_create( power_tab, NULL ); 57 | lv_obj_align( power_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 58 | lv_obj_set_size( power_bg, 290, 190 ); 59 | lv_obj_set_click( power_bg, false ); 60 | lv_style_init( &bg_style ); 61 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 255, 97, 56 ) ); 62 | lv_obj_add_style( power_bg, LV_OBJ_PART_MAIN, &bg_style ); 63 | 64 | /* Create the title within the main body object */ 65 | static lv_style_t title_style; 66 | lv_style_init( &title_style ); 67 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 68 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 69 | lv_obj_t *tab_title_label = lv_label_create( power_bg, NULL ); 70 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 71 | lv_label_set_static_text( tab_title_label, "AXP192 Power Mgmt" ); 72 | lv_obj_align( tab_title_label, power_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 73 | 74 | /* Create the sensor information label object */ 75 | lv_obj_t *body_label = lv_label_create( power_bg, NULL ); 76 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 77 | lv_label_set_static_text( body_label, "The AXP192 provides power management for the battery and on-board peripherals.\n\nTap to toggle:" ); 78 | lv_obj_set_width( body_label, 252 ); 79 | lv_obj_align( body_label, power_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 80 | 81 | static lv_style_t body_style; 82 | lv_style_init( &body_style ); 83 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 84 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 85 | 86 | /* Create the sensor information label object */ 87 | static lv_style_t btn_style; 88 | lv_style_init( &btn_style ); 89 | lv_style_set_pad_top( &btn_style, LV_STATE_DEFAULT, 10 ); 90 | lv_style_set_pad_bottom( &btn_style, LV_STATE_DEFAULT, 10 ); 91 | lv_style_set_pad_left( &btn_style, LV_STATE_DEFAULT, 12 ); 92 | lv_style_set_pad_right( &btn_style, LV_STATE_DEFAULT, 12 ); 93 | 94 | lv_obj_t *pwr_led_btn = lv_btn_create( power_bg, NULL ); 95 | lv_obj_set_event_cb( pwr_led_btn, led_event_handler ); 96 | lv_obj_set_size( pwr_led_btn, 76, 38 ); 97 | lv_obj_align( pwr_led_btn, power_bg, LV_ALIGN_IN_BOTTOM_LEFT, 20, -14 ); 98 | lv_btn_set_checkable( pwr_led_btn, true ); 99 | lv_btn_toggle( pwr_led_btn ); 100 | lv_btn_set_state( pwr_led_btn, LV_BTN_STATE_CHECKED_PRESSED ); 101 | 102 | lv_obj_t *led_label = lv_label_create( pwr_led_btn, NULL ); 103 | lv_label_set_static_text( led_label, "LED" ); 104 | 105 | lv_obj_t *vibr_btn = lv_btn_create( power_bg, pwr_led_btn ); 106 | lv_obj_set_event_cb( vibr_btn, vibration_event_handler ); 107 | lv_obj_align( vibr_btn, power_bg, LV_ALIGN_IN_BOTTOM_MID, 0, -14 ); 108 | 109 | lv_obj_t *vibr_label = lv_label_create( vibr_btn, NULL ); 110 | lv_label_set_static_text( vibr_label, "Motor" ); 111 | 112 | lv_obj_t *scrn_btn = lv_btn_create( power_bg, pwr_led_btn ); 113 | lv_obj_set_event_cb( scrn_btn, brightness_event_handler ); 114 | lv_obj_align( scrn_btn, power_bg, LV_ALIGN_IN_BOTTOM_RIGHT, -20, -14 ); 115 | lv_btn_set_state( scrn_btn, LV_BTN_STATE_CHECKED_PRESSED ); 116 | 117 | lv_obj_t *brightness_label = lv_label_create( scrn_btn, NULL ); 118 | lv_label_set_static_text( brightness_label, "Screen" ); 119 | 120 | xSemaphoreGive( core2foraws_display_semaphore ); 121 | 122 | xTaskCreatePinnedToCore( battery_task, "batteryTask", configMINIMAL_STACK_SIZE * 2, ( void * ) core2forAWS_screen_obj, 0, &power_handle, 1 ); 123 | } 124 | 125 | static void brightness_event_handler( lv_obj_t *obj, lv_event_t event ) 126 | { 127 | if ( event == LV_EVENT_VALUE_CHANGED ) 128 | { 129 | uint8_t value = lv_btn_get_state( obj ); 130 | 131 | if ( value == 0 ) 132 | core2foraws_power_backlight_set( DISPLAY_BACKLIGHT_START / 2 ); 133 | else 134 | core2foraws_power_backlight_set( DISPLAY_BACKLIGHT_START ); 135 | 136 | ESP_LOGI( TAG, "Screen brightness: %x", value ); 137 | } 138 | } 139 | 140 | static void led_event_handler( lv_obj_t *obj, lv_event_t event ) 141 | { 142 | if ( event == LV_EVENT_VALUE_CHANGED ) 143 | { 144 | uint8_t value = lv_btn_get_state( obj ); 145 | 146 | core2foraws_power_led_enable( value ); 147 | ESP_LOGI( TAG, "LED state: %x", value ); 148 | } 149 | } 150 | 151 | static void vibration_event_handler( lv_obj_t *obj, lv_event_t event ) 152 | { 153 | if ( event == LV_EVENT_VALUE_CHANGED ) 154 | { 155 | uint8_t value = lv_btn_get_state( obj ); 156 | 157 | if ( value == 0 ) 158 | core2foraws_power_vibration_enable( 0 ); 159 | else 160 | core2foraws_power_vibration_enable( 60 ); 161 | 162 | ESP_LOGI( TAG, "Vibration motor state: %x", value ); 163 | } 164 | } 165 | 166 | void battery_task( void *pvParameters ) 167 | { 168 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 169 | lv_obj_t *battery_label = lv_label_create( ( lv_obj_t * )pvParameters, NULL ); 170 | lv_label_set_text( battery_label, LV_SYMBOL_BATTERY_FULL ); 171 | lv_label_set_recolor( battery_label, true ); 172 | lv_label_set_align( battery_label, LV_LABEL_ALIGN_CENTER ); 173 | lv_obj_align( battery_label, ( lv_obj_t * )pvParameters, LV_ALIGN_IN_TOP_RIGHT, -20, 10 ); 174 | lv_obj_t *charge_label = lv_label_create( battery_label, NULL ); 175 | lv_label_set_recolor( charge_label, true ); 176 | lv_label_set_text( charge_label, "" ); 177 | lv_obj_align( charge_label, battery_label, LV_ALIGN_CENTER, -4, 0 ); 178 | xSemaphoreGive( core2foraws_display_semaphore ); 179 | 180 | for( ; ; ) 181 | { 182 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 183 | float battery_voltage; 184 | core2foraws_power_batt_volts_get( &battery_voltage ); 185 | if (battery_voltage >= 4.100) 186 | { 187 | lv_label_set_text(battery_label, "#0ab300 " LV_SYMBOL_BATTERY_FULL "#"); 188 | } 189 | else if ( battery_voltage >= 3.95) 190 | { 191 | lv_label_set_text(battery_label, "#0ab300 " LV_SYMBOL_BATTERY_3 "#"); 192 | } 193 | else if ( battery_voltage >= 3.80) 194 | { 195 | lv_label_set_text(battery_label, "#ff9900 " LV_SYMBOL_BATTERY_2 "#"); 196 | } 197 | else if ( battery_voltage >= 3.25) 198 | { 199 | lv_label_set_text(battery_label, "#ff0000 " LV_SYMBOL_BATTERY_1 "#"); 200 | } 201 | else 202 | { 203 | lv_label_set_text(battery_label, "#ff0000 " LV_SYMBOL_BATTERY_EMPTY "#"); 204 | } 205 | 206 | bool charging; 207 | core2foraws_power_plugged_get( &charging ); 208 | if ( charging ) 209 | { 210 | lv_label_set_text( charge_label, "#0000cc " LV_SYMBOL_CHARGE "#" ); 211 | } 212 | else 213 | { 214 | lv_label_set_text( charge_label, "" ); 215 | } 216 | xSemaphoreGive( core2foraws_display_semaphore ); 217 | vTaskDelay( pdMS_TO_TICKS( 200 ) ); 218 | } 219 | 220 | vTaskDelete( NULL ); // Should never get to here... 221 | } -------------------------------------------------------------------------------- /main/clock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * clock.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "freertos/task.h" 33 | #include "freertos/semphr.h" 34 | #include "esp_log.h" 35 | 36 | #include "core2forAWS.h" 37 | #include "clock.h" 38 | 39 | static const char *TAG = CLOCK_TAB_NAME; 40 | 41 | lv_obj_t *clock_tab; 42 | 43 | static lv_obj_t *hour_roller; 44 | static lv_obj_t *minute_roller; 45 | 46 | static void hour_event_handler( lv_obj_t *obj, lv_event_t event ) 47 | { 48 | if ( event == LV_EVENT_VALUE_CHANGED ) 49 | { 50 | int hour = lv_roller_get_selected( obj ); 51 | 52 | struct tm current_time; 53 | core2foraws_rtc_time_get( ¤t_time ); 54 | current_time.tm_hour = hour; 55 | core2foraws_rtc_time_set( current_time ); 56 | } 57 | } 58 | 59 | static void minute_event_handler( lv_obj_t *obj, lv_event_t event ) 60 | { 61 | if ( event == LV_EVENT_VALUE_CHANGED ) 62 | { 63 | int minute = lv_roller_get_selected(obj); 64 | 65 | struct tm current_time; 66 | core2foraws_rtc_time_get( ¤t_time ); 67 | current_time.tm_min = minute; 68 | core2foraws_rtc_time_set( current_time ); 69 | } 70 | } 71 | 72 | void update_roller_time() 73 | { 74 | struct tm current_time; 75 | core2foraws_rtc_time_get( ¤t_time ); 76 | 77 | lv_roller_set_selected( hour_roller, current_time.tm_hour, LV_ANIM_OFF ); 78 | lv_roller_set_selected( minute_roller, current_time.tm_min, LV_ANIM_OFF ); 79 | 80 | ESP_LOGI( TAG, "Current Date: %d-%02d-%02d Time: %02d:%02d:%02d", 81 | current_time.tm_year, current_time.tm_mon, current_time.tm_mday, current_time.tm_hour, current_time.tm_min, current_time.tm_sec ); 82 | } 83 | 84 | /* 85 | Counts the number of digits using binary search. Not as elegant as recursive, but it's much faster. 86 | */ 87 | static uint16_t count_bsearch( int i ) 88 | { 89 | if ( i < 0 ) 90 | { 91 | if ( i == INT_MIN ) 92 | return 10; // special case for -2^31 because 2^31 can't fit in a two's complement 32-bit integer 93 | i = -i; 94 | } 95 | if ( i < 100000 ) 96 | { 97 | if ( i < 1000 ) 98 | { 99 | if ( i < 10 ) return 1; 100 | else if ( i < 100 ) return 2; 101 | else return 3; 102 | } 103 | else 104 | { 105 | if (i < 10000) return 4; 106 | else return 5; 107 | } 108 | } 109 | else 110 | { 111 | if ( i < 10000000 ) 112 | { 113 | if ( i < 1000000 ) return 6; 114 | else return 7; 115 | } 116 | else 117 | { 118 | if ( i < 100000000 ) return 8; 119 | else if ( i < 1000000000 ) return 9; 120 | else return 10; 121 | } 122 | } 123 | } 124 | 125 | static char *generate_roller_str( int number ) 126 | { 127 | uint16_t temp_number = number; 128 | const uint16_t last_number = number - 1; 129 | const uint16_t last_number_digits = count_bsearch( last_number ); 130 | size_t roller_str_len = 0; 131 | 132 | for( int i = last_number_digits - 1; i >= 0; i-- ) 133 | { 134 | size_t number_cutoff = pow( 10, i ) - 1; 135 | roller_str_len += ( i + 2 ) *( temp_number - number_cutoff ); 136 | temp_number = number_cutoff; 137 | } 138 | roller_str_len--; 139 | 140 | char *roller_str = heap_caps_malloc( roller_str_len, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM ); 141 | roller_str[ 0 ] = '\0'; 142 | for( int i = 0; i < number; i++ ) 143 | { 144 | size_t i_size = count_bsearch( i ) + 2; 145 | char message[ i_size ]; 146 | snprintf( message, i_size, "%d\n", i ); 147 | strncat( roller_str, message, roller_str_len - strlen( roller_str ) - 1 ); 148 | } 149 | return roller_str; 150 | } 151 | 152 | void display_clock_tab( lv_obj_t*tv, lv_obj_t *core2forAWS_screen_obj ) 153 | { 154 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 155 | clock_tab = lv_tabview_add_tab( tv, CLOCK_TAB_NAME ); // Create a LVGL tabview 156 | 157 | /* Create the main body object and set background within the tab */ 158 | static lv_style_t bg_style; 159 | lv_obj_t *clock_bg = lv_obj_create( clock_tab, NULL ); 160 | lv_obj_align( clock_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 161 | lv_obj_set_size( clock_bg, 290, 190 ); 162 | lv_obj_set_click( clock_bg, false ); 163 | lv_style_init( &bg_style ); 164 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 254, 230, 0 ) ); 165 | lv_obj_add_style( clock_bg, LV_OBJ_PART_MAIN, &bg_style ); 166 | 167 | /* Create the title within the main body object */ 168 | static lv_style_t title_style; 169 | lv_style_init( &title_style ); 170 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 171 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 172 | lv_obj_t *tab_title_label = lv_label_create( clock_bg, NULL ); 173 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 174 | lv_label_set_static_text( tab_title_label, "BM8563 Real-time Clock" ); 175 | lv_obj_align( tab_title_label, clock_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 176 | 177 | /* Create the sensor information label object */ 178 | lv_obj_t *body_label = lv_label_create( clock_bg, NULL ); 179 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 180 | lv_label_set_static_text( body_label, "The BM8563 is an accurate, low power real-time clock. ▲" ); 181 | lv_obj_set_width( body_label, 252 ); 182 | lv_obj_align( body_label, clock_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 183 | 184 | static lv_style_t body_style; 185 | lv_style_init( &body_style ); 186 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 187 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 188 | 189 | char *hours_str = generate_roller_str( 24 ); 190 | hour_roller = lv_roller_create( clock_bg, NULL ); 191 | lv_roller_set_options( hour_roller, hours_str, LV_ROLLER_MODE_NORMAL ); 192 | lv_roller_set_visible_row_count( hour_roller, 2 ); 193 | lv_roller_set_auto_fit( hour_roller, false ); 194 | lv_obj_set_width( hour_roller, 60 ); 195 | lv_obj_align( hour_roller, clock_bg, LV_ALIGN_IN_BOTTOM_MID, -40, -20 ); 196 | heap_caps_free( hours_str ); 197 | 198 | lv_obj_t *separator_label = lv_label_create( clock_bg, NULL ); 199 | lv_label_set_static_text( separator_label, ":" ); 200 | lv_obj_set_width( separator_label, 4 ); 201 | lv_obj_align( separator_label, clock_bg, LV_ALIGN_IN_BOTTOM_MID, 0, -50 ); 202 | 203 | char *minutes_str = generate_roller_str( 60 ); 204 | minute_roller = lv_roller_create( clock_bg, hour_roller ); 205 | lv_roller_set_options( minute_roller, minutes_str, LV_ROLLER_MODE_NORMAL ); 206 | lv_obj_align( minute_roller, clock_bg, LV_ALIGN_IN_BOTTOM_MID, 40, -20 ); 207 | heap_caps_free( minutes_str ); 208 | 209 | lv_obj_set_event_cb( hour_roller, hour_event_handler ); 210 | lv_obj_set_event_cb( minute_roller, minute_event_handler ); 211 | xSemaphoreGive( core2foraws_display_semaphore ); 212 | 213 | xTaskCreatePinnedToCore(clock_task, "clockTask", configMINIMAL_STACK_SIZE *3, (void*) core2forAWS_screen_obj, 0, &clock_handle, 1); 214 | } 215 | 216 | void clock_task(void *pvParameters) 217 | { 218 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 219 | lv_obj_t *time_label = lv_label_create((lv_obj_t*)pvParameters, NULL ); 220 | lv_label_set_text(time_label, "00:00:00 AM"); 221 | lv_label_set_align(time_label, LV_LABEL_ALIGN_CENTER); 222 | lv_obj_align(time_label, NULL, LV_ALIGN_IN_TOP_MID, 4, 10); 223 | xSemaphoreGive( core2foraws_display_semaphore ); 224 | 225 | for( ; ; ) 226 | { 227 | struct tm current_time; 228 | core2foraws_rtc_time_get( ¤t_time ); 229 | char clock_buf[ 26 ]; 230 | strftime( clock_buf, 26, "%I:%M:%S %p", ¤t_time ); 231 | xSemaphoreTake( core2foraws_display_semaphore, portMAX_DELAY ); 232 | lv_label_set_text( time_label, clock_buf ); 233 | xSemaphoreGive( core2foraws_display_semaphore ); 234 | vTaskDelay( pdMS_TO_TICKS( 1000 ) ); 235 | } 236 | vTaskDelete( NULL ); // Should never get to here... 237 | } -------------------------------------------------------------------------------- /main/led_bar.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * Factory Firmware v2.3.0 4 | * led_bar.c 5 | * 6 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "freertos/FreeRTOS.h" 30 | #include "freertos/task.h" 31 | #include "freertos/semphr.h" 32 | 33 | #include "esp_log.h" 34 | 35 | #include "core2forAWS.h" 36 | #include "led_bar.h" 37 | 38 | #define RED_AMAZON_ORANGE 255 39 | #define GREEN_AMAZON_ORANGE 153 40 | #define BLUE_AMAZON_ORANGE 0 41 | #define AMAZON_ORANGE 16750848 // Amazon Orange in Decimal 42 | 43 | static xSemaphoreHandle color_lock; 44 | 45 | static uint8_t red = RED_AMAZON_ORANGE, green = GREEN_AMAZON_ORANGE, blue = BLUE_AMAZON_ORANGE; 46 | 47 | static const char* TAG = LED_BAR_TAB_NAME; 48 | 49 | static void red_event_handler(lv_obj_t *slider, lv_event_t event); 50 | static void green_event_handler(lv_obj_t *slider, lv_event_t event); 51 | static void blue_event_handler(lv_obj_t *slider, lv_event_t event); 52 | 53 | void display_LED_bar_tab(lv_obj_t *tv) 54 | { 55 | color_lock = xSemaphoreCreateMutex(); 56 | 57 | xSemaphoreTake( core2foraws_display_semaphore, pdMS_TO_TICKS( 30 ) ); 58 | 59 | lv_obj_t *led_bar_tab = lv_tabview_add_tab(tv, LED_BAR_TAB_NAME); 60 | 61 | /* Create the main body object and set background within the tab*/ 62 | lv_obj_t *led_bar_bg = lv_obj_create(led_bar_tab, NULL ); 63 | lv_obj_align( led_bar_bg, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 36 ); 64 | lv_obj_set_size( led_bar_bg, 290, 190 ); 65 | lv_obj_set_click( led_bar_bg, false ); 66 | 67 | /* Create the main body object and set background within the tab*/ 68 | static lv_style_t bg_style; 69 | lv_style_init( &bg_style ); 70 | lv_style_set_bg_color( &bg_style, LV_STATE_DEFAULT, lv_color_make( 236, 216, 218 ) ); 71 | lv_obj_add_style( led_bar_bg, LV_OBJ_PART_MAIN, &bg_style ); 72 | 73 | /* Create the title within the main body object */ 74 | static lv_style_t title_style; 75 | lv_style_init( &title_style ); 76 | lv_style_set_text_font( &title_style, LV_STATE_DEFAULT, LV_THEME_DEFAULT_FONT_TITLE ); 77 | lv_style_set_text_color( &title_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 78 | lv_obj_t *tab_title_label = lv_label_create( led_bar_bg, NULL ); 79 | lv_obj_add_style( tab_title_label, LV_OBJ_PART_MAIN, &title_style ); 80 | lv_label_set_static_text( tab_title_label, "SK6812 LED Bars" ); 81 | lv_obj_align( tab_title_label, led_bar_bg, LV_ALIGN_IN_TOP_MID, 0, 10 ); 82 | 83 | /* Create the sensor information label object */ 84 | lv_obj_t *body_label = lv_label_create( led_bar_bg, NULL ); 85 | lv_label_set_long_mode( body_label, LV_LABEL_LONG_BREAK ); 86 | lv_label_set_static_text( body_label, "The ten SK6812s allow you to control each of the RGB LEDs brightness & color individually." ); 87 | lv_obj_set_width( body_label, 252 ); 88 | lv_obj_align( body_label, led_bar_bg, LV_ALIGN_IN_TOP_LEFT, 20, 40 ); 89 | 90 | static lv_style_t body_style; 91 | lv_style_init( &body_style ); 92 | lv_style_set_text_color( &body_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 93 | lv_obj_add_style( body_label, LV_OBJ_PART_MAIN, &body_style ); 94 | 95 | lv_obj_t *instruction_label = lv_label_create( led_bar_bg, NULL ); 96 | lv_label_set_static_text( instruction_label, "Tap or hold to change color:" ); 97 | lv_obj_align( instruction_label, body_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10 ); 98 | lv_obj_add_style( instruction_label, LV_OBJ_PART_MAIN, &body_style ); 99 | 100 | 101 | lv_obj_t *red_label = lv_label_create(led_bar_bg, NULL ); 102 | lv_label_set_static_text( red_label, "Red" ); 103 | lv_obj_align( red_label, led_bar_bg, LV_ALIGN_IN_BOTTOM_LEFT, 20, -4 ); 104 | 105 | static lv_style_t red_lmeter_style; 106 | lv_style_init( &red_lmeter_style ); 107 | lv_style_set_line_color( &red_lmeter_style, LV_STATE_DEFAULT, LV_COLOR_BLACK ); 108 | lv_style_set_scale_grad_color( &red_lmeter_style, LV_STATE_DEFAULT, LV_COLOR_RED ); 109 | lv_style_set_border_opa( &red_lmeter_style, LV_STATE_DEFAULT, LV_OPA_TRANSP ); 110 | lv_style_set_bg_opa( &red_lmeter_style, LV_STATE_DEFAULT, LV_OPA_TRANSP ); 111 | lv_style_set_scale_end_color( &red_lmeter_style, LV_STATE_DEFAULT, LV_COLOR_WHITE ); 112 | 113 | lv_obj_t *red_lmeter = lv_linemeter_create( led_bar_bg, NULL ); 114 | lv_linemeter_set_range( red_lmeter, 0, 255 ); /*Set the range*/ 115 | lv_linemeter_set_value( red_lmeter, RED_AMAZON_ORANGE); /*Set the current value*/ 116 | lv_linemeter_set_scale( red_lmeter, 240, 41); /*Set the angle and number of lines*/ 117 | lv_obj_add_style( red_lmeter, LV_LINEMETER_PART_MAIN, &red_lmeter_style); 118 | lv_obj_set_size( red_lmeter, 70, 70); 119 | lv_obj_align( red_lmeter, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, -4); 120 | lv_obj_set_event_cb( red_lmeter, red_event_handler); 121 | 122 | lv_obj_t *green_label = lv_label_create( led_bar_bg, NULL ); 123 | lv_label_set_static_text( green_label, "Green" ); 124 | lv_obj_align( green_label, led_bar_bg, LV_ALIGN_IN_BOTTOM_MID, 0, -8 ); 125 | 126 | static lv_style_t green_lmeter_style; 127 | lv_style_init( &green_lmeter_style ); 128 | lv_style_set_scale_grad_color( &green_lmeter_style, LV_STATE_DEFAULT, LV_COLOR_GREEN ); 129 | 130 | lv_obj_t *green_lmeter = lv_linemeter_create( led_bar_bg, red_lmeter ); 131 | lv_obj_add_style( green_lmeter, LV_LINEMETER_PART_MAIN, &green_lmeter_style ); 132 | lv_obj_set_event_cb( green_lmeter, green_event_handler ); 133 | lv_obj_align( green_lmeter, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -4 ); 134 | lv_linemeter_set_value( green_lmeter, GREEN_AMAZON_ORANGE ); /*Set the current value*/ 135 | 136 | lv_obj_t *blue_label = lv_label_create( led_bar_bg, NULL ); 137 | lv_label_set_static_text( blue_label, "Blue" ); 138 | lv_obj_align( blue_label, led_bar_bg, LV_ALIGN_IN_BOTTOM_RIGHT, -20, -4 ); 139 | 140 | static lv_style_t blue_lmeter_style; 141 | lv_style_init( &blue_lmeter_style ); 142 | lv_style_set_scale_grad_color( &blue_lmeter_style, LV_STATE_DEFAULT, LV_COLOR_BLUE ); 143 | 144 | lv_obj_t *blue_lmeter = lv_linemeter_create( led_bar_bg, red_lmeter ); 145 | lv_obj_add_style( blue_lmeter, LV_LINEMETER_PART_MAIN, &blue_lmeter_style ); 146 | lv_obj_set_event_cb( blue_lmeter, blue_event_handler ); 147 | lv_obj_align( blue_lmeter, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, -4 ); 148 | lv_linemeter_set_value( blue_lmeter, BLUE_AMAZON_ORANGE ); /*Set the current value*/ 149 | 150 | xSemaphoreGive( core2foraws_display_semaphore ); 151 | 152 | xTaskCreatePinnedToCore( sk6812_animation_task, "sk6812AnimationTask", configMINIMAL_STACK_SIZE * 3, NULL, 1, &led_bar_animation_handle, 1 ); 153 | xTaskCreatePinnedToCore( sk6812_solid_task, "sk6812SolidTask", configMINIMAL_STACK_SIZE * 3, NULL, 0, &led_bar_solid_handle, 1 ); 154 | 155 | } 156 | 157 | void update_color() 158 | { 159 | xSemaphoreTake( color_lock, pdMS_TO_TICKS( 10 ) ); 160 | uint8_t current_red = red, current_green = green, current_blue = blue; 161 | xSemaphoreGive( color_lock ); 162 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_LEFT, ( current_red << 16 ) + ( current_green << 8 ) + ( current_blue ) ); 163 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_RIGHT, ( current_red << 16 ) + ( current_green << 8 ) + ( current_blue ) ); 164 | core2foraws_rgb_led_write(); 165 | } 166 | 167 | static void red_event_handler( lv_obj_t *lmeter, lv_event_t e ) 168 | { 169 | xSemaphoreTake( color_lock, pdMS_TO_TICKS( 10 ) ); 170 | red = ( uint8_t )lv_linemeter_get_value( lmeter ); 171 | if ( e == LV_EVENT_SHORT_CLICKED ) 172 | { 173 | red += 10; 174 | } 175 | else if ( e == LV_EVENT_LONG_PRESSED_REPEAT ) 176 | { 177 | red +=30; 178 | } 179 | lv_linemeter_set_value( lmeter, red ); 180 | xSemaphoreGive( color_lock ); 181 | } 182 | 183 | static void green_event_handler( lv_obj_t *lmeter, lv_event_t e ) 184 | { 185 | xSemaphoreTake( color_lock, pdMS_TO_TICKS( 10 ) ); 186 | green = ( uint8_t )lv_linemeter_get_value( lmeter ); 187 | if ( e == LV_EVENT_SHORT_CLICKED ) 188 | { 189 | green += 10; 190 | } 191 | else if ( e == LV_EVENT_LONG_PRESSED_REPEAT ) 192 | { 193 | green +=30; 194 | } 195 | lv_linemeter_set_value( lmeter, green ); 196 | xSemaphoreGive( color_lock ); 197 | } 198 | 199 | static void blue_event_handler( lv_obj_t *lmeter, lv_event_t e ) 200 | { 201 | xSemaphoreTake( color_lock, pdMS_TO_TICKS( 10 ) ); 202 | blue = ( uint8_t )lv_linemeter_get_value( lmeter ); 203 | if ( e == LV_EVENT_SHORT_CLICKED ) 204 | { 205 | blue += 10; 206 | } 207 | else if ( e == LV_EVENT_LONG_PRESSED_REPEAT ) 208 | { 209 | blue +=30; 210 | } 211 | lv_linemeter_set_value( lmeter, blue ); 212 | xSemaphoreGive( color_lock ); 213 | } 214 | 215 | void sk6812_solid_task( void *pvParameters ) 216 | { 217 | vTaskSuspend( NULL ); 218 | xSemaphoreTake( color_lock, pdMS_TO_TICKS( 10 ) ); 219 | uint8_t current_red = red, current_green = green, current_blue = blue; 220 | xSemaphoreGive( color_lock ); 221 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_LEFT, ( current_red << 16 ) + ( current_green << 8 ) + ( current_blue ) ); 222 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_RIGHT, ( current_red << 16 ) + ( current_green << 8 ) + ( current_blue ) ); 223 | core2foraws_rgb_led_write(); 224 | 225 | while( 1 ) 226 | { 227 | if ( ( current_red != red ) || ( current_green != green ) || ( current_blue != blue ) ) 228 | { 229 | xSemaphoreTake( color_lock, pdMS_TO_TICKS( 10 ) ); 230 | current_red = red, current_green = green, current_blue = blue; 231 | xSemaphoreGive( color_lock ); 232 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_LEFT, ( current_red << 16 ) + ( current_green << 8 ) + ( current_blue ) ); 233 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_RIGHT, ( current_red << 16 ) + ( current_green << 8 ) + ( current_blue ) ); 234 | core2foraws_rgb_led_write(); 235 | ESP_LOGI( TAG, "Color changed to #%.2x%.2x%.2x", current_red, current_green, current_blue ); 236 | } 237 | vTaskDelay( pdMS_TO_TICKS( 10 ) ); 238 | }; 239 | 240 | vTaskDelete( NULL ); 241 | } 242 | 243 | void sk6812_animation_task( void *pvParameters ) 244 | { 245 | while ( 1 ) 246 | { 247 | core2foraws_rgb_led_clear(); 248 | core2foraws_rgb_led_write(); 249 | 250 | for ( uint8_t i = 0; i < 10; i++ ) 251 | { 252 | core2foraws_rgb_led_single_color_set( i, AMAZON_ORANGE ); 253 | core2foraws_rgb_led_write(); 254 | vTaskDelay( pdMS_TO_TICKS( 70 ) ); 255 | } 256 | 257 | for ( uint8_t i = 0; i < 10; i++ ) 258 | { 259 | core2foraws_rgb_led_single_color_set( i, 0x000000 ); 260 | core2foraws_rgb_led_write(); 261 | vTaskDelay( pdMS_TO_TICKS( 70 ) ); 262 | } 263 | 264 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_LEFT, 0x232f3e ); 265 | core2foraws_rgb_led_side_color_set( RGB_LED_SIDE_RIGHT, 0xffffff ); 266 | core2foraws_rgb_led_write(); 267 | 268 | for ( uint8_t i = 40; i > 0; i-- ) 269 | { 270 | core2foraws_rgb_led_brightness_set(i); 271 | core2foraws_rgb_led_write(); 272 | vTaskDelay( pdMS_TO_TICKS( 25 ) ); 273 | } 274 | 275 | core2foraws_rgb_led_brightness_set( 20 ); 276 | } 277 | vTaskDelete( NULL ); // Should never get to here... 278 | } -------------------------------------------------------------------------------- /components/esp32-fft/fft.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | ESP32 FFT 4 | ========= 5 | 6 | This provides a vanilla radix-2 FFT implementation and a test example. 7 | 8 | Author 9 | ------ 10 | 11 | This code was written by [Robin Scheibler](http://www.robinscheibler.org) during rainy days in October 2017. 12 | 13 | License 14 | ------- 15 | 16 | Copyright (c) 2017 Robin Scheibler 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a copy 19 | of this software and associated documentation files (the "Software"), to deal 20 | in the Software without restriction, including without limitation the rights 21 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | copies of the Software, and to permit persons to whom the Software is 23 | furnished to do so, subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in all 26 | copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 | SOFTWARE. 35 | 36 | */ 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include "fft.h" 43 | 44 | #define TWO_PI 6.28318530 45 | #define USE_SPLIT_RADIX 1 46 | #define LARGE_BASE_CASE 1 47 | 48 | fft_config_t *fft_init(int size, fft_type_t type, fft_direction_t direction, float *input, float *output) 49 | { 50 | /* 51 | * Prepare an FFT of correct size and types. 52 | * 53 | * If no input or output buffers are provided, they will be allocated. 54 | */ 55 | int k,m; 56 | 57 | fft_config_t *config = (fft_config_t *)malloc(sizeof(fft_config_t)); 58 | 59 | // Check if the size is a power of two 60 | if ((size & (size-1)) != 0) // tests if size is a power of two 61 | return NULL; 62 | 63 | // start configuration 64 | config->flags = 0; 65 | config->type = type; 66 | config->direction = direction; 67 | config->size = size; 68 | 69 | // Allocate and precompute twiddle factors 70 | config->twiddle_factors = (float *)malloc(2 * config->size * sizeof(float)); 71 | 72 | float two_pi_by_n = TWO_PI / config->size; 73 | 74 | for (k = 0, m = 0 ; k < config->size ; k++, m+=2) 75 | { 76 | config->twiddle_factors[m] = cosf(two_pi_by_n * k); // real 77 | config->twiddle_factors[m+1] = sinf(two_pi_by_n * k); // imag 78 | } 79 | 80 | // Allocate input buffer 81 | if (input != NULL) 82 | config->input = input; 83 | else 84 | { 85 | if (config->type == FFT_REAL) 86 | config->input = (float *)malloc(config->size * sizeof(float)); 87 | else if (config->type == FFT_COMPLEX) 88 | config->input = (float *)malloc(2 * config->size * sizeof(float)); 89 | 90 | config->flags |= FFT_OWN_INPUT_MEM; 91 | } 92 | 93 | if (config->input == NULL) 94 | return NULL; 95 | 96 | // Allocate output buffer 97 | if (output != NULL) 98 | config->output = output; 99 | else 100 | { 101 | if (config->type == FFT_REAL) 102 | config->output = (float *)malloc(config->size * sizeof(float)); 103 | else if (config->type == FFT_COMPLEX) 104 | config->output = (float *)malloc(2 * config->size * sizeof(float)); 105 | 106 | config->flags |= FFT_OWN_OUTPUT_MEM; 107 | } 108 | 109 | if (config->output == NULL) 110 | return NULL; 111 | 112 | return config; 113 | } 114 | 115 | void fft_destroy(fft_config_t *config) 116 | { 117 | if (config->flags & FFT_OWN_INPUT_MEM) 118 | free(config->input); 119 | 120 | if (config->flags & FFT_OWN_OUTPUT_MEM) 121 | free(config->output); 122 | 123 | free(config->twiddle_factors); 124 | free(config); 125 | } 126 | 127 | void fft_execute(fft_config_t *config) 128 | { 129 | if (config->type == FFT_REAL && config->direction == FFT_FORWARD) 130 | rfft(config->input, config->output, config->twiddle_factors, config->size); 131 | else if (config->type == FFT_REAL && config->direction == FFT_BACKWARD) 132 | irfft(config->input, config->output, config->twiddle_factors, config->size); 133 | else if (config->type == FFT_COMPLEX && config->direction == FFT_FORWARD) 134 | fft(config->input, config->output, config->twiddle_factors, config->size); 135 | else if (config->type == FFT_COMPLEX && config->direction == FFT_BACKWARD) 136 | ifft(config->input, config->output, config->twiddle_factors, config->size); 137 | } 138 | 139 | void fft(float *input, float *output, float *twiddle_factors, int n) 140 | { 141 | /* 142 | * Forward fast Fourier transform 143 | * DIT, radix-2, out-of-place implementation 144 | * 145 | * Parameters 146 | * ---------- 147 | * input (float *) 148 | * The input array containing the complex samples with 149 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 150 | * output (float *) 151 | * The output array containing the complex samples with 152 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 153 | * n (int) 154 | * The FFT size, should be a power of 2 155 | */ 156 | 157 | #if USE_SPLIT_RADIX 158 | split_radix_fft(input, output, n, 2, twiddle_factors, 2); 159 | #else 160 | fft_primitive(input, output, n, 2, twiddle_factors, 2); 161 | #endif 162 | } 163 | 164 | void ifft(float *input, float *output, float *twiddle_factors, int n) 165 | { 166 | /* 167 | * Inverse fast Fourier transform 168 | * DIT, radix-2, out-of-place implementation 169 | * 170 | * Parameters 171 | * ---------- 172 | * input (float *) 173 | * The input array containing the complex samples with 174 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 175 | * output (float *) 176 | * The output array containing the complex samples with 177 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 178 | * n (int) 179 | * The FFT size, should be a power of 2 180 | */ 181 | ifft_primitive(input, output, n, 2, twiddle_factors, 2); 182 | } 183 | 184 | void rfft(float *x, float *y, float *twiddle_factors, int n) 185 | { 186 | 187 | // This code uses the two-for-the-price-of-one strategy 188 | #if USE_SPLIT_RADIX 189 | split_radix_fft(x, y, n / 2, 2, twiddle_factors, 4); 190 | #else 191 | fft_primitive(x, y, n / 2, 2, twiddle_factors, 4); 192 | #endif 193 | 194 | // Now apply post processing to recover positive 195 | // frequencies of the real FFT 196 | float t = y[0]; 197 | y[0] = t + y[1]; // DC coefficient 198 | y[1] = t - y[1]; // Center coefficient 199 | 200 | // Apply post processing to quarter element 201 | // this boils down to taking complex conjugate 202 | y[n/2+1] = -y[n/2+1]; 203 | 204 | // Now process all the other frequencies 205 | int k; 206 | for (k = 2 ; k < n / 2 ; k += 2) 207 | { 208 | float xer, xei, xor, xoi, c, s, tr, ti; 209 | 210 | c = twiddle_factors[k]; 211 | s = twiddle_factors[k+1]; 212 | 213 | // even half coefficient 214 | xer = 0.5 * (y[k] + y[n-k]); 215 | xei = 0.5 * (y[k+1] - y[n-k+1]); 216 | 217 | // odd half coefficient 218 | xor = 0.5 * (y[k+1] + y[n-k+1]); 219 | xoi = - 0.5 * (y[k] - y[n-k]); 220 | 221 | tr = c * xor + s * xoi; 222 | ti = -s * xor + c * xoi; 223 | 224 | y[k] = xer + tr; 225 | y[k+1] = xei + ti; 226 | 227 | y[n-k] = xer - tr; 228 | y[n-k+1] = -(xei - ti); 229 | } 230 | } 231 | 232 | void irfft(float *x, float *y, float *twiddle_factors, int n) 233 | { 234 | /* 235 | * Destroys content of input vector 236 | */ 237 | int k; 238 | 239 | // Here we need to apply a pre-processing first 240 | float t = x[0]; 241 | x[0] = 0.5 * (t + x[1]); 242 | x[1] = 0.5 * (t - x[1]); 243 | 244 | x[n/2+1] = -x[n/2+1]; 245 | 246 | for (k = 2 ; k < n / 2 ; k += 2) 247 | { 248 | float xer, xei, xor, xoi, c, s, tr, ti; 249 | 250 | c = twiddle_factors[k]; 251 | s = twiddle_factors[k+1]; 252 | 253 | xer = 0.5 * (x[k] + x[n-k]); 254 | tr = 0.5 * (x[k] - x[n-k]); 255 | 256 | xei = 0.5 * (x[k+1] - x[n-k+1]); 257 | ti = 0.5 * (x[k+1] + x[n-k+1]); 258 | 259 | xor = c * tr - s * ti; 260 | xoi = s * tr + c * ti; 261 | 262 | x[k] = xer - xoi; 263 | x[k+1] = xor + xei; 264 | 265 | x[n-k] = xer + xoi; 266 | x[n-k+1] = xor - xei; 267 | } 268 | 269 | ifft_primitive(x, y, n / 2, 2, twiddle_factors, 4); 270 | } 271 | 272 | void fft_primitive(float *x, float *y, int n, int stride, float *twiddle_factors, int tw_stride) 273 | { 274 | /* 275 | * This code will compute the FFT of the input vector x 276 | * 277 | * The input data is assumed to be real/imag interleaved 278 | * 279 | * The size n should be a power of two 280 | * 281 | * y is an output buffer of size 2n to accomodate for complex numbers 282 | * 283 | * Forward fast Fourier transform 284 | * DIT, radix-2, out-of-place implementation 285 | * 286 | * For a complex FFT, call first stage as: 287 | * fft(x, y, n, 2, 2); 288 | * 289 | * Parameters 290 | * ---------- 291 | * x (float *) 292 | * The input array containing the complex samples with 293 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 294 | * y (float *) 295 | * The output array containing the complex samples with 296 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 297 | * n (int) 298 | * The FFT size, should be a power of 2 299 | * stride (int) 300 | * The number of elements to skip between two successive samples 301 | * tw_stride (int) 302 | * The number of elements to skip between two successive twiddle factors 303 | */ 304 | int k; 305 | float t; 306 | 307 | #if LARGE_BASE_CASE 308 | // End condition, stop at n=8 to avoid one trivial recursion 309 | if (n == 8) 310 | { 311 | fft8(x, stride, y, 2); 312 | return; 313 | } 314 | #else 315 | // End condition, stop at n=2 to avoid one trivial recursion 316 | if (n == 2) 317 | { 318 | y[0] = x[0] + x[stride]; 319 | y[1] = x[1] + x[stride + 1]; 320 | y[2] = x[0] - x[stride]; 321 | y[3] = x[1] - x[stride + 1]; 322 | return; 323 | } 324 | #endif 325 | 326 | // Recursion -- Decimation In Time algorithm 327 | fft_primitive(x, y, n / 2, 2 * stride, twiddle_factors, 2 * tw_stride); // even half 328 | fft_primitive(x + stride, y+n, n / 2, 2 * stride, twiddle_factors, 2 * tw_stride); // odd half 329 | 330 | // Stitch back together 331 | 332 | // We can a few multiplications in the first step 333 | t = y[0]; 334 | y[0] = t + y[n]; 335 | y[n] = t - y[n]; 336 | 337 | t = y[1]; 338 | y[1] = t + y[n+1]; 339 | y[n+1] = t - y[n+1]; 340 | 341 | for (k = 1 ; k < n / 2 ; k++) 342 | { 343 | float x1r, x1i, x2r, x2i, c, s; 344 | c = twiddle_factors[k * tw_stride]; 345 | s = twiddle_factors[k * tw_stride + 1]; 346 | 347 | x1r = y[2 * k]; 348 | x1i = y[2 * k + 1]; 349 | x2r = c * y[n + 2 * k] + s * y[n + 2 * k + 1]; 350 | x2i = -s * y[n + 2 * k] + c * y[n + 2 * k + 1]; 351 | 352 | y[2 * k] = x1r + x2r; 353 | y[2 * k + 1] = x1i + x2i; 354 | 355 | y[n + 2 * k] = x1r - x2r; 356 | y[n + 2 * k + 1] = x1i - x2i; 357 | } 358 | 359 | } 360 | 361 | void split_radix_fft(float *x, float *y, int n, int stride, float *twiddle_factors, int tw_stride) 362 | { 363 | /* 364 | * This code will compute the FFT of the input vector x 365 | * 366 | * The input data is assumed to be real/imag interleaved 367 | * 368 | * The size n should be a power of two 369 | * 370 | * y is an output buffer of size 2n to accomodate for complex numbers 371 | * 372 | * Forward fast Fourier transform 373 | * Split-Radix 374 | * DIT, radix-2, out-of-place implementation 375 | * 376 | * For a complex FFT, call first stage as: 377 | * fft(x, y, n, 2, 2); 378 | * 379 | * Parameters 380 | * ---------- 381 | * x (float *) 382 | * The input array containing the complex samples with 383 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 384 | * y (float *) 385 | * The output array containing the complex samples with 386 | * real/imaginary parts interleaved [Re(x0), Im(x0), ..., Re(x_n-1), Im(x_n-1)] 387 | * n (int) 388 | * The FFT size, should be a power of 2 389 | * stride (int) 390 | * The number of elements to skip between two successive samples 391 | * twiddle_factors (float *) 392 | * The array of twiddle factors 393 | * tw_stride (int) 394 | * The number of elements to skip between two successive twiddle factors 395 | */ 396 | int k; 397 | 398 | #if LARGE_BASE_CASE 399 | // End condition, stop at n=2 to avoid one trivial recursion 400 | if (n == 8) 401 | { 402 | fft8(x, stride, y, 2); 403 | return; 404 | } 405 | else if (n == 4) 406 | { 407 | fft4(x, stride, y, 2); 408 | return; 409 | } 410 | #else 411 | // End condition, stop at n=2 to avoid one trivial recursion 412 | if (n == 2) 413 | { 414 | y[0] = x[0] + x[stride]; 415 | y[1] = x[1] + x[stride + 1]; 416 | y[2] = x[0] - x[stride]; 417 | y[3] = x[1] - x[stride + 1]; 418 | return; 419 | } 420 | else if (n == 1) 421 | { 422 | y[0] = x[0]; 423 | y[1] = x[1]; 424 | return; 425 | } 426 | #endif 427 | 428 | // Recursion -- Decimation In Time algorithm 429 | split_radix_fft(x, y, n / 2, 2 * stride, twiddle_factors, 2 * tw_stride); 430 | split_radix_fft(x + stride, y + n, n / 4, 4 * stride, twiddle_factors, 4 * tw_stride); 431 | split_radix_fft(x + 3 * stride, y + n + n / 2, n / 4, 4 * stride, twiddle_factors, 4 * tw_stride); 432 | 433 | // Stitch together the output 434 | float u1r, u1i, u2r, u2i, x1r, x1i, x2r, x2i; 435 | float t; 436 | 437 | // We can save a few multiplications in the first step 438 | u1r = y[0]; 439 | u1i = y[1]; 440 | u2r = y[n / 2]; 441 | u2i = y[n / 2 + 1]; 442 | 443 | x1r = y[n]; 444 | x1i = y[n + 1]; 445 | x2r = y[n / 2 + n]; 446 | x2i = y[n / 2 + n + 1]; 447 | 448 | t = x1r + x2r; 449 | y[0] = u1r + t; 450 | y[n] = u1r - t; 451 | 452 | t = x1i + x2i; 453 | y[1] = u1i + t; 454 | y[n + 1] = u1i - t; 455 | 456 | t = x2i - x1i; 457 | y[n / 2] = u2r - t; 458 | y[n + n / 2] = u2r + t; 459 | 460 | t = x1r - x2r; 461 | y[n / 2 + 1] = u2i - t; 462 | y[n + n / 2 + 1] = u2i + t; 463 | 464 | for (k = 1 ; k < n / 4 ; k++) 465 | { 466 | float u1r, u1i, u2r, u2i, x1r, x1i, x2r, x2i, c1, s1, c2, s2; 467 | c1 = twiddle_factors[k * tw_stride]; 468 | s1 = twiddle_factors[k * tw_stride + 1]; 469 | c2 = twiddle_factors[3 * k * tw_stride]; 470 | s2 = twiddle_factors[3 * k * tw_stride + 1]; 471 | 472 | u1r = y[2 * k]; 473 | u1i = y[2 * k + 1]; 474 | u2r = y[2 * k + n / 2]; 475 | u2i = y[2 * k + n / 2 + 1]; 476 | 477 | x1r = c1 * y[n + 2 * k] + s1 * y[n + 2 * k + 1]; 478 | x1i = -s1 * y[n + 2 * k] + c1 * y[n + 2 * k + 1]; 479 | x2r = c2 * y[n / 2 + n + 2 * k] + s2 * y[n / 2 + n + 2 * k + 1]; 480 | x2i = -s2 * y[n / 2 + n + 2 * k] + c2 * y[n / 2 + n + 2 * k + 1]; 481 | 482 | t = x1r + x2r; 483 | y[2 * k] = u1r + t; 484 | y[2 * k + n] = u1r - t; 485 | 486 | t = x1i + x2i; 487 | y[2 * k + 1] = u1i + t; 488 | y[2 * k + n + 1] = u1i - t; 489 | 490 | t = x2i - x1i; 491 | y[2 * k + n / 2] = u2r - t; 492 | y[2 * k + n + n / 2] = u2r + t; 493 | 494 | t = x1r - x2r; 495 | y[2 * k + n / 2 + 1] = u2i - t; 496 | y[2 * k + n + n / 2 + 1] = u2i + t; 497 | } 498 | 499 | } 500 | 501 | 502 | void ifft_primitive(float *input, float *output, int n, int stride, float *twiddle_factors, int tw_stride) 503 | { 504 | 505 | #if USE_SPLIT_RADIX 506 | split_radix_fft(input, output, n, stride, twiddle_factors, tw_stride); 507 | #else 508 | fft_primitive(input, output, n, stride, twiddle_factors, tw_stride); 509 | #endif 510 | 511 | int ks; 512 | 513 | int ns = n * stride; 514 | 515 | // reverse all coefficients from 1 to n / 2 - 1 516 | for (ks = stride ; ks < ns / 2 ; ks += stride) 517 | { 518 | float t; 519 | 520 | t = output[ks]; 521 | output[ks] = output[ns-ks]; 522 | output[ns-ks] = t; 523 | 524 | t = output[ks+1]; 525 | output[ks+1] = output[ns-ks+1]; 526 | output[ns-ks+1] = t; 527 | } 528 | 529 | // Apply normalization 530 | float norm = 1. / n; 531 | for (ks = 0 ; ks < ns ; ks += stride) 532 | { 533 | output[ks] *= norm; 534 | output[ks+1] *= norm; 535 | } 536 | 537 | } 538 | 539 | inline void fft8(float *input, int stride_in, float *output, int stride_out) 540 | { 541 | /* 542 | * Unrolled implementation of FFT8 for a little more performance 543 | */ 544 | float a0r, a1r, a2r, a3r, a4r, a5r, a6r, a7r; 545 | float a0i, a1i, a2i, a3i, a4i, a5i, a6i, a7i; 546 | float b0r, b1r, b2r, b3r, b4r, b5r, b6r, b7r; 547 | float b0i, b1i, b2i, b3i, b4i, b5i, b6i, b7i; 548 | float t; 549 | float sin_pi_4 = 0.7071067812; 550 | 551 | a0r = input[0]; 552 | a0i = input[1]; 553 | a1r = input[stride_in]; 554 | a1i = input[stride_in+1]; 555 | a2r = input[2*stride_in]; 556 | a2i = input[2*stride_in+1]; 557 | a3r = input[3*stride_in]; 558 | a3i = input[3*stride_in+1]; 559 | a4r = input[4*stride_in]; 560 | a4i = input[4*stride_in+1]; 561 | a5r = input[5*stride_in]; 562 | a5i = input[5*stride_in+1]; 563 | a6r = input[6*stride_in]; 564 | a6i = input[6*stride_in+1]; 565 | a7r = input[7*stride_in]; 566 | a7i = input[7*stride_in+1]; 567 | 568 | // Stage 1 569 | 570 | b0r = a0r + a4r; 571 | b0i = a0i + a4i; 572 | 573 | b1r = a1r + a5r; 574 | b1i = a1i + a5i; 575 | 576 | b2r = a2r + a6r; 577 | b2i = a2i + a6i; 578 | 579 | b3r = a3r + a7r; 580 | b3i = a3i + a7i; 581 | 582 | b4r = a0r - a4r; 583 | b4i = a0i - a4i; 584 | 585 | b5r = a1r - a5r; 586 | b5i = a1i - a5i; 587 | // W_8^1 = 1/sqrt(2) - j / sqrt(2) 588 | t = b5r + b5i; 589 | b5i = (b5i - b5r) * sin_pi_4; 590 | b5r = t * sin_pi_4; 591 | 592 | // W_8^2 = -j 593 | b6r = a2i - a6i; 594 | b6i = a6r - a2r; 595 | 596 | b7r = a3r - a7r; 597 | b7i = a3i - a7i; 598 | // W_8^3 = -1 / sqrt(2) + j / sqrt(2) 599 | t = sin_pi_4 * (b7i - b7r); 600 | b7i = - (b7r + b7i) * sin_pi_4; 601 | b7r = t; 602 | 603 | // Stage 2 604 | 605 | a0r = b0r + b2r; 606 | a0i = b0i + b2i; 607 | 608 | a1r = b1r + b3r; 609 | a1i = b1i + b3i; 610 | 611 | a2r = b0r - b2r; 612 | a2i = b0i - b2i; 613 | 614 | // * j 615 | a3r = b1i - b3i; 616 | a3i = b3r - b1r; 617 | 618 | a4r = b4r + b6r; 619 | a4i = b4i + b6i; 620 | 621 | a5r = b5r + b7r; 622 | a5i = b5i + b7i; 623 | 624 | a6r = b4r - b6r; 625 | a6i = b4i - b6i; 626 | 627 | // * j 628 | a7r = b5i - b7i; 629 | a7i = b7r - b5r; 630 | 631 | // Stage 3 632 | 633 | // X[0] 634 | output[0] = a0r + a1r; 635 | output[1] = a0i + a1i; 636 | 637 | // X[4] 638 | output[4*stride_out] = a0r - a1r; 639 | output[4*stride_out+1] = a0i - a1i; 640 | 641 | // X[2] 642 | output[2*stride_out] = a2r + a3r; 643 | output[2*stride_out+1] = a2i + a3i; 644 | 645 | // X[6] 646 | output[6*stride_out] = a2r - a3r; 647 | output[6*stride_out+1] = a2i - a3i; 648 | 649 | // X[1] 650 | output[stride_out] = a4r + a5r; 651 | output[stride_out+1] = a4i + a5i; 652 | 653 | // X[5] 654 | output[5*stride_out] = a4r - a5r; 655 | output[5*stride_out+1] = a4i - a5i; 656 | 657 | // X[3] 658 | output[3*stride_out] = a6r + a7r; 659 | output[3*stride_out+1] = a6i + a7i; 660 | 661 | // X[7] 662 | output[7*stride_out] = a6r - a7r; 663 | output[7*stride_out+1] = a6i - a7i; 664 | 665 | } 666 | 667 | inline void fft4(float *input, int stride_in, float *output, int stride_out) 668 | { 669 | /* 670 | * Unrolled implementation of FFT4 for a little more performance 671 | */ 672 | float t1, t2; 673 | 674 | t1 = input[0] + input[2*stride_in]; 675 | t2 = input[stride_in] + input[3*stride_in]; 676 | output[0] = t1 + t2; 677 | output[2*stride_out] = t1 - t2; 678 | 679 | t1 = input[1] + input[2*stride_in+1]; 680 | t2 = input[stride_in+1] + input[3*stride_in+1]; 681 | output[1] = t1 + t2; 682 | output[2*stride_out+1] = t1 - t2; 683 | 684 | t1 = input[0] - input[2*stride_in]; 685 | t2 = input[stride_in+1] - input[3*stride_in+1]; 686 | output[stride_out] = t1 + t2; 687 | output[3*stride_out] = t1 - t2; 688 | 689 | t1 = input[1] - input[2*stride_in+1]; 690 | t2 = input[3*stride_in] - input[stride_in]; 691 | output[stride_out+1] = t1 + t2; 692 | output[3*stride_out+1] = t1 - t2; 693 | } 694 | -------------------------------------------------------------------------------- /main/images/gauge_hand.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AWS IoT Kit - Core2 for AWS IoT Kit 3 | * gauge_hand.c 4 | * 5 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "lvgl.h" 26 | 27 | #ifndef LV_ATTRIBUTE_MEM_ALIGN 28 | #define LV_ATTRIBUTE_MEM_ALIGN 29 | #endif 30 | 31 | #ifndef LV_ATTRIBUTE_IMG_GAUGE_HAND 32 | #define LV_ATTRIBUTE_IMG_GAUGE_HAND 33 | #endif 34 | 35 | const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_GAUGE_HAND uint8_t gauge_hand_map[] = { 36 | #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8 37 | /*Pixel format: Blue: 2 bit, Green: 3 bit, Red: 3 bit, Alpha 8 bit */ 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0xe4, 0x00, 0xa7, 0x00, 0x67, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xe7, 0x00, 0xa7, 0x00, 0x67, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xe7, 0x00, 0xa7, 0x00, 0x67, 0x00, 0x28, 41 | 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 42 | 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xe7, 0x00, 0xa8, 0x00, 0x68, 0x00, 0x28, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xe7, 0x00, 0xa8, 0x00, 0x68, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0xe7, 0x00, 0xa8, 0x00, 0x68, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | #endif 47 | #if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0 48 | /*Pixel format: Blue: 5 bit, Green: 6 bit, Red: 5 bit, Alpha 8 bit*/ 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xe4, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x67, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x67, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x67, 0x00, 0x00, 0x28, 52 | 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 53 | 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x68, 0x00, 0x00, 0x28, 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x68, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x68, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 57 | #endif 58 | #if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP != 0 59 | /*Pixel format: Blue: 5 bit Green: 6 bit, Red: 5 bit, Alpha 8 bit BUT the 2 color bytes are swapped*/ 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xe4, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x67, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x67, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x67, 0x00, 0x00, 0x28, 63 | 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 64 | 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x68, 0x00, 0x00, 0x28, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x68, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x68, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | #endif 69 | #if LV_COLOR_DEPTH == 32 70 | /*Pixel format: Blue: 8 bit, Green: 8 bit, Red: 8 bit, Alpha: 8 bit*/ 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x28, 74 | 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 75 | 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x28, 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 79 | #endif 80 | }; 81 | 82 | const lv_img_dsc_t gauge_hand = { 83 | .header.always_zero = 0, 84 | .header.w = 41, 85 | .header.h = 8, 86 | .data_size = 328 * LV_IMG_PX_SIZE_ALPHA_BYTE, 87 | .header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA, 88 | .data = gauge_hand_map, 89 | }; 90 | 91 | --------------------------------------------------------------------------------