From 1bc0f3edce14db6cd6595a32e9d22329a2a35ba2 Mon Sep 17 00:00:00 2001 From: RudolphRiedel <31180093+RudolphRiedel@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:15:58 +0100 Subject: [PATCH] - went over all examples and checked that everything compiles --- .../platformio.ini | 5 +- .../platformio.ini | 10 +- .../EVE_Test_ESP32_PlatformIO/platformio.ini | 8 +- .../EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32 | 24 +- .../sdkconfig.ESP32-C3 | 22 +- .../sdkconfig.ESP32-S3 | 21 +- .../EmbeddedVideoEngine/EVE.h | 1663 +++++++++++------ .../EmbeddedVideoEngine/EVE_commands.c | 1497 +++++++++------ .../EmbeddedVideoEngine/EVE_commands.h | 83 +- .../EmbeddedVideoEngine/EVE_target.h | 22 +- .../EVE_target/EVE_target_ATSAMC21.h | 4 +- .../EmbeddedVideoEngine/LICENSE | 3 +- .../platformio.ini | 10 + .../EmbeddedVideoEngine/EVE.h | 1663 +++++++++++------ .../EmbeddedVideoEngine/EVE_commands.c | 1497 +++++++++------ .../EmbeddedVideoEngine/EVE_commands.h | 83 +- .../EmbeddedVideoEngine/EVE_target.h | 22 +- .../EVE_target/EVE_target_ATSAMx5x.h | 4 +- .../EmbeddedVideoEngine/LICENSE | 3 +- .../platformio.ini | 10 + .../Display_Test1.componentinfo.xml | 20 +- .../Display_Test1/Display_Test1.cproj | 140 +- .../Display_Test1/EmbeddedVideoEngine/EVE.h | 1663 +++++++++++------ .../EmbeddedVideoEngine/EVE_commands.c | 1497 +++++++++------ .../EmbeddedVideoEngine/EVE_commands.h | 83 +- .../EmbeddedVideoEngine/EVE_target.h | 22 +- .../EVE_target/EVE_target_XMEGA.h | 2 +- .../Display_Test1/EmbeddedVideoEngine/LICENSE | 3 +- 28 files changed, 6497 insertions(+), 3587 deletions(-) diff --git a/examples/EVE_HelloWorld_Arduino_PlatformIO/platformio.ini b/examples/EVE_HelloWorld_Arduino_PlatformIO/platformio.ini index 1594176..ab343b1 100644 --- a/examples/EVE_HelloWorld_Arduino_PlatformIO/platformio.ini +++ b/examples/EVE_HelloWorld_Arduino_PlatformIO/platformio.ini @@ -90,7 +90,8 @@ build_flags = [env:ESP32] platform = espressif32 board = esp32doit-devkit-v1 -build_unflags = -Os +;build_unflags = -Os +; note: using -O2 does not work with plain ESP32 -> write_flash: error build_flags = ${env.build_flags} ; -D EVE_USE_ESP_IDF @@ -99,7 +100,7 @@ build_flags = -D EVE_SCK=18 -D EVE_MISO=19 -D EVE_MOSI=23 - -O2 +; -O2 [env:ESP32-S3] platform = espressif32 diff --git a/examples/EVE_Test_Arduino_PlatformIO/platformio.ini b/examples/EVE_Test_Arduino_PlatformIO/platformio.ini index 1594176..b5937c7 100644 --- a/examples/EVE_Test_Arduino_PlatformIO/platformio.ini +++ b/examples/EVE_Test_Arduino_PlatformIO/platformio.ini @@ -12,6 +12,9 @@ lib_deps = https://github.com/RudolphRiedel/FT800-FT813/archive/refs/heads/5.x.zip framework = arduino build_flags = -D EVE_RVT50H +;build_flags = -D EVE_FT811CB_HY50HD +;build_flags = -D EVE_EVE2_50G +;build_flags = -D EVE_EVE3_50G [env:uno] platform = atmelavr @@ -90,7 +93,8 @@ build_flags = [env:ESP32] platform = espressif32 board = esp32doit-devkit-v1 -build_unflags = -Os +;build_unflags = -Os +; note: using -O2 does not work with plain ESP32 -> write_flash: error build_flags = ${env.build_flags} ; -D EVE_USE_ESP_IDF @@ -99,7 +103,7 @@ build_flags = -D EVE_SCK=18 -D EVE_MISO=19 -D EVE_MOSI=23 - -O2 +; -O2 [env:ESP32-S3] platform = espressif32 @@ -107,7 +111,7 @@ board = dfrobot_firebeetle2_esp32s3 build_unflags = -Os build_flags = ${env.build_flags} -; -D EVE_USE_ESP_IDF + -D EVE_USE_ESP_IDF -D EVE_CS=10 -D EVE_PDN=14 -D EVE_SCK=12 diff --git a/examples/EVE_Test_ESP32_PlatformIO/platformio.ini b/examples/EVE_Test_ESP32_PlatformIO/platformio.ini index f891466..75125d9 100644 --- a/examples/EVE_Test_ESP32_PlatformIO/platformio.ini +++ b/examples/EVE_Test_ESP32_PlatformIO/platformio.ini @@ -13,14 +13,16 @@ lib_deps = https://github.com/RudolphRiedel/FT800-FT813/archive/refs/heads/5.x.z framework = espidf platform = espressif32 ;platform = espressif32@5.3.0 -build_flags = -D EVE_RVT50H +;build_flags = -D EVE_RVT50H +build_flags = -D EVE_EVE3_50G [env:ESP32] board = esp32doit-devkit-v1 -build_unflags = -Os +;build_unflags = -Os +; note: using -O2 does not work with plain ESP32 -> write_flash: error build_flags = ${env.build_flags} - -O2 +; -O2 [env:ESP32-S3] board = dfrobot_firebeetle2_esp32s3 diff --git a/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32 b/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32 index 52c0ac5..0191b5c 100644 --- a/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32 +++ b/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32 @@ -1,6 +1,6 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# Espressif IoT Development Framework (ESP-IDF) 5.1.2 Project Configuration # CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" @@ -211,6 +211,7 @@ CONFIG_SOC_BLE_MESH_SUPPORTED=y CONFIG_SOC_BT_CLASSIC_SUPPORTED=y CONFIG_SOC_BLUFI_SUPPORTED=y CONFIG_SOC_ULP_HAS_ADC=y +CONFIG_SOC_PHY_COMBO_MODULE=y CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y CONFIG_IDF_TARGET_ARCH="xtensa" @@ -449,6 +450,7 @@ CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM=y # # GPTimer Configuration # +CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y # CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set # CONFIG_GPTIMER_ISR_IRAM_SAFE is not set # CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set @@ -562,6 +564,7 @@ CONFIG_ETH_RMII_CLK_IN_GPIO=0 CONFIG_ETH_DMA_BUFFER_SIZE=512 CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 +# CONFIG_ETH_IRAM_OPTIMIZATION is not set CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set # CONFIG_ETH_SPI_ETHERNET_W5500 is not set @@ -663,6 +666,7 @@ CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # @@ -879,6 +883,10 @@ CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1 CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y +# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 +CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 # CONFIG_ESP_WIFI_CSI_ENABLED is not set CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP_WIFI_TX_BA_WIN=6 @@ -890,6 +898,7 @@ CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 CONFIG_ESP_WIFI_IRAM_OPT=y +# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set CONFIG_ESP_WIFI_RX_IRAM_OPT=y CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y CONFIG_ESP_WIFI_ENABLE_SAE_PK=y @@ -905,7 +914,6 @@ CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y # CONFIG_ESP_WIFI_WAPI_PSK is not set -# CONFIG_ESP_WIFI_SUITE_B_192 is not set # CONFIG_ESP_WIFI_11KV_SUPPORT is not set # CONFIG_ESP_WIFI_MBO_SUPPORT is not set # CONFIG_ESP_WIFI_DPP_SUPPORT is not set @@ -921,6 +929,7 @@ CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y # CONFIG_ESP_WIFI_DEBUG_PRINT is not set # CONFIG_ESP_WIFI_TESTING_OPTIONS is not set +CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=y # end of Wi-Fi # @@ -1077,12 +1086,15 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set +# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y +CONFIG_LWIP_ND6=y CONFIG_LWIP_MAX_SOCKETS=10 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set # CONFIG_LWIP_SO_LINGER is not set @@ -1262,7 +1274,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y @@ -1344,12 +1356,12 @@ CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y # CONFIG_MBEDTLS_POLY1305_C is not set # CONFIG_MBEDTLS_CHACHA20_C is not set # CONFIG_MBEDTLS_HKDF_C is not set # CONFIG_MBEDTLS_THREADING_C is not set # CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -# CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS # @@ -1399,12 +1411,15 @@ CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y # Thread Operational Dataset # CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX="fd00:db8:a0:0::/64" CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" # end of Thread Operational Dataset + +CONFIG_OPENTHREAD_XTAL_ACCURACY=130 # end of OpenThread # @@ -1739,7 +1754,6 @@ CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y CONFIG_WPA_MBEDTLS_CRYPTO=y CONFIG_WPA_MBEDTLS_TLS_CLIENT=y # CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_SUITE_B_192 is not set # CONFIG_WPA_11KV_SUPPORT is not set # CONFIG_WPA_MBO_SUPPORT is not set # CONFIG_WPA_DPP_SUPPORT is not set diff --git a/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-C3 b/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-C3 index d212472..e83494a 100644 --- a/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-C3 +++ b/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-C3 @@ -1,6 +1,6 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# Espressif IoT Development Framework (ESP-IDF) 5.1.2 Project Configuration # CONFIG_SOC_ADC_SUPPORTED=y CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y @@ -181,6 +181,7 @@ CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=54 CONFIG_SOC_TIMER_GROUP_SUPPORT_XTAL=y CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=2 +CONFIG_SOC_MWDT_SUPPORT_XTAL=y CONFIG_SOC_TWAI_CONTROLLER_NUM=1 CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y CONFIG_SOC_TWAI_BRP_MIN=2 @@ -243,6 +244,7 @@ CONFIG_SOC_BLE_MESH_SUPPORTED=y CONFIG_SOC_BLE_50_SUPPORTED=y CONFIG_SOC_BLE_DEVICE_PRIVACY_SUPPORTED=y CONFIG_SOC_BLUFI_SUPPORTED=y +CONFIG_SOC_PHY_COMBO_MODULE=y CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_RISCV=y CONFIG_IDF_TARGET_ARCH="riscv" @@ -497,6 +499,7 @@ CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM=y # # GPTimer Configuration # +CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y # CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set # CONFIG_GPTIMER_ISR_IRAM_SAFE is not set # CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set @@ -665,6 +668,7 @@ CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES=4 CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y # CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config CONFIG_ESP_SLEEP_SYSTIMER_STALL_WORKAROUND=y @@ -868,6 +872,10 @@ CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1 CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y +# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 +CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 # CONFIG_ESP_WIFI_CSI_ENABLED is not set CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP_WIFI_TX_BA_WIN=6 @@ -877,6 +885,7 @@ CONFIG_ESP_WIFI_NVS_ENABLED=y CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 CONFIG_ESP_WIFI_IRAM_OPT=y +# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set CONFIG_ESP_WIFI_RX_IRAM_OPT=y CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y CONFIG_ESP_WIFI_ENABLE_SAE_PK=y @@ -909,6 +918,7 @@ CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y # CONFIG_ESP_WIFI_DEBUG_PRINT is not set # CONFIG_ESP_WIFI_TESTING_OPTIONS is not set +CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=y # end of Wi-Fi # @@ -1065,12 +1075,15 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set +# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y +CONFIG_LWIP_ND6=y CONFIG_LWIP_MAX_SOCKETS=10 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set # CONFIG_LWIP_SO_LINGER is not set @@ -1249,7 +1262,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_HARDWARE_MPI=y @@ -1333,12 +1346,12 @@ CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y # CONFIG_MBEDTLS_POLY1305_C is not set # CONFIG_MBEDTLS_CHACHA20_C is not set # CONFIG_MBEDTLS_HKDF_C is not set # CONFIG_MBEDTLS_THREADING_C is not set CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI=y -# CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS # @@ -1388,12 +1401,15 @@ CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y # Thread Operational Dataset # CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX="fd00:db8:a0:0::/64" CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" # end of Thread Operational Dataset + +CONFIG_OPENTHREAD_XTAL_ACCURACY=130 # end of OpenThread # diff --git a/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-S3 b/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-S3 index be88ab8..3d90b62 100644 --- a/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-S3 +++ b/examples/EVE_Test_ESP32_PlatformIO/sdkconfig.ESP32-S3 @@ -1,6 +1,6 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# Espressif IoT Development Framework (ESP-IDF) 5.1.2 Project Configuration # CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 @@ -315,6 +315,7 @@ CONFIG_SOC_BLE_50_SUPPORTED=y CONFIG_SOC_BLE_DEVICE_PRIVACY_SUPPORTED=y CONFIG_SOC_BLUFI_SUPPORTED=y CONFIG_SOC_ULP_HAS_ADC=y +CONFIG_SOC_PHY_COMBO_MODULE=y CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y CONFIG_IDF_TARGET_ARCH="xtensa" @@ -576,6 +577,7 @@ CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM=y # # GPTimer Configuration # +CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y # CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set # CONFIG_GPTIMER_ISR_IRAM_SAFE is not set # CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set @@ -761,6 +763,7 @@ CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # @@ -1014,6 +1017,10 @@ CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1 CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y +# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 +CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 # CONFIG_ESP_WIFI_CSI_ENABLED is not set CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP_WIFI_TX_BA_WIN=6 @@ -1025,6 +1032,7 @@ CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 CONFIG_ESP_WIFI_IRAM_OPT=y +# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set CONFIG_ESP_WIFI_RX_IRAM_OPT=y CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y CONFIG_ESP_WIFI_ENABLE_SAE_PK=y @@ -1057,6 +1065,7 @@ CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y # CONFIG_ESP_WIFI_DEBUG_PRINT is not set # CONFIG_ESP_WIFI_TESTING_OPTIONS is not set +CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=y # end of Wi-Fi # @@ -1213,12 +1222,15 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set +# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y +CONFIG_LWIP_ND6=y CONFIG_LWIP_MAX_SOCKETS=10 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set # CONFIG_LWIP_SO_LINGER is not set @@ -1398,7 +1410,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_HARDWARE_MPI=y @@ -1482,12 +1494,12 @@ CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y # CONFIG_MBEDTLS_POLY1305_C is not set # CONFIG_MBEDTLS_CHACHA20_C is not set # CONFIG_MBEDTLS_HKDF_C is not set # CONFIG_MBEDTLS_THREADING_C is not set # CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -# CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS # @@ -1537,12 +1549,15 @@ CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y # Thread Operational Dataset # CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX="fd00:db8:a0:0::/64" CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" # end of Thread Operational Dataset + +CONFIG_OPENTHREAD_XTAL_ACCURACY=130 # end of OpenThread # diff --git a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE.h b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE.h index ae2b9b2..e40010e 100644 --- a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE.h +++ b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE.h @@ -2,7 +2,7 @@ @file EVE.h @brief Contains FT80x/FT81x/BT81x API definitions @version 5.0 -@date 2023-06-24 +@date 2024-01-07 @author Rudolph Riedel @section LICENSE @@ -63,6 +63,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - added #ifdef __cplusplus / extern "C" to allow adding EVE_ functions to C++ code - fix: typo REG_COPRO_PATCH_DTR -> REG_COPRO_PATCH_PTR +- started to convert the function-like macros to static inline functions to be + a little friendlier towards C++ in regards of type-safety +- added type-casts to all simple macros +- converted some more function-like macros to static inline functions +- converted the rest of the function-like macros to static inline functions +- fix: forgot to comment out the EVE2 BITMAP_TRANSFORM_E when converting it to an inline function */ @@ -80,561 +86,975 @@ extern "C" #include "EVE_commands.h" /* Memory */ -#define EVE_RAM_G 0x00000000UL -#define EVE_ROM_CHIPID 0x000C0000UL -#define EVE_ROM_FONT 0x001E0000UL -#define EVE_ROM_FONTROOT 0x002FFFFCUL -#define EVE_RAM_DL 0x00300000UL -#define EVE_RAM_REG 0x00302000UL -#define EVE_RAM_CMD 0x00308000UL +#define EVE_RAM_G ((uint32_t) 0x00000000UL) +#define EVE_ROM_CHIPID ((uint32_t) 0x000C0000UL) +#define EVE_ROM_FONT ((uint32_t) 0x001E0000UL) +#define EVE_ROM_FONTROOT ((uint32_t) 0x002FFFFCUL) +#define EVE_RAM_DL ((uint32_t) 0x00300000UL) +#define EVE_RAM_REG ((uint32_t) 0x00302000UL) +#define EVE_RAM_CMD ((uint32_t) 0x00308000UL) /* Memory buffer sizes */ -#define EVE_RAM_G_SIZE (1024U*1024UL) -#define EVE_CMDFIFO_SIZE (4U*1024UL) -#define EVE_RAM_DL_SIZE (8U*1024UL) +#define EVE_RAM_G_SIZE ((uint32_t) 1024U*1024UL) +#define EVE_CMDFIFO_SIZE ((uint32_t) 4U*1024UL) +#define EVE_RAM_DL_SIZE ((uint32_t) 8U*1024UL) /* diplay list list commands, most need OR's arguments */ -#define DL_DISPLAY 0x00000000UL -#define DL_BITMAP_SOURCE 0x01000000UL -#define DL_CLEAR_COLOR_RGB 0x02000000UL -#define DL_TAG 0x03000000UL -#define DL_COLOR_RGB 0x04000000UL -#define DL_BITMAP_HANDLE 0x05000000UL -#define DL_CELL 0x06000000UL -#define DL_BITMAP_LAYOUT 0x07000000UL -#define DL_BITMAP_SIZE 0x08000000UL -#define DL_ALPHA_FUNC 0x09000000UL -#define DL_STENCIL_FUNC 0x0A000000UL -#define DL_BLEND_FUNC 0x0B000000UL -#define DL_STENCIL_OP 0x0C000000UL -#define DL_POINT_SIZE 0x0D000000UL -#define DL_LINE_WIDTH 0x0E000000UL -#define DL_CLEAR_COLOR_A 0x0F000000UL -#define DL_COLOR_A 0x10000000UL -#define DL_CLEAR_STENCIL 0x11000000UL -#define DL_CLEAR_TAG 0x12000000UL -#define DL_STENCIL_MASK 0x13000000UL -#define DL_TAG_MASK 0x14000000UL -#define DL_BITMAP_TRANSFORM_A 0x15000000UL -#define DL_BITMAP_TRANSFORM_B 0x16000000UL -#define DL_BITMAP_TRANSFORM_C 0x17000000UL -#define DL_BITMAP_TRANSFORM_D 0x18000000UL -#define DL_BITMAP_TRANSFORM_E 0x19000000UL -#define DL_BITMAP_TRANSFORM_F 0x1A000000UL -#define DL_SCISSOR_XY 0x1B000000UL -#define DL_SCISSOR_SIZE 0x1C000000UL -#define DL_CALL 0x1D000000UL -#define DL_JUMP 0x1E000000UL -#define DL_BEGIN 0x1F000000UL -#define DL_COLOR_MASK 0x20000000UL -#define DL_END 0x21000000UL -#define DL_SAVE_CONTEXT 0x22000000UL -#define DL_RESTORE_CONTEXT 0x23000000UL -#define DL_RETURN 0x24000000UL -#define DL_MACRO 0x25000000UL -#define DL_CLEAR 0x26000000UL -#define DL_VERTEX_FORMAT 0x27000000UL -#define DL_BITMAP_LAYOUT_H 0x28000000UL -#define DL_BITMAP_SIZE_H 0x29000000UL -#define DL_PALETTE_SOURCE 0x2A000000UL -#define DL_VERTEX_TRANSLATE_X 0x2B000000UL -#define DL_VERTEX_TRANSLATE_Y 0x2C000000UL -#define DL_NOP 0x2D000000UL - -#define DL_VERTEX2F 0x40000000UL -#define DL_VERTEX2II 0x80000000UL - -#define CLR_COL 0x4U -#define CLR_STN 0x2U -#define CLR_TAG 0x1U +#define DL_DISPLAY ((uint32_t) 0x00000000UL) +#define DL_BITMAP_SOURCE ((uint32_t) 0x01000000UL) +#define DL_CLEAR_COLOR_RGB ((uint32_t) 0x02000000UL) +#define DL_TAG ((uint32_t) 0x03000000UL) +#define DL_COLOR_RGB ((uint32_t) 0x04000000UL) +#define DL_BITMAP_HANDLE ((uint32_t) 0x05000000UL) +#define DL_CELL ((uint32_t) 0x06000000UL) +#define DL_BITMAP_LAYOUT ((uint32_t) 0x07000000UL) +#define DL_BITMAP_SIZE ((uint32_t) 0x08000000UL) +#define DL_ALPHA_FUNC ((uint32_t) 0x09000000UL) +#define DL_STENCIL_FUNC ((uint32_t) 0x0A000000UL) +#define DL_BLEND_FUNC ((uint32_t) 0x0B000000UL) +#define DL_STENCIL_OP ((uint32_t) 0x0C000000UL) +#define DL_POINT_SIZE ((uint32_t) 0x0D000000UL) +#define DL_LINE_WIDTH ((uint32_t) 0x0E000000UL) +#define DL_CLEAR_COLOR_A ((uint32_t) 0x0F000000UL) +#define DL_COLOR_A ((uint32_t) 0x10000000UL) +#define DL_CLEAR_STENCIL ((uint32_t) 0x11000000UL) +#define DL_CLEAR_TAG ((uint32_t) 0x12000000UL) +#define DL_STENCIL_MASK ((uint32_t) 0x13000000UL) +#define DL_TAG_MASK ((uint32_t) 0x14000000UL) +#define DL_BITMAP_TRANSFORM_A ((uint32_t) 0x15000000UL) +#define DL_BITMAP_TRANSFORM_B ((uint32_t) 0x16000000UL) +#define DL_BITMAP_TRANSFORM_C ((uint32_t) 0x17000000UL) +#define DL_BITMAP_TRANSFORM_D ((uint32_t) 0x18000000UL) +#define DL_BITMAP_TRANSFORM_E ((uint32_t) 0x19000000UL) +#define DL_BITMAP_TRANSFORM_F ((uint32_t) 0x1A000000UL) +#define DL_SCISSOR_XY ((uint32_t) 0x1B000000UL) +#define DL_SCISSOR_SIZE ((uint32_t) 0x1C000000UL) +#define DL_CALL ((uint32_t) 0x1D000000UL) +#define DL_JUMP ((uint32_t) 0x1E000000UL) +#define DL_BEGIN ((uint32_t) 0x1F000000UL) +#define DL_COLOR_MASK ((uint32_t) 0x20000000UL) +#define DL_END ((uint32_t) 0x21000000UL) +#define DL_SAVE_CONTEXT ((uint32_t) 0x22000000UL) +#define DL_RESTORE_CONTEXT ((uint32_t) 0x23000000UL) +#define DL_RETURN ((uint32_t) 0x24000000UL) +#define DL_MACRO ((uint32_t) 0x25000000UL) +#define DL_CLEAR ((uint32_t) 0x26000000UL) +#define DL_VERTEX_FORMAT ((uint32_t) 0x27000000UL) +#define DL_BITMAP_LAYOUT_H ((uint32_t) 0x28000000UL) +#define DL_BITMAP_SIZE_H ((uint32_t) 0x29000000UL) +#define DL_PALETTE_SOURCE ((uint32_t) 0x2A000000UL) +#define DL_VERTEX_TRANSLATE_X ((uint32_t) 0x2B000000UL) +#define DL_VERTEX_TRANSLATE_Y ((uint32_t) 0x2C000000UL) +#define DL_NOP ((uint32_t) 0x2D000000UL) + +#define DL_VERTEX2F ((uint32_t) 0x40000000UL) +#define DL_VERTEX2II ((uint32_t) 0x80000000UL) + +#define CLR_COL ((uint8_t) 0x4U) +#define CLR_STN ((uint8_t) 0x2U) +#define CLR_TAG ((uint8_t) 0x1U) /* Host commands */ -#define EVE_ACTIVE 0x00U /* place FT8xx in active state */ -#define EVE_STANDBY 0x41U /* place FT8xx in Standby (clk running) */ -#define EVE_SLEEP 0x42U /* place FT8xx in Sleep (clk off) */ -#define EVE_CLKEXT 0x44U /* select external clock source */ +#define EVE_ACTIVE ((uint8_t) 0x00U) /* place EVE in active state */ +#define EVE_STANDBY ((uint8_t) 0x41U) /* place EVE in Standby (clk running) */ +#define EVE_SLEEP ((uint8_t) 0x42U) /* place EVE in Sleep (clk off) */ +#define EVE_CLKEXT ((uint8_t) 0x44U) /* select external clock source */ #if EVE_GEN < 4 -#define EVE_CLKINT 0x48U /* select internal clock source, not a valid option for BT817 / BT818 */ +#define EVE_CLKINT ((uint8_t) 0x48U) /* select internal clock source, not a valid option for BT817 / BT818 */ #endif -#define EVE_PWRDOWN 0x50U /* place FT8xx in Power Down (core off) */ -#define EVE_CLKSEL 0x61U /* configure system clock */ -#define EVE_RST_PULSE 0x68U /* reset core - all registers default and processors reset */ -#define EVE_CORERST 0x68U /* reset core - all registers default and processors reset */ -#define EVE_PINDRIVE 0x70U /* setup drive strength for various pins */ -#define EVE_PIN_PD_STATE 0x71U /* setup how pins behave during power down */ +#define EVE_PWRDOWN ((uint8_t) 0x50U) /* place EVE in Power Down (core off) */ +#define EVE_CLKSEL ((uint8_t) 0x61U) /* configure system clock */ +#define EVE_RST_PULSE ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define EVE_CORERST ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define EVE_PINDRIVE ((uint8_t) 0x70U) /* setup drive strength for various pins */ +#define EVE_PIN_PD_STATE ((uint8_t) 0x71U) /* setup how pins behave during power down */ /* Graphic command defines */ -#define EVE_NEVER 0UL -#define EVE_LESS 1UL -#define EVE_LEQUAL 2UL -#define EVE_GREATER 3UL -#define EVE_GEQUAL 4UL -#define EVE_EQUAL 5UL -#define EVE_NOTEQUAL 6UL -#define EVE_ALWAYS 7UL +#define EVE_NEVER ((uint8_t) 0UL) +#define EVE_LESS ((uint8_t) 1UL) +#define EVE_LEQUAL ((uint8_t) 2UL) +#define EVE_GREATER ((uint8_t) 3UL) +#define EVE_GEQUAL ((uint8_t) 4UL) +#define EVE_EQUAL ((uint8_t) 5UL) +#define EVE_NOTEQUAL ((uint8_t) 6UL) +#define EVE_ALWAYS ((uint8_t) 7UL) /* Bitmap formats */ -#define EVE_ARGB1555 0UL -#define EVE_L1 1UL -#define EVE_L4 2UL -#define EVE_L8 3UL -#define EVE_RGB332 4UL -#define EVE_ARGB2 5UL -#define EVE_ARGB4 6UL -#define EVE_RGB565 7UL -#define EVE_PALETTED 8UL -#define EVE_TEXT8X8 9UL -#define EVE_TEXTVGA 10UL -#define EVE_BARGRAPH 11UL +#define EVE_ARGB1555 ((uint8_t) 0UL) +#define EVE_L1 ((uint8_t) 1UL) +#define EVE_L4 ((uint8_t) 2UL) +#define EVE_L8 ((uint8_t) 3UL) +#define EVE_RGB332 ((uint8_t) 4UL) +#define EVE_ARGB2 ((uint8_t) 5UL) +#define EVE_ARGB4 ((uint8_t) 6UL) +#define EVE_RGB565 ((uint8_t) 7UL) +#define EVE_PALETTED ((uint8_t) 8UL) +#define EVE_TEXT8X8 ((uint8_t) 9UL) +#define EVE_TEXTVGA ((uint8_t) 10UL) +#define EVE_BARGRAPH ((uint8_t) 11UL) /* Bitmap filter types */ -#define EVE_NEAREST 0UL -#define EVE_BILINEAR 1UL +#define EVE_NEAREST ((uint8_t) 0UL) +#define EVE_BILINEAR ((uint8_t) 1UL) /* Bitmap wrap types */ -#define EVE_BORDER 0UL -#define EVE_REPEAT 1UL +#define EVE_BORDER ((uint8_t) 0UL) +#define EVE_REPEAT ((uint8_t) 1UL) /* Stencil defines */ -#define EVE_KEEP 1UL -#define EVE_REPLACE 2UL -#define EVE_INCR 3UL -#define EVE_DECR 4UL -#define EVE_INVERT 5UL +#define EVE_KEEP ((uint8_t) 1UL) +#define EVE_REPLACE ((uint8_t) 2UL) +#define EVE_INCR ((uint8_t) 3UL) +#define EVE_DECR ((uint8_t) 4UL) +#define EVE_INVERT ((uint8_t) 5UL) /* Graphics display list swap defines */ -#define EVE_DLSWAP_DONE 0UL -#define EVE_DLSWAP_LINE 1UL -#define EVE_DLSWAP_FRAME 2UL +#define EVE_DLSWAP_DONE ((uint8_t) 0UL) +#define EVE_DLSWAP_LINE ((uint8_t) 1UL) +#define EVE_DLSWAP_FRAME ((uint8_t) 2UL) /* Interrupt bits */ -#define EVE_INT_SWAP 0x01 -#define EVE_INT_TOUCH 0x02 -#define EVE_INT_TAG 0x04 -#define EVE_INT_SOUND 0x08 -#define EVE_INT_PLAYBACK 0x10 -#define EVE_INT_CMDEMPTY 0x20 -#define EVE_INT_CMDFLAG 0x40 -#define EVE_INT_CONVCOMPLETE 0x80 +#define EVE_INT_SWAP ((uint8_t) 0x01) +#define EVE_INT_TOUCH ((uint8_t) 0x02) +#define EVE_INT_TAG ((uint8_t) 0x04) +#define EVE_INT_SOUND ((uint8_t) 0x08) +#define EVE_INT_PLAYBACK ((uint8_t) 0x10) +#define EVE_INT_CMDEMPTY ((uint8_t) 0x20) +#define EVE_INT_CMDFLAG ((uint8_t) 0x40) +#define EVE_INT_CONVCOMPLETE ((uint8_t) 0x80) /* Touch mode */ -#define EVE_TMODE_OFF 0U -#define EVE_TMODE_ONESHOT 1U -#define EVE_TMODE_FRAME 2U -#define EVE_TMODE_CONTINUOUS 3U +#define EVE_TMODE_OFF ((uint8_t) 0U) +#define EVE_TMODE_ONESHOT ((uint8_t) 1U) +#define EVE_TMODE_FRAME ((uint8_t) 2U) +#define EVE_TMODE_CONTINUOUS ((uint8_t) 3U) /* Alpha blending */ -#define EVE_ZERO 0UL -#define EVE_ONE 1UL -#define EVE_SRC_ALPHA 2UL -#define EVE_DST_ALPHA 3UL -#define EVE_ONE_MINUS_SRC_ALPHA 4UL -#define EVE_ONE_MINUS_DST_ALPHA 5UL +#define EVE_ZERO ((uint32_t) 0UL) +#define EVE_ONE ((uint32_t) 1UL) +#define EVE_SRC_ALPHA ((uint32_t) 2UL) +#define EVE_DST_ALPHA ((uint32_t) 3UL) +#define EVE_ONE_MINUS_SRC_ALPHA ((uint32_t) 4UL) +#define EVE_ONE_MINUS_DST_ALPHA ((uint32_t) 5UL) /* Graphics primitives */ -#define EVE_BITMAPS 1UL -#define EVE_POINTS 2UL -#define EVE_LINES 3UL -#define EVE_LINE_STRIP 4UL -#define EVE_EDGE_STRIP_R 5UL -#define EVE_EDGE_STRIP_L 6UL -#define EVE_EDGE_STRIP_A 7UL -#define EVE_EDGE_STRIP_B 8UL -#define EVE_RECTS 9UL -#define EVE_INT_G8 18UL -#define EVE_INT_L8C 12UL -#define EVE_INT_VGA 13UL -#define EVE_PALETTED565 14UL -#define EVE_PALETTED4444 15UL -#define EVE_PALETTED8 16UL -#define EVE_L2 17UL +#define EVE_BITMAPS ((uint32_t) 1UL) +#define EVE_POINTS ((uint32_t) 2UL) +#define EVE_LINES ((uint32_t) 3UL) +#define EVE_LINE_STRIP ((uint32_t) 4UL) +#define EVE_EDGE_STRIP_R ((uint32_t) 5UL) +#define EVE_EDGE_STRIP_L ((uint32_t) 6UL) +#define EVE_EDGE_STRIP_A ((uint32_t) 7UL) +#define EVE_EDGE_STRIP_B ((uint32_t) 8UL) +#define EVE_RECTS ((uint32_t) 9UL) +#define EVE_INT_G8 ((uint32_t) 18UL) +#define EVE_INT_L8C ((uint32_t) 12UL) +#define EVE_INT_VGA ((uint32_t) 13UL) +#define EVE_PALETTED565 ((uint32_t) 14UL) +#define EVE_PALETTED4444 ((uint32_t) 15UL) +#define EVE_PALETTED8 ((uint32_t) 16UL) +#define EVE_L2 ((uint32_t) 17UL) /* Widget command options */ -#define EVE_OPT_MONO 1U -#define EVE_OPT_NODL 2U -#define EVE_OPT_FLAT 256U -#define EVE_OPT_CENTERX 512U -#define EVE_OPT_CENTERY 1024U +#define EVE_OPT_MONO ((uint16_t) 1U) +#define EVE_OPT_NODL ((uint16_t) 2U) +#define EVE_OPT_FLAT ((uint16_t) 256U) +#define EVE_OPT_CENTERX ((uint16_t) 512U) +#define EVE_OPT_CENTERY ((uint16_t) 1024U) #define EVE_OPT_CENTER (EVE_OPT_CENTERX | EVE_OPT_CENTERY) -#define EVE_OPT_NOBACK 4096U -#define EVE_OPT_NOTICKS 8192U -#define EVE_OPT_NOHM 16384U -#define EVE_OPT_NOPOINTER 16384U -#define EVE_OPT_NOSECS 32768U -#define EVE_OPT_NOHANDS 49152U -#define EVE_OPT_RIGHTX 2048U -#define EVE_OPT_SIGNED 256U - -#define EVE_OPT_MEDIAFIFO 16U -#define EVE_OPT_FULLSCREEN 8U -#define EVE_OPT_NOTEAR 4U -#define EVE_OPT_SOUND 32U +#define EVE_OPT_NOBACK ((uint16_t) 4096U) +#define EVE_OPT_NOTICKS ((uint16_t) 8192U) +#define EVE_OPT_NOHM ((uint16_t) 16384U) +#define EVE_OPT_NOPOINTER ((uint16_t) 16384U) +#define EVE_OPT_NOSECS ((uint16_t) 32768U) +#define EVE_OPT_NOHANDS ((uint16_t) 49152U) +#define EVE_OPT_RIGHTX ((uint16_t) 2048U) +#define EVE_OPT_SIGNED ((uint16_t) 256U) + +#define EVE_OPT_MEDIAFIFO ((uint16_t) 16U) +#define EVE_OPT_FULLSCREEN ((uint16_t) 8U) +#define EVE_OPT_NOTEAR ((uint16_t) 4U) +#define EVE_OPT_SOUND ((uint16_t) 32U) /* ADC */ -#define EVE_ADC_DIFFERENTIAL 1UL -#define EVE_ADC_SINGLE_ENDED 0UL +#define EVE_ADC_DIFFERENTIAL ((uint32_t) 1UL) +#define EVE_ADC_SINGLE_ENDED ((uint32_t) 0UL) /* Fonts */ -#define EVE_NUMCHAR_PERFONT (128UL) /* number of font characters per bitmap handle */ -#define EVE_FONT_TABLE_SIZE (148UL) /* size of the font table - utilized for loopup by the graphics engine */ -#define EVE_FONT_TABLE_POINTER (0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ +#define EVE_NUMCHAR_PERFONT ((uint32_t) 128UL) /* number of font characters per bitmap handle */ +#define EVE_FONT_TABLE_SIZE ((uint32_t) 148UL) /* size of the font table - utilized for loopup by the graphics engine */ +#define EVE_FONT_TABLE_POINTER ((uint32_t) 0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ /* Audio sample type defines */ -#define EVE_LINEAR_SAMPLES 0UL /* 8bit signed samples */ -#define EVE_ULAW_SAMPLES 1UL /* 8bit ulaw samples */ -#define EVE_ADPCM_SAMPLES 2UL /* 4bit ima adpcm samples */ +#define EVE_LINEAR_SAMPLES ((uint32_t) 0UL) /* 8bit signed samples */ +#define EVE_ULAW_SAMPLES ((uint32_t) 1UL) /* 8bit ulaw samples */ +#define EVE_ADPCM_SAMPLES ((uint32_t) 2UL) /* 4bit ima adpcm samples */ /* Synthesized sound */ -#define EVE_SILENCE 0x00U -#define EVE_SQUAREWAVE 0x01U -#define EVE_SINEWAVE 0x02U -#define EVE_SAWTOOTH 0x03U -#define EVE_TRIANGLE 0x04U -#define EVE_BEEPING 0x05U -#define EVE_ALARM 0x06U -#define EVE_WARBLE 0x07U -#define EVE_CAROUSEL 0x08U -#define EVE_PIPS(n) (0x0FU + (n)) -#define EVE_HARP 0x40U -#define EVE_XYLOPHONE 0x41U -#define EVE_TUBA 0x42U -#define EVE_GLOCKENSPIEL 0x43U -#define EVE_ORGAN 0x44U -#define EVE_TRUMPET 0x45U -#define EVE_PIANO 0x46U -#define EVE_CHIMES 0x47U -#define EVE_MUSICBOX 0x48U -#define EVE_BELL 0x49U -#define EVE_CLICK 0x50U -#define EVE_SWITCH 0x51U -#define EVE_COWBELL 0x52U -#define EVE_NOTCH 0x53U -#define EVE_HIHAT 0x54U -#define EVE_KICKDRUM 0x55U -#define EVE_POP 0x56U -#define EVE_CLACK 0x57U -#define EVE_CHACK 0x58U -#define EVE_MUTE 0x60U -#define EVE_UNMUTE 0x61U +#define EVE_SILENCE ((uint8_t) 0x00U) +#define EVE_SQUAREWAVE ((uint8_t) 0x01U) +#define EVE_SINEWAVE ((uint8_t) 0x02U) +#define EVE_SAWTOOTH ((uint8_t) 0x03U) +#define EVE_TRIANGLE ((uint8_t) 0x04U) +#define EVE_BEEPING ((uint8_t) 0x05U) +#define EVE_ALARM ((uint8_t) 0x06U) +#define EVE_WARBLE ((uint8_t) 0x07U) +#define EVE_CAROUSEL ((uint8_t) 0x08U) +#define EVE_PIPS(n) ((uint8_t) (0x0FU + (n))) +#define EVE_HARP ((uint8_t) 0x40U) +#define EVE_XYLOPHONE ((uint8_t) 0x41U) +#define EVE_TUBA ((uint8_t) 0x42U) +#define EVE_GLOCKENSPIEL ((uint8_t) 0x43U) +#define EVE_ORGAN ((uint8_t) 0x44U) +#define EVE_TRUMPET ((uint8_t) 0x45U) +#define EVE_PIANO ((uint8_t) 0x46U) +#define EVE_CHIMES ((uint8_t) 0x47U) +#define EVE_MUSICBOX ((uint8_t) 0x48U) +#define EVE_BELL ((uint8_t) 0x49U) +#define EVE_CLICK ((uint8_t) 0x50U) +#define EVE_SWITCH ((uint8_t) 0x51U) +#define EVE_COWBELL ((uint8_t) 0x52U) +#define EVE_NOTCH ((uint8_t) 0x53U) +#define EVE_HIHAT ((uint8_t) 0x54U) +#define EVE_KICKDRUM ((uint8_t) 0x55U) +#define EVE_POP ((uint8_t) 0x56U) +#define EVE_CLACK ((uint8_t) 0x57U) +#define EVE_CHACK ((uint8_t) 0x58U) +#define EVE_MUTE ((uint8_t) 0x60U) +#define EVE_UNMUTE ((uint8_t) 0x61U) /* Synthesized sound frequencies, midi note */ -#define EVE_MIDI_A0 21U -#define EVE_MIDI_A_0 22U -#define EVE_MIDI_B0 23U -#define EVE_MIDI_C1 24U -#define EVE_MIDI_C_1 25U -#define EVE_MIDI_D1 26U -#define EVE_MIDI_D_1 27U -#define EVE_MIDI_E1 28U -#define EVE_MIDI_F1 29U -#define EVE_MIDI_F_1 30U -#define EVE_MIDI_G1 31U -#define EVE_MIDI_G_1 32U -#define EVE_MIDI_A1 33U -#define EVE_MIDI_A_1 34U -#define EVE_MIDI_B1 35U -#define EVE_MIDI_C2 36U -#define EVE_MIDI_C_2 37U -#define EVE_MIDI_D2 38U -#define EVE_MIDI_D_2 39U -#define EVE_MIDI_E2 40U -#define EVE_MIDI_F2 41U -#define EVE_MIDI_F_2 42U -#define EVE_MIDI_G2 43U -#define EVE_MIDI_G_2 44U -#define EVE_MIDI_A2 45U -#define EVE_MIDI_A_2 46U -#define EVE_MIDI_B2 47U -#define EVE_MIDI_C3 48U -#define EVE_MIDI_C_3 49U -#define EVE_MIDI_D3 50U -#define EVE_MIDI_D_3 51U -#define EVE_MIDI_E3 52U -#define EVE_MIDI_F3 53U -#define EVE_MIDI_F_3 54U -#define EVE_MIDI_G3 55U -#define EVE_MIDI_G_3 56U -#define EVE_MIDI_A3 57U -#define EVE_MIDI_A_3 58U -#define EVE_MIDI_B3 59U -#define EVE_MIDI_C4 60U -#define EVE_MIDI_C_4 61U -#define EVE_MIDI_D4 62U -#define EVE_MIDI_D_4 63U -#define EVE_MIDI_E4 64U -#define EVE_MIDI_F4 65U -#define EVE_MIDI_F_4 66U -#define EVE_MIDI_G4 67U -#define EVE_MIDI_G_4 68U -#define EVE_MIDI_A4 69U -#define EVE_MIDI_A_4 70U -#define EVE_MIDI_B4 71U -#define EVE_MIDI_C5 72U -#define EVE_MIDI_C_5 73U -#define EVE_MIDI_D5 74U -#define EVE_MIDI_D_5 75U -#define EVE_MIDI_E5 76U -#define EVE_MIDI_F5 77U -#define EVE_MIDI_F_5 78U -#define EVE_MIDI_G5 79U -#define EVE_MIDI_G_5 80U -#define EVE_MIDI_A5 81U -#define EVE_MIDI_A_5 82U -#define EVE_MIDI_B5 83U -#define EVE_MIDI_C6 84U -#define EVE_MIDI_C_6 85U -#define EVE_MIDI_D6 86U -#define EVE_MIDI_D_6 87U -#define EVE_MIDI_E6 88U -#define EVE_MIDI_F6 89U -#define EVE_MIDI_F_6 90U -#define EVE_MIDI_G6 91U -#define EVE_MIDI_G_6 92U -#define EVE_MIDI_A6 93U -#define EVE_MIDI_A_6 94U -#define EVE_MIDI_B6 95U -#define EVE_MIDI_C7 96U -#define EVE_MIDI_C_7 97U -#define EVE_MIDI_D7 98U -#define EVE_MIDI_D_7 99U -#define EVE_MIDI_E7 100U -#define EVE_MIDI_F7 101U -#define EVE_MIDI_F_7 102U -#define EVE_MIDI_G7 103U -#define EVE_MIDI_G_7 104U -#define EVE_MIDI_A7 105U -#define EVE_MIDI_A_7 106U -#define EVE_MIDI_B7 107U -#define EVE_MIDI_C8 108U +#define EVE_MIDI_A0 ((uint8_t) 21U) +#define EVE_MIDI_A_0 ((uint8_t) 22U) +#define EVE_MIDI_B0 ((uint8_t) 23U) +#define EVE_MIDI_C1 ((uint8_t) 24U) +#define EVE_MIDI_C_1 ((uint8_t) 25U) +#define EVE_MIDI_D1 ((uint8_t) 26U) +#define EVE_MIDI_D_1 ((uint8_t) 27U) +#define EVE_MIDI_E1 ((uint8_t) 28U) +#define EVE_MIDI_F1 ((uint8_t) 29U) +#define EVE_MIDI_F_1 ((uint8_t) 30U) +#define EVE_MIDI_G1 ((uint8_t) 31U) +#define EVE_MIDI_G_1 ((uint8_t) 32U) +#define EVE_MIDI_A1 ((uint8_t) 33U) +#define EVE_MIDI_A_1 ((uint8_t) 34U) +#define EVE_MIDI_B1 ((uint8_t) 35U) +#define EVE_MIDI_C2 ((uint8_t) 36U) +#define EVE_MIDI_C_2 ((uint8_t) 37U) +#define EVE_MIDI_D2 ((uint8_t) 38U) +#define EVE_MIDI_D_2 ((uint8_t) 39U) +#define EVE_MIDI_E2 ((uint8_t) 40U) +#define EVE_MIDI_F2 ((uint8_t) 41U) +#define EVE_MIDI_F_2 ((uint8_t) 42U) +#define EVE_MIDI_G2 ((uint8_t) 43U) +#define EVE_MIDI_G_2 ((uint8_t) 44U) +#define EVE_MIDI_A2 ((uint8_t) 45U) +#define EVE_MIDI_A_2 ((uint8_t) 46U) +#define EVE_MIDI_B2 ((uint8_t) 47U) +#define EVE_MIDI_C3 ((uint8_t) 48U) +#define EVE_MIDI_C_3 ((uint8_t) 49U) +#define EVE_MIDI_D3 ((uint8_t) 50U) +#define EVE_MIDI_D_3 ((uint8_t) 51U) +#define EVE_MIDI_E3 ((uint8_t) 52U) +#define EVE_MIDI_F3 ((uint8_t) 53U) +#define EVE_MIDI_F_3 ((uint8_t) 54U) +#define EVE_MIDI_G3 ((uint8_t) 55U) +#define EVE_MIDI_G_3 ((uint8_t) 56U) +#define EVE_MIDI_A3 ((uint8_t) 57U) +#define EVE_MIDI_A_3 ((uint8_t) 58U) +#define EVE_MIDI_B3 ((uint8_t) 59U) +#define EVE_MIDI_C4 ((uint8_t) 60U) +#define EVE_MIDI_C_4 ((uint8_t) 61U) +#define EVE_MIDI_D4 ((uint8_t) 62U) +#define EVE_MIDI_D_4 ((uint8_t) 63U) +#define EVE_MIDI_E4 ((uint8_t) 64U) +#define EVE_MIDI_F4 ((uint8_t) 65U) +#define EVE_MIDI_F_4 ((uint8_t) 66U) +#define EVE_MIDI_G4 ((uint8_t) 67U) +#define EVE_MIDI_G_4 ((uint8_t) 68U) +#define EVE_MIDI_A4 ((uint8_t) 69U) +#define EVE_MIDI_A_4 ((uint8_t) 70U) +#define EVE_MIDI_B4 ((uint8_t) 71U) +#define EVE_MIDI_C5 ((uint8_t) 72U) +#define EVE_MIDI_C_5 ((uint8_t) 73U) +#define EVE_MIDI_D5 ((uint8_t) 74U) +#define EVE_MIDI_D_5 ((uint8_t) 75U) +#define EVE_MIDI_E5 ((uint8_t) 76U) +#define EVE_MIDI_F5 ((uint8_t) 77U) +#define EVE_MIDI_F_5 ((uint8_t) 78U) +#define EVE_MIDI_G5 ((uint8_t) 79U) +#define EVE_MIDI_G_5 ((uint8_t) 80U) +#define EVE_MIDI_A5 ((uint8_t) 81U) +#define EVE_MIDI_A_5 ((uint8_t) 82U) +#define EVE_MIDI_B5 ((uint8_t) 83U) +#define EVE_MIDI_C6 ((uint8_t) 84U) +#define EVE_MIDI_C_6 ((uint8_t) 85U) +#define EVE_MIDI_D6 ((uint8_t) 86U) +#define EVE_MIDI_D_6 ((uint8_t) 87U) +#define EVE_MIDI_E6 ((uint8_t) 88U) +#define EVE_MIDI_F6 ((uint8_t) 89U) +#define EVE_MIDI_F_6 ((uint8_t) 90U) +#define EVE_MIDI_G6 ((uint8_t) 91U) +#define EVE_MIDI_G_6 ((uint8_t) 92U) +#define EVE_MIDI_A6 ((uint8_t) 93U) +#define EVE_MIDI_A_6 ((uint8_t) 94U) +#define EVE_MIDI_B6 ((uint8_t) 95U) +#define EVE_MIDI_C7 ((uint8_t) 96U) +#define EVE_MIDI_C_7 ((uint8_t) 97U) +#define EVE_MIDI_D7 ((uint8_t) 98U) +#define EVE_MIDI_D_7 ((uint8_t) 99U) +#define EVE_MIDI_E7 ((uint8_t) 100U) +#define EVE_MIDI_F7 ((uint8_t) 101U) +#define EVE_MIDI_F_7 ((uint8_t) 102U) +#define EVE_MIDI_G7 ((uint8_t) 103U) +#define EVE_MIDI_G_7 ((uint8_t) 104U) +#define EVE_MIDI_A7 ((uint8_t) 105U) +#define EVE_MIDI_A_7 ((uint8_t) 106U) +#define EVE_MIDI_B7 ((uint8_t) 107U) +#define EVE_MIDI_C8 ((uint8_t) 108U) /* GPIO bits */ -#define EVE_GPIO0 0U -#define EVE_GPIO1 1U /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ -#define EVE_GPIO7 7U /* default gpio pin for display enable, 1 - enable, 0 - disable */ +#define EVE_GPIO0 ((uint8_t) 0U) +#define EVE_GPIO1 ((uint8_t) 1U) /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ +#define EVE_GPIO7 ((uint8_t) 7U) /* default gpio pin for display enable, 1 - enable, 0 - disable */ /* Display rotation */ -#define EVE_DISPLAY_0 0U /* 0 degrees rotation */ -#define EVE_DISPLAY_180 1U /* 180 degrees rotation */ +#define EVE_DISPLAY_0 ((uint8_t) 0U) /* 0 degrees rotation */ +#define EVE_DISPLAY_180 ((uint8_t) 1U) /* 180 degrees rotation */ /* Commands */ -#define CMD_APPEND 0xFFFFFF1EUL -#define CMD_BGCOLOR 0xFFFFFF09UL -#define CMD_BUTTON 0xFFFFFF0DUL -#define CMD_CALIBRATE 0xFFFFFF15UL -#define CMD_CLOCK 0xFFFFFF14UL -#define CMD_COLDSTART 0xFFFFFF32UL -#define CMD_DIAL 0xFFFFFF2DUL -#define CMD_DLSTART 0xFFFFFF00UL -#define CMD_FGCOLOR 0xFFFFFF0AUL -#define CMD_GAUGE 0xFFFFFF13UL -#define CMD_GETMATRIX 0xFFFFFF33UL -#define CMD_GETPROPS 0xFFFFFF25UL -#define CMD_GETPTR 0xFFFFFF23UL -#define CMD_GRADCOLOR 0xFFFFFF34UL -#define CMD_GRADIENT 0xFFFFFF0BUL -#define CMD_INFLATE 0xFFFFFF22UL -#define CMD_INTERRUPT 0xFFFFFF02UL -#define CMD_KEYS 0xFFFFFF0EUL -#define CMD_LOADIDENTITY 0xFFFFFF26UL -#define CMD_LOADIMAGE 0xFFFFFF24UL -#define CMD_LOGO 0xFFFFFF31UL -#define CMD_MEDIAFIFO 0xFFFFFF39UL -#define CMD_MEMCPY 0xFFFFFF1DUL -#define CMD_MEMCRC 0xFFFFFF18UL -#define CMD_MEMSET 0xFFFFFF1BUL -#define CMD_MEMWRITE 0xFFFFFF1AUL -#define CMD_MEMZERO 0xFFFFFF1CUL -#define CMD_NUMBER 0xFFFFFF2EUL -#define CMD_PLAYVIDEO 0xFFFFFF3AUL -#define CMD_PROGRESS 0xFFFFFF0FUL -#define CMD_REGREAD 0xFFFFFF19UL -#define CMD_ROMFONT 0xFFFFFF3FUL -#define CMD_ROTATE 0xFFFFFF29UL -#define CMD_SCALE 0xFFFFFF28UL -#define CMD_SCREENSAVER 0xFFFFFF2FUL -#define CMD_SCROLLBAR 0xFFFFFF11UL -#define CMD_SETBASE 0xFFFFFF38UL -#define CMD_SETBITMAP 0xFFFFFF43UL -#define CMD_SETFONT 0xFFFFFF2BUL -#define CMD_SETFONT2 0xFFFFFF3BUL -#define CMD_SETMATRIX 0xFFFFFF2AUL -#define CMD_SETROTATE 0xFFFFFF36UL -#define CMD_SETSCRATCH 0xFFFFFF3CUL -#define CMD_SKETCH 0xFFFFFF30UL -#define CMD_SLIDER 0xFFFFFF10UL -#define CMD_SNAPSHOT 0xFFFFFF1FUL -#define CMD_SNAPSHOT2 0xFFFFFF37UL -#define CMD_SPINNER 0xFFFFFF16UL -#define CMD_STOP 0xFFFFFF17UL -#define CMD_SWAP 0xFFFFFF01UL -#define CMD_TEXT 0xFFFFFF0CUL -#define CMD_TOGGLE 0xFFFFFF12UL -#define CMD_TRACK 0xFFFFFF2CUL -#define CMD_TRANSLATE 0xFFFFFF27UL -#define CMD_VIDEOFRAME 0xFFFFFF41UL -#define CMD_VIDEOSTART 0xFFFFFF40UL +#define CMD_APPEND ((uint32_t) 0xFFFFFF1EUL) +#define CMD_BGCOLOR ((uint32_t) 0xFFFFFF09UL) +#define CMD_BUTTON ((uint32_t) 0xFFFFFF0DUL) +#define CMD_CALIBRATE ((uint32_t) 0xFFFFFF15UL) +#define CMD_CLOCK ((uint32_t) 0xFFFFFF14UL) +#define CMD_COLDSTART ((uint32_t) 0xFFFFFF32UL) +#define CMD_DIAL ((uint32_t) 0xFFFFFF2DUL) +#define CMD_DLSTART ((uint32_t) 0xFFFFFF00UL) +#define CMD_FGCOLOR ((uint32_t) 0xFFFFFF0AUL) +#define CMD_GAUGE ((uint32_t) 0xFFFFFF13UL) +#define CMD_GETMATRIX ((uint32_t) 0xFFFFFF33UL) +#define CMD_GETPROPS ((uint32_t) 0xFFFFFF25UL) +#define CMD_GETPTR ((uint32_t) 0xFFFFFF23UL) +#define CMD_GRADCOLOR ((uint32_t) 0xFFFFFF34UL) +#define CMD_GRADIENT ((uint32_t) 0xFFFFFF0BUL) +#define CMD_INFLATE ((uint32_t) 0xFFFFFF22UL) +#define CMD_INTERRUPT ((uint32_t) 0xFFFFFF02UL) +#define CMD_KEYS ((uint32_t) 0xFFFFFF0EUL) +#define CMD_LOADIDENTITY ((uint32_t) 0xFFFFFF26UL) +#define CMD_LOADIMAGE ((uint32_t) 0xFFFFFF24UL) +#define CMD_LOGO ((uint32_t) 0xFFFFFF31UL) +#define CMD_MEDIAFIFO ((uint32_t) 0xFFFFFF39UL) +#define CMD_MEMCPY ((uint32_t) 0xFFFFFF1DUL) +#define CMD_MEMCRC ((uint32_t) 0xFFFFFF18UL) +#define CMD_MEMSET ((uint32_t) 0xFFFFFF1BUL) +#define CMD_MEMWRITE ((uint32_t) 0xFFFFFF1AUL) +#define CMD_MEMZERO ((uint32_t) 0xFFFFFF1CUL) +#define CMD_NUMBER ((uint32_t) 0xFFFFFF2EUL) +#define CMD_PLAYVIDEO ((uint32_t) 0xFFFFFF3AUL) +#define CMD_PROGRESS ((uint32_t) 0xFFFFFF0FUL) +#define CMD_REGREAD ((uint32_t) 0xFFFFFF19UL) +#define CMD_ROMFONT ((uint32_t) 0xFFFFFF3FUL) +#define CMD_ROTATE ((uint32_t) 0xFFFFFF29UL) +#define CMD_SCALE ((uint32_t) 0xFFFFFF28UL) +#define CMD_SCREENSAVER ((uint32_t) 0xFFFFFF2FUL) +#define CMD_SCROLLBAR ((uint32_t) 0xFFFFFF11UL) +#define CMD_SETBASE ((uint32_t) 0xFFFFFF38UL) +#define CMD_SETBITMAP ((uint32_t) 0xFFFFFF43UL) +#define CMD_SETFONT ((uint32_t) 0xFFFFFF2BUL) +#define CMD_SETFONT2 ((uint32_t) 0xFFFFFF3BUL) +#define CMD_SETMATRIX ((uint32_t) 0xFFFFFF2AUL) +#define CMD_SETROTATE ((uint32_t) 0xFFFFFF36UL) +#define CMD_SETSCRATCH ((uint32_t) 0xFFFFFF3CUL) +#define CMD_SKETCH ((uint32_t) 0xFFFFFF30UL) +#define CMD_SLIDER ((uint32_t) 0xFFFFFF10UL) +#define CMD_SNAPSHOT ((uint32_t) 0xFFFFFF1FUL) +#define CMD_SNAPSHOT2 ((uint32_t) 0xFFFFFF37UL) +#define CMD_SPINNER ((uint32_t) 0xFFFFFF16UL) +#define CMD_STOP ((uint32_t) 0xFFFFFF17UL) +#define CMD_SWAP ((uint32_t) 0xFFFFFF01UL) +#define CMD_TEXT ((uint32_t) 0xFFFFFF0CUL) +#define CMD_TOGGLE ((uint32_t) 0xFFFFFF12UL) +#define CMD_TRACK ((uint32_t) 0xFFFFFF2CUL) +#define CMD_TRANSLATE ((uint32_t) 0xFFFFFF27UL) +#define CMD_VIDEOFRAME ((uint32_t) 0xFFFFFF41UL) +#define CMD_VIDEOSTART ((uint32_t) 0xFFFFFF40UL) /* Registers */ -#define REG_ANA_COMP 0x00302184UL /* only listed in datasheet */ -#define REG_BIST_EN 0x00302174UL /* only listed in datasheet */ -#define REG_CLOCK 0x00302008UL -#define REG_CMDB_SPACE 0x00302574UL -#define REG_CMDB_WRITE 0x00302578UL -#define REG_CMD_DL 0x00302100UL -#define REG_CMD_READ 0x003020f8UL -#define REG_CMD_WRITE 0x003020fcUL -#define REG_CPURESET 0x00302020UL -#define REG_CSPREAD 0x00302068UL -#define REG_CTOUCH_EXTENDED 0x00302108UL -#define REG_CTOUCH_TOUCH0_XY 0x00302124UL /* only listed in datasheet */ -#define REG_CTOUCH_TOUCH4_X 0x0030216cUL -#define REG_CTOUCH_TOUCH4_Y 0x00302120UL -#define REG_CTOUCH_TOUCH1_XY 0x0030211cUL -#define REG_CTOUCH_TOUCH2_XY 0x0030218cUL -#define REG_CTOUCH_TOUCH3_XY 0x00302190UL -#define REG_TOUCH_CONFIG 0x00302168UL -#define REG_DATESTAMP 0x00302564UL /* only listed in datasheet */ -#define REG_DITHER 0x00302060UL -#define REG_DLSWAP 0x00302054UL -#define REG_FRAMES 0x00302004UL -#define REG_FREQUENCY 0x0030200cUL -#define REG_GPIO 0x00302094UL -#define REG_GPIOX 0x0030209cUL -#define REG_GPIOX_DIR 0x00302098UL -#define REG_GPIO_DIR 0x00302090UL -#define REG_HCYCLE 0x0030202cUL -#define REG_HOFFSET 0x00302030UL -#define REG_HSIZE 0x00302034UL -#define REG_HSYNC0 0x00302038UL -#define REG_HSYNC1 0x0030203cUL -#define REG_ID 0x00302000UL -#define REG_INT_EN 0x003020acUL -#define REG_INT_FLAGS 0x003020a8UL -#define REG_INT_MASK 0x003020b0UL -#define REG_MACRO_0 0x003020d8UL -#define REG_MACRO_1 0x003020dcUL -#define REG_MEDIAFIFO_READ 0x00309014UL /* only listed in programmers guide */ -#define REG_MEDIAFIFO_WRITE 0x00309018UL /* only listed in programmers guide */ -#define REG_OUTBITS 0x0030205cUL -#define REG_PCLK 0x00302070UL -#define REG_PCLK_POL 0x0030206cUL -#define REG_PLAY 0x0030208cUL -#define REG_PLAYBACK_FORMAT 0x003020c4UL -#define REG_PLAYBACK_FREQ 0x003020c0UL -#define REG_PLAYBACK_LENGTH 0x003020b8UL -#define REG_PLAYBACK_LOOP 0x003020c8UL -#define REG_PLAYBACK_PLAY 0x003020ccUL -#define REG_PLAYBACK_READPTR 0x003020bcUL -#define REG_PLAYBACK_START 0x003020b4UL -#define REG_PWM_DUTY 0x003020d4UL -#define REG_PWM_HZ 0x003020d0UL -#define REG_RENDERMODE 0x00302010UL /* only listed in datasheet */ -#define REG_ROTATE 0x00302058UL -#define REG_SNAPFORMAT 0x0030201cUL /* only listed in datasheet */ -#define REG_SNAPSHOT 0x00302018UL /* only listed in datasheet */ -#define REG_SNAPY 0x00302014UL /* only listed in datasheet */ -#define REG_SOUND 0x00302088UL -#define REG_SPI_WIDTH 0x00302188UL /* listed with false offset in programmers guide V1.1 */ -#define REG_SWIZZLE 0x00302064UL -#define REG_TAG 0x0030207cUL -#define REG_TAG_X 0x00302074UL -#define REG_TAG_Y 0x00302078UL -#define REG_TAP_CRC 0x00302024UL /* only listed in datasheet */ -#define REG_TAP_MASK 0x00302028UL /* only listed in datasheet */ -#define REG_TOUCH_ADC_MODE 0x00302108UL -#define REG_TOUCH_CHARGE 0x0030210cUL -#define REG_TOUCH_DIRECT_XY 0x0030218cUL -#define REG_TOUCH_DIRECT_Z1Z2 0x00302190UL -#define REG_TOUCH_MODE 0x00302104UL -#define REG_TOUCH_OVERSAMPLE 0x00302114UL -#define REG_TOUCH_RAW_XY 0x0030211cUL -#define REG_TOUCH_RZ 0x00302120UL -#define REG_TOUCH_RZTHRESH 0x00302118UL -#define REG_TOUCH_SCREEN_XY 0x00302124UL -#define REG_TOUCH_SETTLE 0x00302110UL -#define REG_TOUCH_TAG 0x0030212cUL -#define REG_TOUCH_TAG1 0x00302134UL /* only listed in datasheet */ -#define REG_TOUCH_TAG1_XY 0x00302130UL /* only listed in datasheet */ -#define REG_TOUCH_TAG2 0x0030213cUL /* only listed in datasheet */ -#define REG_TOUCH_TAG2_XY 0x00302138UL /* only listed in datasheet */ -#define REG_TOUCH_TAG3 0x00302144UL /* only listed in datasheet */ -#define REG_TOUCH_TAG3_XY 0x00302140UL /* only listed in datasheet */ -#define REG_TOUCH_TAG4 0x0030214cUL /* only listed in datasheet */ -#define REG_TOUCH_TAG4_XY 0x00302148UL /* only listed in datasheet */ -#define REG_TOUCH_TAG_XY 0x00302128UL -#define REG_TOUCH_TRANSFORM_A 0x00302150UL -#define REG_TOUCH_TRANSFORM_B 0x00302154UL -#define REG_TOUCH_TRANSFORM_C 0x00302158UL -#define REG_TOUCH_TRANSFORM_D 0x0030215cUL -#define REG_TOUCH_TRANSFORM_E 0x00302160UL -#define REG_TOUCH_TRANSFORM_F 0x00302164UL -#define REG_TRACKER 0x00309000UL /* only listed in programmers guide */ -#define REG_TRACKER_1 0x00309004UL /* only listed in programmers guide */ -#define REG_TRACKER_2 0x00309008UL /* only listed in programmers guide */ -#define REG_TRACKER_3 0x0030900cUL /* only listed in programmers guide */ -#define REG_TRACKER_4 0x00309010UL /* only listed in programmers guide */ -#define REG_TRIM 0x00302180UL -#define REG_VCYCLE 0x00302040UL -#define REG_VOFFSET 0x00302044UL -#define REG_VOL_PB 0x00302080UL -#define REG_VOL_SOUND 0x00302084UL -#define REG_VSIZE 0x00302048UL -#define REG_VSYNC0 0x0030204cUL -#define REG_VSYNC1 0x00302050UL +#define REG_ANA_COMP ((uint32_t) 0x00302184UL) /* only listed in datasheet */ +#define REG_BIST_EN ((uint32_t) 0x00302174UL) /* only listed in datasheet */ +#define REG_CLOCK ((uint32_t) 0x00302008UL) +#define REG_CMDB_SPACE ((uint32_t) 0x00302574UL) +#define REG_CMDB_WRITE ((uint32_t) 0x00302578UL) +#define REG_CMD_DL ((uint32_t) 0x00302100UL) +#define REG_CMD_READ ((uint32_t) 0x003020f8UL) +#define REG_CMD_WRITE ((uint32_t) 0x003020fcUL) +#define REG_CPURESET ((uint32_t) 0x00302020UL) +#define REG_CSPREAD ((uint32_t) 0x00302068UL) +#define REG_CTOUCH_EXTENDED ((uint32_t) 0x00302108UL) +#define REG_CTOUCH_TOUCH0_XY ((uint32_t) 0x00302124UL) /* only listed in datasheet */ +#define REG_CTOUCH_TOUCH4_X ((uint32_t) 0x0030216cUL) +#define REG_CTOUCH_TOUCH4_Y ((uint32_t) 0x00302120UL) +#define REG_CTOUCH_TOUCH1_XY ((uint32_t) 0x0030211cUL) +#define REG_CTOUCH_TOUCH2_XY ((uint32_t) 0x0030218cUL) +#define REG_CTOUCH_TOUCH3_XY ((uint32_t) 0x00302190UL) +#define REG_TOUCH_CONFIG ((uint32_t) 0x00302168UL) +#define REG_DATESTAMP ((uint32_t) 0x00302564UL) /* only listed in datasheet */ +#define REG_DITHER ((uint32_t) 0x00302060UL) +#define REG_DLSWAP ((uint32_t) 0x00302054UL) +#define REG_FRAMES ((uint32_t) 0x00302004UL) +#define REG_FREQUENCY ((uint32_t) 0x0030200cUL) +#define REG_GPIO ((uint32_t) 0x00302094UL) +#define REG_GPIOX ((uint32_t) 0x0030209cUL) +#define REG_GPIOX_DIR ((uint32_t) 0x00302098UL) +#define REG_GPIO_DIR ((uint32_t) 0x00302090UL) +#define REG_HCYCLE ((uint32_t) 0x0030202cUL) +#define REG_HOFFSET ((uint32_t) 0x00302030UL) +#define REG_HSIZE ((uint32_t) 0x00302034UL) +#define REG_HSYNC0 ((uint32_t) 0x00302038UL) +#define REG_HSYNC1 ((uint32_t) 0x0030203cUL) +#define REG_ID ((uint32_t) 0x00302000UL) +#define REG_INT_EN ((uint32_t) 0x003020acUL) +#define REG_INT_FLAGS ((uint32_t) 0x003020a8UL) +#define REG_INT_MASK ((uint32_t) 0x003020b0UL) +#define REG_MACRO_0 ((uint32_t) 0x003020d8UL) +#define REG_MACRO_1 ((uint32_t) 0x003020dcUL) +#define REG_MEDIAFIFO_READ ((uint32_t) 0x00309014UL) /* only listed in programmers guide */ +#define REG_MEDIAFIFO_WRITE ((uint32_t) 0x00309018UL) /* only listed in programmers guide */ +#define REG_OUTBITS ((uint32_t) 0x0030205cUL) +#define REG_PCLK ((uint32_t) 0x00302070UL) +#define REG_PCLK_POL ((uint32_t) 0x0030206cUL) +#define REG_PLAY ((uint32_t) 0x0030208cUL) +#define REG_PLAYBACK_FORMAT ((uint32_t) 0x003020c4UL) +#define REG_PLAYBACK_FREQ ((uint32_t) 0x003020c0UL) +#define REG_PLAYBACK_LENGTH ((uint32_t) 0x003020b8UL) +#define REG_PLAYBACK_LOOP ((uint32_t) 0x003020c8UL) +#define REG_PLAYBACK_PLAY ((uint32_t) 0x003020ccUL) +#define REG_PLAYBACK_READPTR ((uint32_t) 0x003020bcUL) +#define REG_PLAYBACK_START ((uint32_t) 0x003020b4UL) +#define REG_PWM_DUTY ((uint32_t) 0x003020d4UL) +#define REG_PWM_HZ ((uint32_t) 0x003020d0UL) +#define REG_RENDERMODE ((uint32_t) 0x00302010UL) /* only listed in datasheet */ +#define REG_ROTATE ((uint32_t) 0x00302058UL) +#define REG_SNAPFORMAT ((uint32_t) 0x0030201cUL) /* only listed in datasheet */ +#define REG_SNAPSHOT ((uint32_t) 0x00302018UL) /* only listed in datasheet */ +#define REG_SNAPY ((uint32_t) 0x00302014UL) /* only listed in datasheet */ +#define REG_SOUND ((uint32_t) 0x00302088UL) +#define REG_SPI_WIDTH ((uint32_t) 0x00302188UL) /* listed with false offset in programmers guide V1.1 */ +#define REG_SWIZZLE ((uint32_t) 0x00302064UL) +#define REG_TAG ((uint32_t) 0x0030207cUL) +#define REG_TAG_X ((uint32_t) 0x00302074UL) +#define REG_TAG_Y ((uint32_t) 0x00302078UL) +#define REG_TAP_CRC ((uint32_t) 0x00302024UL) /* only listed in datasheet */ +#define REG_TAP_MASK ((uint32_t) 0x00302028UL) /* only listed in datasheet */ +#define REG_TOUCH_ADC_MODE ((uint32_t) 0x00302108UL) +#define REG_TOUCH_CHARGE ((uint32_t) 0x0030210cUL) +#define REG_TOUCH_DIRECT_XY ((uint32_t) 0x0030218cUL) +#define REG_TOUCH_DIRECT_Z1Z2 ((uint32_t) 0x00302190UL) +#define REG_TOUCH_MODE ((uint32_t) 0x00302104UL) +#define REG_TOUCH_OVERSAMPLE ((uint32_t) 0x00302114UL) +#define REG_TOUCH_RAW_XY ((uint32_t) 0x0030211cUL) +#define REG_TOUCH_RZ ((uint32_t) 0x00302120UL) +#define REG_TOUCH_RZTHRESH ((uint32_t) 0x00302118UL) +#define REG_TOUCH_SCREEN_XY ((uint32_t) 0x00302124UL) +#define REG_TOUCH_SETTLE ((uint32_t) 0x00302110UL) +#define REG_TOUCH_TAG ((uint32_t) 0x0030212cUL) +#define REG_TOUCH_TAG1 ((uint32_t) 0x00302134UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG1_XY ((uint32_t) 0x00302130UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG2 ((uint32_t) 0x0030213cUL) /* only listed in datasheet */ +#define REG_TOUCH_TAG2_XY ((uint32_t) 0x00302138UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG3 ((uint32_t) 0x00302144UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG3_XY ((uint32_t) 0x00302140UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG4 ((uint32_t) 0x0030214cUL)/* only listed in datasheet */ +#define REG_TOUCH_TAG4_XY ((uint32_t) 0x00302148UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG_XY ((uint32_t) 0x00302128UL) +#define REG_TOUCH_TRANSFORM_A ((uint32_t) 0x00302150UL) +#define REG_TOUCH_TRANSFORM_B ((uint32_t) 0x00302154UL) +#define REG_TOUCH_TRANSFORM_C ((uint32_t) 0x00302158UL) +#define REG_TOUCH_TRANSFORM_D ((uint32_t) 0x0030215cUL) +#define REG_TOUCH_TRANSFORM_E ((uint32_t) 0x00302160UL) +#define REG_TOUCH_TRANSFORM_F ((uint32_t) 0x00302164UL) +#define REG_TRACKER ((uint32_t) 0x00309000UL) /* only listed in programmers guide */ +#define REG_TRACKER_1 ((uint32_t) 0x00309004UL) /* only listed in programmers guide */ +#define REG_TRACKER_2 ((uint32_t) 0x00309008UL) /* only listed in programmers guide */ +#define REG_TRACKER_3 ((uint32_t) 0x0030900cUL) /* only listed in programmers guide */ +#define REG_TRACKER_4 ((uint32_t) 0x00309010UL) /* only listed in programmers guide */ +#define REG_TRIM ((uint32_t) 0x00302180UL) +#define REG_VCYCLE ((uint32_t) 0x00302040UL) +#define REG_VOFFSET ((uint32_t) 0x00302044UL) +#define REG_VOL_PB ((uint32_t) 0x00302080UL) +#define REG_VOL_SOUND ((uint32_t) 0x00302084UL) +#define REG_VSIZE ((uint32_t) 0x00302048UL) +#define REG_VSYNC0 ((uint32_t) 0x0030204cUL) +#define REG_VSYNC1 ((uint32_t) 0x00302050UL) /* Macros for static display list generation */ -#define ALPHA_FUNC(func,ref) ((DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) -#define BITMAP_HANDLE(handle) ((DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) -#define BITMAP_LAYOUT(format,linestride,height) ((DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) -#define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) -/* beware, this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits */ -#define BITMAP_LAYOUT_H(linestride,height) ((DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +//#define ALPHA_FUNC(func,ref) ((DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) +/** + * @brief Set the alpha test function. + * + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t ALPHA_FUNC(uint8_t func, uint8_t ref) +{ + uint32_t const funcv = ((uint32_t) func & 7U) << 8U; + return (DL_ALPHA_FUNC | funcv | ref); +} -/* beware, this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits */ -#define BITMAP_SIZE_H(width,height) ((DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +//#define BITMAP_HANDLE(handle) ((DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) +/** + * @brief Set the bitmap handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_HANDLE(uint8_t handle) +{ + return (DL_BITMAP_HANDLE | ((handle) & 0x1FUL)); +} -#define BITMAP_SOURCE(addr) ((DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +//#define BITMAP_LAYOUT(format,linestride,height) ((DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint8_t height) +{ + uint32_t const formatv = ((uint32_t) format & 0x1FUL) << 19U; + uint32_t const linestridev = ((uint32_t) linestride & 0x3FFUL) << 9U; + return (DL_BITMAP_LAYOUT | formatv | linestridev | height); +} + +//#define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) +{ + uint32_t const filterv = (filter & 0x1UL) << 20U; + uint32_t const wrapxv = (wrapx & 0x1UL) << 19U; + uint32_t const wrapyv = (wrapy & 0x1UL) << 18U; + uint32_t const widthv = (width & 0x1FFUL) << 9U; + uint32_t const heightv = (height & 0x1FFUL) << 9U; + return (DL_BITMAP_SIZE | filterv | wrapxv | wrapyv | widthv | heightv); +} + +//#define BITMAP_LAYOUT_H(linestride,height) ((DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of the source bitmap memory format and layout for the current handle. + * @param linestride 12-bit value specified to BITMAP_LAYOUT + * @param height 11-bit value specified to BITMAP_LAYOUT + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_LAYOUT_H(uint16_t linestride, uint16_t height) +{ + uint32_t const linestridev = (uint32_t) ((((linestride & 0xC00U) >> 10U) &3UL) << 2U); + uint32_t const heightv = (uint32_t) (((height & 0x600U) >> 9U) & 3UL); + return (DL_BITMAP_LAYOUT_H | linestridev | heightv); +} + +//#define BITMAP_SIZE_H(width,height) ((DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of bitmaps dimension for the current handle. + * @param linestride 11-bit value of bitmap width, the 2 most significant bits are used + * @param height 11-bit value of bitmap width, the 2 most significant bits are used + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SIZE_H(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t) ((((width & 0x600U) >> 9U) & 3UL) << 2U); + uint32_t const heightv = (uint32_t) (((height & 0x600U) >> 9U) & 3UL); + return ((DL_BITMAP_SIZE_H) | widthv | heightv); +} + +//#define BITMAP_SOURCE(addr) ((DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +/** + * @brief Set the source address of bitmap data in RAM_G or flash memory. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SOURCE(uint32_t addr) +{ + return (DL_BITMAP_SOURCE | (addr & 0x3FFFFFUL)); +} #if EVE_GEN < 3 /* only define these for FT81x */ -#define BITMAP_TRANSFORM_A(a) ((DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_B(b) ((DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_D(d) ((DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_E(e) ((DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +//#define BITMAP_TRANSFORM_A(a) ((DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_A(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_A | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_B(b) ((DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_B(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_B | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_D(d) ((DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_D(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_D | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_E(e) ((DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +/** + * @brief Set he E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_E(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_E | (val & 0x1FFFFUL)); +} + #endif -#define BITMAP_TRANSFORM_C(c) ((DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_F(f) ((DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) - -#define BLEND_FUNC(src,dst) ((DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) -#define CALL(dest) ((DL_CALL) | ((dest) & 0xFFFFUL)) -#define CELL(cell) ((DL_CELL) | ((cell) & 0x7FUL)) -#define CLEAR(c,s,t) ((DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) -#define CLEAR_COLOR_A(alpha) ((DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) -#define CLEAR_COLOR_RGB(red,green,blue) ((DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -#define CLEAR_STENCIL(s) ((DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) -#define CLEAR_TAG(s) ((DL_CLEAR_TAG) | ((s) & 0xFFUL)) -#define COLOR_A(alpha) ((DL_COLOR_A) | ((alpha) & 0xFFUL)) -#define COLOR_MASK(r,g,b,a) ((DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) -#define COLOR_RGB(red,green,blue) ((DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -#define JUMP(dest) ((DL_JUMP) | ((dest) & 0xFFFFUL)) -#define LINE_WIDTH(width) ((DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) -#define MACRO(m) ((DL_MACRO) | ((m) & 1UL)) -#define PALETTE_SOURCE(addr) ((DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) -#define POINT_SIZE(size) ((DL_POINT_SIZE) | ((size) & 0x1FFFUL)) -#define SCISSOR_SIZE(width,height) ((DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) -#define SCISSOR_XY(x,y) ((DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) -#define STENCIL_FUNC(func,ref,mask) ((DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) -#define STENCIL_MASK(mask) ((DL_STENCIL_MASK) | ((mask) & 0xFFUL)) -#define STENCIL_OP(sfail,spass) ((DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) -#define TAG(s) ((DL_TAG) | ((s) & 0xFFUL)) -#define TAG_MASK(mask) ((DL_TAG_MASK) | ((mask) & 1UL)) -#define VERTEX2F(x,y) ((DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) -#define VERTEX2II(x,y,handle,cell) ((DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) -#define VERTEX_FORMAT(frac) ((DL_VERTEX_FORMAT) | ((frac) & 7UL)) -#define VERTEX_TRANSLATE_X(x) ((DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) -#define VERTEX_TRANSLATE_Y(y) ((DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +//#define BITMAP_TRANSFORM_C(c) ((DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) +/** + * @brief Set the C coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_C(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_C | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_F(f) ((DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) +/** + * @brief Set the F coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_F(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_F | (val & 0x1FFFFUL)); +} + +//#define BLEND_FUNC(src,dst) ((DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BLEND_FUNC(uint8_t src, uint8_t dst) +{ + uint32_t const srcv = (uint32_t) ((src & 7UL) << 3U); + uint32_t const dstv = (uint32_t) (dst & 7UL); + return (DL_BLEND_FUNC | srcv | dstv); +} + +//#define CALL(dest) ((DL_CALL) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CALL(uint16_t dest) +{ + return (DL_CALL | (dest & 0x7FFUL)); +} + +//#define JUMP(dest) ((DL_JUMP) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t JUMP(uint16_t dest) +{ + return (DL_JUMP | (dest & 0x7FFUL)); +} + +//#define CELL(cell) ((DL_CELL) | ((cell) & 0x7FUL)) +/** + * @brief Set the bitmap cell number for the VERTEX2F command. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CELL(uint8_t cell) +{ + return (DL_CELL | (cell & 0x7FUL)); +} + +//#define CLEAR(c,s,t) ((DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) +/** + * @brief Clear buffers to preset values. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR(uint8_t color, uint8_t stencil, uint8_t tag) +{ + uint32_t const colorv = (color & 1UL) << 2U; + uint32_t const stencilv = (stencil & 1UL) << 1U; + uint32_t const tagv = (tag & 1UL); + return (DL_CLEAR | colorv | stencilv | tagv); +} + +//#define CLEAR_COLOR_A(alpha) ((DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set clear value for the alpha channel. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_COLOR_A(uint8_t alpha) +{ + return (DL_CLEAR_COLOR_A | alpha); +} + +//#define CLEAR_COLOR_RGB(red,green,blue) ((DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set clear values for red, green and blue channels. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (DL_CLEAR_COLOR_RGB | redv | greenv | bluev); +} + +//#define CLEAR_STENCIL(s) ((DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the stencil buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_STENCIL(uint8_t val) +{ + return (DL_CLEAR_STENCIL | val); +} + +//#define CLEAR_TAG(s) ((DL_CLEAR_TAG) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_TAG(uint8_t val) +{ + return (DL_CLEAR_TAG | val); +} + +//#define COLOR_A(alpha) ((DL_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set the current color alpha. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_A(uint8_t alpha) +{ + return (DL_COLOR_A | alpha); +} + +//#define COLOR_MASK(r,g,b,a) ((DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) +/** + * @brief Enable or disable writing of color components. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_MASK(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 1UL) << 3U); + uint32_t const greenv = ((green & 1UL) << 2U); + uint32_t const bluev = ((blue & 1UL) << 1U); + uint32_t const alphav = (alpha & 1UL); + return (DL_COLOR_MASK | redv | greenv | bluev | alphav); +} + +//#define COLOR_RGB(red,green,blue) ((DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set the current color red, green and blue. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (DL_COLOR_RGB | redv | greenv | bluev); +} + +//#define LINE_WIDTH(width) ((DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) +/** + * @brief Set the width of lines to be drawn with primitive LINES in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LINE_WIDTH(uint16_t width) +{ + return (DL_LINE_WIDTH | (width & 0xFFFUL)); +} + +//#define MACRO(m) ((DL_MACRO) | ((m) & 1UL)) +/** + * @brief Execute a single command from a macro register. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t MACRO(uint8_t macro) +{ + return (DL_MACRO | (macro & 0x1UL)); +} + +//#define PALETTE_SOURCE(addr) ((DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) +/** + * @brief Set the base address of the palette. + * @note 2-byte alignment is required if pixel format is PALETTE4444 or PALETTE565. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t PALETTE_SOURCE(uint32_t addr) +{ + return (DL_PALETTE_SOURCE | (addr & 0x3FFFFFUL)); +} + +//#define POINT_SIZE(size) ((DL_POINT_SIZE) | ((size) & 0x1FFFUL)) +/** + * @brief Set the radius of points to be drawn with primitive POINTS in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t POINT_SIZE(uint16_t size) +{ + return (DL_POINT_SIZE | (size & 0x1FFFUL)); +} + +//#define SCISSOR_SIZE(width,height) ((DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) +/** + * @brief Set the size of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2048 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t SCISSOR_SIZE(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t) ((width & 0xFFFUL) << 12U); + uint32_t const heightv = (uint32_t) (height & 0xFFFUL); + return (DL_SCISSOR_SIZE | widthv | heightv); +} + +//#define SCISSOR_XY(x,y) ((DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) +/** + * @brief Set the top left corner of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2047 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t SCISSOR_XY(uint16_t xc0, uint16_t yc0) +{ + uint32_t const xc0v = (uint32_t) ((xc0 & 0x7FFUL) << 11U); + uint32_t const yc0v = (uint32_t) (yc0 & 0x7FFUL); + return (DL_SCISSOR_XY | xc0v | yc0v); +} + +//#define STENCIL_FUNC(func,ref,mask) ((DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) +/** + * @brief Set function and reference value for stencil testing. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_FUNC(uint8_t func, uint8_t ref, uint8_t mask) +{ + uint32_t const funcv = (uint32_t) ((func & 7UL) << 16U); + uint32_t const refv = (uint32_t) ((ref & 0xFFUL) << 8U); + uint32_t const maskv = (uint32_t) (mask & 0xFFUL); + return (DL_STENCIL_FUNC | funcv | refv | maskv); +} + +//#define STENCIL_MASK(mask) ((DL_STENCIL_MASK) | ((mask) & 0xFFUL)) +/** + * @brief Control the writing of individual bits in the stencil planes. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_MASK(uint8_t mask) +{ + return (DL_STENCIL_MASK | mask); +} + +//#define STENCIL_OP(sfail,spass) ((DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) +/** + * @brief Set stencil test actions. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_OP(uint8_t sfail, uint8_t spass) +{ + uint32_t const sfailv = (uint32_t) ((sfail & 0x07UL) << 3U); + uint32_t const spassv = (uint32_t) (spass & 0x07UL); + return (DL_STENCIL_OP | sfailv | spassv); +} + +//#define TAG(s) ((DL_TAG) | ((s) & 0xFFUL)) +/** + * @brief Attach the tag value for the following graphics objects drawn on the screen. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t TAG(uint8_t tagval) +{ + return (DL_TAG | tagval); +} + +//#define TAG_MASK(mask) ((DL_TAG_MASK) | ((mask) & 1UL)) +/** + * @brief Control the writing of the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t TAG_MASK(uint8_t mask) +{ + return (DL_TAG_MASK | ((mask) & 1UL)); +} + +//#define VERTEX2F(x,y) ((DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) +/** + * @brief Set coordinates for graphics primitves. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX2F(int16_t xc0, int16_t yc0) +{ + uint32_t const xc0v = ((((uint32_t) ((uint16_t) xc0)) & 0x7FFFUL) << 15U); + uint32_t const yc0v = (((uint32_t) ((uint16_t) yc0)) & 0x7FFFUL); + return (DL_VERTEX2F | xc0v | yc0v); +} + +//#define VERTEX2II(x,y,handle,cell) ((DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) +/** + * @brief Set coordinates, bitmap-handle and cell-number for graphics primitves. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX2II(uint16_t xc0, uint16_t yc0, uint8_t handle, uint8_t cell) +{ + uint32_t const xc0v = ((((uint32_t) xc0) & 0x1FFUL) << 21U); + uint32_t const yc0v = ((((uint32_t) yc0) & 0x1FFUL) << 12U); + uint32_t const handlev = ((((uint32_t) handle) & 0x1FUL) << 7U); + uint32_t const cellv = (((uint32_t) cell) & 0x7FUL); + return (DL_VERTEX2II | xc0v | yc0v | handlev | cellv); +} + +//#define VERTEX_FORMAT(frac) ((DL_VERTEX_FORMAT) | ((frac) & 7UL)) +/** + * @brief Set the precision of VERTEX2F coordinates. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_FORMAT(uint8_t frac) +{ + return (DL_VERTEX_FORMAT | ((frac) & 7UL)); +} + +//#define VERTEX_TRANSLATE_X(x) ((DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations X translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_TRANSLATE_X(int32_t xco) +{ + return (DL_VERTEX_TRANSLATE_X | (((uint32_t) xco) & 0x1FFFFUL)); +} + +//#define VERTEX_TRANSLATE_Y(y) ((DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations Y translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_TRANSLATE_Y(int32_t yco) +{ + return (DL_VERTEX_TRANSLATE_Y | (((uint32_t) yco) & 0x1FFFFUL)); +} /* #define BEGIN(prim) ((DL_BEGIN) | ((prim) & 15UL)) */ /* use define DL_BEGIN */ /* #define DISPLAY() ((DL_DISPLAY)) */ /* use define DL_DISPLAY */ @@ -648,86 +1068,151 @@ extern "C" #if EVE_GEN > 2 -#define EVE_GLFORMAT 31UL /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ +#define EVE_GLFORMAT ((uint32_t) 31UL) /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ -#define DL_BITMAP_EXT_FORMAT 0x2E000000UL /* requires OR'd arguments */ -#define DL_BITMAP_SWIZZLE 0x2F000000UL -/* #define DL_INT_FRR 0x30000000UL */ /* ESE displays "Internal: flash read result" - undocumented display list command */ +#define DL_BITMAP_EXT_FORMAT ((uint32_t) 0x2E000000UL) /* requires OR'd arguments */ +#define DL_BITMAP_SWIZZLE ((uint32_t) 0x2F000000UL) +/* #define DL_INT_FRR ((uint32_t) 0x30000000UL) */ /* ESE displays "Internal: flash read result" - undocumented display list command */ /* Extended Bitmap formats */ -#define EVE_ASTC_4X4 37808UL -#define EVE_ASTC_5X4 37809UL -#define EVE_ASTC_5X5 37810UL -#define EVE_ASTC_6X5 37811UL -#define EVE_ASTC_6X6 37812UL -#define EVE_ASTC_8X5 37813UL -#define EVE_ASTC_8X6 37814UL -#define EVE_ASTC_8X8 37815UL -#define EVE_ASTC_10X5 37816UL -#define EVE_ASTC_10X6 37817UL -#define EVE_ASTC_10X8 37818UL -#define EVE_ASTC_10X10 37819UL -#define EVE_ASTC_12X10 37820UL -#define EVE_ASTC_12X12 37821UL - -#define EVE_RAM_ERR_REPORT 0x309800UL /* max 128 bytes null terminated string */ -#define EVE_RAM_FLASH 0x800000UL -#define EVE_RAM_FLASH_POSTBLOB 0x801000UL - -#define EVE_OPT_FLASH 64U -#define EVE_OPT_OVERLAY 128U -#define EVE_OPT_FORMAT 4096U -#define EVE_OPT_FILL 8192U +#define EVE_ASTC_4X4 ((uint32_t) 37808UL) +#define EVE_ASTC_5X4 ((uint32_t) 37809UL) +#define EVE_ASTC_5X5 ((uint32_t) 37810UL) +#define EVE_ASTC_6X5 ((uint32_t) 37811UL) +#define EVE_ASTC_6X6 ((uint32_t) 37812UL) +#define EVE_ASTC_8X5 ((uint32_t) 37813UL) +#define EVE_ASTC_8X6 ((uint32_t) 37814UL) +#define EVE_ASTC_8X8 ((uint32_t) 37815UL) +#define EVE_ASTC_10X5 ((uint32_t) 37816UL) +#define EVE_ASTC_10X6 ((uint32_t) 37817UL) +#define EVE_ASTC_10X8 ((uint32_t) 37818UL) +#define EVE_ASTC_10X10 ((uint32_t) 37819UL) +#define EVE_ASTC_12X10 ((uint32_t) 37820UL) +#define EVE_ASTC_12X12 ((uint32_t) 37821UL) + +#define EVE_RAM_ERR_REPORT ((uint32_t) 0x309800UL) /* max 128 bytes null terminated string */ +#define EVE_RAM_FLASH ((uint32_t) 0x800000UL) +#define EVE_RAM_FLASH_POSTBLOB ((uint32_t) 0x801000UL) + +#define EVE_OPT_FLASH ((uint16_t) 64U) +#define EVE_OPT_OVERLAY ((uint16_t) 128U) +#define EVE_OPT_FORMAT ((uint16_t) 4096U) +#define EVE_OPT_FILL ((uint16_t) 8192U) /* Commands for BT815 / BT816 */ -#define CMD_BITMAP_TRANSFORM 0xFFFFFF21UL -#define CMD_SYNC 0xFFFFFF42UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ -#define CMD_FLASHERASE 0xFFFFFF44UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ -#define CMD_FLASHWRITE 0xFFFFFF45UL -#define CMD_FLASHREAD 0xFFFFFF46UL -#define CMD_FLASHUPDATE 0xFFFFFF47UL -#define CMD_FLASHDETACH 0xFFFFFF48UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ -#define CMD_FLASHATTACH 0xFFFFFF49UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ -#define CMD_FLASHFAST 0xFFFFFF4AUL -#define CMD_FLASHSPIDESEL 0xFFFFFF4BUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ -#define CMD_FLASHSPITX 0xFFFFFF4CUL -#define CMD_FLASHSPIRX 0xFFFFFF4DUL -#define CMD_FLASHSOURCE 0xFFFFFF4EUL -#define CMD_CLEARCACHE 0xFFFFFF4FUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ -#define CMD_INFLATE2 0xFFFFFF50UL -#define CMD_ROTATEAROUND 0xFFFFFF51UL -#define CMD_RESETFONTS 0xFFFFFF52UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ -#define CMD_ANIMSTART 0xFFFFFF53UL -#define CMD_ANIMSTOP 0xFFFFFF54UL -#define CMD_ANIMXY 0xFFFFFF55UL -#define CMD_ANIMDRAW 0xFFFFFF56UL -#define CMD_GRADIENTA 0xFFFFFF57UL -#define CMD_FILLWIDTH 0xFFFFFF58UL -#define CMD_APPENDF 0xFFFFFF59UL -#define CMD_ANIMFRAME 0xFFFFFF5AUL -#define CMD_VIDEOSTARTF 0xFFFFFF5FUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ +#define CMD_BITMAP_TRANSFORM ((uint32_t) 0xFFFFFF21UL) +#define CMD_SYNC ((uint32_t) 0xFFFFFF42UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ +#define CMD_FLASHERASE ((uint32_t) 0xFFFFFF44UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ +#define CMD_FLASHWRITE ((uint32_t) 0xFFFFFF45UL) +#define CMD_FLASHREAD ((uint32_t) 0xFFFFFF46UL) +#define CMD_FLASHUPDATE ((uint32_t) 0xFFFFFF47UL) +#define CMD_FLASHDETACH ((uint32_t) 0xFFFFFF48UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ +#define CMD_FLASHATTACH ((uint32_t) 0xFFFFFF49UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ +#define CMD_FLASHFAST ((uint32_t) 0xFFFFFF4AUL) +#define CMD_FLASHSPIDESEL ((uint32_t) 0xFFFFFF4BUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ +#define CMD_FLASHSPITX ((uint32_t) 0xFFFFFF4CUL) +#define CMD_FLASHSPIRX ((uint32_t) 0xFFFFFF4DUL) +#define CMD_FLASHSOURCE ((uint32_t) 0xFFFFFF4EUL) +#define CMD_CLEARCACHE ((uint32_t) 0xFFFFFF4FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ +#define CMD_INFLATE2 ((uint32_t) 0xFFFFFF50UL) +#define CMD_ROTATEAROUND ((uint32_t) 0xFFFFFF51UL) +#define CMD_RESETFONTS ((uint32_t) 0xFFFFFF52UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ +#define CMD_ANIMSTART ((uint32_t) 0xFFFFFF53UL) +#define CMD_ANIMSTOP ((uint32_t) 0xFFFFFF54UL) +#define CMD_ANIMXY ((uint32_t) 0xFFFFFF55UL) +#define CMD_ANIMDRAW ((uint32_t) 0xFFFFFF56UL) +#define CMD_GRADIENTA ((uint32_t) 0xFFFFFF57UL) +#define CMD_FILLWIDTH ((uint32_t) 0xFFFFFF58UL) +#define CMD_APPENDF ((uint32_t) 0xFFFFFF59UL) +#define CMD_ANIMFRAME ((uint32_t) 0xFFFFFF5AUL) +#define CMD_VIDEOSTARTF ((uint32_t) 0xFFFFFF5FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ /* Registers for BT815 / BT816 */ -#define REG_ADAPTIVE_FRAMERATE 0x0030257cUL -#define REG_PLAYBACK_PAUSE 0x003025ecUL -#define REG_FLASH_STATUS 0x003025f0UL -#define REG_FLASH_SIZE 0x00309024UL -#define REG_PLAY_CONTROL 0x0030914eUL -#define REG_COPRO_PATCH_PTR 0x00309162UL +#define REG_ADAPTIVE_FRAMERATE ((uint32_t) 0x0030257cUL) +#define REG_PLAYBACK_PAUSE ((uint32_t) 0x003025ecUL) +#define REG_FLASH_STATUS ((uint32_t) 0x003025f0UL) +#define REG_FLASH_SIZE ((uint32_t) 0x00309024UL) +#define REG_PLAY_CONTROL ((uint32_t) 0x0030914eUL) +#define REG_COPRO_PATCH_PTR ((uint32_t) 0x00309162UL) /* Macros for BT815 / BT816 */ -#define BITMAP_EXT_FORMAT(format) ((DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) -#define BITMAP_SWIZZLE(r,g,b,a) ((DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) -#define BITMAP_TRANSFORM_A_EXT(p,v) ((DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_B_EXT(p,v) ((DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_D_EXT(p,v) ((DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_E_EXT(p,v) ((DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +//#define BITMAP_EXT_FORMAT(format) ((DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) +/** + * @brief Set the extended format of the bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_EXT_FORMAT(uint16_t format) +{ + return (DL_BITMAP_EXT_FORMAT | format); +} + +//#define BITMAP_SWIZZLE(r,g,b,a) ((DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) +/** + * @brief Set the source for the red, green, blue and alpha channels of a bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SWIZZLE(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 7UL) << 9U); + uint32_t const greenv = ((green & 7UL) << 6U); + uint32_t const bluev = ((blue & 7UL) << 3U); + uint32_t const alphav = (alpha & 7UL); + return (DL_BITMAP_SWIZZLE | redv | greenv | bluev | alphav); +} + +//#define BITMAP_TRANSFORM_A_EXT(p,v) ((DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_A(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_A | prcv | valv); +} + +//#define BITMAP_TRANSFORM_B_EXT(p,v) ((DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_B(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_B | prcv | valv); +} + +//#define BITMAP_TRANSFORM_D_EXT(p,v) ((DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_D(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_D | prcv | valv); +} + +//#define BITMAP_TRANSFORM_E_EXT(p,v) ((DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_E(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_E | prcv | valv); +} -#define BITMAP_TRANSFORM_A(a) BITMAP_TRANSFORM_A_EXT(0UL,(a)) -#define BITMAP_TRANSFORM_B(b) BITMAP_TRANSFORM_B_EXT(0UL,(b)) -#define BITMAP_TRANSFORM_D(d) BITMAP_TRANSFORM_D_EXT(0UL,(d)) -#define BITMAP_TRANSFORM_E(e) BITMAP_TRANSFORM_E_EXT(0UL,(e)) +//#define BITMAP_TRANSFORM_A(a) BITMAP_TRANSFORM_A_EXT(0UL,(a)) +//#define BITMAP_TRANSFORM_B(b) BITMAP_TRANSFORM_B_EXT(0UL,(b)) +//#define BITMAP_TRANSFORM_D(d) BITMAP_TRANSFORM_D_EXT(0UL,(d)) +//#define BITMAP_TRANSFORM_E(e) BITMAP_TRANSFORM_E_EXT(0UL,(e)) #endif /* EVE_GEN > 2 */ @@ -736,31 +1221,31 @@ extern "C" #if EVE_GEN > 3 /* Commands for BT817 / BT818 */ -#define CMD_ANIMFRAMERAM 0xFFFFFF6DUL -#define CMD_ANIMSTARTRAM 0xFFFFFF6EUL -#define CMD_APILEVEL 0xFFFFFF63UL -#define CMD_CALIBRATESUB 0xFFFFFF60UL -#define CMD_CALLLIST 0xFFFFFF67UL -#define CMD_ENDLIST 0xFFFFFF69UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ -#define CMD_FLASHPROGRAM 0xFFFFFF70UL -#define CMD_FONTCACHE 0xFFFFFF6BUL -#define CMD_FONTCACHEQUERY 0xFFFFFF6CUL -#define CMD_GETIMAGE 0xFFFFFF64UL -#define CMD_HSF 0xFFFFFF62UL -#define CMD_LINETIME 0xFFFFFF5EUL -#define CMD_NEWLIST 0xFFFFFF68UL -#define CMD_PCLKFREQ 0xFFFFFF6AUL -#define CMD_RETURN 0xFFFFFF66UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ -#define CMD_RUNANIM 0xFFFFFF6FUL -#define CMD_TESTCARD 0xFFFFFF61UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ -#define CMD_WAIT 0xFFFFFF65UL +#define CMD_ANIMFRAMERAM ((uint32_t) 0xFFFFFF6DUL) +#define CMD_ANIMSTARTRAM ((uint32_t) 0xFFFFFF6EUL) +#define CMD_APILEVEL ((uint32_t) 0xFFFFFF63UL) +#define CMD_CALIBRATESUB ((uint32_t) 0xFFFFFF60UL) +#define CMD_CALLLIST ((uint32_t) 0xFFFFFF67UL) +#define CMD_ENDLIST ((uint32_t) 0xFFFFFF69UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ +#define CMD_FLASHPROGRAM ((uint32_t) 0xFFFFFF70UL) +#define CMD_FONTCACHE ((uint32_t) 0xFFFFFF6BUL) +#define CMD_FONTCACHEQUERY ((uint32_t) 0xFFFFFF6CUL) +#define CMD_GETIMAGE ((uint32_t) 0xFFFFFF64UL) +#define CMD_HSF ((uint32_t) 0xFFFFFF62UL) +#define CMD_LINETIME ((uint32_t) 0xFFFFFF5EUL) +#define CMD_NEWLIST ((uint32_t) 0xFFFFFF68UL) +#define CMD_PCLKFREQ ((uint32_t) 0xFFFFFF6AUL) +#define CMD_RETURN ((uint32_t) 0xFFFFFF66UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ +#define CMD_RUNANIM ((uint32_t) 0xFFFFFF6FUL) +#define CMD_TESTCARD ((uint32_t) 0xFFFFFF61UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ +#define CMD_WAIT ((uint32_t) 0xFFFFFF65UL) /* Registers for BT817 / BT818 */ -#define REG_UNDERRUN 0x0030260cUL -#define REG_AH_HCYCLE_MAX 0x00302610UL -#define REG_PCLK_FREQ 0x00302614UL -#define REG_PCLK_2X 0x00302618UL -#define REG_ANIM_ACTIVE 0x0030902CUL +#define REG_UNDERRUN ((uint32_t) 0x0030260cUL) +#define REG_AH_HCYCLE_MAX ((uint32_t) 0x00302610UL) +#define REG_PCLK_FREQ ((uint32_t) 0x00302614UL) +#define REG_PCLK_2X ((uint32_t) 0x00302618UL) +#define REG_ANIM_ACTIVE ((uint32_t) 0x0030902CUL) #endif /* EVE_GEN > 3 */ diff --git a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.c b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.c index 4808fb3..c213b91 100644 --- a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.c +++ b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.c @@ -2,7 +2,7 @@ @file EVE_commands.c @brief contains FT8xx / BT8xx functions @version 5.0 -@date 2023-08-17 +@date 2023-12-29 @author Rudolph Riedel @section info @@ -49,7 +49,7 @@ has EVE_PCLK_FREQ defined - removed the meta-commands EVE_cmd_point(), EVE_cmd_line() and EVE_cmd_rect() - split all display-list commands into two functions: EVE_cmd_XXX() and EVE_cmd_XXX_burst() - switched from using EVE_RAM_CMD + cmdOffset to REG_CMDB_WRITE -- as a side effect from switching to REG_CMDB_WRITE, every co-processor command is automatically executed now +- as a side effect from switching to REG_CMDB_WRITE, every coprocessor command is automatically executed now - renamed EVE_LIB_GetProps() back to EVE_cmd_getprops() since it does not do anything special to justify a special name - added helper function EVE_memWrite_sram_buffer() - added EVE_cmd_bitmap_transform() and EVE_cmd_bitmap_transform_burst() @@ -136,9 +136,9 @@ without the traling _burst in the name when exceution speed is not an issue - e. - switched from using CMD_PCLKFREQ to writing to REG_PCLK_FREQ directly - added define EVE_SET_REG_PCLK_2X to set REG_PCLK_2X to 1 when necessary - Bugfix: EVE_init() did not set the audio engine to "mute" as intended, but to "silent" -- Bugfix: EVE_busy() returns E_NOT_OK now on co-processor faults. +- Bugfix: EVE_busy() returns E_NOT_OK now on coprocessor faults. thanks for the report to Z0ld3n on Github! -- Fix: reworked EVE_busy() to return EVE_FAULT_RECOVERED on deteced co-processor faults, +- Fix: reworked EVE_busy() to return EVE_FAULT_RECOVERED on deteced coprocessor faults, removed the flash commands from the fault recovery sequence as these are project specific. - added EVE_get_and_reset_fault_state() to check if EVE_busy() triggered a fault recovery - added notes on how to use to EVE_cmd_setfont2() and EVE_cmd_romfont() @@ -147,6 +147,12 @@ without the traling _burst in the name when exceution speed is not an issue - e. - reworked the burst part of private_string_write() to be less complex - renamed chipid references to regid as suggested by #93 on github - Bugfix: broke transfers of buffers larger than 3840 when fixing issues from static code analysis +- changed a number of function parameters from signed to unsigned following the + updated BT81x series programming guide V2.4 +- did another linter pass and fixed some things +- started to improve the embedded documentation +- added more documentation +- removed EVE_cmd_hsf_burst() */ @@ -168,7 +174,9 @@ static volatile uint8_t fault_recovered = E_OK; /* flag to indicate if EVE_busy helper functions ##################################################################### */ - +/** + * @brief Send a host command. + */ void EVE_cmdWrite(uint8_t const command, uint8_t const parameter) { EVE_cs_set(); @@ -178,6 +186,9 @@ void EVE_cmdWrite(uint8_t const command, uint8_t const parameter) EVE_cs_clear(); } +/** + * @brief Implementation of rd8() function, reads 8 bits. + */ uint8_t EVE_memRead8(uint32_t const ft_address) { uint8_t data; @@ -185,21 +196,28 @@ uint8_t EVE_memRead8(uint32_t const ft_address) spi_transmit_32(((ft_address >> 16U) & 0x0000007fUL) + (ft_address & 0x0000ff00UL) + ((ft_address & 0x000000ffUL) << 16U)); data = spi_receive(0U); /* read data byte by sending another dummy byte */ EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of rd16() function, reads 16 bits. + */ uint16_t EVE_memRead16(uint32_t const ft_address) { uint16_t data; + EVE_cs_set(); spi_transmit_32(((ft_address >> 16U) & 0x0000007fUL) + (ft_address & 0x0000ff00UL) + ((ft_address & 0x000000ffUL) << 16U)); - uint8_t lowbyte = spi_receive(0U); /* read low byte */ - uint8_t hibyte = spi_receive(0U); /* read high byte */ + uint8_t const lowbyte = spi_receive(0U); /* read low byte */ + uint8_t const hibyte = spi_receive(0U); /* read high byte */ data = ((uint16_t) hibyte * 256U) | lowbyte; EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of rd32() function, reads 32 bits. + */ uint32_t EVE_memRead32(uint32_t const ft_address) { uint32_t data; @@ -210,49 +228,60 @@ uint32_t EVE_memRead32(uint32_t const ft_address) data = ((uint32_t) spi_receive(0U) << 16U) | data; data = ((uint32_t) spi_receive(0U) << 24U) | data; /* read high byte */ EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of wr8() function, writes 8 bits. + */ void EVE_memWrite8(uint32_t const ft_address, uint8_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); spi_transmit(ft_data); EVE_cs_clear(); } +/** + * @brief Implementation of wr16() function, writes 16 bits. + */ void EVE_memWrite16(uint32_t const ft_address, uint16_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ - spi_transmit((uint8_t)(ft_address >> 8U)); /* send middle address byte */ - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); /* send low address byte */ - spi_transmit((uint8_t)(ft_data & 0x00ffU)); /* send data low byte */ - spi_transmit((uint8_t)(ft_data >> 8U)); /* send data high byte */ + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ + spi_transmit((uint8_t) (ft_address >> 8U)); /* send middle address byte */ + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); /* send low address byte */ + spi_transmit((uint8_t) (ft_data & 0x00ffU)); /* send data low byte */ + spi_transmit((uint8_t) (ft_data >> 8U)); /* send data high byte */ EVE_cs_clear(); } +/** + * @brief Implementation of wr32() function, writes 32 bits. + */ void EVE_memWrite32(uint32_t const ft_address, uint32_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ - spi_transmit((uint8_t)(ft_address >> 8U)); /* send middle address byte */ - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); /* send low address byte */ + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ + spi_transmit((uint8_t) (ft_address >> 8U)); /* send middle address byte */ + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); /* send low address byte */ spi_transmit_32(ft_data); EVE_cs_clear(); } -/* Helper function, write a block of memory from the FLASH of the host controller to EVE. */ +/** + * @brief Helper function, write a block of memory from the FLASH of the host controller to EVE. + */ void EVE_memWrite_flash_buffer(uint32_t const ft_address, const uint8_t *p_data, uint32_t const len) { if (p_data != NULL) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); // uint32_t length = (len + 3U) & (~3U); @@ -265,15 +294,17 @@ void EVE_memWrite_flash_buffer(uint32_t const ft_address, const uint8_t *p_data, } } -/* Helper function, write a block of memory from the SRAM of the host controller to EVE. */ +/** + * @brief Helper function, write a block of memory from the SRAM of the host controller to EVE. + */ void EVE_memWrite_sram_buffer(uint32_t const ft_address, const uint8_t *p_data, uint32_t const len) { if (p_data != NULL) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); // uint32_t length = (len + 3U) & (~3U); @@ -286,7 +317,9 @@ void EVE_memWrite_sram_buffer(uint32_t const ft_address, const uint8_t *p_data, } } -/* Helper function, read a block of memory from EVE to the SRAM of the host controller */ +/** + * @brief Helper function, read a block of memory from EVE to the SRAM of the host controller. + */ void EVE_memRead_sram_buffer(uint32_t const ft_address, uint8_t *p_data, uint32_t const len) { if (p_data != NULL) @@ -310,7 +343,7 @@ static void CoprocessorFaultRecover(void) copro_patch_pointer = EVE_memRead16(REG_COPRO_PATCH_PTR); #endif - EVE_memWrite8(REG_CPURESET, 1U); /* hold co-processor engine in the reset condition */ + EVE_memWrite8(REG_CPURESET, 1U); /* hold coprocessor engine in the reset condition */ EVE_memWrite16(REG_CMD_READ, 0U); /* set REG_CMD_READ to 0 */ EVE_memWrite16(REG_CMD_WRITE, 0U); /* set REG_CMD_WRITE to 0 */ EVE_memWrite16(REG_CMD_DL, 0U); /* reset REG_CMD_DL to 0 as required by the BT81x programming guide, should not hurt FT8xx */ @@ -327,21 +360,18 @@ static void CoprocessorFaultRecover(void) #endif #endif - EVE_memWrite8(REG_CPURESET, 0U); /* set REG_CPURESET to 0 to restart the co-processor engine*/ + EVE_memWrite8(REG_CPURESET, 0U); /* set REG_CPURESET to 0 to restart the coprocessor engine*/ DELAY_MS(10U); /* just to be safe */ } -/* Check if the co-processor completed executing the current command list. */ -/* Returns E_OK in case EVE is not busy (no DMA transfer active and */ -/* REG_CMDB_SPACE has the value 0xffc, meaning the CMD-FIFO is empty. */ -/* If there was a coprocessor fault the recovery sequence is */ -/* executed and E_NOT_OK is returned. */ -/* note: in case of recovery the graphics context gets reset and the */ -/* external flash needs to be reinitialized if needed */ -/* Returns EVE_FIFO_HALF_EMPTY if no DMA transfer is active */ -/* and REG_CMDB_SPACE shows more than 2048 bytes available. */ -/* Returns EVE_IS_BUSY if a DMA transfer is active */ -/* or REG_CMDB_SPACE has a value smaller than 0xffc. */ +/** + * @brief Check if the coprocessor completed executing the current command list. + * @return - E_OK - if EVE is not busy (no DMA transfer active and REG_CMDB_SPACE has the value 0xffc, meaning the CMD-FIFO is empty + * @return - EVE_IS_BUSY - if a DMA transfer is active or REG_CMDB_SPACE has a value smaller than 0xffc + * @return - EVE_FIFO_HALF_EMPTY - if no DMA transfer is active and REG_CMDB_SPACE shows more than 2048 bytes available + * @return - E_NOT_OK - if there was a coprocessor fault and the recovery sequence was executed + * @note - if there is a coprocessor fault the external flash is not reinitialized by EVE_busy() + */ uint8_t EVE_busy(void) { uint16_t space; @@ -354,8 +384,8 @@ uint8_t EVE_busy(void) space = EVE_memRead16(REG_CMDB_SPACE); - /* (REG_CMDB_SPACE & 0x03) != 0 -> we have a co-processor fault */ - if ((space & 3U) != 0U) /* we have a co-processor fault, make EVE play with us again */ + /* (REG_CMDB_SPACE & 0x03) != 0 -> we have a coprocessor fault */ + if ((space & 3U) != 0U) /* we have a coprocessor fault, make EVE play with us again */ { ret = EVE_FAULT_RECOVERED; fault_recovered = EVE_FAULT_RECOVERED; /* save fault recovery state */ @@ -381,16 +411,14 @@ uint8_t EVE_busy(void) } #endif - return ret; + return (ret); } /** - * @brief Helper function to check if EVE_busy() tried to recover from - * a coprocessor fault. + * @brief Helper function to check if EVE_busy() tried to recover from a coprocessor fault. * The internal fault indicator is cleared so it could be set by EVE_busy() again. - * - * @return Returns EVE_FAULT_RECOVERED if EVE_busy() detected a coprocessor fault. - * Returns E_OK if EVE_busy() did not detect a coprocessor fault. + * @return - EVE_FAULT_RECOVERED - if EVE_busy() detected a coprocessor fault + * @return - E_OK - if EVE_busy() did not detect a coprocessor fault */ uint8_t EVE_get_and_reset_fault_state(void) { @@ -401,10 +429,12 @@ uint8_t EVE_get_and_reset_fault_state(void) ret = EVE_FAULT_RECOVERED; fault_recovered = E_OK; } - return ret; + return (ret); } -/* Wait for the co-processor to complete the FIFO queue.*/ +/** + * @brief Helper function, wait for the coprocessor to complete the FIFO queue. + */ void EVE_execute_cmd(void) { while (EVE_busy() != E_OK) @@ -412,7 +442,7 @@ void EVE_execute_cmd(void) } } -/* Begin a co-processor command, this is used for non-display-list and non-burst-mode commands.*/ +/* begin a coprocessor command, this is used for non-display-list and non-burst-mode commands.*/ static void eve_begin_cmd(uint32_t command) { EVE_cs_set(); @@ -471,21 +501,23 @@ void block_transfer(const uint8_t *p_data, uint32_t len) } /* ################################################################## - co-processor commands that are not used in displays lists, + coprocessor commands that are not used in displays lists, these are not to be used with burst transfers ################################################################### */ /* BT817 / BT818 */ #if EVE_GEN > 3 -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in RAM_G to to the external flash on a BT81x board at address dest */ -/* note: dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ -/* note: this looks exactly the same as EVE_cmd_flashupdate() but it needs the flash to be empty */ +/** + * @brief Write "num" bytes from src in RAM_G to the previously erased external flash of a BT81x at address dest. + * @note - dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 + * @note - EVE will not do anything if the alignment requirements are not met + * @note - the address ptr is relative to the flash so the first address is 0x000000 not 0x800000 + * @note - this looks exactly the same as EVE_cmd_flashupdate() but it needs the flash to be empty + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHPROGRAM); @@ -496,23 +528,29 @@ void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_fontcache(uint32_t font, int32_t ptr, uint32_t num) +/** + * @brief Enable the font cache. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num) { eve_begin_cmd(CMD_FONTCACHE); spi_transmit_32(font); - spi_transmit_32((uint32_t) ptr); + spi_transmit_32(ptr); spi_transmit_32(num); EVE_cs_clear(); EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used) +/** + * @brief Queries the capacity and utilization of the font cache. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_fontcachequery(uint32_t *p_total, uint32_t *p_used) { uint16_t cmdoffset; @@ -522,21 +560,24 @@ void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used) EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_total != NULL) { - *p_total = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_total = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_used != NULL) { - *p_used = (int32_t) EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_used = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Returns all the attributes of the bitmap made by the previous CMD_LOADIMAGE, CMD_PLAYVIDEO, CMD_VIDEOSTART or CMD_VIDEOSTARTF. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, uint32_t *p_height, uint32_t *p_palette) { uint16_t cmdoffset; @@ -550,33 +591,36 @@ void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, ui EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_palette != NULL) { - *p_palette = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_palette = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } if (p_height != NULL) { - *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_width != NULL) { - *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU)); + *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL)); } if (p_fmt != NULL) { - *p_fmt = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 16U) & 0xfffU)); + *p_fmt = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 16UL) & 0xfffUL)); } if (p_source != NULL) { - *p_source = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 20U) & 0xfffU)); + *p_source = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 20UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Undocumented command. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_linetime(uint32_t dest) { eve_begin_cmd(CMD_LINETIME); @@ -585,9 +629,12 @@ void EVE_cmd_linetime(uint32_t dest) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Starts the compilation of a command list into RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_newlist(uint32_t adr) { eve_begin_cmd(CMD_NEWLIST); @@ -596,12 +643,14 @@ void EVE_cmd_newlist(uint32_t adr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* This command sets REG_PCLK_FREQ to generate the closest possible */ -/* frequency to the one requested. */ -/* Returns the frequency achieved or zero if no frequency was found. */ +/** + * @brief Sets REG_PCLK_FREQ to generate the closest possible frequency to the one requested. + * @return - the frequency achieved or zero if no frequency was found + * @note - When using this command, the flash BLOB is required. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_pclkfreq(uint32_t ftarget, int32_t rounding) { uint16_t cmdoffset; @@ -612,15 +661,18 @@ uint32_t EVE_cmd_pclkfreq(uint32_t ftarget, int32_t rounding) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Waits for a specified number of microseconds. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_wait(uint32_t usec) { eve_begin_cmd(CMD_WAIT); @@ -634,11 +686,13 @@ void EVE_cmd_wait(uint32_t usec) /* BT815 / BT816 */ #if EVE_GEN > 2 -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this command clears the graphics systems flash cache and to do so */ -/* it needs to empty the display lists first */ +/** + * @brief Clears the graphics engine’s internal flash cache. + * @note - This function includes clearing out the display list. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_clearcache(void) { EVE_cmd_dl(CMD_DLSTART); @@ -653,11 +707,12 @@ void EVE_cmd_clearcache(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHATTACH); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Re-connect to the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashattach(void) { eve_begin_cmd(CMD_FLASHATTACH); @@ -665,11 +720,12 @@ void EVE_cmd_flashattach(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHDETACH); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Dis-connect from the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashdetach(void) { eve_begin_cmd(CMD_FLASHDETACH); @@ -677,11 +733,12 @@ void EVE_cmd_flashdetach(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHERASE); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Erases the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flasherase(void) { eve_begin_cmd(CMD_FLASHERASE); @@ -689,9 +746,14 @@ void EVE_cmd_flasherase(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Drive the attached SPI flash storage in full-speed mode, if possible. + * @return - Zero on success, error code on failure + * @note - When using this command, the flash BLOB is required. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_flashfast(void) { uint16_t cmdoffset; @@ -700,17 +762,19 @@ uint32_t EVE_cmd_flashfast(void) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHSPIDESEL); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief De-asserts the SPI CS signal of the attached SPI flash storage. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspidesel(void) { eve_begin_cmd(CMD_FLASHSPIDESEL); @@ -718,13 +782,15 @@ void EVE_cmd_flashspidesel(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in the external flash on a BT81x board to dest in RAM_G */ -/* note: src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the src pointer is relative to the flash so the first address is 0x00000000 not 0x800000 */ +/** + * @brief Copies "num" bytes from "src" in attached SPI flash storage to "dest" in RAM_G. + * @note - src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4 + * @note - EVE will not do anything if the alignment requirements are not met + * @note - The src pointer is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHREAD); @@ -735,9 +801,15 @@ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Set the source address for flash data loaded by the CMD_LOADIMAGE, CMD_PLAYVIDEO, CMD_VIDEOSTARTF and CMD_INFLATE2 commands with the OPT_FLASH option. + * @note - Address must be 64-byte aligned. + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The pointer is relative to the flash, so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashsource(uint32_t ptr) { eve_begin_cmd(CMD_FLASHSOURCE); @@ -746,11 +818,13 @@ void EVE_cmd_flashsource(uint32_t ptr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from the BT81x SPI interface dest in RAM_G */ -/* note: raw direct access, not really useful for anything */ +/** + * @brief Receives bytes from the flash SPI interface and writes them to main memory. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspirx(uint32_t dest, uint32_t num) { eve_begin_cmd(CMD_FLASHSPIRX); @@ -760,11 +834,13 @@ void EVE_cmd_flashspirx(uint32_t dest, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from *p_data to the BT81x SPI interface */ -/* note: raw direct access, not really useful for anything */ +/** + * @brief Transmits bytes over the flash SPI interface. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *p_data) { eve_begin_cmd(CMD_FLASHSPITX); @@ -773,13 +849,15 @@ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *p_data) block_transfer(p_data, num); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in RAM_G to to the external flash on a BT81x board at address dest */ -/* note: dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ +/** + * @brief Write "num" bytes from src in RAM_G to the attached SPI flash storage at address dest. + * @note - dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The address ptr is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHUPDATE); @@ -790,14 +868,15 @@ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from *p_data to the external flash on a BT81x board at address ptr */ -/* note: ptr must be 256 byte aligned, num must be a multiple of 256 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ -/* note: on AVR controllers this expects the data to be located in the controllers flash memory */ +/** + * @brief Write "num" bytes to the attached SPI flash storage at address dest. + * @note - dest must be 256-byte aligned, num must be a multiple of 256 + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The address ptr is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *p_data) { eve_begin_cmd(CMD_FLASHWRITE); @@ -810,9 +889,13 @@ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *p_data) } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Decompress data into RAM_G. + * @note - The data must be correct and complete. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_inflate2(uint32_t ptr, uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_INFLATE2); @@ -831,10 +914,12 @@ void EVE_cmd_inflate2(uint32_t ptr, uint32_t options, const uint8_t *p_data, uin #endif /* EVE_GEN > 2 */ -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* get the properties of an image after a CMD_LOADIMAGE operation and write the values to the variables that are supplied by pointers*/ +/** + * @brief Returns the source address and size of the bitmap loaded by the previous CMD_LOADIMAGE. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_getprops(uint32_t *p_pointer, uint32_t *p_width, uint32_t *p_height) { uint16_t cmdoffset; @@ -845,25 +930,28 @@ void EVE_cmd_getprops(uint32_t *p_pointer, uint32_t *p_width, uint32_t *p_height spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_pointer != NULL) { - *p_pointer = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU)); + *p_pointer = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL)); } if (p_width != NULL) { - *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_height != NULL) { - *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Returns the next address after a CMD_INFLATE and other commands. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_getptr(void) { uint16_t cmdoffset; @@ -872,15 +960,19 @@ uint32_t EVE_cmd_getptr(void) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Decompress data into RAM_G. + * @note - The data must be correct and complete. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_INFLATE); @@ -892,18 +984,29 @@ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *p_data, uint32_t len) } } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Trigger interrupt INT_CMDFLAG. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_interrupt(uint32_t msec) { eve_begin_cmd(CMD_INTERRUPT); spi_transmit_32(msec); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Loads and decodes a JPEG/PNG image into RAM_G. + * @note - Decoding PNG images takes significantly more time than decoding JPEG images. + * @note - In doubt use the EVE Asset Builder to check if PNG/JPEG files are compatible. + * @note - If the image is in PNG format, the top 42kiB of RAM_G will be overwritten. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_LOADIMAGE); @@ -925,19 +1028,27 @@ void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *p_data, ui } } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Set up a streaming media FIFO in RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_mediafifo(uint32_t ptr, uint32_t size) { eve_begin_cmd(CMD_MEDIAFIFO); spi_transmit_32(ptr); spi_transmit_32(size); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Copy a block of RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_MEMCPY); @@ -948,9 +1059,12 @@ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Compute a CRC-32 for RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num) { uint16_t cmdoffset; @@ -961,14 +1075,18 @@ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Fill RAM_G with a byte value. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num) { eve_begin_cmd(CMD_MEMSET); @@ -976,12 +1094,16 @@ void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num) spi_transmit_32((uint32_t)value); spi_transmit_32(num); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is a pointless command, just use one of the EVE_memWrite* helper functions to directly write to EVEs memory */ +/** + * @brief Write bytes into RAM_G using the coprocessor. + * @note - Commented out, just use one of the EVE_memWrite* helper functions to directly write to EVEs memory. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ /* void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data) { @@ -1001,9 +1123,36 @@ void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data) } */ -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Read a register value using the coprocessor. + * @note - Commented out, just read the register directly. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +/* +uint32_t EVE_cmd_regread(uint32_t ptr) +{ + uint16_t cmdoffset; + + eve_begin_cmd(CMD_REGREAD); + spi_transmit_32(ptr); + spi_transmit_32(0UL); + EVE_cs_clear(); + EVE_execute_cmd(); + cmdoffset = EVE_memRead16(REG_CMD_WRITE); // read the coprocessor write pointer + cmdoffset -= 4U; + cmdoffset &= 0x0fffU; + return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); +} +*/ + +/** + * @brief Write zero to RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num) { eve_begin_cmd(CMD_MEMZERO); @@ -1013,8 +1162,13 @@ void EVE_cmd_memzero(uint32_t ptr, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, it includes executing the command, does not support cmd-burst.*/ -/* it does not wait for completion in order to allow the video to be paused or terminated by REG_PLAY_CONTROL */ +/** + * @brief Play back motion-JPEG encoded AVI video. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command. + * @note - Does not support burst-mode. + * @note - Does not wait for completion in order to allow the video to be paused or terminated by REG_PLAY_CONTROL + */ void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_PLAYVIDEO); @@ -1035,30 +1189,12 @@ void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len) } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* regvalue = EVE_cmd_regread(ptr); */ -/* this seems to be completely pointless, there is no real use for it outside a display-list since the register could be read directly */ -/* and for what purpose would this be implemented to be used in a display list?? */ -uint32_t EVE_cmd_regread(uint32_t ptr) -{ - uint16_t cmdoffset; - - eve_begin_cmd(CMD_REGREAD); - spi_transmit_32(ptr); - spi_transmit_32(0UL); - EVE_cs_clear(); - EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ - cmdoffset -= 4U; - cmdoffset &= 0x0fffU; - return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); -} - -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Rotate the screen and set up transform matrix accordingly. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_setrotate(uint32_t rotation) { eve_begin_cmd(CMD_SETROTATE); @@ -1067,9 +1203,12 @@ void EVE_cmd_setrotate(uint32_t rotation) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Take a snapshot of the current screen. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_snapshot(uint32_t ptr) { eve_begin_cmd(CMD_SNAPSHOT); @@ -1078,10 +1217,13 @@ void EVE_cmd_snapshot(uint32_t ptr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt) +/** + * @brief Take a snapshot of part of the current screen with format option. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt) { eve_begin_cmd(CMD_SNAPSHOT2); spi_transmit_32(fmt); @@ -1092,19 +1234,22 @@ void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); EVE_cs_clear(); EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t tag) +/** + * @brief Track touches for a graphics object. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_track(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t tag) { eve_begin_cmd(CMD_TRACK); @@ -1113,13 +1258,13 @@ void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t t spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); - spi_transmit((uint8_t) ((uint16_t) tag)); - spi_transmit((uint8_t) (((uint16_t) tag) >> 8U)); + spi_transmit((uint8_t) (tag)); + spi_transmit((uint8_t) (tag >> 8U)); spi_transmit(0U); spi_transmit(0U); @@ -1127,9 +1272,12 @@ void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t t EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Load the next frame of a video. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr) { eve_begin_cmd(CMD_VIDEOFRAME); @@ -1147,7 +1295,6 @@ void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr) /** * @brief EVE flash initialization for BT81x, switches the FLASH attached to a BT81x to full-speed mode - * * @return Returns E_OK in case of success, EVE_FAIL_FLASH_STATUS_INIT if the status remains init, * EVE_FAIL_FLASH_STATUS_DETACHED if no flash chip was found, a number of different values for failures with * cmd_flashfast and E_NOT_OK if a not supported status is returned in REG_FLASH_STATUS. @@ -1229,7 +1376,7 @@ uint8_t EVE_init_flash(void) ret_val = E_OK; } - return ret_val; + return (ret_val); } #endif /* EVE_GEN > 2 */ @@ -1253,7 +1400,8 @@ void use_gt911(void) #else /* FT811 / FT813 binary-blob from FTDIs AN_336 to patch the touch-engine for Goodix GT911 / GT9271 touch controllers */ -const uint8_t eve_gt911_data[1184U] PROGMEM = { +const uint8_t eve_gt911_data[1184U] PROGMEM = +{ 26, 255, 255, 255, 32, 32, 48, 0, 4, 0, 0, 0, 2, 0, 0, 0, 34, 255, 255, 255, 0, 176, 48, 0, 120, 218, 237, 84, 221, 111, 84, 69, 20, 63, 51, 179, 93, 160, 148, 101, 111, 76, 5, 44, 141, 123, 111, 161, 11, 219, 154, 16, 9, 16, 17, 229, 156, 75, 26, 11, 13, 21, 227, 3, 16, 252, 184, 179, 45, @@ -1305,7 +1453,8 @@ const uint8_t eve_gt911_data[1184U] PROGMEM = { 188, 11, 55, 240, 31, 243, 122, 152, 226, 183, 207, 154, 73, 188, 39, 219, 43, 105, 222, 87, 41, 143, 141, 140, 175, 73, 112, 184, 252, 61, 184, 16, 90, 250, 35, 168, 82, 119, 176, 57, 116, 94, 200, 150, 22, 190, 179, 44, 104, 12, 235, 84, 149, 102, 252, 89, 154, 193, 99, 228, 106, 242, 125, 248, 64, 194, 255, 223, 127, - 242, 83, 11, 255, 2, 70, 214, 226, 128, 0, 0}; + 242, 83, 11, 255, 2, 70, 214, 226, 128, 0, 0 +}; EVE_cs_set(); spi_transmit((uint8_t) 0xB0U); /* high-byte of REG_CMDB_WRITE + MEM_WRITE */ @@ -1333,7 +1482,6 @@ const uint8_t eve_gt911_data[1184U] PROGMEM = { /** * @brief Waits for either reading REG_ID with a value of 0x7c, indicating that * an EVE chip is present and ready to communicate, or untill a timeout of 400ms has passed. - * * @return Returns E_OK in case of success, EVE_FAIL_REGID_TIMEOUT if the * value of 0x7c could not be read. */ @@ -1354,14 +1502,13 @@ static uint8_t wait_regid(void) } } - return ret; + return (ret); } /** * @brief Waits for either REG_CPURESET to indicate that the audio, touch and * coprocessor units finished their respective reset cycles, * or untill a timeout of 50ms has passed. - * * @return Returns E_OK in case of success, EVE_FAIL_RESET_TIMEOUT if either the * audio, touch or coprocessor unit indicate a fault by not returning from reset. */ @@ -1382,11 +1529,11 @@ static uint8_t wait_reset(void) } } - return ret; + return (ret); } /** - * @brief Writes all parameters defined for the display selected in EVE_config.h + * @brief Writes all parameters defined for the display selected in EVE_config.h. * to the corresponding registers. * It is used by EVE_init() and can be used to refresh the register values if needed. */ @@ -1438,15 +1585,17 @@ static void enable_pixel_clock(void) #endif } -/* EVE chip initialization, has to be executed with the SPI setup to 11 MHz or less as required by FT8xx / BT8xx! */ -/* Takes no parameters but has a few optional parameters that are used by setting up defines. */ -/* EVE_TOUCH_RZTHRESH - configure the sensitivity of resistive touch, defaults to 1200. */ -/* EVE_ROTATE - set the screen rotation: bit0 = invert, bit2 = portrait, bit3 = mirrored */ -/* Note: if you use this you need a set of calibration values for the selected rotation since this rotates before - * calibration! */ -/* EVE_BACKLIGHT_FREQ - configure the backlight frequency, default is not writing it which results in 250Hz */ -/* EVE_BACKLIGHT_PWM - configure the backlight pwm, defaults to 0x20 / 25% */ -/* Returns E_OK in case of success. */ +/** + * @brief Initializes EVE according to the selected configuration from EVE_config.h. + * @return E_OK in case of success + * @note - Has to be executed with the SPI setup to 11 MHz or less as required by FT8xx / BT8xx! + * @note - Additional settings can be made through extra macros. + * @note - EVE_TOUCH_RZTHRESH - configure the sensitivity of resistive touch, defaults to 1200. + * @note - EVE_ROTATE - set the screen rotation: bit0 = invert, bit1 = portrait, bit2 = mirrored. + * @note - needs a set of calibration values for the selected rotation since this rotates before calibration! + * @note - EVE_BACKLIGHT_FREQ - configure the backlight frequency, default is not writing it which results in 250Hz. + * @note - EVE_BACKLIGHT_PWM - configure the backlight pwm, defaults to 0x20 / 25%. + */ uint8_t EVE_init(void) { uint8_t ret; @@ -1537,16 +1686,19 @@ uint8_t EVE_init(void) } } - return ret; + return (ret); } /* ################################################################## functions for display lists ##################################################################### */ -/* Begin a sequence of commands or prepare a DMA transfer if applicable. */ -/* Needs to be used with EVE_end_cmd_burst(). */ -/* Be careful to not use any functions in the sequence that do not address the command-fifo as for example any of EVE_mem...() functions. */ +/** + * @brief Begin a sequence of commands or prepare a DMA transfer if applicable. + * @note - Needs to be used with EVE_end_cmd_burst(). + * @note - Do not use any functions in the sequence that do not address the command-fifo as for example any of EVE_mem...() functions. + * @note - Do not use any of the functions that do not support burst-mode. + */ void EVE_start_cmd_burst(void) { #if defined (EVE_DMA) @@ -1560,7 +1712,7 @@ void EVE_start_cmd_burst(void) #if defined (EVE_DMA) EVE_dma_buffer[0U] = 0x7825B000UL; /* REG_CMDB_WRITE + MEM_WRITE low mid hi 00 */ -// ((uint8_t)(ft_address >> 16U) | MEM_WRITE) | (ft_address & 0x0000ff00UL) | ((uint8_t)(ft_address) << 16U); +// ((uint8_t) (ft_address >> 16U) | MEM_WRITE) | (ft_address & 0x0000ff00UL) | ((uint8_t) (ft_address) << 16U); // EVE_dma_buffer[0U] = EVE_dma_buffer[0U] << 8U; EVE_dma_buffer_index = 1U; #else @@ -1571,8 +1723,10 @@ void EVE_start_cmd_burst(void) #endif } -/* End a sequence of commands or trigger a prepared DMA transfer if applicable. */ -/* Needs to be used with EVE_start_cmd_burst(). */ +/** + * @brief End a sequence of commands or trigger a prepared DMA transfer if applicable. + * @note - Needs to be used with EVE_start_cmd_burst(). + */ void EVE_end_cmd_burst(void) { cmd_burst = 0U; @@ -1584,7 +1738,7 @@ void EVE_end_cmd_burst(void) #endif } -/* write a string to co-processor memory in context of a command: */ +/* write a string to coprocessor memory in context of a command: */ /* no chip-select, just plain SPI-transfers */ static void private_string_write(const char *p_text) { @@ -1622,7 +1776,9 @@ static void private_string_write(const char *p_text) for (uint8_t index = 0U; index < 4U; index++) { - uint8_t data = p_bytes[textindex + index]; + uint8_t data; + + data = p_bytes[textindex + index]; if (0U == data) { @@ -1643,8 +1799,10 @@ static void private_string_write(const char *p_text) /* BT817 / BT818 */ #if EVE_GEN > 3 -void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, - uint32_t frame) +/** + * @brief Render one frame in RAM_G of an animation. + */ +void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { if (0U == cmd_burst) { @@ -1666,6 +1824,9 @@ void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, } } +/** + * @brief Render one frame in RAM_G of an animation, only works in burst-mode. + */ void EVE_cmd_animframeram_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { @@ -1675,6 +1836,9 @@ void EVE_cmd_animframeram_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, spi_transmit_burst(frame); } +/** + * @brief Start an animation in RAM_G. + */ void EVE_cmd_animstartram(int32_t chnl, uint32_t aoptr, uint32_t loop) { if (0U == cmd_burst) @@ -1694,6 +1858,9 @@ void EVE_cmd_animstartram(int32_t chnl, uint32_t aoptr, uint32_t loop) } } +/** + * @brief Start an animation in RAM_G, only works in burst-mode. + */ void EVE_cmd_animstartram_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) { spi_transmit_burst(CMD_ANIMSTARTRAM); @@ -1702,6 +1869,9 @@ void EVE_cmd_animstartram_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) spi_transmit_burst(loop); } +/** + * @brief Sets the API level used by the coprocessor. + */ void EVE_cmd_apilevel(uint32_t level) { if (0U == cmd_burst) @@ -1717,14 +1887,20 @@ void EVE_cmd_apilevel(uint32_t level) } } +/** + * @brief Sets the API level used by the coprocessor, only works in burst-mode. + */ void EVE_cmd_apilevel_burst(uint32_t level) { spi_transmit_burst(CMD_APILEVEL); spi_transmit_burst(level); } -void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, - uint16_t height) +/** + * @brief Execute the touch screen calibration routine for a sub-window. + * @note - Does not support burst-mode. + */ +void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, uint16_t height) { if (0U == cmd_burst) { @@ -1741,6 +1917,9 @@ void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, } } +/** + * @brief Calls a command list in RAM_G. + */ void EVE_cmd_calllist(uint32_t adr) { if (0U == cmd_burst) @@ -1756,12 +1935,19 @@ void EVE_cmd_calllist(uint32_t adr) } } +/** + * @brief Calls a command list in RAM_G, only works in burst-mode. + */ void EVE_cmd_calllist_burst(uint32_t adr) { spi_transmit_burst(CMD_CALLLIST); spi_transmit_burst(adr); } +/** + * @brief Setup the Horizontal Scan out Filter for non-square pixel LCD support. + * @note - Does not support burst-mode. + */ void EVE_cmd_hsf(uint32_t hsf) { if (0U == cmd_burst) @@ -1770,19 +1956,11 @@ void EVE_cmd_hsf(uint32_t hsf) spi_transmit_32(hsf); EVE_cs_clear(); } - else - { - spi_transmit_burst(CMD_HSF); - spi_transmit_burst(hsf); - } -} - -void EVE_cmd_hsf_burst(uint32_t hsf) -{ - spi_transmit_burst(CMD_HSF); - spi_transmit_burst(hsf); } +/** + * @brief Play/run animations until complete. + */ void EVE_cmd_runanim(uint32_t waitmask, uint32_t play) { if (0U == cmd_burst) @@ -1800,6 +1978,9 @@ void EVE_cmd_runanim(uint32_t waitmask, uint32_t play) } } +/** + * @brief Play/run animations until complete, only works in burst-mode. + */ void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play) { spi_transmit_burst(CMD_RUNANIM); @@ -1812,6 +1993,9 @@ void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play) /* BT815 / BT816 */ #if EVE_GEN > 2 +/** + * @brief Draw one or more active animations. + */ void EVE_cmd_animdraw(int32_t chnl) { if (0U == cmd_burst) @@ -1827,12 +2011,18 @@ void EVE_cmd_animdraw(int32_t chnl) } } +/** + * @brief Draw one or more active animations, only works in burst-mode. + */ void EVE_cmd_animdraw_burst(int32_t chnl) { spi_transmit_burst(CMD_ANIMDRAW); spi_transmit_burst((uint32_t) chnl); } +/** + * @brief Draw the specified frame of an animation. + */ void EVE_cmd_animframe(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { if (0U == cmd_burst) @@ -1855,6 +2045,9 @@ void EVE_cmd_animframe(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) } } +/** + * @brief Draw the specified frame of an animation, only works in burst-mode. + */ void EVE_cmd_animframe_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { @@ -1864,6 +2057,9 @@ void EVE_cmd_animframe_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, spi_transmit_burst(frame); } +/** + * @brief Start an animation. + */ void EVE_cmd_animstart(int32_t chnl, uint32_t aoptr, uint32_t loop) { if (0U == cmd_burst) @@ -1883,6 +2079,9 @@ void EVE_cmd_animstart(int32_t chnl, uint32_t aoptr, uint32_t loop) } } +/** + * @brief Start an animation, only works in burst-mode. + */ void EVE_cmd_animstart_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) { spi_transmit_burst(CMD_ANIMSTART); @@ -1891,6 +2090,9 @@ void EVE_cmd_animstart_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) spi_transmit_burst(loop); } +/** + * @brief Stops one or more active animations. + */ void EVE_cmd_animstop(int32_t chnl) { if (0U == cmd_burst) @@ -1906,12 +2108,18 @@ void EVE_cmd_animstop(int32_t chnl) } } +/** + * @brief Stops one or more active animations, only works in burst-mode. + */ void EVE_cmd_animstop_burst(int32_t chnl) { spi_transmit_burst(CMD_ANIMSTOP); spi_transmit_burst((uint32_t) chnl); } +/** + * @brief Sets the coordinates of an animation. + */ void EVE_cmd_animxy(int32_t chnl, int16_t xc0, int16_t yc0) { if (0U == cmd_burst) @@ -1932,6 +2140,9 @@ void EVE_cmd_animxy(int32_t chnl, int16_t xc0, int16_t yc0) } } +/** + * @brief Sets the coordinates of an animation, only works in burst-mode. + */ void EVE_cmd_animxy_burst(int32_t chnl, int16_t xc0, int16_t yc0) { spi_transmit_burst(CMD_ANIMXY); @@ -1939,6 +2150,9 @@ void EVE_cmd_animxy_burst(int32_t chnl, int16_t xc0, int16_t yc0) spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); } +/** + * @brief Append flash data to the display list. + */ void EVE_cmd_appendf(uint32_t ptr, uint32_t num) { if (0U == cmd_burst) @@ -1956,6 +2170,9 @@ void EVE_cmd_appendf(uint32_t ptr, uint32_t num) } } +/** + * @brief Append flash data to the display list, only works in burst-mode. + */ void EVE_cmd_appendf_burst(uint32_t ptr, uint32_t num) { spi_transmit_burst(CMD_APPENDF); @@ -1963,6 +2180,9 @@ void EVE_cmd_appendf_burst(uint32_t ptr, uint32_t num) spi_transmit_burst(num); } +/** + * @brief Computes a bitmap transform and appends commands BITMAP_TRANSFORM_A...BITMAP_TRANSFORM_F to the display list. + */ uint16_t EVE_cmd_bitmap_transform(int32_t xc0, int32_t yc0, int32_t xc1, int32_t yc1, int32_t xc2, int32_t yc2, int32_t tx0, int32_t ty0, int32_t tx1, @@ -2012,11 +2232,13 @@ uint16_t EVE_cmd_bitmap_transform(int32_t xc0, int32_t yc0, int32_t xc1, spi_transmit_burst((uint32_t) ty2); spi_transmit_burst(0UL); } - return ret_val; + return (ret_val); } -/* note: as this is meant for use in burst-mode display-list generation */ -/* the result parameter is ignored */ +/** + * @brief Computes a bitmap transform and appends commands BITMAP_TRANSFORM_A...BITMAP_TRANSFORM_F to the display list. + * @note - Only works in burst-mode, the result parameter is ignored. + */ void EVE_cmd_bitmap_transform_burst(int32_t xc0, int32_t yc0, int32_t xc1, int32_t yc1, int32_t xc2, int32_t yc2, int32_t tx0, int32_t ty0, int32_t tx1, @@ -2038,6 +2260,9 @@ void EVE_cmd_bitmap_transform_burst(int32_t xc0, int32_t yc0, int32_t xc1, spi_transmit_burst(0UL); } +/** + * @brief Sets the pixel fill width for CMD_TEXT,CMD_BUTTON,CMD_BUTTON with the OPT_FILL option. + */ void EVE_cmd_fillwidth(uint32_t pixel) { if (0U == cmd_burst) @@ -2053,14 +2278,20 @@ void EVE_cmd_fillwidth(uint32_t pixel) } } +/** + * @brief Sets the pixel fill width for CMD_TEXT,CMD_BUTTON,CMD_BUTTON with the OPT_FILL option. + * @note - Only works in burst-mode. + */ void EVE_cmd_fillwidth_burst(uint32_t pixel) { spi_transmit_burst(CMD_FILLWIDTH); spi_transmit_burst(pixel); } -void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, - int16_t yc1, uint32_t argb1) +/** + * @brief Draw a smooth color gradient with transparency. + */ +void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1) { if (0U == cmd_burst) { @@ -2087,8 +2318,10 @@ void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, } } -void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, - int16_t xc1, int16_t yc1, uint32_t argb1) +/** + * @brief Draw a smooth color gradient with transparency, only works in burst-mode. + */ +void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1) { spi_transmit_burst(CMD_GRADIENTA); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); @@ -2097,14 +2330,17 @@ void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, spi_transmit_burst(argb1); } -void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale) +/** + * @brief Apply a rotation and scale around a specified coordinate. + */ +void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale) { if (0U == cmd_burst) { eve_begin_cmd(CMD_ROTATEAROUND); spi_transmit_32((uint32_t) xc0); spi_transmit_32((uint32_t) yc0); - spi_transmit_32((uint32_t) angle); + spi_transmit_32(angle & 0xFFFFUL); spi_transmit_32((uint32_t) scale); EVE_cs_clear(); } @@ -2113,24 +2349,31 @@ void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale spi_transmit_burst(CMD_ROTATEAROUND); spi_transmit_burst((uint32_t) xc0); spi_transmit_burst((uint32_t) yc0); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); spi_transmit_burst((uint32_t) scale); } } -void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, int32_t angle, +/** + * @brief Apply a rotation and scale around a specified coordinate, only works in burst-mode. + */ +void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale) { spi_transmit_burst(CMD_ROTATEAROUND); spi_transmit_burst((uint32_t) xc0); spi_transmit_burst((uint32_t) yc0); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); spi_transmit_burst((uint32_t) scale); } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text, +/** + * @brief Draw a button with a label, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_button_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { if (0U == cmd_burst) @@ -2140,12 +2383,12 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2166,8 +2409,8 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + ((uint32_t) options << 16U)); + spi_transmit_burst(((uint32_t) wid) + ((uint32_t) hgt << 16U)); + spi_transmit_burst(((uint32_t) font) + ((uint32_t) options << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2183,15 +2426,19 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text, +/** + * @brief Draw a button with a label, varargs version, only works in burst-mode. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + ((uint32_t) options << 16U)); + spi_transmit_burst(((uint32_t) wid) + ((uint32_t) hgt << 16U)); + spi_transmit_burst(((uint32_t) font) + ((uint32_t) options << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2206,8 +2453,12 @@ void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_text_var(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { @@ -2218,8 +2469,8 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2240,7 +2491,7 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2256,14 +2507,18 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2278,8 +2533,12 @@ void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { @@ -2290,10 +2549,10 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (state)); @@ -2316,8 +2575,8 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font) << 16U))); - spi_transmit_burst((uint32_t) options + (((uint32_t) state) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2333,15 +2592,19 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, varargs version, only works in burst-mode. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font) << 16U))); - spi_transmit_burst((uint32_t) options + (((uint32_t) state) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2358,18 +2621,14 @@ void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t fon #endif /* EVE_GEN > 2 */ -/* generic function for: */ -/* all co-processor commands that have no arguments */ -/* all display-list commands */ -/* - examples: - EVE_cmd_dl(CMD_DLSTART); - EVE_cmd_dl(CMD_SWAP); - EVE_cmd_dl(CMD_SCREENSAVER); - EVE_cmd_dl(LINE_WIDTH(1*16)); - EVE_cmd_dl(VERTEX2F(0,0)); - EVE_cmd_dl(DL_BEGIN | EVE_RECTS); -*/ +/** + * @brief Generic function for display-list and coprocessor commands with no arguments, only works in burst-mode. + * @note - EVE_cmd_dl(CMD_DLSTART); + * @note - EVE_cmd_dl(CMD_SWAP); + * @note - EVE_cmd_dl(CMD_SCREENSAVER); + * @note - EVE_cmd_dl(VERTEX2F(0,0)); + * @note - EVE_cmd_dl(DL_BEGIN | EVE_RECTS); + */ void EVE_cmd_dl(uint32_t command) { if (0U == cmd_burst) @@ -2383,11 +2642,17 @@ void EVE_cmd_dl(uint32_t command) } } +/** + * @brief Generic function for display-list and coprocessor commands with no arguments, only works in burst-mode. + */ void EVE_cmd_dl_burst(uint32_t command) { spi_transmit_burst(command); } +/** + * @brief Appends commands from RAM_G to the display list. + */ void EVE_cmd_append(uint32_t ptr, uint32_t num) { if (0U == cmd_burst) @@ -2405,6 +2670,9 @@ void EVE_cmd_append(uint32_t ptr, uint32_t num) } } +/** + * @brief Appends commands from RAM_G to the display list, only works in burst-mode. + */ void EVE_cmd_append_burst(uint32_t ptr, uint32_t num) { spi_transmit_burst(CMD_APPEND); @@ -2412,6 +2680,9 @@ void EVE_cmd_append_burst(uint32_t ptr, uint32_t num) spi_transmit_burst(num); } +/** + * @brief Set the background color. + */ void EVE_cmd_bgcolor(uint32_t color) { if (0U == cmd_burst) @@ -2430,14 +2701,20 @@ void EVE_cmd_bgcolor(uint32_t color) } } +/** + * @brief Set the background color, only works in burst-mode. + */ void EVE_cmd_bgcolor_burst(uint32_t color) { spi_transmit_burst(CMD_BGCOLOR); spi_transmit_burst(color); } -void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a button with a label. + */ +void EVE_cmd_button(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) { @@ -2446,12 +2723,12 @@ void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2461,22 +2738,29 @@ void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a button with a label, only works in burst-mode. + */ +void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } +/** + * @brief Execute the touch screen calibration routine. + * @note - does not support burst-mode + */ void EVE_cmd_calibrate(void) { if (0U == cmd_burst) @@ -2487,65 +2771,74 @@ void EVE_cmd_calibrate(void) } } -void EVE_cmd_clock(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, - uint16_t mins, uint16_t secs, uint16_t msecs) +/** + * @brief Draw an analog clock. + */ +void EVE_cmd_clock(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, + uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs) { if (0U == cmd_burst) { eve_begin_cmd(CMD_CLOCK); - spi_transmit((uint8_t)((uint16_t) xc0)); - spi_transmit((uint8_t)(((uint16_t) xc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) yc0)); - spi_transmit((uint8_t)(((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) rad)); - spi_transmit((uint8_t)(((uint16_t) rad) >> 8U)); - spi_transmit((uint8_t)(options)); - spi_transmit((uint8_t)(options >> 8U)); - spi_transmit((uint8_t)(hours)); - spi_transmit((uint8_t)(hours >> 8U)); - spi_transmit((uint8_t)(mins)); - spi_transmit((uint8_t)(mins >> 8U)); - spi_transmit((uint8_t)(secs)); - spi_transmit((uint8_t)(secs >> 8U)); - spi_transmit((uint8_t)(msecs)); - spi_transmit((uint8_t)(msecs >> 8U)); + spi_transmit((uint8_t) ((uint16_t) xc0)); + spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); + spi_transmit((uint8_t) ((uint16_t) yc0)); + spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); + spi_transmit((uint8_t) (options)); + spi_transmit((uint8_t) (options >> 8U)); + spi_transmit((uint8_t) (hours)); + spi_transmit((uint8_t) (hours >> 8U)); + spi_transmit((uint8_t) (mins)); + spi_transmit((uint8_t) (mins >> 8U)); + spi_transmit((uint8_t) (secs)); + spi_transmit((uint8_t) (secs >> 8U)); + spi_transmit((uint8_t) (msecs)); + spi_transmit((uint8_t) (msecs >> 8U)); EVE_cs_clear(); } else { spi_transmit_burst(CMD_CLOCK); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); - spi_transmit_burst((uint32_t) hours + (((uint32_t) mins) << 16U)); - spi_transmit_burst((uint32_t) secs + (((uint32_t) msecs) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) hours) + (((uint32_t) mins) << 16U)); + spi_transmit_burst(((uint32_t) secs) + (((uint32_t) msecs) << 16U)); } } -void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, +/** + * @brief Draw an analog clock, only works in burst-mode. + */ +void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs) { spi_transmit_burst(CMD_CLOCK); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); - spi_transmit_burst((uint32_t) hours + (((uint32_t) mins) << 16U)); - spi_transmit_burst((uint32_t) secs + (((uint32_t) msecs) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) hours) + (((uint32_t) mins) << 16U)); + spi_transmit_burst(((uint32_t) secs) + (((uint32_t) msecs) << 16U)); } -void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val) +/** + * @brief Draw a rotary dial control. + */ +void EVE_cmd_dial(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val) { if (0U == cmd_burst) { eve_begin_cmd(CMD_DIAL); - spi_transmit((uint8_t)((uint16_t) xc0)); - spi_transmit((uint8_t)(((uint16_t) xc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) yc0)); - spi_transmit((uint8_t)(((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) rad)); - spi_transmit((uint8_t)(((uint16_t) rad) >> 8U)); - spi_transmit((uint8_t)(options)); - spi_transmit((uint8_t)(options >> 8U)); - spi_transmit((uint8_t)(val)); - spi_transmit((uint8_t)(val >> 8U)); + spi_transmit((uint8_t) ((uint16_t) xc0)); + spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); + spi_transmit((uint8_t) ((uint16_t) yc0)); + spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); + spi_transmit((uint8_t) (options)); + spi_transmit((uint8_t) (options >> 8U)); + spi_transmit((uint8_t) (val)); + spi_transmit((uint8_t) (val >> 8U)); spi_transmit(0U); spi_transmit(0U); EVE_cs_clear(); @@ -2553,29 +2846,35 @@ void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint1 else { spi_transmit_burst(CMD_DIAL); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(val); } } -void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a rotary dial control, only works in burst-mode. + */ +void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val) { spi_transmit_burst(CMD_DIAL); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(val); } +/** + * @brief Set the foreground color. + */ void EVE_cmd_fgcolor(uint32_t color) { if (0U == cmd_burst) { eve_begin_cmd(CMD_FGCOLOR); - spi_transmit((uint8_t)(color)); - spi_transmit((uint8_t)(color >> 8U)); - spi_transmit((uint8_t)(color >> 16U)); + spi_transmit((uint8_t) (color)); + spi_transmit((uint8_t) (color >> 8U)); + spi_transmit((uint8_t) (color >> 16U)); spi_transmit(0U); EVE_cs_clear(); } @@ -2586,13 +2885,19 @@ void EVE_cmd_fgcolor(uint32_t color) } } +/** + * @brief Set the foreground color, only works in burst-mode. + */ void EVE_cmd_fgcolor_burst(uint32_t color) { spi_transmit_burst(CMD_FGCOLOR); spi_transmit_burst(color); } -void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a gauge. + */ +void EVE_cmd_gauge(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -2602,8 +2907,8 @@ void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) rad)); - spi_transmit((uint8_t) (((uint16_t) rad) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (major)); @@ -2620,27 +2925,30 @@ void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, { spi_transmit_burst(CMD_GAUGE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) rad)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(((uint32_t) major) + (((uint32_t) minor) << 16U)); spi_transmit_burst(((uint32_t) val) + (((uint32_t) range) << 16U)); } } -void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a gauge, only works in burst-mode. + */ +void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_GAUGE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) rad)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(((uint32_t) major) + (((uint32_t) minor) << 16U)); spi_transmit_burst(((uint32_t) val) + (((uint32_t) range) << 16U)); } -/* EVE_cmd_getmatrix() is meant to be called with display-list building. */ -/* but it waits for completion as it returns values by writing */ -/* to the command-fifo, it can not be used with cmd-burst */ -/* gets the properties of the bitmap transform matrix and write the values */ -/* to the variables that are supplied by pointers */ +/** + * @brief Retrieves the current matrix within the context of the coprocessor engine. + * @note - waits for completion and reads values from RAM_CMD after completion + * @note - can not be used with cmd-burst + */ void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, int32_t *p_d, int32_t *p_e, int32_t *p_f) { @@ -2662,45 +2970,48 @@ void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, if (p_f != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL); *p_f = (int32_t) EVE_memRead32(address); } if (p_e != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL); *p_e = (int32_t) EVE_memRead32(address); } if (p_d != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL); *p_d = (int32_t) EVE_memRead32(address); } if (p_c != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 16U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 16UL) & 0xfffUL); *p_c = (int32_t) EVE_memRead32(address); } if (p_b != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 20U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 20UL) & 0xfffUL); *p_b = (int32_t) EVE_memRead32(address); } if (p_a != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 24U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 24UL) & 0xfffUL); *p_a = (int32_t) EVE_memRead32(address); } } } +/** + * @brief Set up the highlight color used in 3D effects for CMD_BUTTON and CMD_KEYS. + */ void EVE_cmd_gradcolor(uint32_t color) { if (0U == cmd_burst) { eve_begin_cmd(CMD_GRADCOLOR); - spi_transmit((uint8_t)(color)); - spi_transmit((uint8_t)(color >> 8U)); - spi_transmit((uint8_t)(color >> 16U)); + spi_transmit((uint8_t) (color)); + spi_transmit((uint8_t) (color >> 8U)); + spi_transmit((uint8_t) (color >> 16U)); spi_transmit(0U); EVE_cs_clear(); } @@ -2711,12 +3022,18 @@ void EVE_cmd_gradcolor(uint32_t color) } } +/** + * @brief Set up the highlight color used in 3D effects for CMD_BUTTON and CMD_KEYS, only works in burst-mode. + */ void EVE_cmd_gradcolor_burst(uint32_t color) { spi_transmit_burst(CMD_GRADCOLOR); spi_transmit_burst(color); } +/** + * @brief Draw a smooth color gradient. + */ void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1) { @@ -2751,6 +3068,9 @@ void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, } } +/** + * @brief Draw a smooth color gradient, only works in burst-mode. + */ void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1) { @@ -2761,8 +3081,13 @@ void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1 spi_transmit_burst(rgb1); } -void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a row of key buttons with labels. + * @note - The tag value of each button is set to the ASCII value of its label. + * @note - Does not work with UTF-8. + */ +void EVE_cmd_keys(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) { @@ -2771,12 +3096,12 @@ void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2786,24 +3111,32 @@ void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_KEYS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a row of key buttons with labels, only works in burst-mode. + * @note - The tag value of each button is set to the ASCII value of its label. + * @note - Does not work with UTF-8. + */ +void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_KEYS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } -void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, - int32_t number) +/** + * @brief Draw a number. + */ +void EVE_cmd_number(int16_t xc0, int16_t yc0, uint16_t font, + uint16_t options, int32_t number) { if (0U == cmd_burst) { @@ -2812,8 +3145,8 @@ void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit_32((uint32_t) number); @@ -2823,21 +3156,27 @@ void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, { spi_transmit_burst(CMD_NUMBER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); spi_transmit_burst((uint32_t) number); } } -void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a number, only works in burst-mode. + */ +void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number) { spi_transmit_burst(CMD_NUMBER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); spi_transmit_burst((uint32_t) number); } -void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a progress bar. + */ +void EVE_cmd_progress(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -2847,10 +3186,10 @@ void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -2865,28 +3204,29 @@ void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_PROGRESS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) options) + ((uint32_t)val << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } } -void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a progress bar, only works in burst-mode. + */ +void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_PROGRESS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) options) + ((uint32_t)val << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } -/* Note: CMD_ROMFONT generates display list commands so it needs to be put in a display list. */ -/* A minimum display list to properly execute CMD_ROMFONT would be: */ -/* EVE_cmd_dl(CMD_DLSTART); */ -/* EVE_cmd_romfont(font, romslot); */ -/* ...other bitmap handle commands like more CMD_ROMFONT or CMD_SETFONT2 */ -/* EVE_cmd_dl(CMD_SWAP); */ +/** + * @brief Load a ROM font into bitmap handle. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_romfont(uint32_t font, uint32_t romslot) { if (0U == cmd_burst) @@ -2904,6 +3244,10 @@ void EVE_cmd_romfont(uint32_t font, uint32_t romslot) } } +/** + * @brief Load a ROM font into bitmap handle, only works in burst-mode. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot) { spi_transmit_burst(CMD_ROMFONT); @@ -2911,27 +3255,36 @@ void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot) spi_transmit_burst(romslot); } -void EVE_cmd_rotate(int32_t angle) +/** + * @brief Apply a rotation to the current matrix. + */ +void EVE_cmd_rotate(uint32_t angle) { if (0U == cmd_burst) { eve_begin_cmd(CMD_ROTATE); - spi_transmit_32((uint32_t) angle); + spi_transmit_32(angle & 0xFFFFUL); EVE_cs_clear(); } else { spi_transmit_burst(CMD_ROTATE); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); } } -void EVE_cmd_rotate_burst(int32_t angle) +/** + * @brief Apply a rotation to the current matrix, only works in burst-mode. + */ +void EVE_cmd_rotate_burst(uint32_t angle) { spi_transmit_burst(CMD_ROTATE); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); } +/** + * @brief Apply a scale to the current matrix. + */ void EVE_cmd_scale(int32_t scx, int32_t scy) { if (0U == cmd_burst) @@ -2949,6 +3302,9 @@ void EVE_cmd_scale(int32_t scx, int32_t scy) } } +/** + * @brief Apply a scale to the current matrix, only works in burst-mode. + */ void EVE_cmd_scale_burst(int32_t scx, int32_t scy) { spi_transmit_burst(CMD_SCALE); @@ -2956,7 +3312,10 @@ void EVE_cmd_scale_burst(int32_t scx, int32_t scy) spi_transmit_burst((uint32_t) scy); } -void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a scroll bar. + */ +void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { if (0U == cmd_burst) @@ -2966,10 +3325,10 @@ void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -2984,22 +3343,28 @@ void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_SCROLLBAR); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst(((uint32_t) size) + (((uint32_t) range) << 16U)); } } -void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a scroll bar, only works in burst-mode. + */ +void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { spi_transmit_burst(CMD_SCROLLBAR); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst(((uint32_t) size) + (((uint32_t) range) << 16U)); } +/** + * @brief Set the base for number output. + */ void EVE_cmd_setbase(uint32_t base) { if (0U == cmd_burst) @@ -3015,12 +3380,18 @@ void EVE_cmd_setbase(uint32_t base) } } +/** + * @brief Set the base for number output, only works in burst-mode. + */ void EVE_cmd_setbase_burst(uint32_t base) { spi_transmit_burst(CMD_SETBASE); spi_transmit_burst(base); } +/** + * @brief Generate the corresponding display list commands for given bitmap information. + */ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height) { @@ -3028,12 +3399,12 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, { eve_begin_cmd(CMD_SETBITMAP); spi_transmit_32(addr); - spi_transmit((uint8_t)(fmt)); - spi_transmit((uint8_t)(fmt >> 8U)); - spi_transmit((uint8_t)(width)); - spi_transmit((uint8_t)(width >> 8U)); - spi_transmit((uint8_t)(height)); - spi_transmit((uint8_t)(height >> 8U)); + spi_transmit((uint8_t) (fmt)); + spi_transmit((uint8_t) (fmt >> 8U)); + spi_transmit((uint8_t) (width)); + spi_transmit((uint8_t) (width >> 8U)); + spi_transmit((uint8_t) (height)); + spi_transmit((uint8_t) (height >> 8U)); spi_transmit(0U); spi_transmit(0U); EVE_cs_clear(); @@ -3042,20 +3413,27 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, { spi_transmit_burst(CMD_SETBITMAP); spi_transmit_burst(addr); - spi_transmit_burst((uint32_t) fmt + (((uint32_t) width) << 16U)); + spi_transmit_burst(((uint32_t) fmt) + (((uint32_t) width) << 16U)); spi_transmit_burst((uint32_t) height); } } +/** + * @brief Generate the corresponding display list commands for given bitmap information, only works in burst-mode. + */ void EVE_cmd_setbitmap_burst(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height) { spi_transmit_burst(CMD_SETBITMAP); spi_transmit_burst(addr); - spi_transmit_burst((uint32_t) fmt + (((uint32_t) width) << 16U)); + spi_transmit_burst(((uint32_t) fmt) + (((uint32_t) width) << 16U)); spi_transmit_burst((uint32_t) height); } +/** + * @brief Register one custom font into the coprocessor engine. + * @note - does not set up the bitmap parameters of the font + */ void EVE_cmd_setfont(uint32_t font, uint32_t ptr) { if (0U == cmd_burst) @@ -3073,6 +3451,10 @@ void EVE_cmd_setfont(uint32_t font, uint32_t ptr) } } +/** + * @brief Register one custom font into the coprocessor engine, only works in burst-mode. + * @note - does not set up the bitmap parameters of the font + */ void EVE_cmd_setfont_burst(uint32_t font, uint32_t ptr) { spi_transmit_burst(CMD_SETFONT); @@ -3080,12 +3462,10 @@ void EVE_cmd_setfont_burst(uint32_t font, uint32_t ptr) spi_transmit_burst(ptr); } -/* Note: CMD_SETFONT2 generates display list commands so it needs to be put in a display list. */ -/* A minimum display list to properly execute CMD_SETFONT2 would be: */ -/* EVE_cmd_dl(CMD_DLSTART); */ -/* EVE_cmd_setfont2(font, ptr, firstchar); */ -/* ...other bitmap handle commands like more CMD_SETFONT2 or CMD_ROMFONT */ -/* EVE_cmd_dl(CMD_SWAP); */ +/** + * @brief Set up a custom for use by the coprocessor engine. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar) { if (0U == cmd_burst) @@ -3105,6 +3485,10 @@ void EVE_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar) } } +/** + * @brief Set up a custom for use by the coprocessor engine, only works in burst-mode. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_setfont2_burst(uint32_t font, uint32_t ptr, uint32_t firstchar) { spi_transmit_burst(CMD_SETFONT2); @@ -3113,6 +3497,9 @@ void EVE_cmd_setfont2_burst(uint32_t font, uint32_t ptr, uint32_t firstchar) spi_transmit_burst(firstchar); } +/** + * @brief Set the scratch bitmap for widget use. + */ void EVE_cmd_setscratch(uint32_t handle) { if (0U == cmd_burst) @@ -3128,12 +3515,18 @@ void EVE_cmd_setscratch(uint32_t handle) } } +/** + * @brief Set the scratch bitmap for widget use, only works in burst-mode. + */ void EVE_cmd_setscratch_burst(uint32_t handle) { spi_transmit_burst(CMD_SETSCRATCH); spi_transmit_burst(handle); } +/** + * @brief Start a continuous sketch update. + */ void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format) { @@ -3165,6 +3558,9 @@ void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, } } +/** + * @brief Start a continuous sketch update, only works in burst-mode. + */ void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format) { @@ -3175,7 +3571,10 @@ void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, spi_transmit_burst((uint32_t) format); } -void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a slider. + */ +void EVE_cmd_slider(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -3185,10 +3584,10 @@ void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -3203,22 +3602,28 @@ void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_SLIDER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } } -void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a slider, only works in burst-mode. + */ +void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_SLIDER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } +/** + * @brief Start an animated spinner. + */ void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) { if (0U == cmd_burst) @@ -3242,6 +3647,9 @@ void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) } } +/** + * @brief Start an animated spinner, only works in burst-mode. + */ void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) { @@ -3250,7 +3658,10 @@ void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, spi_transmit_burst(((uint32_t) style) + (((uint32_t) scale) << 16U)); } -void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, +/** + * @brief Draw a text string. + */ +void EVE_cmd_text(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) @@ -3260,8 +3671,8 @@ void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -3271,21 +3682,27 @@ void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, only works in burst-mode. + */ +void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } -void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels. + */ +void EVE_cmd_toggle(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text) { if (0U == cmd_burst) @@ -3295,10 +3712,10 @@ void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (state)); @@ -3310,22 +3727,28 @@ void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); } } -void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, only works in burst-mode. + */ +void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text) { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); } +/** + * @brief Apply a translation to the current matrix. + */ void EVE_cmd_translate(int32_t tr_x, int32_t tr_y) { if (0U == cmd_burst) @@ -3343,6 +3766,9 @@ void EVE_cmd_translate(int32_t tr_x, int32_t tr_y) } } +/** + * @brief Apply a translation to the current matrix, only works in burst-mode. + */ void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y) { spi_transmit_burst(CMD_TRANSLATE); @@ -3350,21 +3776,33 @@ void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y) spi_transmit_burst((uint32_t) tr_y); } +/** + * @brief Set the current color red, green and blue. + */ void EVE_color_rgb(uint32_t color) { EVE_cmd_dl(DL_COLOR_RGB | (color & 0x00ffffffUL)); } +/** + * @brief Set the current color red, green and blue, only works in burst-mode. + */ void EVE_color_rgb_burst(uint32_t color) { spi_transmit_burst(DL_COLOR_RGB | (color & 0x00ffffffUL)); } +/** + * @brief Set the current color alpha, green and blue. + */ void EVE_color_a(uint8_t alpha) { EVE_cmd_dl(DL_COLOR_A | ((uint32_t) alpha)); } +/** + * @brief Set the current color alpha, green and blue, only works in burst-mode. + */ void EVE_color_a_burst(uint8_t alpha) { spi_transmit_burst(DL_COLOR_A | ((uint32_t) alpha)); @@ -3417,19 +3855,26 @@ void EVE_calibrate_manual(uint16_t width, uint16_t height) EVE_cmd_dl(CMD_DLSTART); EVE_cmd_dl(DL_CLEAR_COLOR_RGB); EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG); + EVE_cmd_dl(DL_VERTEX_FORMAT); /* set to 0 - reduce precision for VERTEX2F to 1 pixel instead of 1/16 pixel default */ /* draw Calibration Point on screen */ EVE_cmd_dl(DL_COLOR_RGB | 0x0000ffUL); EVE_cmd_dl(POINT_SIZE(15U * 16U)); EVE_cmd_dl((DL_BEGIN | EVE_POINTS)); - EVE_cmd_dl(VERTEX2F((uint32_t)(display_x[count]) * 16U, (uint32_t)((display_y[count])) * 16U)); + + int16_t xc0; + int16_t yc0; + + xc0 = (int16_t) display_x[count]; + yc0 = (int16_t) display_y[count]; + EVE_cmd_dl(VERTEX2F(xc0, yc0)); EVE_cmd_dl(DL_END); EVE_cmd_dl(DL_COLOR_RGB | 0xffffffUL); - EVE_cmd_text((int16_t) width / 2, 20, 26, EVE_OPT_CENTER, "tap on the dot"); + EVE_cmd_text((int16_t) width / 2, 20, 26U, EVE_OPT_CENTER, "tap on the dot"); calc = count + 0x31U; num[0U] = (char) calc; num[1U] = (char) 0U; /* null terminated string of one character */ - EVE_cmd_text((int16_t) display_x[count], (int16_t) display_y[count], 27, EVE_OPT_CENTER, num); + EVE_cmd_text((int16_t) display_x[count], (int16_t) display_y[count], 27U, EVE_OPT_CENTER, num); EVE_cmd_dl(DL_DISPLAY); EVE_cmd_dl(CMD_SWAP); diff --git a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.h b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.h index 912e493..144d7ed 100644 --- a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.h +++ b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_commands.h @@ -2,7 +2,7 @@ @file EVE_commands.h @brief contains FT8xx / BT8xx function prototypes @version 5.0 -@date 2023-07-28 +@date 2023-12-29 @author Rudolph Riedel @section LICENSE @@ -80,6 +80,10 @@ EVE_cmd_animstartram_burst() - put E_OK and E_NOT_OK in #ifndef/#endif guards as these are usually defined already in AUTOSAR projects - renamed EVE_FAIL_CHIPID_TIMEOUT to EVE_FAIL_REGID_TIMEOUT as suggested by #93 on github +- changed a number of function parameters from signed to unsigned following the + updated BT81x series programming guide V2.4 +- commented out EVE_cmd_regread() prototype +- removed prototype for EVE_cmd_hsf_burst() */ @@ -142,8 +146,8 @@ void EVE_execute_cmd(void); #if EVE_GEN > 3 void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num); -void EVE_cmd_fontcache(uint32_t font, int32_t ptr, uint32_t num); -void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used); +void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num); +void EVE_cmd_fontcachequery(uint32_t *p_total, uint32_t *p_used); void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, uint32_t *p_height, uint32_t *p_palette); void EVE_cmd_linetime(uint32_t dest); void EVE_cmd_newlist(uint32_t adr); @@ -180,15 +184,15 @@ void EVE_cmd_mediafifo(uint32_t ptr, uint32_t size); void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num); uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num); void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num); -/*(void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data); */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num); void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len); -uint32_t EVE_cmd_regread(uint32_t ptr); void EVE_cmd_setrotate(uint32_t rotation); void EVE_cmd_snapshot(uint32_t ptr); -void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt); -void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t tag); +void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt); +void EVE_cmd_track(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t tag); void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr); +/*void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data);*/ +/*uint32_t EVE_cmd_regread(uint32_t ptr);*/ /* ################################################################## patching and initialization @@ -221,7 +225,6 @@ void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, uint16_t h void EVE_cmd_calllist(uint32_t adr); void EVE_cmd_calllist_burst(uint32_t adr); void EVE_cmd_hsf(uint32_t hsf); -void EVE_cmd_hsf_burst(uint32_t hsf); void EVE_cmd_runanim(uint32_t waitmask, uint32_t play); void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play); @@ -250,15 +253,15 @@ void EVE_cmd_fillwidth(uint32_t pixel); void EVE_cmd_fillwidth_burst(uint32_t pixel); void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1); void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1); -void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale); -void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale); +void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale); +void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale); -void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_button_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_text_var(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); #endif /* EVE_GEN > 2 */ @@ -269,36 +272,36 @@ void EVE_cmd_append(uint32_t ptr, uint32_t num); void EVE_cmd_append_burst(uint32_t ptr, uint32_t num); void EVE_cmd_bgcolor(uint32_t color); void EVE_cmd_bgcolor_burst(uint32_t color); -void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); +void EVE_cmd_button(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); void EVE_cmd_calibrate(void); -void EVE_cmd_clock(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); -void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); -void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val); -void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val); +void EVE_cmd_clock(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); +void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); +void EVE_cmd_dial(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val); +void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val); void EVE_cmd_fgcolor(uint32_t color); void EVE_cmd_fgcolor_burst(uint32_t color); -void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); -void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); +void EVE_cmd_gauge(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); +void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, int32_t *p_d, int32_t *p_e, int32_t *p_f); void EVE_cmd_gradcolor(uint32_t color); void EVE_cmd_gradcolor_burst(uint32_t color); void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1); void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1); -void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, int32_t number); -void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, int32_t number); -void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); -void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_keys(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_number(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number); +void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number); +void EVE_cmd_progress(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); void EVE_cmd_romfont(uint32_t font, uint32_t romslot); void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot); -void EVE_cmd_rotate(int32_t angle); -void EVE_cmd_rotate_burst(int32_t angle); +void EVE_cmd_rotate(uint32_t angle); +void EVE_cmd_rotate_burst(uint32_t angle); void EVE_cmd_scale(int32_t scx, int32_t scy); void EVE_cmd_scale_burst(int32_t scx, int32_t scy); -void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); -void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); +void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); +void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); void EVE_cmd_setbase(uint32_t base); void EVE_cmd_setbase_burst(uint32_t base); void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height); @@ -311,14 +314,14 @@ void EVE_cmd_setscratch(uint32_t handle); void EVE_cmd_setscratch_burst(uint32_t handle); void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format); void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format); -void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); -void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_slider(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale); void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale); -void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text); -void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text); +void EVE_cmd_text(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_toggle(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text); +void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text); void EVE_cmd_translate(int32_t tr_x, int32_t tr_y); void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y); diff --git a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target.h b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target.h index 8891c85..e926cfd 100644 --- a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target.h +++ b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target.h @@ -2,7 +2,7 @@ @file EVE_target.h @brief target specific includes, definitions and functions @version 5.0 -@date 2023-09-01 +@date 2023-09-30 @author Rudolph Riedel @section LICENSE @@ -87,6 +87,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - fix: while working, the check for multiple different targets was not implemented correctly - added ARDUINO_HLK_w80x target for W801, W806 and Air103 boards - modified the RISC-V entry as there are ESP32 now with RISC-V core +- added detection of the Tasking compiler and added tc38x and tc39xb targets +- removed the unfortunately defunct WIZIOPICO */ @@ -285,8 +287,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif /* __GNUC__ */ -#endif /* !Arduino */ - /* ################################################################## */ /* ################################################################## */ @@ -312,6 +312,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* ################################################################## */ /* ################################################################## */ +#if defined(__TASKING__) + +#if (__CPU__ == tc38x) || (__CPU__ == tc39xb) + +#include "EVE_target/EVE_target_Tricore_Tasking.h" + +#endif +#endif + +/* ################################################################## */ +/* ################################################################## */ + +#endif /* !Arduino */ + #if defined (ARDUINO) #if defined (__AVR__) @@ -340,7 +354,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "EVE_target/EVE_target_Arduino_Nucleo_F446RE.h" -#elif defined (WIZIOPICO) || defined (PICOPI) +#elif defined (ARDUINO_RASPBERRY_PI_PICO) #include "EVE_target/EVE_target_Arduino_RP2040.h" diff --git a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMC21.h b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMC21.h index b1dd218..2b2f64d 100644 --- a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMC21.h +++ b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMC21.h @@ -199,12 +199,12 @@ static inline uint8_t spi_receive(uint8_t data) { EVE_SPI_SERCOM->SPI.DATA.reg = data; while (0U == (EVE_SPI_SERCOM->SPI.INTFLAG.reg & SERCOM_SPI_INTFLAG_TXC)) {} - return EVE_SPI_SERCOM->SPI.DATA.reg; + return (EVE_SPI_SERCOM->SPI.DATA.reg); } static inline uint8_t fetch_flash_byte(const uint8_t *p_data) { - return *p_data; + return (*p_data); } #endif /* SAMC2x */ diff --git a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/LICENSE b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/LICENSE index e454a70..a6ab28b 100644 --- a/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/LICENSE +++ b/examples/EVE_Test_SAMC21_EVE2-50G/EmbeddedVideoEngine/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2023 Rudolph Riedel +Copyright (c) 2016-2024 Rudolph Riedel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -18,4 +18,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/examples/EVE_Test_SAME51_DMA_EVE3-50G_Dev_PlatformIO/platformio.ini b/examples/EVE_Test_SAME51_DMA_EVE3-50G_Dev_PlatformIO/platformio.ini index c6e0ed3..a0eaf6a 100644 --- a/examples/EVE_Test_SAME51_DMA_EVE3-50G_Dev_PlatformIO/platformio.ini +++ b/examples/EVE_Test_SAME51_DMA_EVE3-50G_Dev_PlatformIO/platformio.ini @@ -16,6 +16,16 @@ platform = https://github.com/RudolphRiedel/platform-atmelsam.git#feat-cmsis-bui lib_deps = https://github.com/RudolphRiedel/FT800-FT813/archive/refs/heads/5.x.zip build_flags = -D EVE_EVE3_50G +;note: this is necessary, by default PlatformIO does not care for +;C/C++ preprocessor conditional syntax and tries to compile whatever might +;be indicated by whatever header file, regardless of that it is not actually used +lib_ldf_mode = chain+ + +;check_tool = cppcheck +;check_flags = --enable=all --addon=cert.py --suppress=unusedFunction + +check_tool = clangtidy +check_flags = --checks=-*,cert-*,bugprone-*,google-*,hicpp-*, portability-*, readability-* [env:same51j19a] board = same51j19a diff --git a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE.h b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE.h index ae2b9b2..e40010e 100644 --- a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE.h +++ b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE.h @@ -2,7 +2,7 @@ @file EVE.h @brief Contains FT80x/FT81x/BT81x API definitions @version 5.0 -@date 2023-06-24 +@date 2024-01-07 @author Rudolph Riedel @section LICENSE @@ -63,6 +63,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - added #ifdef __cplusplus / extern "C" to allow adding EVE_ functions to C++ code - fix: typo REG_COPRO_PATCH_DTR -> REG_COPRO_PATCH_PTR +- started to convert the function-like macros to static inline functions to be + a little friendlier towards C++ in regards of type-safety +- added type-casts to all simple macros +- converted some more function-like macros to static inline functions +- converted the rest of the function-like macros to static inline functions +- fix: forgot to comment out the EVE2 BITMAP_TRANSFORM_E when converting it to an inline function */ @@ -80,561 +86,975 @@ extern "C" #include "EVE_commands.h" /* Memory */ -#define EVE_RAM_G 0x00000000UL -#define EVE_ROM_CHIPID 0x000C0000UL -#define EVE_ROM_FONT 0x001E0000UL -#define EVE_ROM_FONTROOT 0x002FFFFCUL -#define EVE_RAM_DL 0x00300000UL -#define EVE_RAM_REG 0x00302000UL -#define EVE_RAM_CMD 0x00308000UL +#define EVE_RAM_G ((uint32_t) 0x00000000UL) +#define EVE_ROM_CHIPID ((uint32_t) 0x000C0000UL) +#define EVE_ROM_FONT ((uint32_t) 0x001E0000UL) +#define EVE_ROM_FONTROOT ((uint32_t) 0x002FFFFCUL) +#define EVE_RAM_DL ((uint32_t) 0x00300000UL) +#define EVE_RAM_REG ((uint32_t) 0x00302000UL) +#define EVE_RAM_CMD ((uint32_t) 0x00308000UL) /* Memory buffer sizes */ -#define EVE_RAM_G_SIZE (1024U*1024UL) -#define EVE_CMDFIFO_SIZE (4U*1024UL) -#define EVE_RAM_DL_SIZE (8U*1024UL) +#define EVE_RAM_G_SIZE ((uint32_t) 1024U*1024UL) +#define EVE_CMDFIFO_SIZE ((uint32_t) 4U*1024UL) +#define EVE_RAM_DL_SIZE ((uint32_t) 8U*1024UL) /* diplay list list commands, most need OR's arguments */ -#define DL_DISPLAY 0x00000000UL -#define DL_BITMAP_SOURCE 0x01000000UL -#define DL_CLEAR_COLOR_RGB 0x02000000UL -#define DL_TAG 0x03000000UL -#define DL_COLOR_RGB 0x04000000UL -#define DL_BITMAP_HANDLE 0x05000000UL -#define DL_CELL 0x06000000UL -#define DL_BITMAP_LAYOUT 0x07000000UL -#define DL_BITMAP_SIZE 0x08000000UL -#define DL_ALPHA_FUNC 0x09000000UL -#define DL_STENCIL_FUNC 0x0A000000UL -#define DL_BLEND_FUNC 0x0B000000UL -#define DL_STENCIL_OP 0x0C000000UL -#define DL_POINT_SIZE 0x0D000000UL -#define DL_LINE_WIDTH 0x0E000000UL -#define DL_CLEAR_COLOR_A 0x0F000000UL -#define DL_COLOR_A 0x10000000UL -#define DL_CLEAR_STENCIL 0x11000000UL -#define DL_CLEAR_TAG 0x12000000UL -#define DL_STENCIL_MASK 0x13000000UL -#define DL_TAG_MASK 0x14000000UL -#define DL_BITMAP_TRANSFORM_A 0x15000000UL -#define DL_BITMAP_TRANSFORM_B 0x16000000UL -#define DL_BITMAP_TRANSFORM_C 0x17000000UL -#define DL_BITMAP_TRANSFORM_D 0x18000000UL -#define DL_BITMAP_TRANSFORM_E 0x19000000UL -#define DL_BITMAP_TRANSFORM_F 0x1A000000UL -#define DL_SCISSOR_XY 0x1B000000UL -#define DL_SCISSOR_SIZE 0x1C000000UL -#define DL_CALL 0x1D000000UL -#define DL_JUMP 0x1E000000UL -#define DL_BEGIN 0x1F000000UL -#define DL_COLOR_MASK 0x20000000UL -#define DL_END 0x21000000UL -#define DL_SAVE_CONTEXT 0x22000000UL -#define DL_RESTORE_CONTEXT 0x23000000UL -#define DL_RETURN 0x24000000UL -#define DL_MACRO 0x25000000UL -#define DL_CLEAR 0x26000000UL -#define DL_VERTEX_FORMAT 0x27000000UL -#define DL_BITMAP_LAYOUT_H 0x28000000UL -#define DL_BITMAP_SIZE_H 0x29000000UL -#define DL_PALETTE_SOURCE 0x2A000000UL -#define DL_VERTEX_TRANSLATE_X 0x2B000000UL -#define DL_VERTEX_TRANSLATE_Y 0x2C000000UL -#define DL_NOP 0x2D000000UL - -#define DL_VERTEX2F 0x40000000UL -#define DL_VERTEX2II 0x80000000UL - -#define CLR_COL 0x4U -#define CLR_STN 0x2U -#define CLR_TAG 0x1U +#define DL_DISPLAY ((uint32_t) 0x00000000UL) +#define DL_BITMAP_SOURCE ((uint32_t) 0x01000000UL) +#define DL_CLEAR_COLOR_RGB ((uint32_t) 0x02000000UL) +#define DL_TAG ((uint32_t) 0x03000000UL) +#define DL_COLOR_RGB ((uint32_t) 0x04000000UL) +#define DL_BITMAP_HANDLE ((uint32_t) 0x05000000UL) +#define DL_CELL ((uint32_t) 0x06000000UL) +#define DL_BITMAP_LAYOUT ((uint32_t) 0x07000000UL) +#define DL_BITMAP_SIZE ((uint32_t) 0x08000000UL) +#define DL_ALPHA_FUNC ((uint32_t) 0x09000000UL) +#define DL_STENCIL_FUNC ((uint32_t) 0x0A000000UL) +#define DL_BLEND_FUNC ((uint32_t) 0x0B000000UL) +#define DL_STENCIL_OP ((uint32_t) 0x0C000000UL) +#define DL_POINT_SIZE ((uint32_t) 0x0D000000UL) +#define DL_LINE_WIDTH ((uint32_t) 0x0E000000UL) +#define DL_CLEAR_COLOR_A ((uint32_t) 0x0F000000UL) +#define DL_COLOR_A ((uint32_t) 0x10000000UL) +#define DL_CLEAR_STENCIL ((uint32_t) 0x11000000UL) +#define DL_CLEAR_TAG ((uint32_t) 0x12000000UL) +#define DL_STENCIL_MASK ((uint32_t) 0x13000000UL) +#define DL_TAG_MASK ((uint32_t) 0x14000000UL) +#define DL_BITMAP_TRANSFORM_A ((uint32_t) 0x15000000UL) +#define DL_BITMAP_TRANSFORM_B ((uint32_t) 0x16000000UL) +#define DL_BITMAP_TRANSFORM_C ((uint32_t) 0x17000000UL) +#define DL_BITMAP_TRANSFORM_D ((uint32_t) 0x18000000UL) +#define DL_BITMAP_TRANSFORM_E ((uint32_t) 0x19000000UL) +#define DL_BITMAP_TRANSFORM_F ((uint32_t) 0x1A000000UL) +#define DL_SCISSOR_XY ((uint32_t) 0x1B000000UL) +#define DL_SCISSOR_SIZE ((uint32_t) 0x1C000000UL) +#define DL_CALL ((uint32_t) 0x1D000000UL) +#define DL_JUMP ((uint32_t) 0x1E000000UL) +#define DL_BEGIN ((uint32_t) 0x1F000000UL) +#define DL_COLOR_MASK ((uint32_t) 0x20000000UL) +#define DL_END ((uint32_t) 0x21000000UL) +#define DL_SAVE_CONTEXT ((uint32_t) 0x22000000UL) +#define DL_RESTORE_CONTEXT ((uint32_t) 0x23000000UL) +#define DL_RETURN ((uint32_t) 0x24000000UL) +#define DL_MACRO ((uint32_t) 0x25000000UL) +#define DL_CLEAR ((uint32_t) 0x26000000UL) +#define DL_VERTEX_FORMAT ((uint32_t) 0x27000000UL) +#define DL_BITMAP_LAYOUT_H ((uint32_t) 0x28000000UL) +#define DL_BITMAP_SIZE_H ((uint32_t) 0x29000000UL) +#define DL_PALETTE_SOURCE ((uint32_t) 0x2A000000UL) +#define DL_VERTEX_TRANSLATE_X ((uint32_t) 0x2B000000UL) +#define DL_VERTEX_TRANSLATE_Y ((uint32_t) 0x2C000000UL) +#define DL_NOP ((uint32_t) 0x2D000000UL) + +#define DL_VERTEX2F ((uint32_t) 0x40000000UL) +#define DL_VERTEX2II ((uint32_t) 0x80000000UL) + +#define CLR_COL ((uint8_t) 0x4U) +#define CLR_STN ((uint8_t) 0x2U) +#define CLR_TAG ((uint8_t) 0x1U) /* Host commands */ -#define EVE_ACTIVE 0x00U /* place FT8xx in active state */ -#define EVE_STANDBY 0x41U /* place FT8xx in Standby (clk running) */ -#define EVE_SLEEP 0x42U /* place FT8xx in Sleep (clk off) */ -#define EVE_CLKEXT 0x44U /* select external clock source */ +#define EVE_ACTIVE ((uint8_t) 0x00U) /* place EVE in active state */ +#define EVE_STANDBY ((uint8_t) 0x41U) /* place EVE in Standby (clk running) */ +#define EVE_SLEEP ((uint8_t) 0x42U) /* place EVE in Sleep (clk off) */ +#define EVE_CLKEXT ((uint8_t) 0x44U) /* select external clock source */ #if EVE_GEN < 4 -#define EVE_CLKINT 0x48U /* select internal clock source, not a valid option for BT817 / BT818 */ +#define EVE_CLKINT ((uint8_t) 0x48U) /* select internal clock source, not a valid option for BT817 / BT818 */ #endif -#define EVE_PWRDOWN 0x50U /* place FT8xx in Power Down (core off) */ -#define EVE_CLKSEL 0x61U /* configure system clock */ -#define EVE_RST_PULSE 0x68U /* reset core - all registers default and processors reset */ -#define EVE_CORERST 0x68U /* reset core - all registers default and processors reset */ -#define EVE_PINDRIVE 0x70U /* setup drive strength for various pins */ -#define EVE_PIN_PD_STATE 0x71U /* setup how pins behave during power down */ +#define EVE_PWRDOWN ((uint8_t) 0x50U) /* place EVE in Power Down (core off) */ +#define EVE_CLKSEL ((uint8_t) 0x61U) /* configure system clock */ +#define EVE_RST_PULSE ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define EVE_CORERST ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define EVE_PINDRIVE ((uint8_t) 0x70U) /* setup drive strength for various pins */ +#define EVE_PIN_PD_STATE ((uint8_t) 0x71U) /* setup how pins behave during power down */ /* Graphic command defines */ -#define EVE_NEVER 0UL -#define EVE_LESS 1UL -#define EVE_LEQUAL 2UL -#define EVE_GREATER 3UL -#define EVE_GEQUAL 4UL -#define EVE_EQUAL 5UL -#define EVE_NOTEQUAL 6UL -#define EVE_ALWAYS 7UL +#define EVE_NEVER ((uint8_t) 0UL) +#define EVE_LESS ((uint8_t) 1UL) +#define EVE_LEQUAL ((uint8_t) 2UL) +#define EVE_GREATER ((uint8_t) 3UL) +#define EVE_GEQUAL ((uint8_t) 4UL) +#define EVE_EQUAL ((uint8_t) 5UL) +#define EVE_NOTEQUAL ((uint8_t) 6UL) +#define EVE_ALWAYS ((uint8_t) 7UL) /* Bitmap formats */ -#define EVE_ARGB1555 0UL -#define EVE_L1 1UL -#define EVE_L4 2UL -#define EVE_L8 3UL -#define EVE_RGB332 4UL -#define EVE_ARGB2 5UL -#define EVE_ARGB4 6UL -#define EVE_RGB565 7UL -#define EVE_PALETTED 8UL -#define EVE_TEXT8X8 9UL -#define EVE_TEXTVGA 10UL -#define EVE_BARGRAPH 11UL +#define EVE_ARGB1555 ((uint8_t) 0UL) +#define EVE_L1 ((uint8_t) 1UL) +#define EVE_L4 ((uint8_t) 2UL) +#define EVE_L8 ((uint8_t) 3UL) +#define EVE_RGB332 ((uint8_t) 4UL) +#define EVE_ARGB2 ((uint8_t) 5UL) +#define EVE_ARGB4 ((uint8_t) 6UL) +#define EVE_RGB565 ((uint8_t) 7UL) +#define EVE_PALETTED ((uint8_t) 8UL) +#define EVE_TEXT8X8 ((uint8_t) 9UL) +#define EVE_TEXTVGA ((uint8_t) 10UL) +#define EVE_BARGRAPH ((uint8_t) 11UL) /* Bitmap filter types */ -#define EVE_NEAREST 0UL -#define EVE_BILINEAR 1UL +#define EVE_NEAREST ((uint8_t) 0UL) +#define EVE_BILINEAR ((uint8_t) 1UL) /* Bitmap wrap types */ -#define EVE_BORDER 0UL -#define EVE_REPEAT 1UL +#define EVE_BORDER ((uint8_t) 0UL) +#define EVE_REPEAT ((uint8_t) 1UL) /* Stencil defines */ -#define EVE_KEEP 1UL -#define EVE_REPLACE 2UL -#define EVE_INCR 3UL -#define EVE_DECR 4UL -#define EVE_INVERT 5UL +#define EVE_KEEP ((uint8_t) 1UL) +#define EVE_REPLACE ((uint8_t) 2UL) +#define EVE_INCR ((uint8_t) 3UL) +#define EVE_DECR ((uint8_t) 4UL) +#define EVE_INVERT ((uint8_t) 5UL) /* Graphics display list swap defines */ -#define EVE_DLSWAP_DONE 0UL -#define EVE_DLSWAP_LINE 1UL -#define EVE_DLSWAP_FRAME 2UL +#define EVE_DLSWAP_DONE ((uint8_t) 0UL) +#define EVE_DLSWAP_LINE ((uint8_t) 1UL) +#define EVE_DLSWAP_FRAME ((uint8_t) 2UL) /* Interrupt bits */ -#define EVE_INT_SWAP 0x01 -#define EVE_INT_TOUCH 0x02 -#define EVE_INT_TAG 0x04 -#define EVE_INT_SOUND 0x08 -#define EVE_INT_PLAYBACK 0x10 -#define EVE_INT_CMDEMPTY 0x20 -#define EVE_INT_CMDFLAG 0x40 -#define EVE_INT_CONVCOMPLETE 0x80 +#define EVE_INT_SWAP ((uint8_t) 0x01) +#define EVE_INT_TOUCH ((uint8_t) 0x02) +#define EVE_INT_TAG ((uint8_t) 0x04) +#define EVE_INT_SOUND ((uint8_t) 0x08) +#define EVE_INT_PLAYBACK ((uint8_t) 0x10) +#define EVE_INT_CMDEMPTY ((uint8_t) 0x20) +#define EVE_INT_CMDFLAG ((uint8_t) 0x40) +#define EVE_INT_CONVCOMPLETE ((uint8_t) 0x80) /* Touch mode */ -#define EVE_TMODE_OFF 0U -#define EVE_TMODE_ONESHOT 1U -#define EVE_TMODE_FRAME 2U -#define EVE_TMODE_CONTINUOUS 3U +#define EVE_TMODE_OFF ((uint8_t) 0U) +#define EVE_TMODE_ONESHOT ((uint8_t) 1U) +#define EVE_TMODE_FRAME ((uint8_t) 2U) +#define EVE_TMODE_CONTINUOUS ((uint8_t) 3U) /* Alpha blending */ -#define EVE_ZERO 0UL -#define EVE_ONE 1UL -#define EVE_SRC_ALPHA 2UL -#define EVE_DST_ALPHA 3UL -#define EVE_ONE_MINUS_SRC_ALPHA 4UL -#define EVE_ONE_MINUS_DST_ALPHA 5UL +#define EVE_ZERO ((uint32_t) 0UL) +#define EVE_ONE ((uint32_t) 1UL) +#define EVE_SRC_ALPHA ((uint32_t) 2UL) +#define EVE_DST_ALPHA ((uint32_t) 3UL) +#define EVE_ONE_MINUS_SRC_ALPHA ((uint32_t) 4UL) +#define EVE_ONE_MINUS_DST_ALPHA ((uint32_t) 5UL) /* Graphics primitives */ -#define EVE_BITMAPS 1UL -#define EVE_POINTS 2UL -#define EVE_LINES 3UL -#define EVE_LINE_STRIP 4UL -#define EVE_EDGE_STRIP_R 5UL -#define EVE_EDGE_STRIP_L 6UL -#define EVE_EDGE_STRIP_A 7UL -#define EVE_EDGE_STRIP_B 8UL -#define EVE_RECTS 9UL -#define EVE_INT_G8 18UL -#define EVE_INT_L8C 12UL -#define EVE_INT_VGA 13UL -#define EVE_PALETTED565 14UL -#define EVE_PALETTED4444 15UL -#define EVE_PALETTED8 16UL -#define EVE_L2 17UL +#define EVE_BITMAPS ((uint32_t) 1UL) +#define EVE_POINTS ((uint32_t) 2UL) +#define EVE_LINES ((uint32_t) 3UL) +#define EVE_LINE_STRIP ((uint32_t) 4UL) +#define EVE_EDGE_STRIP_R ((uint32_t) 5UL) +#define EVE_EDGE_STRIP_L ((uint32_t) 6UL) +#define EVE_EDGE_STRIP_A ((uint32_t) 7UL) +#define EVE_EDGE_STRIP_B ((uint32_t) 8UL) +#define EVE_RECTS ((uint32_t) 9UL) +#define EVE_INT_G8 ((uint32_t) 18UL) +#define EVE_INT_L8C ((uint32_t) 12UL) +#define EVE_INT_VGA ((uint32_t) 13UL) +#define EVE_PALETTED565 ((uint32_t) 14UL) +#define EVE_PALETTED4444 ((uint32_t) 15UL) +#define EVE_PALETTED8 ((uint32_t) 16UL) +#define EVE_L2 ((uint32_t) 17UL) /* Widget command options */ -#define EVE_OPT_MONO 1U -#define EVE_OPT_NODL 2U -#define EVE_OPT_FLAT 256U -#define EVE_OPT_CENTERX 512U -#define EVE_OPT_CENTERY 1024U +#define EVE_OPT_MONO ((uint16_t) 1U) +#define EVE_OPT_NODL ((uint16_t) 2U) +#define EVE_OPT_FLAT ((uint16_t) 256U) +#define EVE_OPT_CENTERX ((uint16_t) 512U) +#define EVE_OPT_CENTERY ((uint16_t) 1024U) #define EVE_OPT_CENTER (EVE_OPT_CENTERX | EVE_OPT_CENTERY) -#define EVE_OPT_NOBACK 4096U -#define EVE_OPT_NOTICKS 8192U -#define EVE_OPT_NOHM 16384U -#define EVE_OPT_NOPOINTER 16384U -#define EVE_OPT_NOSECS 32768U -#define EVE_OPT_NOHANDS 49152U -#define EVE_OPT_RIGHTX 2048U -#define EVE_OPT_SIGNED 256U - -#define EVE_OPT_MEDIAFIFO 16U -#define EVE_OPT_FULLSCREEN 8U -#define EVE_OPT_NOTEAR 4U -#define EVE_OPT_SOUND 32U +#define EVE_OPT_NOBACK ((uint16_t) 4096U) +#define EVE_OPT_NOTICKS ((uint16_t) 8192U) +#define EVE_OPT_NOHM ((uint16_t) 16384U) +#define EVE_OPT_NOPOINTER ((uint16_t) 16384U) +#define EVE_OPT_NOSECS ((uint16_t) 32768U) +#define EVE_OPT_NOHANDS ((uint16_t) 49152U) +#define EVE_OPT_RIGHTX ((uint16_t) 2048U) +#define EVE_OPT_SIGNED ((uint16_t) 256U) + +#define EVE_OPT_MEDIAFIFO ((uint16_t) 16U) +#define EVE_OPT_FULLSCREEN ((uint16_t) 8U) +#define EVE_OPT_NOTEAR ((uint16_t) 4U) +#define EVE_OPT_SOUND ((uint16_t) 32U) /* ADC */ -#define EVE_ADC_DIFFERENTIAL 1UL -#define EVE_ADC_SINGLE_ENDED 0UL +#define EVE_ADC_DIFFERENTIAL ((uint32_t) 1UL) +#define EVE_ADC_SINGLE_ENDED ((uint32_t) 0UL) /* Fonts */ -#define EVE_NUMCHAR_PERFONT (128UL) /* number of font characters per bitmap handle */ -#define EVE_FONT_TABLE_SIZE (148UL) /* size of the font table - utilized for loopup by the graphics engine */ -#define EVE_FONT_TABLE_POINTER (0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ +#define EVE_NUMCHAR_PERFONT ((uint32_t) 128UL) /* number of font characters per bitmap handle */ +#define EVE_FONT_TABLE_SIZE ((uint32_t) 148UL) /* size of the font table - utilized for loopup by the graphics engine */ +#define EVE_FONT_TABLE_POINTER ((uint32_t) 0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ /* Audio sample type defines */ -#define EVE_LINEAR_SAMPLES 0UL /* 8bit signed samples */ -#define EVE_ULAW_SAMPLES 1UL /* 8bit ulaw samples */ -#define EVE_ADPCM_SAMPLES 2UL /* 4bit ima adpcm samples */ +#define EVE_LINEAR_SAMPLES ((uint32_t) 0UL) /* 8bit signed samples */ +#define EVE_ULAW_SAMPLES ((uint32_t) 1UL) /* 8bit ulaw samples */ +#define EVE_ADPCM_SAMPLES ((uint32_t) 2UL) /* 4bit ima adpcm samples */ /* Synthesized sound */ -#define EVE_SILENCE 0x00U -#define EVE_SQUAREWAVE 0x01U -#define EVE_SINEWAVE 0x02U -#define EVE_SAWTOOTH 0x03U -#define EVE_TRIANGLE 0x04U -#define EVE_BEEPING 0x05U -#define EVE_ALARM 0x06U -#define EVE_WARBLE 0x07U -#define EVE_CAROUSEL 0x08U -#define EVE_PIPS(n) (0x0FU + (n)) -#define EVE_HARP 0x40U -#define EVE_XYLOPHONE 0x41U -#define EVE_TUBA 0x42U -#define EVE_GLOCKENSPIEL 0x43U -#define EVE_ORGAN 0x44U -#define EVE_TRUMPET 0x45U -#define EVE_PIANO 0x46U -#define EVE_CHIMES 0x47U -#define EVE_MUSICBOX 0x48U -#define EVE_BELL 0x49U -#define EVE_CLICK 0x50U -#define EVE_SWITCH 0x51U -#define EVE_COWBELL 0x52U -#define EVE_NOTCH 0x53U -#define EVE_HIHAT 0x54U -#define EVE_KICKDRUM 0x55U -#define EVE_POP 0x56U -#define EVE_CLACK 0x57U -#define EVE_CHACK 0x58U -#define EVE_MUTE 0x60U -#define EVE_UNMUTE 0x61U +#define EVE_SILENCE ((uint8_t) 0x00U) +#define EVE_SQUAREWAVE ((uint8_t) 0x01U) +#define EVE_SINEWAVE ((uint8_t) 0x02U) +#define EVE_SAWTOOTH ((uint8_t) 0x03U) +#define EVE_TRIANGLE ((uint8_t) 0x04U) +#define EVE_BEEPING ((uint8_t) 0x05U) +#define EVE_ALARM ((uint8_t) 0x06U) +#define EVE_WARBLE ((uint8_t) 0x07U) +#define EVE_CAROUSEL ((uint8_t) 0x08U) +#define EVE_PIPS(n) ((uint8_t) (0x0FU + (n))) +#define EVE_HARP ((uint8_t) 0x40U) +#define EVE_XYLOPHONE ((uint8_t) 0x41U) +#define EVE_TUBA ((uint8_t) 0x42U) +#define EVE_GLOCKENSPIEL ((uint8_t) 0x43U) +#define EVE_ORGAN ((uint8_t) 0x44U) +#define EVE_TRUMPET ((uint8_t) 0x45U) +#define EVE_PIANO ((uint8_t) 0x46U) +#define EVE_CHIMES ((uint8_t) 0x47U) +#define EVE_MUSICBOX ((uint8_t) 0x48U) +#define EVE_BELL ((uint8_t) 0x49U) +#define EVE_CLICK ((uint8_t) 0x50U) +#define EVE_SWITCH ((uint8_t) 0x51U) +#define EVE_COWBELL ((uint8_t) 0x52U) +#define EVE_NOTCH ((uint8_t) 0x53U) +#define EVE_HIHAT ((uint8_t) 0x54U) +#define EVE_KICKDRUM ((uint8_t) 0x55U) +#define EVE_POP ((uint8_t) 0x56U) +#define EVE_CLACK ((uint8_t) 0x57U) +#define EVE_CHACK ((uint8_t) 0x58U) +#define EVE_MUTE ((uint8_t) 0x60U) +#define EVE_UNMUTE ((uint8_t) 0x61U) /* Synthesized sound frequencies, midi note */ -#define EVE_MIDI_A0 21U -#define EVE_MIDI_A_0 22U -#define EVE_MIDI_B0 23U -#define EVE_MIDI_C1 24U -#define EVE_MIDI_C_1 25U -#define EVE_MIDI_D1 26U -#define EVE_MIDI_D_1 27U -#define EVE_MIDI_E1 28U -#define EVE_MIDI_F1 29U -#define EVE_MIDI_F_1 30U -#define EVE_MIDI_G1 31U -#define EVE_MIDI_G_1 32U -#define EVE_MIDI_A1 33U -#define EVE_MIDI_A_1 34U -#define EVE_MIDI_B1 35U -#define EVE_MIDI_C2 36U -#define EVE_MIDI_C_2 37U -#define EVE_MIDI_D2 38U -#define EVE_MIDI_D_2 39U -#define EVE_MIDI_E2 40U -#define EVE_MIDI_F2 41U -#define EVE_MIDI_F_2 42U -#define EVE_MIDI_G2 43U -#define EVE_MIDI_G_2 44U -#define EVE_MIDI_A2 45U -#define EVE_MIDI_A_2 46U -#define EVE_MIDI_B2 47U -#define EVE_MIDI_C3 48U -#define EVE_MIDI_C_3 49U -#define EVE_MIDI_D3 50U -#define EVE_MIDI_D_3 51U -#define EVE_MIDI_E3 52U -#define EVE_MIDI_F3 53U -#define EVE_MIDI_F_3 54U -#define EVE_MIDI_G3 55U -#define EVE_MIDI_G_3 56U -#define EVE_MIDI_A3 57U -#define EVE_MIDI_A_3 58U -#define EVE_MIDI_B3 59U -#define EVE_MIDI_C4 60U -#define EVE_MIDI_C_4 61U -#define EVE_MIDI_D4 62U -#define EVE_MIDI_D_4 63U -#define EVE_MIDI_E4 64U -#define EVE_MIDI_F4 65U -#define EVE_MIDI_F_4 66U -#define EVE_MIDI_G4 67U -#define EVE_MIDI_G_4 68U -#define EVE_MIDI_A4 69U -#define EVE_MIDI_A_4 70U -#define EVE_MIDI_B4 71U -#define EVE_MIDI_C5 72U -#define EVE_MIDI_C_5 73U -#define EVE_MIDI_D5 74U -#define EVE_MIDI_D_5 75U -#define EVE_MIDI_E5 76U -#define EVE_MIDI_F5 77U -#define EVE_MIDI_F_5 78U -#define EVE_MIDI_G5 79U -#define EVE_MIDI_G_5 80U -#define EVE_MIDI_A5 81U -#define EVE_MIDI_A_5 82U -#define EVE_MIDI_B5 83U -#define EVE_MIDI_C6 84U -#define EVE_MIDI_C_6 85U -#define EVE_MIDI_D6 86U -#define EVE_MIDI_D_6 87U -#define EVE_MIDI_E6 88U -#define EVE_MIDI_F6 89U -#define EVE_MIDI_F_6 90U -#define EVE_MIDI_G6 91U -#define EVE_MIDI_G_6 92U -#define EVE_MIDI_A6 93U -#define EVE_MIDI_A_6 94U -#define EVE_MIDI_B6 95U -#define EVE_MIDI_C7 96U -#define EVE_MIDI_C_7 97U -#define EVE_MIDI_D7 98U -#define EVE_MIDI_D_7 99U -#define EVE_MIDI_E7 100U -#define EVE_MIDI_F7 101U -#define EVE_MIDI_F_7 102U -#define EVE_MIDI_G7 103U -#define EVE_MIDI_G_7 104U -#define EVE_MIDI_A7 105U -#define EVE_MIDI_A_7 106U -#define EVE_MIDI_B7 107U -#define EVE_MIDI_C8 108U +#define EVE_MIDI_A0 ((uint8_t) 21U) +#define EVE_MIDI_A_0 ((uint8_t) 22U) +#define EVE_MIDI_B0 ((uint8_t) 23U) +#define EVE_MIDI_C1 ((uint8_t) 24U) +#define EVE_MIDI_C_1 ((uint8_t) 25U) +#define EVE_MIDI_D1 ((uint8_t) 26U) +#define EVE_MIDI_D_1 ((uint8_t) 27U) +#define EVE_MIDI_E1 ((uint8_t) 28U) +#define EVE_MIDI_F1 ((uint8_t) 29U) +#define EVE_MIDI_F_1 ((uint8_t) 30U) +#define EVE_MIDI_G1 ((uint8_t) 31U) +#define EVE_MIDI_G_1 ((uint8_t) 32U) +#define EVE_MIDI_A1 ((uint8_t) 33U) +#define EVE_MIDI_A_1 ((uint8_t) 34U) +#define EVE_MIDI_B1 ((uint8_t) 35U) +#define EVE_MIDI_C2 ((uint8_t) 36U) +#define EVE_MIDI_C_2 ((uint8_t) 37U) +#define EVE_MIDI_D2 ((uint8_t) 38U) +#define EVE_MIDI_D_2 ((uint8_t) 39U) +#define EVE_MIDI_E2 ((uint8_t) 40U) +#define EVE_MIDI_F2 ((uint8_t) 41U) +#define EVE_MIDI_F_2 ((uint8_t) 42U) +#define EVE_MIDI_G2 ((uint8_t) 43U) +#define EVE_MIDI_G_2 ((uint8_t) 44U) +#define EVE_MIDI_A2 ((uint8_t) 45U) +#define EVE_MIDI_A_2 ((uint8_t) 46U) +#define EVE_MIDI_B2 ((uint8_t) 47U) +#define EVE_MIDI_C3 ((uint8_t) 48U) +#define EVE_MIDI_C_3 ((uint8_t) 49U) +#define EVE_MIDI_D3 ((uint8_t) 50U) +#define EVE_MIDI_D_3 ((uint8_t) 51U) +#define EVE_MIDI_E3 ((uint8_t) 52U) +#define EVE_MIDI_F3 ((uint8_t) 53U) +#define EVE_MIDI_F_3 ((uint8_t) 54U) +#define EVE_MIDI_G3 ((uint8_t) 55U) +#define EVE_MIDI_G_3 ((uint8_t) 56U) +#define EVE_MIDI_A3 ((uint8_t) 57U) +#define EVE_MIDI_A_3 ((uint8_t) 58U) +#define EVE_MIDI_B3 ((uint8_t) 59U) +#define EVE_MIDI_C4 ((uint8_t) 60U) +#define EVE_MIDI_C_4 ((uint8_t) 61U) +#define EVE_MIDI_D4 ((uint8_t) 62U) +#define EVE_MIDI_D_4 ((uint8_t) 63U) +#define EVE_MIDI_E4 ((uint8_t) 64U) +#define EVE_MIDI_F4 ((uint8_t) 65U) +#define EVE_MIDI_F_4 ((uint8_t) 66U) +#define EVE_MIDI_G4 ((uint8_t) 67U) +#define EVE_MIDI_G_4 ((uint8_t) 68U) +#define EVE_MIDI_A4 ((uint8_t) 69U) +#define EVE_MIDI_A_4 ((uint8_t) 70U) +#define EVE_MIDI_B4 ((uint8_t) 71U) +#define EVE_MIDI_C5 ((uint8_t) 72U) +#define EVE_MIDI_C_5 ((uint8_t) 73U) +#define EVE_MIDI_D5 ((uint8_t) 74U) +#define EVE_MIDI_D_5 ((uint8_t) 75U) +#define EVE_MIDI_E5 ((uint8_t) 76U) +#define EVE_MIDI_F5 ((uint8_t) 77U) +#define EVE_MIDI_F_5 ((uint8_t) 78U) +#define EVE_MIDI_G5 ((uint8_t) 79U) +#define EVE_MIDI_G_5 ((uint8_t) 80U) +#define EVE_MIDI_A5 ((uint8_t) 81U) +#define EVE_MIDI_A_5 ((uint8_t) 82U) +#define EVE_MIDI_B5 ((uint8_t) 83U) +#define EVE_MIDI_C6 ((uint8_t) 84U) +#define EVE_MIDI_C_6 ((uint8_t) 85U) +#define EVE_MIDI_D6 ((uint8_t) 86U) +#define EVE_MIDI_D_6 ((uint8_t) 87U) +#define EVE_MIDI_E6 ((uint8_t) 88U) +#define EVE_MIDI_F6 ((uint8_t) 89U) +#define EVE_MIDI_F_6 ((uint8_t) 90U) +#define EVE_MIDI_G6 ((uint8_t) 91U) +#define EVE_MIDI_G_6 ((uint8_t) 92U) +#define EVE_MIDI_A6 ((uint8_t) 93U) +#define EVE_MIDI_A_6 ((uint8_t) 94U) +#define EVE_MIDI_B6 ((uint8_t) 95U) +#define EVE_MIDI_C7 ((uint8_t) 96U) +#define EVE_MIDI_C_7 ((uint8_t) 97U) +#define EVE_MIDI_D7 ((uint8_t) 98U) +#define EVE_MIDI_D_7 ((uint8_t) 99U) +#define EVE_MIDI_E7 ((uint8_t) 100U) +#define EVE_MIDI_F7 ((uint8_t) 101U) +#define EVE_MIDI_F_7 ((uint8_t) 102U) +#define EVE_MIDI_G7 ((uint8_t) 103U) +#define EVE_MIDI_G_7 ((uint8_t) 104U) +#define EVE_MIDI_A7 ((uint8_t) 105U) +#define EVE_MIDI_A_7 ((uint8_t) 106U) +#define EVE_MIDI_B7 ((uint8_t) 107U) +#define EVE_MIDI_C8 ((uint8_t) 108U) /* GPIO bits */ -#define EVE_GPIO0 0U -#define EVE_GPIO1 1U /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ -#define EVE_GPIO7 7U /* default gpio pin for display enable, 1 - enable, 0 - disable */ +#define EVE_GPIO0 ((uint8_t) 0U) +#define EVE_GPIO1 ((uint8_t) 1U) /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ +#define EVE_GPIO7 ((uint8_t) 7U) /* default gpio pin for display enable, 1 - enable, 0 - disable */ /* Display rotation */ -#define EVE_DISPLAY_0 0U /* 0 degrees rotation */ -#define EVE_DISPLAY_180 1U /* 180 degrees rotation */ +#define EVE_DISPLAY_0 ((uint8_t) 0U) /* 0 degrees rotation */ +#define EVE_DISPLAY_180 ((uint8_t) 1U) /* 180 degrees rotation */ /* Commands */ -#define CMD_APPEND 0xFFFFFF1EUL -#define CMD_BGCOLOR 0xFFFFFF09UL -#define CMD_BUTTON 0xFFFFFF0DUL -#define CMD_CALIBRATE 0xFFFFFF15UL -#define CMD_CLOCK 0xFFFFFF14UL -#define CMD_COLDSTART 0xFFFFFF32UL -#define CMD_DIAL 0xFFFFFF2DUL -#define CMD_DLSTART 0xFFFFFF00UL -#define CMD_FGCOLOR 0xFFFFFF0AUL -#define CMD_GAUGE 0xFFFFFF13UL -#define CMD_GETMATRIX 0xFFFFFF33UL -#define CMD_GETPROPS 0xFFFFFF25UL -#define CMD_GETPTR 0xFFFFFF23UL -#define CMD_GRADCOLOR 0xFFFFFF34UL -#define CMD_GRADIENT 0xFFFFFF0BUL -#define CMD_INFLATE 0xFFFFFF22UL -#define CMD_INTERRUPT 0xFFFFFF02UL -#define CMD_KEYS 0xFFFFFF0EUL -#define CMD_LOADIDENTITY 0xFFFFFF26UL -#define CMD_LOADIMAGE 0xFFFFFF24UL -#define CMD_LOGO 0xFFFFFF31UL -#define CMD_MEDIAFIFO 0xFFFFFF39UL -#define CMD_MEMCPY 0xFFFFFF1DUL -#define CMD_MEMCRC 0xFFFFFF18UL -#define CMD_MEMSET 0xFFFFFF1BUL -#define CMD_MEMWRITE 0xFFFFFF1AUL -#define CMD_MEMZERO 0xFFFFFF1CUL -#define CMD_NUMBER 0xFFFFFF2EUL -#define CMD_PLAYVIDEO 0xFFFFFF3AUL -#define CMD_PROGRESS 0xFFFFFF0FUL -#define CMD_REGREAD 0xFFFFFF19UL -#define CMD_ROMFONT 0xFFFFFF3FUL -#define CMD_ROTATE 0xFFFFFF29UL -#define CMD_SCALE 0xFFFFFF28UL -#define CMD_SCREENSAVER 0xFFFFFF2FUL -#define CMD_SCROLLBAR 0xFFFFFF11UL -#define CMD_SETBASE 0xFFFFFF38UL -#define CMD_SETBITMAP 0xFFFFFF43UL -#define CMD_SETFONT 0xFFFFFF2BUL -#define CMD_SETFONT2 0xFFFFFF3BUL -#define CMD_SETMATRIX 0xFFFFFF2AUL -#define CMD_SETROTATE 0xFFFFFF36UL -#define CMD_SETSCRATCH 0xFFFFFF3CUL -#define CMD_SKETCH 0xFFFFFF30UL -#define CMD_SLIDER 0xFFFFFF10UL -#define CMD_SNAPSHOT 0xFFFFFF1FUL -#define CMD_SNAPSHOT2 0xFFFFFF37UL -#define CMD_SPINNER 0xFFFFFF16UL -#define CMD_STOP 0xFFFFFF17UL -#define CMD_SWAP 0xFFFFFF01UL -#define CMD_TEXT 0xFFFFFF0CUL -#define CMD_TOGGLE 0xFFFFFF12UL -#define CMD_TRACK 0xFFFFFF2CUL -#define CMD_TRANSLATE 0xFFFFFF27UL -#define CMD_VIDEOFRAME 0xFFFFFF41UL -#define CMD_VIDEOSTART 0xFFFFFF40UL +#define CMD_APPEND ((uint32_t) 0xFFFFFF1EUL) +#define CMD_BGCOLOR ((uint32_t) 0xFFFFFF09UL) +#define CMD_BUTTON ((uint32_t) 0xFFFFFF0DUL) +#define CMD_CALIBRATE ((uint32_t) 0xFFFFFF15UL) +#define CMD_CLOCK ((uint32_t) 0xFFFFFF14UL) +#define CMD_COLDSTART ((uint32_t) 0xFFFFFF32UL) +#define CMD_DIAL ((uint32_t) 0xFFFFFF2DUL) +#define CMD_DLSTART ((uint32_t) 0xFFFFFF00UL) +#define CMD_FGCOLOR ((uint32_t) 0xFFFFFF0AUL) +#define CMD_GAUGE ((uint32_t) 0xFFFFFF13UL) +#define CMD_GETMATRIX ((uint32_t) 0xFFFFFF33UL) +#define CMD_GETPROPS ((uint32_t) 0xFFFFFF25UL) +#define CMD_GETPTR ((uint32_t) 0xFFFFFF23UL) +#define CMD_GRADCOLOR ((uint32_t) 0xFFFFFF34UL) +#define CMD_GRADIENT ((uint32_t) 0xFFFFFF0BUL) +#define CMD_INFLATE ((uint32_t) 0xFFFFFF22UL) +#define CMD_INTERRUPT ((uint32_t) 0xFFFFFF02UL) +#define CMD_KEYS ((uint32_t) 0xFFFFFF0EUL) +#define CMD_LOADIDENTITY ((uint32_t) 0xFFFFFF26UL) +#define CMD_LOADIMAGE ((uint32_t) 0xFFFFFF24UL) +#define CMD_LOGO ((uint32_t) 0xFFFFFF31UL) +#define CMD_MEDIAFIFO ((uint32_t) 0xFFFFFF39UL) +#define CMD_MEMCPY ((uint32_t) 0xFFFFFF1DUL) +#define CMD_MEMCRC ((uint32_t) 0xFFFFFF18UL) +#define CMD_MEMSET ((uint32_t) 0xFFFFFF1BUL) +#define CMD_MEMWRITE ((uint32_t) 0xFFFFFF1AUL) +#define CMD_MEMZERO ((uint32_t) 0xFFFFFF1CUL) +#define CMD_NUMBER ((uint32_t) 0xFFFFFF2EUL) +#define CMD_PLAYVIDEO ((uint32_t) 0xFFFFFF3AUL) +#define CMD_PROGRESS ((uint32_t) 0xFFFFFF0FUL) +#define CMD_REGREAD ((uint32_t) 0xFFFFFF19UL) +#define CMD_ROMFONT ((uint32_t) 0xFFFFFF3FUL) +#define CMD_ROTATE ((uint32_t) 0xFFFFFF29UL) +#define CMD_SCALE ((uint32_t) 0xFFFFFF28UL) +#define CMD_SCREENSAVER ((uint32_t) 0xFFFFFF2FUL) +#define CMD_SCROLLBAR ((uint32_t) 0xFFFFFF11UL) +#define CMD_SETBASE ((uint32_t) 0xFFFFFF38UL) +#define CMD_SETBITMAP ((uint32_t) 0xFFFFFF43UL) +#define CMD_SETFONT ((uint32_t) 0xFFFFFF2BUL) +#define CMD_SETFONT2 ((uint32_t) 0xFFFFFF3BUL) +#define CMD_SETMATRIX ((uint32_t) 0xFFFFFF2AUL) +#define CMD_SETROTATE ((uint32_t) 0xFFFFFF36UL) +#define CMD_SETSCRATCH ((uint32_t) 0xFFFFFF3CUL) +#define CMD_SKETCH ((uint32_t) 0xFFFFFF30UL) +#define CMD_SLIDER ((uint32_t) 0xFFFFFF10UL) +#define CMD_SNAPSHOT ((uint32_t) 0xFFFFFF1FUL) +#define CMD_SNAPSHOT2 ((uint32_t) 0xFFFFFF37UL) +#define CMD_SPINNER ((uint32_t) 0xFFFFFF16UL) +#define CMD_STOP ((uint32_t) 0xFFFFFF17UL) +#define CMD_SWAP ((uint32_t) 0xFFFFFF01UL) +#define CMD_TEXT ((uint32_t) 0xFFFFFF0CUL) +#define CMD_TOGGLE ((uint32_t) 0xFFFFFF12UL) +#define CMD_TRACK ((uint32_t) 0xFFFFFF2CUL) +#define CMD_TRANSLATE ((uint32_t) 0xFFFFFF27UL) +#define CMD_VIDEOFRAME ((uint32_t) 0xFFFFFF41UL) +#define CMD_VIDEOSTART ((uint32_t) 0xFFFFFF40UL) /* Registers */ -#define REG_ANA_COMP 0x00302184UL /* only listed in datasheet */ -#define REG_BIST_EN 0x00302174UL /* only listed in datasheet */ -#define REG_CLOCK 0x00302008UL -#define REG_CMDB_SPACE 0x00302574UL -#define REG_CMDB_WRITE 0x00302578UL -#define REG_CMD_DL 0x00302100UL -#define REG_CMD_READ 0x003020f8UL -#define REG_CMD_WRITE 0x003020fcUL -#define REG_CPURESET 0x00302020UL -#define REG_CSPREAD 0x00302068UL -#define REG_CTOUCH_EXTENDED 0x00302108UL -#define REG_CTOUCH_TOUCH0_XY 0x00302124UL /* only listed in datasheet */ -#define REG_CTOUCH_TOUCH4_X 0x0030216cUL -#define REG_CTOUCH_TOUCH4_Y 0x00302120UL -#define REG_CTOUCH_TOUCH1_XY 0x0030211cUL -#define REG_CTOUCH_TOUCH2_XY 0x0030218cUL -#define REG_CTOUCH_TOUCH3_XY 0x00302190UL -#define REG_TOUCH_CONFIG 0x00302168UL -#define REG_DATESTAMP 0x00302564UL /* only listed in datasheet */ -#define REG_DITHER 0x00302060UL -#define REG_DLSWAP 0x00302054UL -#define REG_FRAMES 0x00302004UL -#define REG_FREQUENCY 0x0030200cUL -#define REG_GPIO 0x00302094UL -#define REG_GPIOX 0x0030209cUL -#define REG_GPIOX_DIR 0x00302098UL -#define REG_GPIO_DIR 0x00302090UL -#define REG_HCYCLE 0x0030202cUL -#define REG_HOFFSET 0x00302030UL -#define REG_HSIZE 0x00302034UL -#define REG_HSYNC0 0x00302038UL -#define REG_HSYNC1 0x0030203cUL -#define REG_ID 0x00302000UL -#define REG_INT_EN 0x003020acUL -#define REG_INT_FLAGS 0x003020a8UL -#define REG_INT_MASK 0x003020b0UL -#define REG_MACRO_0 0x003020d8UL -#define REG_MACRO_1 0x003020dcUL -#define REG_MEDIAFIFO_READ 0x00309014UL /* only listed in programmers guide */ -#define REG_MEDIAFIFO_WRITE 0x00309018UL /* only listed in programmers guide */ -#define REG_OUTBITS 0x0030205cUL -#define REG_PCLK 0x00302070UL -#define REG_PCLK_POL 0x0030206cUL -#define REG_PLAY 0x0030208cUL -#define REG_PLAYBACK_FORMAT 0x003020c4UL -#define REG_PLAYBACK_FREQ 0x003020c0UL -#define REG_PLAYBACK_LENGTH 0x003020b8UL -#define REG_PLAYBACK_LOOP 0x003020c8UL -#define REG_PLAYBACK_PLAY 0x003020ccUL -#define REG_PLAYBACK_READPTR 0x003020bcUL -#define REG_PLAYBACK_START 0x003020b4UL -#define REG_PWM_DUTY 0x003020d4UL -#define REG_PWM_HZ 0x003020d0UL -#define REG_RENDERMODE 0x00302010UL /* only listed in datasheet */ -#define REG_ROTATE 0x00302058UL -#define REG_SNAPFORMAT 0x0030201cUL /* only listed in datasheet */ -#define REG_SNAPSHOT 0x00302018UL /* only listed in datasheet */ -#define REG_SNAPY 0x00302014UL /* only listed in datasheet */ -#define REG_SOUND 0x00302088UL -#define REG_SPI_WIDTH 0x00302188UL /* listed with false offset in programmers guide V1.1 */ -#define REG_SWIZZLE 0x00302064UL -#define REG_TAG 0x0030207cUL -#define REG_TAG_X 0x00302074UL -#define REG_TAG_Y 0x00302078UL -#define REG_TAP_CRC 0x00302024UL /* only listed in datasheet */ -#define REG_TAP_MASK 0x00302028UL /* only listed in datasheet */ -#define REG_TOUCH_ADC_MODE 0x00302108UL -#define REG_TOUCH_CHARGE 0x0030210cUL -#define REG_TOUCH_DIRECT_XY 0x0030218cUL -#define REG_TOUCH_DIRECT_Z1Z2 0x00302190UL -#define REG_TOUCH_MODE 0x00302104UL -#define REG_TOUCH_OVERSAMPLE 0x00302114UL -#define REG_TOUCH_RAW_XY 0x0030211cUL -#define REG_TOUCH_RZ 0x00302120UL -#define REG_TOUCH_RZTHRESH 0x00302118UL -#define REG_TOUCH_SCREEN_XY 0x00302124UL -#define REG_TOUCH_SETTLE 0x00302110UL -#define REG_TOUCH_TAG 0x0030212cUL -#define REG_TOUCH_TAG1 0x00302134UL /* only listed in datasheet */ -#define REG_TOUCH_TAG1_XY 0x00302130UL /* only listed in datasheet */ -#define REG_TOUCH_TAG2 0x0030213cUL /* only listed in datasheet */ -#define REG_TOUCH_TAG2_XY 0x00302138UL /* only listed in datasheet */ -#define REG_TOUCH_TAG3 0x00302144UL /* only listed in datasheet */ -#define REG_TOUCH_TAG3_XY 0x00302140UL /* only listed in datasheet */ -#define REG_TOUCH_TAG4 0x0030214cUL /* only listed in datasheet */ -#define REG_TOUCH_TAG4_XY 0x00302148UL /* only listed in datasheet */ -#define REG_TOUCH_TAG_XY 0x00302128UL -#define REG_TOUCH_TRANSFORM_A 0x00302150UL -#define REG_TOUCH_TRANSFORM_B 0x00302154UL -#define REG_TOUCH_TRANSFORM_C 0x00302158UL -#define REG_TOUCH_TRANSFORM_D 0x0030215cUL -#define REG_TOUCH_TRANSFORM_E 0x00302160UL -#define REG_TOUCH_TRANSFORM_F 0x00302164UL -#define REG_TRACKER 0x00309000UL /* only listed in programmers guide */ -#define REG_TRACKER_1 0x00309004UL /* only listed in programmers guide */ -#define REG_TRACKER_2 0x00309008UL /* only listed in programmers guide */ -#define REG_TRACKER_3 0x0030900cUL /* only listed in programmers guide */ -#define REG_TRACKER_4 0x00309010UL /* only listed in programmers guide */ -#define REG_TRIM 0x00302180UL -#define REG_VCYCLE 0x00302040UL -#define REG_VOFFSET 0x00302044UL -#define REG_VOL_PB 0x00302080UL -#define REG_VOL_SOUND 0x00302084UL -#define REG_VSIZE 0x00302048UL -#define REG_VSYNC0 0x0030204cUL -#define REG_VSYNC1 0x00302050UL +#define REG_ANA_COMP ((uint32_t) 0x00302184UL) /* only listed in datasheet */ +#define REG_BIST_EN ((uint32_t) 0x00302174UL) /* only listed in datasheet */ +#define REG_CLOCK ((uint32_t) 0x00302008UL) +#define REG_CMDB_SPACE ((uint32_t) 0x00302574UL) +#define REG_CMDB_WRITE ((uint32_t) 0x00302578UL) +#define REG_CMD_DL ((uint32_t) 0x00302100UL) +#define REG_CMD_READ ((uint32_t) 0x003020f8UL) +#define REG_CMD_WRITE ((uint32_t) 0x003020fcUL) +#define REG_CPURESET ((uint32_t) 0x00302020UL) +#define REG_CSPREAD ((uint32_t) 0x00302068UL) +#define REG_CTOUCH_EXTENDED ((uint32_t) 0x00302108UL) +#define REG_CTOUCH_TOUCH0_XY ((uint32_t) 0x00302124UL) /* only listed in datasheet */ +#define REG_CTOUCH_TOUCH4_X ((uint32_t) 0x0030216cUL) +#define REG_CTOUCH_TOUCH4_Y ((uint32_t) 0x00302120UL) +#define REG_CTOUCH_TOUCH1_XY ((uint32_t) 0x0030211cUL) +#define REG_CTOUCH_TOUCH2_XY ((uint32_t) 0x0030218cUL) +#define REG_CTOUCH_TOUCH3_XY ((uint32_t) 0x00302190UL) +#define REG_TOUCH_CONFIG ((uint32_t) 0x00302168UL) +#define REG_DATESTAMP ((uint32_t) 0x00302564UL) /* only listed in datasheet */ +#define REG_DITHER ((uint32_t) 0x00302060UL) +#define REG_DLSWAP ((uint32_t) 0x00302054UL) +#define REG_FRAMES ((uint32_t) 0x00302004UL) +#define REG_FREQUENCY ((uint32_t) 0x0030200cUL) +#define REG_GPIO ((uint32_t) 0x00302094UL) +#define REG_GPIOX ((uint32_t) 0x0030209cUL) +#define REG_GPIOX_DIR ((uint32_t) 0x00302098UL) +#define REG_GPIO_DIR ((uint32_t) 0x00302090UL) +#define REG_HCYCLE ((uint32_t) 0x0030202cUL) +#define REG_HOFFSET ((uint32_t) 0x00302030UL) +#define REG_HSIZE ((uint32_t) 0x00302034UL) +#define REG_HSYNC0 ((uint32_t) 0x00302038UL) +#define REG_HSYNC1 ((uint32_t) 0x0030203cUL) +#define REG_ID ((uint32_t) 0x00302000UL) +#define REG_INT_EN ((uint32_t) 0x003020acUL) +#define REG_INT_FLAGS ((uint32_t) 0x003020a8UL) +#define REG_INT_MASK ((uint32_t) 0x003020b0UL) +#define REG_MACRO_0 ((uint32_t) 0x003020d8UL) +#define REG_MACRO_1 ((uint32_t) 0x003020dcUL) +#define REG_MEDIAFIFO_READ ((uint32_t) 0x00309014UL) /* only listed in programmers guide */ +#define REG_MEDIAFIFO_WRITE ((uint32_t) 0x00309018UL) /* only listed in programmers guide */ +#define REG_OUTBITS ((uint32_t) 0x0030205cUL) +#define REG_PCLK ((uint32_t) 0x00302070UL) +#define REG_PCLK_POL ((uint32_t) 0x0030206cUL) +#define REG_PLAY ((uint32_t) 0x0030208cUL) +#define REG_PLAYBACK_FORMAT ((uint32_t) 0x003020c4UL) +#define REG_PLAYBACK_FREQ ((uint32_t) 0x003020c0UL) +#define REG_PLAYBACK_LENGTH ((uint32_t) 0x003020b8UL) +#define REG_PLAYBACK_LOOP ((uint32_t) 0x003020c8UL) +#define REG_PLAYBACK_PLAY ((uint32_t) 0x003020ccUL) +#define REG_PLAYBACK_READPTR ((uint32_t) 0x003020bcUL) +#define REG_PLAYBACK_START ((uint32_t) 0x003020b4UL) +#define REG_PWM_DUTY ((uint32_t) 0x003020d4UL) +#define REG_PWM_HZ ((uint32_t) 0x003020d0UL) +#define REG_RENDERMODE ((uint32_t) 0x00302010UL) /* only listed in datasheet */ +#define REG_ROTATE ((uint32_t) 0x00302058UL) +#define REG_SNAPFORMAT ((uint32_t) 0x0030201cUL) /* only listed in datasheet */ +#define REG_SNAPSHOT ((uint32_t) 0x00302018UL) /* only listed in datasheet */ +#define REG_SNAPY ((uint32_t) 0x00302014UL) /* only listed in datasheet */ +#define REG_SOUND ((uint32_t) 0x00302088UL) +#define REG_SPI_WIDTH ((uint32_t) 0x00302188UL) /* listed with false offset in programmers guide V1.1 */ +#define REG_SWIZZLE ((uint32_t) 0x00302064UL) +#define REG_TAG ((uint32_t) 0x0030207cUL) +#define REG_TAG_X ((uint32_t) 0x00302074UL) +#define REG_TAG_Y ((uint32_t) 0x00302078UL) +#define REG_TAP_CRC ((uint32_t) 0x00302024UL) /* only listed in datasheet */ +#define REG_TAP_MASK ((uint32_t) 0x00302028UL) /* only listed in datasheet */ +#define REG_TOUCH_ADC_MODE ((uint32_t) 0x00302108UL) +#define REG_TOUCH_CHARGE ((uint32_t) 0x0030210cUL) +#define REG_TOUCH_DIRECT_XY ((uint32_t) 0x0030218cUL) +#define REG_TOUCH_DIRECT_Z1Z2 ((uint32_t) 0x00302190UL) +#define REG_TOUCH_MODE ((uint32_t) 0x00302104UL) +#define REG_TOUCH_OVERSAMPLE ((uint32_t) 0x00302114UL) +#define REG_TOUCH_RAW_XY ((uint32_t) 0x0030211cUL) +#define REG_TOUCH_RZ ((uint32_t) 0x00302120UL) +#define REG_TOUCH_RZTHRESH ((uint32_t) 0x00302118UL) +#define REG_TOUCH_SCREEN_XY ((uint32_t) 0x00302124UL) +#define REG_TOUCH_SETTLE ((uint32_t) 0x00302110UL) +#define REG_TOUCH_TAG ((uint32_t) 0x0030212cUL) +#define REG_TOUCH_TAG1 ((uint32_t) 0x00302134UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG1_XY ((uint32_t) 0x00302130UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG2 ((uint32_t) 0x0030213cUL) /* only listed in datasheet */ +#define REG_TOUCH_TAG2_XY ((uint32_t) 0x00302138UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG3 ((uint32_t) 0x00302144UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG3_XY ((uint32_t) 0x00302140UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG4 ((uint32_t) 0x0030214cUL)/* only listed in datasheet */ +#define REG_TOUCH_TAG4_XY ((uint32_t) 0x00302148UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG_XY ((uint32_t) 0x00302128UL) +#define REG_TOUCH_TRANSFORM_A ((uint32_t) 0x00302150UL) +#define REG_TOUCH_TRANSFORM_B ((uint32_t) 0x00302154UL) +#define REG_TOUCH_TRANSFORM_C ((uint32_t) 0x00302158UL) +#define REG_TOUCH_TRANSFORM_D ((uint32_t) 0x0030215cUL) +#define REG_TOUCH_TRANSFORM_E ((uint32_t) 0x00302160UL) +#define REG_TOUCH_TRANSFORM_F ((uint32_t) 0x00302164UL) +#define REG_TRACKER ((uint32_t) 0x00309000UL) /* only listed in programmers guide */ +#define REG_TRACKER_1 ((uint32_t) 0x00309004UL) /* only listed in programmers guide */ +#define REG_TRACKER_2 ((uint32_t) 0x00309008UL) /* only listed in programmers guide */ +#define REG_TRACKER_3 ((uint32_t) 0x0030900cUL) /* only listed in programmers guide */ +#define REG_TRACKER_4 ((uint32_t) 0x00309010UL) /* only listed in programmers guide */ +#define REG_TRIM ((uint32_t) 0x00302180UL) +#define REG_VCYCLE ((uint32_t) 0x00302040UL) +#define REG_VOFFSET ((uint32_t) 0x00302044UL) +#define REG_VOL_PB ((uint32_t) 0x00302080UL) +#define REG_VOL_SOUND ((uint32_t) 0x00302084UL) +#define REG_VSIZE ((uint32_t) 0x00302048UL) +#define REG_VSYNC0 ((uint32_t) 0x0030204cUL) +#define REG_VSYNC1 ((uint32_t) 0x00302050UL) /* Macros for static display list generation */ -#define ALPHA_FUNC(func,ref) ((DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) -#define BITMAP_HANDLE(handle) ((DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) -#define BITMAP_LAYOUT(format,linestride,height) ((DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) -#define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) -/* beware, this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits */ -#define BITMAP_LAYOUT_H(linestride,height) ((DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +//#define ALPHA_FUNC(func,ref) ((DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) +/** + * @brief Set the alpha test function. + * + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t ALPHA_FUNC(uint8_t func, uint8_t ref) +{ + uint32_t const funcv = ((uint32_t) func & 7U) << 8U; + return (DL_ALPHA_FUNC | funcv | ref); +} -/* beware, this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits */ -#define BITMAP_SIZE_H(width,height) ((DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +//#define BITMAP_HANDLE(handle) ((DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) +/** + * @brief Set the bitmap handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_HANDLE(uint8_t handle) +{ + return (DL_BITMAP_HANDLE | ((handle) & 0x1FUL)); +} -#define BITMAP_SOURCE(addr) ((DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +//#define BITMAP_LAYOUT(format,linestride,height) ((DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint8_t height) +{ + uint32_t const formatv = ((uint32_t) format & 0x1FUL) << 19U; + uint32_t const linestridev = ((uint32_t) linestride & 0x3FFUL) << 9U; + return (DL_BITMAP_LAYOUT | formatv | linestridev | height); +} + +//#define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) +{ + uint32_t const filterv = (filter & 0x1UL) << 20U; + uint32_t const wrapxv = (wrapx & 0x1UL) << 19U; + uint32_t const wrapyv = (wrapy & 0x1UL) << 18U; + uint32_t const widthv = (width & 0x1FFUL) << 9U; + uint32_t const heightv = (height & 0x1FFUL) << 9U; + return (DL_BITMAP_SIZE | filterv | wrapxv | wrapyv | widthv | heightv); +} + +//#define BITMAP_LAYOUT_H(linestride,height) ((DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of the source bitmap memory format and layout for the current handle. + * @param linestride 12-bit value specified to BITMAP_LAYOUT + * @param height 11-bit value specified to BITMAP_LAYOUT + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_LAYOUT_H(uint16_t linestride, uint16_t height) +{ + uint32_t const linestridev = (uint32_t) ((((linestride & 0xC00U) >> 10U) &3UL) << 2U); + uint32_t const heightv = (uint32_t) (((height & 0x600U) >> 9U) & 3UL); + return (DL_BITMAP_LAYOUT_H | linestridev | heightv); +} + +//#define BITMAP_SIZE_H(width,height) ((DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of bitmaps dimension for the current handle. + * @param linestride 11-bit value of bitmap width, the 2 most significant bits are used + * @param height 11-bit value of bitmap width, the 2 most significant bits are used + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SIZE_H(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t) ((((width & 0x600U) >> 9U) & 3UL) << 2U); + uint32_t const heightv = (uint32_t) (((height & 0x600U) >> 9U) & 3UL); + return ((DL_BITMAP_SIZE_H) | widthv | heightv); +} + +//#define BITMAP_SOURCE(addr) ((DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +/** + * @brief Set the source address of bitmap data in RAM_G or flash memory. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SOURCE(uint32_t addr) +{ + return (DL_BITMAP_SOURCE | (addr & 0x3FFFFFUL)); +} #if EVE_GEN < 3 /* only define these for FT81x */ -#define BITMAP_TRANSFORM_A(a) ((DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_B(b) ((DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_D(d) ((DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_E(e) ((DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +//#define BITMAP_TRANSFORM_A(a) ((DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_A(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_A | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_B(b) ((DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_B(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_B | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_D(d) ((DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_D(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_D | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_E(e) ((DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +/** + * @brief Set he E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_E(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_E | (val & 0x1FFFFUL)); +} + #endif -#define BITMAP_TRANSFORM_C(c) ((DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_F(f) ((DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) - -#define BLEND_FUNC(src,dst) ((DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) -#define CALL(dest) ((DL_CALL) | ((dest) & 0xFFFFUL)) -#define CELL(cell) ((DL_CELL) | ((cell) & 0x7FUL)) -#define CLEAR(c,s,t) ((DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) -#define CLEAR_COLOR_A(alpha) ((DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) -#define CLEAR_COLOR_RGB(red,green,blue) ((DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -#define CLEAR_STENCIL(s) ((DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) -#define CLEAR_TAG(s) ((DL_CLEAR_TAG) | ((s) & 0xFFUL)) -#define COLOR_A(alpha) ((DL_COLOR_A) | ((alpha) & 0xFFUL)) -#define COLOR_MASK(r,g,b,a) ((DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) -#define COLOR_RGB(red,green,blue) ((DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -#define JUMP(dest) ((DL_JUMP) | ((dest) & 0xFFFFUL)) -#define LINE_WIDTH(width) ((DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) -#define MACRO(m) ((DL_MACRO) | ((m) & 1UL)) -#define PALETTE_SOURCE(addr) ((DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) -#define POINT_SIZE(size) ((DL_POINT_SIZE) | ((size) & 0x1FFFUL)) -#define SCISSOR_SIZE(width,height) ((DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) -#define SCISSOR_XY(x,y) ((DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) -#define STENCIL_FUNC(func,ref,mask) ((DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) -#define STENCIL_MASK(mask) ((DL_STENCIL_MASK) | ((mask) & 0xFFUL)) -#define STENCIL_OP(sfail,spass) ((DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) -#define TAG(s) ((DL_TAG) | ((s) & 0xFFUL)) -#define TAG_MASK(mask) ((DL_TAG_MASK) | ((mask) & 1UL)) -#define VERTEX2F(x,y) ((DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) -#define VERTEX2II(x,y,handle,cell) ((DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) -#define VERTEX_FORMAT(frac) ((DL_VERTEX_FORMAT) | ((frac) & 7UL)) -#define VERTEX_TRANSLATE_X(x) ((DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) -#define VERTEX_TRANSLATE_Y(y) ((DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +//#define BITMAP_TRANSFORM_C(c) ((DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) +/** + * @brief Set the C coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_C(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_C | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_F(f) ((DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) +/** + * @brief Set the F coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_F(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_F | (val & 0x1FFFFUL)); +} + +//#define BLEND_FUNC(src,dst) ((DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BLEND_FUNC(uint8_t src, uint8_t dst) +{ + uint32_t const srcv = (uint32_t) ((src & 7UL) << 3U); + uint32_t const dstv = (uint32_t) (dst & 7UL); + return (DL_BLEND_FUNC | srcv | dstv); +} + +//#define CALL(dest) ((DL_CALL) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CALL(uint16_t dest) +{ + return (DL_CALL | (dest & 0x7FFUL)); +} + +//#define JUMP(dest) ((DL_JUMP) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t JUMP(uint16_t dest) +{ + return (DL_JUMP | (dest & 0x7FFUL)); +} + +//#define CELL(cell) ((DL_CELL) | ((cell) & 0x7FUL)) +/** + * @brief Set the bitmap cell number for the VERTEX2F command. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CELL(uint8_t cell) +{ + return (DL_CELL | (cell & 0x7FUL)); +} + +//#define CLEAR(c,s,t) ((DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) +/** + * @brief Clear buffers to preset values. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR(uint8_t color, uint8_t stencil, uint8_t tag) +{ + uint32_t const colorv = (color & 1UL) << 2U; + uint32_t const stencilv = (stencil & 1UL) << 1U; + uint32_t const tagv = (tag & 1UL); + return (DL_CLEAR | colorv | stencilv | tagv); +} + +//#define CLEAR_COLOR_A(alpha) ((DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set clear value for the alpha channel. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_COLOR_A(uint8_t alpha) +{ + return (DL_CLEAR_COLOR_A | alpha); +} + +//#define CLEAR_COLOR_RGB(red,green,blue) ((DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set clear values for red, green and blue channels. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (DL_CLEAR_COLOR_RGB | redv | greenv | bluev); +} + +//#define CLEAR_STENCIL(s) ((DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the stencil buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_STENCIL(uint8_t val) +{ + return (DL_CLEAR_STENCIL | val); +} + +//#define CLEAR_TAG(s) ((DL_CLEAR_TAG) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_TAG(uint8_t val) +{ + return (DL_CLEAR_TAG | val); +} + +//#define COLOR_A(alpha) ((DL_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set the current color alpha. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_A(uint8_t alpha) +{ + return (DL_COLOR_A | alpha); +} + +//#define COLOR_MASK(r,g,b,a) ((DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) +/** + * @brief Enable or disable writing of color components. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_MASK(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 1UL) << 3U); + uint32_t const greenv = ((green & 1UL) << 2U); + uint32_t const bluev = ((blue & 1UL) << 1U); + uint32_t const alphav = (alpha & 1UL); + return (DL_COLOR_MASK | redv | greenv | bluev | alphav); +} + +//#define COLOR_RGB(red,green,blue) ((DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set the current color red, green and blue. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (DL_COLOR_RGB | redv | greenv | bluev); +} + +//#define LINE_WIDTH(width) ((DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) +/** + * @brief Set the width of lines to be drawn with primitive LINES in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LINE_WIDTH(uint16_t width) +{ + return (DL_LINE_WIDTH | (width & 0xFFFUL)); +} + +//#define MACRO(m) ((DL_MACRO) | ((m) & 1UL)) +/** + * @brief Execute a single command from a macro register. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t MACRO(uint8_t macro) +{ + return (DL_MACRO | (macro & 0x1UL)); +} + +//#define PALETTE_SOURCE(addr) ((DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) +/** + * @brief Set the base address of the palette. + * @note 2-byte alignment is required if pixel format is PALETTE4444 or PALETTE565. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t PALETTE_SOURCE(uint32_t addr) +{ + return (DL_PALETTE_SOURCE | (addr & 0x3FFFFFUL)); +} + +//#define POINT_SIZE(size) ((DL_POINT_SIZE) | ((size) & 0x1FFFUL)) +/** + * @brief Set the radius of points to be drawn with primitive POINTS in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t POINT_SIZE(uint16_t size) +{ + return (DL_POINT_SIZE | (size & 0x1FFFUL)); +} + +//#define SCISSOR_SIZE(width,height) ((DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) +/** + * @brief Set the size of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2048 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t SCISSOR_SIZE(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t) ((width & 0xFFFUL) << 12U); + uint32_t const heightv = (uint32_t) (height & 0xFFFUL); + return (DL_SCISSOR_SIZE | widthv | heightv); +} + +//#define SCISSOR_XY(x,y) ((DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) +/** + * @brief Set the top left corner of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2047 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t SCISSOR_XY(uint16_t xc0, uint16_t yc0) +{ + uint32_t const xc0v = (uint32_t) ((xc0 & 0x7FFUL) << 11U); + uint32_t const yc0v = (uint32_t) (yc0 & 0x7FFUL); + return (DL_SCISSOR_XY | xc0v | yc0v); +} + +//#define STENCIL_FUNC(func,ref,mask) ((DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) +/** + * @brief Set function and reference value for stencil testing. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_FUNC(uint8_t func, uint8_t ref, uint8_t mask) +{ + uint32_t const funcv = (uint32_t) ((func & 7UL) << 16U); + uint32_t const refv = (uint32_t) ((ref & 0xFFUL) << 8U); + uint32_t const maskv = (uint32_t) (mask & 0xFFUL); + return (DL_STENCIL_FUNC | funcv | refv | maskv); +} + +//#define STENCIL_MASK(mask) ((DL_STENCIL_MASK) | ((mask) & 0xFFUL)) +/** + * @brief Control the writing of individual bits in the stencil planes. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_MASK(uint8_t mask) +{ + return (DL_STENCIL_MASK | mask); +} + +//#define STENCIL_OP(sfail,spass) ((DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) +/** + * @brief Set stencil test actions. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_OP(uint8_t sfail, uint8_t spass) +{ + uint32_t const sfailv = (uint32_t) ((sfail & 0x07UL) << 3U); + uint32_t const spassv = (uint32_t) (spass & 0x07UL); + return (DL_STENCIL_OP | sfailv | spassv); +} + +//#define TAG(s) ((DL_TAG) | ((s) & 0xFFUL)) +/** + * @brief Attach the tag value for the following graphics objects drawn on the screen. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t TAG(uint8_t tagval) +{ + return (DL_TAG | tagval); +} + +//#define TAG_MASK(mask) ((DL_TAG_MASK) | ((mask) & 1UL)) +/** + * @brief Control the writing of the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t TAG_MASK(uint8_t mask) +{ + return (DL_TAG_MASK | ((mask) & 1UL)); +} + +//#define VERTEX2F(x,y) ((DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) +/** + * @brief Set coordinates for graphics primitves. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX2F(int16_t xc0, int16_t yc0) +{ + uint32_t const xc0v = ((((uint32_t) ((uint16_t) xc0)) & 0x7FFFUL) << 15U); + uint32_t const yc0v = (((uint32_t) ((uint16_t) yc0)) & 0x7FFFUL); + return (DL_VERTEX2F | xc0v | yc0v); +} + +//#define VERTEX2II(x,y,handle,cell) ((DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) +/** + * @brief Set coordinates, bitmap-handle and cell-number for graphics primitves. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX2II(uint16_t xc0, uint16_t yc0, uint8_t handle, uint8_t cell) +{ + uint32_t const xc0v = ((((uint32_t) xc0) & 0x1FFUL) << 21U); + uint32_t const yc0v = ((((uint32_t) yc0) & 0x1FFUL) << 12U); + uint32_t const handlev = ((((uint32_t) handle) & 0x1FUL) << 7U); + uint32_t const cellv = (((uint32_t) cell) & 0x7FUL); + return (DL_VERTEX2II | xc0v | yc0v | handlev | cellv); +} + +//#define VERTEX_FORMAT(frac) ((DL_VERTEX_FORMAT) | ((frac) & 7UL)) +/** + * @brief Set the precision of VERTEX2F coordinates. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_FORMAT(uint8_t frac) +{ + return (DL_VERTEX_FORMAT | ((frac) & 7UL)); +} + +//#define VERTEX_TRANSLATE_X(x) ((DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations X translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_TRANSLATE_X(int32_t xco) +{ + return (DL_VERTEX_TRANSLATE_X | (((uint32_t) xco) & 0x1FFFFUL)); +} + +//#define VERTEX_TRANSLATE_Y(y) ((DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations Y translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_TRANSLATE_Y(int32_t yco) +{ + return (DL_VERTEX_TRANSLATE_Y | (((uint32_t) yco) & 0x1FFFFUL)); +} /* #define BEGIN(prim) ((DL_BEGIN) | ((prim) & 15UL)) */ /* use define DL_BEGIN */ /* #define DISPLAY() ((DL_DISPLAY)) */ /* use define DL_DISPLAY */ @@ -648,86 +1068,151 @@ extern "C" #if EVE_GEN > 2 -#define EVE_GLFORMAT 31UL /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ +#define EVE_GLFORMAT ((uint32_t) 31UL) /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ -#define DL_BITMAP_EXT_FORMAT 0x2E000000UL /* requires OR'd arguments */ -#define DL_BITMAP_SWIZZLE 0x2F000000UL -/* #define DL_INT_FRR 0x30000000UL */ /* ESE displays "Internal: flash read result" - undocumented display list command */ +#define DL_BITMAP_EXT_FORMAT ((uint32_t) 0x2E000000UL) /* requires OR'd arguments */ +#define DL_BITMAP_SWIZZLE ((uint32_t) 0x2F000000UL) +/* #define DL_INT_FRR ((uint32_t) 0x30000000UL) */ /* ESE displays "Internal: flash read result" - undocumented display list command */ /* Extended Bitmap formats */ -#define EVE_ASTC_4X4 37808UL -#define EVE_ASTC_5X4 37809UL -#define EVE_ASTC_5X5 37810UL -#define EVE_ASTC_6X5 37811UL -#define EVE_ASTC_6X6 37812UL -#define EVE_ASTC_8X5 37813UL -#define EVE_ASTC_8X6 37814UL -#define EVE_ASTC_8X8 37815UL -#define EVE_ASTC_10X5 37816UL -#define EVE_ASTC_10X6 37817UL -#define EVE_ASTC_10X8 37818UL -#define EVE_ASTC_10X10 37819UL -#define EVE_ASTC_12X10 37820UL -#define EVE_ASTC_12X12 37821UL - -#define EVE_RAM_ERR_REPORT 0x309800UL /* max 128 bytes null terminated string */ -#define EVE_RAM_FLASH 0x800000UL -#define EVE_RAM_FLASH_POSTBLOB 0x801000UL - -#define EVE_OPT_FLASH 64U -#define EVE_OPT_OVERLAY 128U -#define EVE_OPT_FORMAT 4096U -#define EVE_OPT_FILL 8192U +#define EVE_ASTC_4X4 ((uint32_t) 37808UL) +#define EVE_ASTC_5X4 ((uint32_t) 37809UL) +#define EVE_ASTC_5X5 ((uint32_t) 37810UL) +#define EVE_ASTC_6X5 ((uint32_t) 37811UL) +#define EVE_ASTC_6X6 ((uint32_t) 37812UL) +#define EVE_ASTC_8X5 ((uint32_t) 37813UL) +#define EVE_ASTC_8X6 ((uint32_t) 37814UL) +#define EVE_ASTC_8X8 ((uint32_t) 37815UL) +#define EVE_ASTC_10X5 ((uint32_t) 37816UL) +#define EVE_ASTC_10X6 ((uint32_t) 37817UL) +#define EVE_ASTC_10X8 ((uint32_t) 37818UL) +#define EVE_ASTC_10X10 ((uint32_t) 37819UL) +#define EVE_ASTC_12X10 ((uint32_t) 37820UL) +#define EVE_ASTC_12X12 ((uint32_t) 37821UL) + +#define EVE_RAM_ERR_REPORT ((uint32_t) 0x309800UL) /* max 128 bytes null terminated string */ +#define EVE_RAM_FLASH ((uint32_t) 0x800000UL) +#define EVE_RAM_FLASH_POSTBLOB ((uint32_t) 0x801000UL) + +#define EVE_OPT_FLASH ((uint16_t) 64U) +#define EVE_OPT_OVERLAY ((uint16_t) 128U) +#define EVE_OPT_FORMAT ((uint16_t) 4096U) +#define EVE_OPT_FILL ((uint16_t) 8192U) /* Commands for BT815 / BT816 */ -#define CMD_BITMAP_TRANSFORM 0xFFFFFF21UL -#define CMD_SYNC 0xFFFFFF42UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ -#define CMD_FLASHERASE 0xFFFFFF44UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ -#define CMD_FLASHWRITE 0xFFFFFF45UL -#define CMD_FLASHREAD 0xFFFFFF46UL -#define CMD_FLASHUPDATE 0xFFFFFF47UL -#define CMD_FLASHDETACH 0xFFFFFF48UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ -#define CMD_FLASHATTACH 0xFFFFFF49UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ -#define CMD_FLASHFAST 0xFFFFFF4AUL -#define CMD_FLASHSPIDESEL 0xFFFFFF4BUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ -#define CMD_FLASHSPITX 0xFFFFFF4CUL -#define CMD_FLASHSPIRX 0xFFFFFF4DUL -#define CMD_FLASHSOURCE 0xFFFFFF4EUL -#define CMD_CLEARCACHE 0xFFFFFF4FUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ -#define CMD_INFLATE2 0xFFFFFF50UL -#define CMD_ROTATEAROUND 0xFFFFFF51UL -#define CMD_RESETFONTS 0xFFFFFF52UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ -#define CMD_ANIMSTART 0xFFFFFF53UL -#define CMD_ANIMSTOP 0xFFFFFF54UL -#define CMD_ANIMXY 0xFFFFFF55UL -#define CMD_ANIMDRAW 0xFFFFFF56UL -#define CMD_GRADIENTA 0xFFFFFF57UL -#define CMD_FILLWIDTH 0xFFFFFF58UL -#define CMD_APPENDF 0xFFFFFF59UL -#define CMD_ANIMFRAME 0xFFFFFF5AUL -#define CMD_VIDEOSTARTF 0xFFFFFF5FUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ +#define CMD_BITMAP_TRANSFORM ((uint32_t) 0xFFFFFF21UL) +#define CMD_SYNC ((uint32_t) 0xFFFFFF42UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ +#define CMD_FLASHERASE ((uint32_t) 0xFFFFFF44UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ +#define CMD_FLASHWRITE ((uint32_t) 0xFFFFFF45UL) +#define CMD_FLASHREAD ((uint32_t) 0xFFFFFF46UL) +#define CMD_FLASHUPDATE ((uint32_t) 0xFFFFFF47UL) +#define CMD_FLASHDETACH ((uint32_t) 0xFFFFFF48UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ +#define CMD_FLASHATTACH ((uint32_t) 0xFFFFFF49UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ +#define CMD_FLASHFAST ((uint32_t) 0xFFFFFF4AUL) +#define CMD_FLASHSPIDESEL ((uint32_t) 0xFFFFFF4BUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ +#define CMD_FLASHSPITX ((uint32_t) 0xFFFFFF4CUL) +#define CMD_FLASHSPIRX ((uint32_t) 0xFFFFFF4DUL) +#define CMD_FLASHSOURCE ((uint32_t) 0xFFFFFF4EUL) +#define CMD_CLEARCACHE ((uint32_t) 0xFFFFFF4FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ +#define CMD_INFLATE2 ((uint32_t) 0xFFFFFF50UL) +#define CMD_ROTATEAROUND ((uint32_t) 0xFFFFFF51UL) +#define CMD_RESETFONTS ((uint32_t) 0xFFFFFF52UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ +#define CMD_ANIMSTART ((uint32_t) 0xFFFFFF53UL) +#define CMD_ANIMSTOP ((uint32_t) 0xFFFFFF54UL) +#define CMD_ANIMXY ((uint32_t) 0xFFFFFF55UL) +#define CMD_ANIMDRAW ((uint32_t) 0xFFFFFF56UL) +#define CMD_GRADIENTA ((uint32_t) 0xFFFFFF57UL) +#define CMD_FILLWIDTH ((uint32_t) 0xFFFFFF58UL) +#define CMD_APPENDF ((uint32_t) 0xFFFFFF59UL) +#define CMD_ANIMFRAME ((uint32_t) 0xFFFFFF5AUL) +#define CMD_VIDEOSTARTF ((uint32_t) 0xFFFFFF5FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ /* Registers for BT815 / BT816 */ -#define REG_ADAPTIVE_FRAMERATE 0x0030257cUL -#define REG_PLAYBACK_PAUSE 0x003025ecUL -#define REG_FLASH_STATUS 0x003025f0UL -#define REG_FLASH_SIZE 0x00309024UL -#define REG_PLAY_CONTROL 0x0030914eUL -#define REG_COPRO_PATCH_PTR 0x00309162UL +#define REG_ADAPTIVE_FRAMERATE ((uint32_t) 0x0030257cUL) +#define REG_PLAYBACK_PAUSE ((uint32_t) 0x003025ecUL) +#define REG_FLASH_STATUS ((uint32_t) 0x003025f0UL) +#define REG_FLASH_SIZE ((uint32_t) 0x00309024UL) +#define REG_PLAY_CONTROL ((uint32_t) 0x0030914eUL) +#define REG_COPRO_PATCH_PTR ((uint32_t) 0x00309162UL) /* Macros for BT815 / BT816 */ -#define BITMAP_EXT_FORMAT(format) ((DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) -#define BITMAP_SWIZZLE(r,g,b,a) ((DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) -#define BITMAP_TRANSFORM_A_EXT(p,v) ((DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_B_EXT(p,v) ((DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_D_EXT(p,v) ((DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_E_EXT(p,v) ((DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +//#define BITMAP_EXT_FORMAT(format) ((DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) +/** + * @brief Set the extended format of the bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_EXT_FORMAT(uint16_t format) +{ + return (DL_BITMAP_EXT_FORMAT | format); +} + +//#define BITMAP_SWIZZLE(r,g,b,a) ((DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) +/** + * @brief Set the source for the red, green, blue and alpha channels of a bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SWIZZLE(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 7UL) << 9U); + uint32_t const greenv = ((green & 7UL) << 6U); + uint32_t const bluev = ((blue & 7UL) << 3U); + uint32_t const alphav = (alpha & 7UL); + return (DL_BITMAP_SWIZZLE | redv | greenv | bluev | alphav); +} + +//#define BITMAP_TRANSFORM_A_EXT(p,v) ((DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_A(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_A | prcv | valv); +} + +//#define BITMAP_TRANSFORM_B_EXT(p,v) ((DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_B(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_B | prcv | valv); +} + +//#define BITMAP_TRANSFORM_D_EXT(p,v) ((DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_D(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_D | prcv | valv); +} + +//#define BITMAP_TRANSFORM_E_EXT(p,v) ((DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_E(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_E | prcv | valv); +} -#define BITMAP_TRANSFORM_A(a) BITMAP_TRANSFORM_A_EXT(0UL,(a)) -#define BITMAP_TRANSFORM_B(b) BITMAP_TRANSFORM_B_EXT(0UL,(b)) -#define BITMAP_TRANSFORM_D(d) BITMAP_TRANSFORM_D_EXT(0UL,(d)) -#define BITMAP_TRANSFORM_E(e) BITMAP_TRANSFORM_E_EXT(0UL,(e)) +//#define BITMAP_TRANSFORM_A(a) BITMAP_TRANSFORM_A_EXT(0UL,(a)) +//#define BITMAP_TRANSFORM_B(b) BITMAP_TRANSFORM_B_EXT(0UL,(b)) +//#define BITMAP_TRANSFORM_D(d) BITMAP_TRANSFORM_D_EXT(0UL,(d)) +//#define BITMAP_TRANSFORM_E(e) BITMAP_TRANSFORM_E_EXT(0UL,(e)) #endif /* EVE_GEN > 2 */ @@ -736,31 +1221,31 @@ extern "C" #if EVE_GEN > 3 /* Commands for BT817 / BT818 */ -#define CMD_ANIMFRAMERAM 0xFFFFFF6DUL -#define CMD_ANIMSTARTRAM 0xFFFFFF6EUL -#define CMD_APILEVEL 0xFFFFFF63UL -#define CMD_CALIBRATESUB 0xFFFFFF60UL -#define CMD_CALLLIST 0xFFFFFF67UL -#define CMD_ENDLIST 0xFFFFFF69UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ -#define CMD_FLASHPROGRAM 0xFFFFFF70UL -#define CMD_FONTCACHE 0xFFFFFF6BUL -#define CMD_FONTCACHEQUERY 0xFFFFFF6CUL -#define CMD_GETIMAGE 0xFFFFFF64UL -#define CMD_HSF 0xFFFFFF62UL -#define CMD_LINETIME 0xFFFFFF5EUL -#define CMD_NEWLIST 0xFFFFFF68UL -#define CMD_PCLKFREQ 0xFFFFFF6AUL -#define CMD_RETURN 0xFFFFFF66UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ -#define CMD_RUNANIM 0xFFFFFF6FUL -#define CMD_TESTCARD 0xFFFFFF61UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ -#define CMD_WAIT 0xFFFFFF65UL +#define CMD_ANIMFRAMERAM ((uint32_t) 0xFFFFFF6DUL) +#define CMD_ANIMSTARTRAM ((uint32_t) 0xFFFFFF6EUL) +#define CMD_APILEVEL ((uint32_t) 0xFFFFFF63UL) +#define CMD_CALIBRATESUB ((uint32_t) 0xFFFFFF60UL) +#define CMD_CALLLIST ((uint32_t) 0xFFFFFF67UL) +#define CMD_ENDLIST ((uint32_t) 0xFFFFFF69UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ +#define CMD_FLASHPROGRAM ((uint32_t) 0xFFFFFF70UL) +#define CMD_FONTCACHE ((uint32_t) 0xFFFFFF6BUL) +#define CMD_FONTCACHEQUERY ((uint32_t) 0xFFFFFF6CUL) +#define CMD_GETIMAGE ((uint32_t) 0xFFFFFF64UL) +#define CMD_HSF ((uint32_t) 0xFFFFFF62UL) +#define CMD_LINETIME ((uint32_t) 0xFFFFFF5EUL) +#define CMD_NEWLIST ((uint32_t) 0xFFFFFF68UL) +#define CMD_PCLKFREQ ((uint32_t) 0xFFFFFF6AUL) +#define CMD_RETURN ((uint32_t) 0xFFFFFF66UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ +#define CMD_RUNANIM ((uint32_t) 0xFFFFFF6FUL) +#define CMD_TESTCARD ((uint32_t) 0xFFFFFF61UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ +#define CMD_WAIT ((uint32_t) 0xFFFFFF65UL) /* Registers for BT817 / BT818 */ -#define REG_UNDERRUN 0x0030260cUL -#define REG_AH_HCYCLE_MAX 0x00302610UL -#define REG_PCLK_FREQ 0x00302614UL -#define REG_PCLK_2X 0x00302618UL -#define REG_ANIM_ACTIVE 0x0030902CUL +#define REG_UNDERRUN ((uint32_t) 0x0030260cUL) +#define REG_AH_HCYCLE_MAX ((uint32_t) 0x00302610UL) +#define REG_PCLK_FREQ ((uint32_t) 0x00302614UL) +#define REG_PCLK_2X ((uint32_t) 0x00302618UL) +#define REG_ANIM_ACTIVE ((uint32_t) 0x0030902CUL) #endif /* EVE_GEN > 3 */ diff --git a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.c b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.c index 4808fb3..c213b91 100644 --- a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.c +++ b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.c @@ -2,7 +2,7 @@ @file EVE_commands.c @brief contains FT8xx / BT8xx functions @version 5.0 -@date 2023-08-17 +@date 2023-12-29 @author Rudolph Riedel @section info @@ -49,7 +49,7 @@ has EVE_PCLK_FREQ defined - removed the meta-commands EVE_cmd_point(), EVE_cmd_line() and EVE_cmd_rect() - split all display-list commands into two functions: EVE_cmd_XXX() and EVE_cmd_XXX_burst() - switched from using EVE_RAM_CMD + cmdOffset to REG_CMDB_WRITE -- as a side effect from switching to REG_CMDB_WRITE, every co-processor command is automatically executed now +- as a side effect from switching to REG_CMDB_WRITE, every coprocessor command is automatically executed now - renamed EVE_LIB_GetProps() back to EVE_cmd_getprops() since it does not do anything special to justify a special name - added helper function EVE_memWrite_sram_buffer() - added EVE_cmd_bitmap_transform() and EVE_cmd_bitmap_transform_burst() @@ -136,9 +136,9 @@ without the traling _burst in the name when exceution speed is not an issue - e. - switched from using CMD_PCLKFREQ to writing to REG_PCLK_FREQ directly - added define EVE_SET_REG_PCLK_2X to set REG_PCLK_2X to 1 when necessary - Bugfix: EVE_init() did not set the audio engine to "mute" as intended, but to "silent" -- Bugfix: EVE_busy() returns E_NOT_OK now on co-processor faults. +- Bugfix: EVE_busy() returns E_NOT_OK now on coprocessor faults. thanks for the report to Z0ld3n on Github! -- Fix: reworked EVE_busy() to return EVE_FAULT_RECOVERED on deteced co-processor faults, +- Fix: reworked EVE_busy() to return EVE_FAULT_RECOVERED on deteced coprocessor faults, removed the flash commands from the fault recovery sequence as these are project specific. - added EVE_get_and_reset_fault_state() to check if EVE_busy() triggered a fault recovery - added notes on how to use to EVE_cmd_setfont2() and EVE_cmd_romfont() @@ -147,6 +147,12 @@ without the traling _burst in the name when exceution speed is not an issue - e. - reworked the burst part of private_string_write() to be less complex - renamed chipid references to regid as suggested by #93 on github - Bugfix: broke transfers of buffers larger than 3840 when fixing issues from static code analysis +- changed a number of function parameters from signed to unsigned following the + updated BT81x series programming guide V2.4 +- did another linter pass and fixed some things +- started to improve the embedded documentation +- added more documentation +- removed EVE_cmd_hsf_burst() */ @@ -168,7 +174,9 @@ static volatile uint8_t fault_recovered = E_OK; /* flag to indicate if EVE_busy helper functions ##################################################################### */ - +/** + * @brief Send a host command. + */ void EVE_cmdWrite(uint8_t const command, uint8_t const parameter) { EVE_cs_set(); @@ -178,6 +186,9 @@ void EVE_cmdWrite(uint8_t const command, uint8_t const parameter) EVE_cs_clear(); } +/** + * @brief Implementation of rd8() function, reads 8 bits. + */ uint8_t EVE_memRead8(uint32_t const ft_address) { uint8_t data; @@ -185,21 +196,28 @@ uint8_t EVE_memRead8(uint32_t const ft_address) spi_transmit_32(((ft_address >> 16U) & 0x0000007fUL) + (ft_address & 0x0000ff00UL) + ((ft_address & 0x000000ffUL) << 16U)); data = spi_receive(0U); /* read data byte by sending another dummy byte */ EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of rd16() function, reads 16 bits. + */ uint16_t EVE_memRead16(uint32_t const ft_address) { uint16_t data; + EVE_cs_set(); spi_transmit_32(((ft_address >> 16U) & 0x0000007fUL) + (ft_address & 0x0000ff00UL) + ((ft_address & 0x000000ffUL) << 16U)); - uint8_t lowbyte = spi_receive(0U); /* read low byte */ - uint8_t hibyte = spi_receive(0U); /* read high byte */ + uint8_t const lowbyte = spi_receive(0U); /* read low byte */ + uint8_t const hibyte = spi_receive(0U); /* read high byte */ data = ((uint16_t) hibyte * 256U) | lowbyte; EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of rd32() function, reads 32 bits. + */ uint32_t EVE_memRead32(uint32_t const ft_address) { uint32_t data; @@ -210,49 +228,60 @@ uint32_t EVE_memRead32(uint32_t const ft_address) data = ((uint32_t) spi_receive(0U) << 16U) | data; data = ((uint32_t) spi_receive(0U) << 24U) | data; /* read high byte */ EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of wr8() function, writes 8 bits. + */ void EVE_memWrite8(uint32_t const ft_address, uint8_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); spi_transmit(ft_data); EVE_cs_clear(); } +/** + * @brief Implementation of wr16() function, writes 16 bits. + */ void EVE_memWrite16(uint32_t const ft_address, uint16_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ - spi_transmit((uint8_t)(ft_address >> 8U)); /* send middle address byte */ - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); /* send low address byte */ - spi_transmit((uint8_t)(ft_data & 0x00ffU)); /* send data low byte */ - spi_transmit((uint8_t)(ft_data >> 8U)); /* send data high byte */ + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ + spi_transmit((uint8_t) (ft_address >> 8U)); /* send middle address byte */ + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); /* send low address byte */ + spi_transmit((uint8_t) (ft_data & 0x00ffU)); /* send data low byte */ + spi_transmit((uint8_t) (ft_data >> 8U)); /* send data high byte */ EVE_cs_clear(); } +/** + * @brief Implementation of wr32() function, writes 32 bits. + */ void EVE_memWrite32(uint32_t const ft_address, uint32_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ - spi_transmit((uint8_t)(ft_address >> 8U)); /* send middle address byte */ - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); /* send low address byte */ + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ + spi_transmit((uint8_t) (ft_address >> 8U)); /* send middle address byte */ + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); /* send low address byte */ spi_transmit_32(ft_data); EVE_cs_clear(); } -/* Helper function, write a block of memory from the FLASH of the host controller to EVE. */ +/** + * @brief Helper function, write a block of memory from the FLASH of the host controller to EVE. + */ void EVE_memWrite_flash_buffer(uint32_t const ft_address, const uint8_t *p_data, uint32_t const len) { if (p_data != NULL) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); // uint32_t length = (len + 3U) & (~3U); @@ -265,15 +294,17 @@ void EVE_memWrite_flash_buffer(uint32_t const ft_address, const uint8_t *p_data, } } -/* Helper function, write a block of memory from the SRAM of the host controller to EVE. */ +/** + * @brief Helper function, write a block of memory from the SRAM of the host controller to EVE. + */ void EVE_memWrite_sram_buffer(uint32_t const ft_address, const uint8_t *p_data, uint32_t const len) { if (p_data != NULL) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); // uint32_t length = (len + 3U) & (~3U); @@ -286,7 +317,9 @@ void EVE_memWrite_sram_buffer(uint32_t const ft_address, const uint8_t *p_data, } } -/* Helper function, read a block of memory from EVE to the SRAM of the host controller */ +/** + * @brief Helper function, read a block of memory from EVE to the SRAM of the host controller. + */ void EVE_memRead_sram_buffer(uint32_t const ft_address, uint8_t *p_data, uint32_t const len) { if (p_data != NULL) @@ -310,7 +343,7 @@ static void CoprocessorFaultRecover(void) copro_patch_pointer = EVE_memRead16(REG_COPRO_PATCH_PTR); #endif - EVE_memWrite8(REG_CPURESET, 1U); /* hold co-processor engine in the reset condition */ + EVE_memWrite8(REG_CPURESET, 1U); /* hold coprocessor engine in the reset condition */ EVE_memWrite16(REG_CMD_READ, 0U); /* set REG_CMD_READ to 0 */ EVE_memWrite16(REG_CMD_WRITE, 0U); /* set REG_CMD_WRITE to 0 */ EVE_memWrite16(REG_CMD_DL, 0U); /* reset REG_CMD_DL to 0 as required by the BT81x programming guide, should not hurt FT8xx */ @@ -327,21 +360,18 @@ static void CoprocessorFaultRecover(void) #endif #endif - EVE_memWrite8(REG_CPURESET, 0U); /* set REG_CPURESET to 0 to restart the co-processor engine*/ + EVE_memWrite8(REG_CPURESET, 0U); /* set REG_CPURESET to 0 to restart the coprocessor engine*/ DELAY_MS(10U); /* just to be safe */ } -/* Check if the co-processor completed executing the current command list. */ -/* Returns E_OK in case EVE is not busy (no DMA transfer active and */ -/* REG_CMDB_SPACE has the value 0xffc, meaning the CMD-FIFO is empty. */ -/* If there was a coprocessor fault the recovery sequence is */ -/* executed and E_NOT_OK is returned. */ -/* note: in case of recovery the graphics context gets reset and the */ -/* external flash needs to be reinitialized if needed */ -/* Returns EVE_FIFO_HALF_EMPTY if no DMA transfer is active */ -/* and REG_CMDB_SPACE shows more than 2048 bytes available. */ -/* Returns EVE_IS_BUSY if a DMA transfer is active */ -/* or REG_CMDB_SPACE has a value smaller than 0xffc. */ +/** + * @brief Check if the coprocessor completed executing the current command list. + * @return - E_OK - if EVE is not busy (no DMA transfer active and REG_CMDB_SPACE has the value 0xffc, meaning the CMD-FIFO is empty + * @return - EVE_IS_BUSY - if a DMA transfer is active or REG_CMDB_SPACE has a value smaller than 0xffc + * @return - EVE_FIFO_HALF_EMPTY - if no DMA transfer is active and REG_CMDB_SPACE shows more than 2048 bytes available + * @return - E_NOT_OK - if there was a coprocessor fault and the recovery sequence was executed + * @note - if there is a coprocessor fault the external flash is not reinitialized by EVE_busy() + */ uint8_t EVE_busy(void) { uint16_t space; @@ -354,8 +384,8 @@ uint8_t EVE_busy(void) space = EVE_memRead16(REG_CMDB_SPACE); - /* (REG_CMDB_SPACE & 0x03) != 0 -> we have a co-processor fault */ - if ((space & 3U) != 0U) /* we have a co-processor fault, make EVE play with us again */ + /* (REG_CMDB_SPACE & 0x03) != 0 -> we have a coprocessor fault */ + if ((space & 3U) != 0U) /* we have a coprocessor fault, make EVE play with us again */ { ret = EVE_FAULT_RECOVERED; fault_recovered = EVE_FAULT_RECOVERED; /* save fault recovery state */ @@ -381,16 +411,14 @@ uint8_t EVE_busy(void) } #endif - return ret; + return (ret); } /** - * @brief Helper function to check if EVE_busy() tried to recover from - * a coprocessor fault. + * @brief Helper function to check if EVE_busy() tried to recover from a coprocessor fault. * The internal fault indicator is cleared so it could be set by EVE_busy() again. - * - * @return Returns EVE_FAULT_RECOVERED if EVE_busy() detected a coprocessor fault. - * Returns E_OK if EVE_busy() did not detect a coprocessor fault. + * @return - EVE_FAULT_RECOVERED - if EVE_busy() detected a coprocessor fault + * @return - E_OK - if EVE_busy() did not detect a coprocessor fault */ uint8_t EVE_get_and_reset_fault_state(void) { @@ -401,10 +429,12 @@ uint8_t EVE_get_and_reset_fault_state(void) ret = EVE_FAULT_RECOVERED; fault_recovered = E_OK; } - return ret; + return (ret); } -/* Wait for the co-processor to complete the FIFO queue.*/ +/** + * @brief Helper function, wait for the coprocessor to complete the FIFO queue. + */ void EVE_execute_cmd(void) { while (EVE_busy() != E_OK) @@ -412,7 +442,7 @@ void EVE_execute_cmd(void) } } -/* Begin a co-processor command, this is used for non-display-list and non-burst-mode commands.*/ +/* begin a coprocessor command, this is used for non-display-list and non-burst-mode commands.*/ static void eve_begin_cmd(uint32_t command) { EVE_cs_set(); @@ -471,21 +501,23 @@ void block_transfer(const uint8_t *p_data, uint32_t len) } /* ################################################################## - co-processor commands that are not used in displays lists, + coprocessor commands that are not used in displays lists, these are not to be used with burst transfers ################################################################### */ /* BT817 / BT818 */ #if EVE_GEN > 3 -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in RAM_G to to the external flash on a BT81x board at address dest */ -/* note: dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ -/* note: this looks exactly the same as EVE_cmd_flashupdate() but it needs the flash to be empty */ +/** + * @brief Write "num" bytes from src in RAM_G to the previously erased external flash of a BT81x at address dest. + * @note - dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 + * @note - EVE will not do anything if the alignment requirements are not met + * @note - the address ptr is relative to the flash so the first address is 0x000000 not 0x800000 + * @note - this looks exactly the same as EVE_cmd_flashupdate() but it needs the flash to be empty + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHPROGRAM); @@ -496,23 +528,29 @@ void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_fontcache(uint32_t font, int32_t ptr, uint32_t num) +/** + * @brief Enable the font cache. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num) { eve_begin_cmd(CMD_FONTCACHE); spi_transmit_32(font); - spi_transmit_32((uint32_t) ptr); + spi_transmit_32(ptr); spi_transmit_32(num); EVE_cs_clear(); EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used) +/** + * @brief Queries the capacity and utilization of the font cache. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_fontcachequery(uint32_t *p_total, uint32_t *p_used) { uint16_t cmdoffset; @@ -522,21 +560,24 @@ void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used) EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_total != NULL) { - *p_total = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_total = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_used != NULL) { - *p_used = (int32_t) EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_used = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Returns all the attributes of the bitmap made by the previous CMD_LOADIMAGE, CMD_PLAYVIDEO, CMD_VIDEOSTART or CMD_VIDEOSTARTF. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, uint32_t *p_height, uint32_t *p_palette) { uint16_t cmdoffset; @@ -550,33 +591,36 @@ void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, ui EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_palette != NULL) { - *p_palette = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_palette = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } if (p_height != NULL) { - *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_width != NULL) { - *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU)); + *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL)); } if (p_fmt != NULL) { - *p_fmt = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 16U) & 0xfffU)); + *p_fmt = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 16UL) & 0xfffUL)); } if (p_source != NULL) { - *p_source = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 20U) & 0xfffU)); + *p_source = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 20UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Undocumented command. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_linetime(uint32_t dest) { eve_begin_cmd(CMD_LINETIME); @@ -585,9 +629,12 @@ void EVE_cmd_linetime(uint32_t dest) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Starts the compilation of a command list into RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_newlist(uint32_t adr) { eve_begin_cmd(CMD_NEWLIST); @@ -596,12 +643,14 @@ void EVE_cmd_newlist(uint32_t adr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* This command sets REG_PCLK_FREQ to generate the closest possible */ -/* frequency to the one requested. */ -/* Returns the frequency achieved or zero if no frequency was found. */ +/** + * @brief Sets REG_PCLK_FREQ to generate the closest possible frequency to the one requested. + * @return - the frequency achieved or zero if no frequency was found + * @note - When using this command, the flash BLOB is required. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_pclkfreq(uint32_t ftarget, int32_t rounding) { uint16_t cmdoffset; @@ -612,15 +661,18 @@ uint32_t EVE_cmd_pclkfreq(uint32_t ftarget, int32_t rounding) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Waits for a specified number of microseconds. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_wait(uint32_t usec) { eve_begin_cmd(CMD_WAIT); @@ -634,11 +686,13 @@ void EVE_cmd_wait(uint32_t usec) /* BT815 / BT816 */ #if EVE_GEN > 2 -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this command clears the graphics systems flash cache and to do so */ -/* it needs to empty the display lists first */ +/** + * @brief Clears the graphics engine’s internal flash cache. + * @note - This function includes clearing out the display list. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_clearcache(void) { EVE_cmd_dl(CMD_DLSTART); @@ -653,11 +707,12 @@ void EVE_cmd_clearcache(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHATTACH); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Re-connect to the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashattach(void) { eve_begin_cmd(CMD_FLASHATTACH); @@ -665,11 +720,12 @@ void EVE_cmd_flashattach(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHDETACH); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Dis-connect from the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashdetach(void) { eve_begin_cmd(CMD_FLASHDETACH); @@ -677,11 +733,12 @@ void EVE_cmd_flashdetach(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHERASE); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Erases the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flasherase(void) { eve_begin_cmd(CMD_FLASHERASE); @@ -689,9 +746,14 @@ void EVE_cmd_flasherase(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Drive the attached SPI flash storage in full-speed mode, if possible. + * @return - Zero on success, error code on failure + * @note - When using this command, the flash BLOB is required. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_flashfast(void) { uint16_t cmdoffset; @@ -700,17 +762,19 @@ uint32_t EVE_cmd_flashfast(void) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHSPIDESEL); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief De-asserts the SPI CS signal of the attached SPI flash storage. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspidesel(void) { eve_begin_cmd(CMD_FLASHSPIDESEL); @@ -718,13 +782,15 @@ void EVE_cmd_flashspidesel(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in the external flash on a BT81x board to dest in RAM_G */ -/* note: src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the src pointer is relative to the flash so the first address is 0x00000000 not 0x800000 */ +/** + * @brief Copies "num" bytes from "src" in attached SPI flash storage to "dest" in RAM_G. + * @note - src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4 + * @note - EVE will not do anything if the alignment requirements are not met + * @note - The src pointer is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHREAD); @@ -735,9 +801,15 @@ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Set the source address for flash data loaded by the CMD_LOADIMAGE, CMD_PLAYVIDEO, CMD_VIDEOSTARTF and CMD_INFLATE2 commands with the OPT_FLASH option. + * @note - Address must be 64-byte aligned. + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The pointer is relative to the flash, so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashsource(uint32_t ptr) { eve_begin_cmd(CMD_FLASHSOURCE); @@ -746,11 +818,13 @@ void EVE_cmd_flashsource(uint32_t ptr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from the BT81x SPI interface dest in RAM_G */ -/* note: raw direct access, not really useful for anything */ +/** + * @brief Receives bytes from the flash SPI interface and writes them to main memory. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspirx(uint32_t dest, uint32_t num) { eve_begin_cmd(CMD_FLASHSPIRX); @@ -760,11 +834,13 @@ void EVE_cmd_flashspirx(uint32_t dest, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from *p_data to the BT81x SPI interface */ -/* note: raw direct access, not really useful for anything */ +/** + * @brief Transmits bytes over the flash SPI interface. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *p_data) { eve_begin_cmd(CMD_FLASHSPITX); @@ -773,13 +849,15 @@ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *p_data) block_transfer(p_data, num); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in RAM_G to to the external flash on a BT81x board at address dest */ -/* note: dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ +/** + * @brief Write "num" bytes from src in RAM_G to the attached SPI flash storage at address dest. + * @note - dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The address ptr is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHUPDATE); @@ -790,14 +868,15 @@ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from *p_data to the external flash on a BT81x board at address ptr */ -/* note: ptr must be 256 byte aligned, num must be a multiple of 256 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ -/* note: on AVR controllers this expects the data to be located in the controllers flash memory */ +/** + * @brief Write "num" bytes to the attached SPI flash storage at address dest. + * @note - dest must be 256-byte aligned, num must be a multiple of 256 + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The address ptr is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *p_data) { eve_begin_cmd(CMD_FLASHWRITE); @@ -810,9 +889,13 @@ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *p_data) } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Decompress data into RAM_G. + * @note - The data must be correct and complete. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_inflate2(uint32_t ptr, uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_INFLATE2); @@ -831,10 +914,12 @@ void EVE_cmd_inflate2(uint32_t ptr, uint32_t options, const uint8_t *p_data, uin #endif /* EVE_GEN > 2 */ -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* get the properties of an image after a CMD_LOADIMAGE operation and write the values to the variables that are supplied by pointers*/ +/** + * @brief Returns the source address and size of the bitmap loaded by the previous CMD_LOADIMAGE. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_getprops(uint32_t *p_pointer, uint32_t *p_width, uint32_t *p_height) { uint16_t cmdoffset; @@ -845,25 +930,28 @@ void EVE_cmd_getprops(uint32_t *p_pointer, uint32_t *p_width, uint32_t *p_height spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_pointer != NULL) { - *p_pointer = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU)); + *p_pointer = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL)); } if (p_width != NULL) { - *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_height != NULL) { - *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Returns the next address after a CMD_INFLATE and other commands. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_getptr(void) { uint16_t cmdoffset; @@ -872,15 +960,19 @@ uint32_t EVE_cmd_getptr(void) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Decompress data into RAM_G. + * @note - The data must be correct and complete. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_INFLATE); @@ -892,18 +984,29 @@ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *p_data, uint32_t len) } } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Trigger interrupt INT_CMDFLAG. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_interrupt(uint32_t msec) { eve_begin_cmd(CMD_INTERRUPT); spi_transmit_32(msec); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Loads and decodes a JPEG/PNG image into RAM_G. + * @note - Decoding PNG images takes significantly more time than decoding JPEG images. + * @note - In doubt use the EVE Asset Builder to check if PNG/JPEG files are compatible. + * @note - If the image is in PNG format, the top 42kiB of RAM_G will be overwritten. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_LOADIMAGE); @@ -925,19 +1028,27 @@ void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *p_data, ui } } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Set up a streaming media FIFO in RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_mediafifo(uint32_t ptr, uint32_t size) { eve_begin_cmd(CMD_MEDIAFIFO); spi_transmit_32(ptr); spi_transmit_32(size); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Copy a block of RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_MEMCPY); @@ -948,9 +1059,12 @@ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Compute a CRC-32 for RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num) { uint16_t cmdoffset; @@ -961,14 +1075,18 @@ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Fill RAM_G with a byte value. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num) { eve_begin_cmd(CMD_MEMSET); @@ -976,12 +1094,16 @@ void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num) spi_transmit_32((uint32_t)value); spi_transmit_32(num); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is a pointless command, just use one of the EVE_memWrite* helper functions to directly write to EVEs memory */ +/** + * @brief Write bytes into RAM_G using the coprocessor. + * @note - Commented out, just use one of the EVE_memWrite* helper functions to directly write to EVEs memory. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ /* void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data) { @@ -1001,9 +1123,36 @@ void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data) } */ -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Read a register value using the coprocessor. + * @note - Commented out, just read the register directly. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +/* +uint32_t EVE_cmd_regread(uint32_t ptr) +{ + uint16_t cmdoffset; + + eve_begin_cmd(CMD_REGREAD); + spi_transmit_32(ptr); + spi_transmit_32(0UL); + EVE_cs_clear(); + EVE_execute_cmd(); + cmdoffset = EVE_memRead16(REG_CMD_WRITE); // read the coprocessor write pointer + cmdoffset -= 4U; + cmdoffset &= 0x0fffU; + return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); +} +*/ + +/** + * @brief Write zero to RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num) { eve_begin_cmd(CMD_MEMZERO); @@ -1013,8 +1162,13 @@ void EVE_cmd_memzero(uint32_t ptr, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, it includes executing the command, does not support cmd-burst.*/ -/* it does not wait for completion in order to allow the video to be paused or terminated by REG_PLAY_CONTROL */ +/** + * @brief Play back motion-JPEG encoded AVI video. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command. + * @note - Does not support burst-mode. + * @note - Does not wait for completion in order to allow the video to be paused or terminated by REG_PLAY_CONTROL + */ void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_PLAYVIDEO); @@ -1035,30 +1189,12 @@ void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len) } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* regvalue = EVE_cmd_regread(ptr); */ -/* this seems to be completely pointless, there is no real use for it outside a display-list since the register could be read directly */ -/* and for what purpose would this be implemented to be used in a display list?? */ -uint32_t EVE_cmd_regread(uint32_t ptr) -{ - uint16_t cmdoffset; - - eve_begin_cmd(CMD_REGREAD); - spi_transmit_32(ptr); - spi_transmit_32(0UL); - EVE_cs_clear(); - EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ - cmdoffset -= 4U; - cmdoffset &= 0x0fffU; - return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); -} - -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Rotate the screen and set up transform matrix accordingly. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_setrotate(uint32_t rotation) { eve_begin_cmd(CMD_SETROTATE); @@ -1067,9 +1203,12 @@ void EVE_cmd_setrotate(uint32_t rotation) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Take a snapshot of the current screen. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_snapshot(uint32_t ptr) { eve_begin_cmd(CMD_SNAPSHOT); @@ -1078,10 +1217,13 @@ void EVE_cmd_snapshot(uint32_t ptr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt) +/** + * @brief Take a snapshot of part of the current screen with format option. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt) { eve_begin_cmd(CMD_SNAPSHOT2); spi_transmit_32(fmt); @@ -1092,19 +1234,22 @@ void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); EVE_cs_clear(); EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t tag) +/** + * @brief Track touches for a graphics object. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_track(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t tag) { eve_begin_cmd(CMD_TRACK); @@ -1113,13 +1258,13 @@ void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t t spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); - spi_transmit((uint8_t) ((uint16_t) tag)); - spi_transmit((uint8_t) (((uint16_t) tag) >> 8U)); + spi_transmit((uint8_t) (tag)); + spi_transmit((uint8_t) (tag >> 8U)); spi_transmit(0U); spi_transmit(0U); @@ -1127,9 +1272,12 @@ void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t t EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Load the next frame of a video. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr) { eve_begin_cmd(CMD_VIDEOFRAME); @@ -1147,7 +1295,6 @@ void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr) /** * @brief EVE flash initialization for BT81x, switches the FLASH attached to a BT81x to full-speed mode - * * @return Returns E_OK in case of success, EVE_FAIL_FLASH_STATUS_INIT if the status remains init, * EVE_FAIL_FLASH_STATUS_DETACHED if no flash chip was found, a number of different values for failures with * cmd_flashfast and E_NOT_OK if a not supported status is returned in REG_FLASH_STATUS. @@ -1229,7 +1376,7 @@ uint8_t EVE_init_flash(void) ret_val = E_OK; } - return ret_val; + return (ret_val); } #endif /* EVE_GEN > 2 */ @@ -1253,7 +1400,8 @@ void use_gt911(void) #else /* FT811 / FT813 binary-blob from FTDIs AN_336 to patch the touch-engine for Goodix GT911 / GT9271 touch controllers */ -const uint8_t eve_gt911_data[1184U] PROGMEM = { +const uint8_t eve_gt911_data[1184U] PROGMEM = +{ 26, 255, 255, 255, 32, 32, 48, 0, 4, 0, 0, 0, 2, 0, 0, 0, 34, 255, 255, 255, 0, 176, 48, 0, 120, 218, 237, 84, 221, 111, 84, 69, 20, 63, 51, 179, 93, 160, 148, 101, 111, 76, 5, 44, 141, 123, 111, 161, 11, 219, 154, 16, 9, 16, 17, 229, 156, 75, 26, 11, 13, 21, 227, 3, 16, 252, 184, 179, 45, @@ -1305,7 +1453,8 @@ const uint8_t eve_gt911_data[1184U] PROGMEM = { 188, 11, 55, 240, 31, 243, 122, 152, 226, 183, 207, 154, 73, 188, 39, 219, 43, 105, 222, 87, 41, 143, 141, 140, 175, 73, 112, 184, 252, 61, 184, 16, 90, 250, 35, 168, 82, 119, 176, 57, 116, 94, 200, 150, 22, 190, 179, 44, 104, 12, 235, 84, 149, 102, 252, 89, 154, 193, 99, 228, 106, 242, 125, 248, 64, 194, 255, 223, 127, - 242, 83, 11, 255, 2, 70, 214, 226, 128, 0, 0}; + 242, 83, 11, 255, 2, 70, 214, 226, 128, 0, 0 +}; EVE_cs_set(); spi_transmit((uint8_t) 0xB0U); /* high-byte of REG_CMDB_WRITE + MEM_WRITE */ @@ -1333,7 +1482,6 @@ const uint8_t eve_gt911_data[1184U] PROGMEM = { /** * @brief Waits for either reading REG_ID with a value of 0x7c, indicating that * an EVE chip is present and ready to communicate, or untill a timeout of 400ms has passed. - * * @return Returns E_OK in case of success, EVE_FAIL_REGID_TIMEOUT if the * value of 0x7c could not be read. */ @@ -1354,14 +1502,13 @@ static uint8_t wait_regid(void) } } - return ret; + return (ret); } /** * @brief Waits for either REG_CPURESET to indicate that the audio, touch and * coprocessor units finished their respective reset cycles, * or untill a timeout of 50ms has passed. - * * @return Returns E_OK in case of success, EVE_FAIL_RESET_TIMEOUT if either the * audio, touch or coprocessor unit indicate a fault by not returning from reset. */ @@ -1382,11 +1529,11 @@ static uint8_t wait_reset(void) } } - return ret; + return (ret); } /** - * @brief Writes all parameters defined for the display selected in EVE_config.h + * @brief Writes all parameters defined for the display selected in EVE_config.h. * to the corresponding registers. * It is used by EVE_init() and can be used to refresh the register values if needed. */ @@ -1438,15 +1585,17 @@ static void enable_pixel_clock(void) #endif } -/* EVE chip initialization, has to be executed with the SPI setup to 11 MHz or less as required by FT8xx / BT8xx! */ -/* Takes no parameters but has a few optional parameters that are used by setting up defines. */ -/* EVE_TOUCH_RZTHRESH - configure the sensitivity of resistive touch, defaults to 1200. */ -/* EVE_ROTATE - set the screen rotation: bit0 = invert, bit2 = portrait, bit3 = mirrored */ -/* Note: if you use this you need a set of calibration values for the selected rotation since this rotates before - * calibration! */ -/* EVE_BACKLIGHT_FREQ - configure the backlight frequency, default is not writing it which results in 250Hz */ -/* EVE_BACKLIGHT_PWM - configure the backlight pwm, defaults to 0x20 / 25% */ -/* Returns E_OK in case of success. */ +/** + * @brief Initializes EVE according to the selected configuration from EVE_config.h. + * @return E_OK in case of success + * @note - Has to be executed with the SPI setup to 11 MHz or less as required by FT8xx / BT8xx! + * @note - Additional settings can be made through extra macros. + * @note - EVE_TOUCH_RZTHRESH - configure the sensitivity of resistive touch, defaults to 1200. + * @note - EVE_ROTATE - set the screen rotation: bit0 = invert, bit1 = portrait, bit2 = mirrored. + * @note - needs a set of calibration values for the selected rotation since this rotates before calibration! + * @note - EVE_BACKLIGHT_FREQ - configure the backlight frequency, default is not writing it which results in 250Hz. + * @note - EVE_BACKLIGHT_PWM - configure the backlight pwm, defaults to 0x20 / 25%. + */ uint8_t EVE_init(void) { uint8_t ret; @@ -1537,16 +1686,19 @@ uint8_t EVE_init(void) } } - return ret; + return (ret); } /* ################################################################## functions for display lists ##################################################################### */ -/* Begin a sequence of commands or prepare a DMA transfer if applicable. */ -/* Needs to be used with EVE_end_cmd_burst(). */ -/* Be careful to not use any functions in the sequence that do not address the command-fifo as for example any of EVE_mem...() functions. */ +/** + * @brief Begin a sequence of commands or prepare a DMA transfer if applicable. + * @note - Needs to be used with EVE_end_cmd_burst(). + * @note - Do not use any functions in the sequence that do not address the command-fifo as for example any of EVE_mem...() functions. + * @note - Do not use any of the functions that do not support burst-mode. + */ void EVE_start_cmd_burst(void) { #if defined (EVE_DMA) @@ -1560,7 +1712,7 @@ void EVE_start_cmd_burst(void) #if defined (EVE_DMA) EVE_dma_buffer[0U] = 0x7825B000UL; /* REG_CMDB_WRITE + MEM_WRITE low mid hi 00 */ -// ((uint8_t)(ft_address >> 16U) | MEM_WRITE) | (ft_address & 0x0000ff00UL) | ((uint8_t)(ft_address) << 16U); +// ((uint8_t) (ft_address >> 16U) | MEM_WRITE) | (ft_address & 0x0000ff00UL) | ((uint8_t) (ft_address) << 16U); // EVE_dma_buffer[0U] = EVE_dma_buffer[0U] << 8U; EVE_dma_buffer_index = 1U; #else @@ -1571,8 +1723,10 @@ void EVE_start_cmd_burst(void) #endif } -/* End a sequence of commands or trigger a prepared DMA transfer if applicable. */ -/* Needs to be used with EVE_start_cmd_burst(). */ +/** + * @brief End a sequence of commands or trigger a prepared DMA transfer if applicable. + * @note - Needs to be used with EVE_start_cmd_burst(). + */ void EVE_end_cmd_burst(void) { cmd_burst = 0U; @@ -1584,7 +1738,7 @@ void EVE_end_cmd_burst(void) #endif } -/* write a string to co-processor memory in context of a command: */ +/* write a string to coprocessor memory in context of a command: */ /* no chip-select, just plain SPI-transfers */ static void private_string_write(const char *p_text) { @@ -1622,7 +1776,9 @@ static void private_string_write(const char *p_text) for (uint8_t index = 0U; index < 4U; index++) { - uint8_t data = p_bytes[textindex + index]; + uint8_t data; + + data = p_bytes[textindex + index]; if (0U == data) { @@ -1643,8 +1799,10 @@ static void private_string_write(const char *p_text) /* BT817 / BT818 */ #if EVE_GEN > 3 -void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, - uint32_t frame) +/** + * @brief Render one frame in RAM_G of an animation. + */ +void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { if (0U == cmd_burst) { @@ -1666,6 +1824,9 @@ void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, } } +/** + * @brief Render one frame in RAM_G of an animation, only works in burst-mode. + */ void EVE_cmd_animframeram_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { @@ -1675,6 +1836,9 @@ void EVE_cmd_animframeram_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, spi_transmit_burst(frame); } +/** + * @brief Start an animation in RAM_G. + */ void EVE_cmd_animstartram(int32_t chnl, uint32_t aoptr, uint32_t loop) { if (0U == cmd_burst) @@ -1694,6 +1858,9 @@ void EVE_cmd_animstartram(int32_t chnl, uint32_t aoptr, uint32_t loop) } } +/** + * @brief Start an animation in RAM_G, only works in burst-mode. + */ void EVE_cmd_animstartram_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) { spi_transmit_burst(CMD_ANIMSTARTRAM); @@ -1702,6 +1869,9 @@ void EVE_cmd_animstartram_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) spi_transmit_burst(loop); } +/** + * @brief Sets the API level used by the coprocessor. + */ void EVE_cmd_apilevel(uint32_t level) { if (0U == cmd_burst) @@ -1717,14 +1887,20 @@ void EVE_cmd_apilevel(uint32_t level) } } +/** + * @brief Sets the API level used by the coprocessor, only works in burst-mode. + */ void EVE_cmd_apilevel_burst(uint32_t level) { spi_transmit_burst(CMD_APILEVEL); spi_transmit_burst(level); } -void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, - uint16_t height) +/** + * @brief Execute the touch screen calibration routine for a sub-window. + * @note - Does not support burst-mode. + */ +void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, uint16_t height) { if (0U == cmd_burst) { @@ -1741,6 +1917,9 @@ void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, } } +/** + * @brief Calls a command list in RAM_G. + */ void EVE_cmd_calllist(uint32_t adr) { if (0U == cmd_burst) @@ -1756,12 +1935,19 @@ void EVE_cmd_calllist(uint32_t adr) } } +/** + * @brief Calls a command list in RAM_G, only works in burst-mode. + */ void EVE_cmd_calllist_burst(uint32_t adr) { spi_transmit_burst(CMD_CALLLIST); spi_transmit_burst(adr); } +/** + * @brief Setup the Horizontal Scan out Filter for non-square pixel LCD support. + * @note - Does not support burst-mode. + */ void EVE_cmd_hsf(uint32_t hsf) { if (0U == cmd_burst) @@ -1770,19 +1956,11 @@ void EVE_cmd_hsf(uint32_t hsf) spi_transmit_32(hsf); EVE_cs_clear(); } - else - { - spi_transmit_burst(CMD_HSF); - spi_transmit_burst(hsf); - } -} - -void EVE_cmd_hsf_burst(uint32_t hsf) -{ - spi_transmit_burst(CMD_HSF); - spi_transmit_burst(hsf); } +/** + * @brief Play/run animations until complete. + */ void EVE_cmd_runanim(uint32_t waitmask, uint32_t play) { if (0U == cmd_burst) @@ -1800,6 +1978,9 @@ void EVE_cmd_runanim(uint32_t waitmask, uint32_t play) } } +/** + * @brief Play/run animations until complete, only works in burst-mode. + */ void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play) { spi_transmit_burst(CMD_RUNANIM); @@ -1812,6 +1993,9 @@ void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play) /* BT815 / BT816 */ #if EVE_GEN > 2 +/** + * @brief Draw one or more active animations. + */ void EVE_cmd_animdraw(int32_t chnl) { if (0U == cmd_burst) @@ -1827,12 +2011,18 @@ void EVE_cmd_animdraw(int32_t chnl) } } +/** + * @brief Draw one or more active animations, only works in burst-mode. + */ void EVE_cmd_animdraw_burst(int32_t chnl) { spi_transmit_burst(CMD_ANIMDRAW); spi_transmit_burst((uint32_t) chnl); } +/** + * @brief Draw the specified frame of an animation. + */ void EVE_cmd_animframe(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { if (0U == cmd_burst) @@ -1855,6 +2045,9 @@ void EVE_cmd_animframe(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) } } +/** + * @brief Draw the specified frame of an animation, only works in burst-mode. + */ void EVE_cmd_animframe_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { @@ -1864,6 +2057,9 @@ void EVE_cmd_animframe_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, spi_transmit_burst(frame); } +/** + * @brief Start an animation. + */ void EVE_cmd_animstart(int32_t chnl, uint32_t aoptr, uint32_t loop) { if (0U == cmd_burst) @@ -1883,6 +2079,9 @@ void EVE_cmd_animstart(int32_t chnl, uint32_t aoptr, uint32_t loop) } } +/** + * @brief Start an animation, only works in burst-mode. + */ void EVE_cmd_animstart_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) { spi_transmit_burst(CMD_ANIMSTART); @@ -1891,6 +2090,9 @@ void EVE_cmd_animstart_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) spi_transmit_burst(loop); } +/** + * @brief Stops one or more active animations. + */ void EVE_cmd_animstop(int32_t chnl) { if (0U == cmd_burst) @@ -1906,12 +2108,18 @@ void EVE_cmd_animstop(int32_t chnl) } } +/** + * @brief Stops one or more active animations, only works in burst-mode. + */ void EVE_cmd_animstop_burst(int32_t chnl) { spi_transmit_burst(CMD_ANIMSTOP); spi_transmit_burst((uint32_t) chnl); } +/** + * @brief Sets the coordinates of an animation. + */ void EVE_cmd_animxy(int32_t chnl, int16_t xc0, int16_t yc0) { if (0U == cmd_burst) @@ -1932,6 +2140,9 @@ void EVE_cmd_animxy(int32_t chnl, int16_t xc0, int16_t yc0) } } +/** + * @brief Sets the coordinates of an animation, only works in burst-mode. + */ void EVE_cmd_animxy_burst(int32_t chnl, int16_t xc0, int16_t yc0) { spi_transmit_burst(CMD_ANIMXY); @@ -1939,6 +2150,9 @@ void EVE_cmd_animxy_burst(int32_t chnl, int16_t xc0, int16_t yc0) spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); } +/** + * @brief Append flash data to the display list. + */ void EVE_cmd_appendf(uint32_t ptr, uint32_t num) { if (0U == cmd_burst) @@ -1956,6 +2170,9 @@ void EVE_cmd_appendf(uint32_t ptr, uint32_t num) } } +/** + * @brief Append flash data to the display list, only works in burst-mode. + */ void EVE_cmd_appendf_burst(uint32_t ptr, uint32_t num) { spi_transmit_burst(CMD_APPENDF); @@ -1963,6 +2180,9 @@ void EVE_cmd_appendf_burst(uint32_t ptr, uint32_t num) spi_transmit_burst(num); } +/** + * @brief Computes a bitmap transform and appends commands BITMAP_TRANSFORM_A...BITMAP_TRANSFORM_F to the display list. + */ uint16_t EVE_cmd_bitmap_transform(int32_t xc0, int32_t yc0, int32_t xc1, int32_t yc1, int32_t xc2, int32_t yc2, int32_t tx0, int32_t ty0, int32_t tx1, @@ -2012,11 +2232,13 @@ uint16_t EVE_cmd_bitmap_transform(int32_t xc0, int32_t yc0, int32_t xc1, spi_transmit_burst((uint32_t) ty2); spi_transmit_burst(0UL); } - return ret_val; + return (ret_val); } -/* note: as this is meant for use in burst-mode display-list generation */ -/* the result parameter is ignored */ +/** + * @brief Computes a bitmap transform and appends commands BITMAP_TRANSFORM_A...BITMAP_TRANSFORM_F to the display list. + * @note - Only works in burst-mode, the result parameter is ignored. + */ void EVE_cmd_bitmap_transform_burst(int32_t xc0, int32_t yc0, int32_t xc1, int32_t yc1, int32_t xc2, int32_t yc2, int32_t tx0, int32_t ty0, int32_t tx1, @@ -2038,6 +2260,9 @@ void EVE_cmd_bitmap_transform_burst(int32_t xc0, int32_t yc0, int32_t xc1, spi_transmit_burst(0UL); } +/** + * @brief Sets the pixel fill width for CMD_TEXT,CMD_BUTTON,CMD_BUTTON with the OPT_FILL option. + */ void EVE_cmd_fillwidth(uint32_t pixel) { if (0U == cmd_burst) @@ -2053,14 +2278,20 @@ void EVE_cmd_fillwidth(uint32_t pixel) } } +/** + * @brief Sets the pixel fill width for CMD_TEXT,CMD_BUTTON,CMD_BUTTON with the OPT_FILL option. + * @note - Only works in burst-mode. + */ void EVE_cmd_fillwidth_burst(uint32_t pixel) { spi_transmit_burst(CMD_FILLWIDTH); spi_transmit_burst(pixel); } -void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, - int16_t yc1, uint32_t argb1) +/** + * @brief Draw a smooth color gradient with transparency. + */ +void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1) { if (0U == cmd_burst) { @@ -2087,8 +2318,10 @@ void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, } } -void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, - int16_t xc1, int16_t yc1, uint32_t argb1) +/** + * @brief Draw a smooth color gradient with transparency, only works in burst-mode. + */ +void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1) { spi_transmit_burst(CMD_GRADIENTA); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); @@ -2097,14 +2330,17 @@ void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, spi_transmit_burst(argb1); } -void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale) +/** + * @brief Apply a rotation and scale around a specified coordinate. + */ +void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale) { if (0U == cmd_burst) { eve_begin_cmd(CMD_ROTATEAROUND); spi_transmit_32((uint32_t) xc0); spi_transmit_32((uint32_t) yc0); - spi_transmit_32((uint32_t) angle); + spi_transmit_32(angle & 0xFFFFUL); spi_transmit_32((uint32_t) scale); EVE_cs_clear(); } @@ -2113,24 +2349,31 @@ void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale spi_transmit_burst(CMD_ROTATEAROUND); spi_transmit_burst((uint32_t) xc0); spi_transmit_burst((uint32_t) yc0); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); spi_transmit_burst((uint32_t) scale); } } -void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, int32_t angle, +/** + * @brief Apply a rotation and scale around a specified coordinate, only works in burst-mode. + */ +void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale) { spi_transmit_burst(CMD_ROTATEAROUND); spi_transmit_burst((uint32_t) xc0); spi_transmit_burst((uint32_t) yc0); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); spi_transmit_burst((uint32_t) scale); } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text, +/** + * @brief Draw a button with a label, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_button_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { if (0U == cmd_burst) @@ -2140,12 +2383,12 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2166,8 +2409,8 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + ((uint32_t) options << 16U)); + spi_transmit_burst(((uint32_t) wid) + ((uint32_t) hgt << 16U)); + spi_transmit_burst(((uint32_t) font) + ((uint32_t) options << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2183,15 +2426,19 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text, +/** + * @brief Draw a button with a label, varargs version, only works in burst-mode. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + ((uint32_t) options << 16U)); + spi_transmit_burst(((uint32_t) wid) + ((uint32_t) hgt << 16U)); + spi_transmit_burst(((uint32_t) font) + ((uint32_t) options << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2206,8 +2453,12 @@ void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_text_var(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { @@ -2218,8 +2469,8 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2240,7 +2491,7 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2256,14 +2507,18 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2278,8 +2533,12 @@ void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { @@ -2290,10 +2549,10 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (state)); @@ -2316,8 +2575,8 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font) << 16U))); - spi_transmit_burst((uint32_t) options + (((uint32_t) state) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2333,15 +2592,19 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, varargs version, only works in burst-mode. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font) << 16U))); - spi_transmit_burst((uint32_t) options + (((uint32_t) state) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2358,18 +2621,14 @@ void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t fon #endif /* EVE_GEN > 2 */ -/* generic function for: */ -/* all co-processor commands that have no arguments */ -/* all display-list commands */ -/* - examples: - EVE_cmd_dl(CMD_DLSTART); - EVE_cmd_dl(CMD_SWAP); - EVE_cmd_dl(CMD_SCREENSAVER); - EVE_cmd_dl(LINE_WIDTH(1*16)); - EVE_cmd_dl(VERTEX2F(0,0)); - EVE_cmd_dl(DL_BEGIN | EVE_RECTS); -*/ +/** + * @brief Generic function for display-list and coprocessor commands with no arguments, only works in burst-mode. + * @note - EVE_cmd_dl(CMD_DLSTART); + * @note - EVE_cmd_dl(CMD_SWAP); + * @note - EVE_cmd_dl(CMD_SCREENSAVER); + * @note - EVE_cmd_dl(VERTEX2F(0,0)); + * @note - EVE_cmd_dl(DL_BEGIN | EVE_RECTS); + */ void EVE_cmd_dl(uint32_t command) { if (0U == cmd_burst) @@ -2383,11 +2642,17 @@ void EVE_cmd_dl(uint32_t command) } } +/** + * @brief Generic function for display-list and coprocessor commands with no arguments, only works in burst-mode. + */ void EVE_cmd_dl_burst(uint32_t command) { spi_transmit_burst(command); } +/** + * @brief Appends commands from RAM_G to the display list. + */ void EVE_cmd_append(uint32_t ptr, uint32_t num) { if (0U == cmd_burst) @@ -2405,6 +2670,9 @@ void EVE_cmd_append(uint32_t ptr, uint32_t num) } } +/** + * @brief Appends commands from RAM_G to the display list, only works in burst-mode. + */ void EVE_cmd_append_burst(uint32_t ptr, uint32_t num) { spi_transmit_burst(CMD_APPEND); @@ -2412,6 +2680,9 @@ void EVE_cmd_append_burst(uint32_t ptr, uint32_t num) spi_transmit_burst(num); } +/** + * @brief Set the background color. + */ void EVE_cmd_bgcolor(uint32_t color) { if (0U == cmd_burst) @@ -2430,14 +2701,20 @@ void EVE_cmd_bgcolor(uint32_t color) } } +/** + * @brief Set the background color, only works in burst-mode. + */ void EVE_cmd_bgcolor_burst(uint32_t color) { spi_transmit_burst(CMD_BGCOLOR); spi_transmit_burst(color); } -void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a button with a label. + */ +void EVE_cmd_button(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) { @@ -2446,12 +2723,12 @@ void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2461,22 +2738,29 @@ void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a button with a label, only works in burst-mode. + */ +void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } +/** + * @brief Execute the touch screen calibration routine. + * @note - does not support burst-mode + */ void EVE_cmd_calibrate(void) { if (0U == cmd_burst) @@ -2487,65 +2771,74 @@ void EVE_cmd_calibrate(void) } } -void EVE_cmd_clock(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, - uint16_t mins, uint16_t secs, uint16_t msecs) +/** + * @brief Draw an analog clock. + */ +void EVE_cmd_clock(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, + uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs) { if (0U == cmd_burst) { eve_begin_cmd(CMD_CLOCK); - spi_transmit((uint8_t)((uint16_t) xc0)); - spi_transmit((uint8_t)(((uint16_t) xc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) yc0)); - spi_transmit((uint8_t)(((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) rad)); - spi_transmit((uint8_t)(((uint16_t) rad) >> 8U)); - spi_transmit((uint8_t)(options)); - spi_transmit((uint8_t)(options >> 8U)); - spi_transmit((uint8_t)(hours)); - spi_transmit((uint8_t)(hours >> 8U)); - spi_transmit((uint8_t)(mins)); - spi_transmit((uint8_t)(mins >> 8U)); - spi_transmit((uint8_t)(secs)); - spi_transmit((uint8_t)(secs >> 8U)); - spi_transmit((uint8_t)(msecs)); - spi_transmit((uint8_t)(msecs >> 8U)); + spi_transmit((uint8_t) ((uint16_t) xc0)); + spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); + spi_transmit((uint8_t) ((uint16_t) yc0)); + spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); + spi_transmit((uint8_t) (options)); + spi_transmit((uint8_t) (options >> 8U)); + spi_transmit((uint8_t) (hours)); + spi_transmit((uint8_t) (hours >> 8U)); + spi_transmit((uint8_t) (mins)); + spi_transmit((uint8_t) (mins >> 8U)); + spi_transmit((uint8_t) (secs)); + spi_transmit((uint8_t) (secs >> 8U)); + spi_transmit((uint8_t) (msecs)); + spi_transmit((uint8_t) (msecs >> 8U)); EVE_cs_clear(); } else { spi_transmit_burst(CMD_CLOCK); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); - spi_transmit_burst((uint32_t) hours + (((uint32_t) mins) << 16U)); - spi_transmit_burst((uint32_t) secs + (((uint32_t) msecs) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) hours) + (((uint32_t) mins) << 16U)); + spi_transmit_burst(((uint32_t) secs) + (((uint32_t) msecs) << 16U)); } } -void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, +/** + * @brief Draw an analog clock, only works in burst-mode. + */ +void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs) { spi_transmit_burst(CMD_CLOCK); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); - spi_transmit_burst((uint32_t) hours + (((uint32_t) mins) << 16U)); - spi_transmit_burst((uint32_t) secs + (((uint32_t) msecs) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) hours) + (((uint32_t) mins) << 16U)); + spi_transmit_burst(((uint32_t) secs) + (((uint32_t) msecs) << 16U)); } -void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val) +/** + * @brief Draw a rotary dial control. + */ +void EVE_cmd_dial(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val) { if (0U == cmd_burst) { eve_begin_cmd(CMD_DIAL); - spi_transmit((uint8_t)((uint16_t) xc0)); - spi_transmit((uint8_t)(((uint16_t) xc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) yc0)); - spi_transmit((uint8_t)(((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) rad)); - spi_transmit((uint8_t)(((uint16_t) rad) >> 8U)); - spi_transmit((uint8_t)(options)); - spi_transmit((uint8_t)(options >> 8U)); - spi_transmit((uint8_t)(val)); - spi_transmit((uint8_t)(val >> 8U)); + spi_transmit((uint8_t) ((uint16_t) xc0)); + spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); + spi_transmit((uint8_t) ((uint16_t) yc0)); + spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); + spi_transmit((uint8_t) (options)); + spi_transmit((uint8_t) (options >> 8U)); + spi_transmit((uint8_t) (val)); + spi_transmit((uint8_t) (val >> 8U)); spi_transmit(0U); spi_transmit(0U); EVE_cs_clear(); @@ -2553,29 +2846,35 @@ void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint1 else { spi_transmit_burst(CMD_DIAL); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(val); } } -void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a rotary dial control, only works in burst-mode. + */ +void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val) { spi_transmit_burst(CMD_DIAL); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(val); } +/** + * @brief Set the foreground color. + */ void EVE_cmd_fgcolor(uint32_t color) { if (0U == cmd_burst) { eve_begin_cmd(CMD_FGCOLOR); - spi_transmit((uint8_t)(color)); - spi_transmit((uint8_t)(color >> 8U)); - spi_transmit((uint8_t)(color >> 16U)); + spi_transmit((uint8_t) (color)); + spi_transmit((uint8_t) (color >> 8U)); + spi_transmit((uint8_t) (color >> 16U)); spi_transmit(0U); EVE_cs_clear(); } @@ -2586,13 +2885,19 @@ void EVE_cmd_fgcolor(uint32_t color) } } +/** + * @brief Set the foreground color, only works in burst-mode. + */ void EVE_cmd_fgcolor_burst(uint32_t color) { spi_transmit_burst(CMD_FGCOLOR); spi_transmit_burst(color); } -void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a gauge. + */ +void EVE_cmd_gauge(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -2602,8 +2907,8 @@ void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) rad)); - spi_transmit((uint8_t) (((uint16_t) rad) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (major)); @@ -2620,27 +2925,30 @@ void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, { spi_transmit_burst(CMD_GAUGE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) rad)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(((uint32_t) major) + (((uint32_t) minor) << 16U)); spi_transmit_burst(((uint32_t) val) + (((uint32_t) range) << 16U)); } } -void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a gauge, only works in burst-mode. + */ +void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_GAUGE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) rad)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(((uint32_t) major) + (((uint32_t) minor) << 16U)); spi_transmit_burst(((uint32_t) val) + (((uint32_t) range) << 16U)); } -/* EVE_cmd_getmatrix() is meant to be called with display-list building. */ -/* but it waits for completion as it returns values by writing */ -/* to the command-fifo, it can not be used with cmd-burst */ -/* gets the properties of the bitmap transform matrix and write the values */ -/* to the variables that are supplied by pointers */ +/** + * @brief Retrieves the current matrix within the context of the coprocessor engine. + * @note - waits for completion and reads values from RAM_CMD after completion + * @note - can not be used with cmd-burst + */ void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, int32_t *p_d, int32_t *p_e, int32_t *p_f) { @@ -2662,45 +2970,48 @@ void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, if (p_f != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL); *p_f = (int32_t) EVE_memRead32(address); } if (p_e != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL); *p_e = (int32_t) EVE_memRead32(address); } if (p_d != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL); *p_d = (int32_t) EVE_memRead32(address); } if (p_c != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 16U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 16UL) & 0xfffUL); *p_c = (int32_t) EVE_memRead32(address); } if (p_b != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 20U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 20UL) & 0xfffUL); *p_b = (int32_t) EVE_memRead32(address); } if (p_a != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 24U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 24UL) & 0xfffUL); *p_a = (int32_t) EVE_memRead32(address); } } } +/** + * @brief Set up the highlight color used in 3D effects for CMD_BUTTON and CMD_KEYS. + */ void EVE_cmd_gradcolor(uint32_t color) { if (0U == cmd_burst) { eve_begin_cmd(CMD_GRADCOLOR); - spi_transmit((uint8_t)(color)); - spi_transmit((uint8_t)(color >> 8U)); - spi_transmit((uint8_t)(color >> 16U)); + spi_transmit((uint8_t) (color)); + spi_transmit((uint8_t) (color >> 8U)); + spi_transmit((uint8_t) (color >> 16U)); spi_transmit(0U); EVE_cs_clear(); } @@ -2711,12 +3022,18 @@ void EVE_cmd_gradcolor(uint32_t color) } } +/** + * @brief Set up the highlight color used in 3D effects for CMD_BUTTON and CMD_KEYS, only works in burst-mode. + */ void EVE_cmd_gradcolor_burst(uint32_t color) { spi_transmit_burst(CMD_GRADCOLOR); spi_transmit_burst(color); } +/** + * @brief Draw a smooth color gradient. + */ void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1) { @@ -2751,6 +3068,9 @@ void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, } } +/** + * @brief Draw a smooth color gradient, only works in burst-mode. + */ void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1) { @@ -2761,8 +3081,13 @@ void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1 spi_transmit_burst(rgb1); } -void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a row of key buttons with labels. + * @note - The tag value of each button is set to the ASCII value of its label. + * @note - Does not work with UTF-8. + */ +void EVE_cmd_keys(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) { @@ -2771,12 +3096,12 @@ void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2786,24 +3111,32 @@ void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_KEYS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a row of key buttons with labels, only works in burst-mode. + * @note - The tag value of each button is set to the ASCII value of its label. + * @note - Does not work with UTF-8. + */ +void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_KEYS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } -void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, - int32_t number) +/** + * @brief Draw a number. + */ +void EVE_cmd_number(int16_t xc0, int16_t yc0, uint16_t font, + uint16_t options, int32_t number) { if (0U == cmd_burst) { @@ -2812,8 +3145,8 @@ void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit_32((uint32_t) number); @@ -2823,21 +3156,27 @@ void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, { spi_transmit_burst(CMD_NUMBER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); spi_transmit_burst((uint32_t) number); } } -void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a number, only works in burst-mode. + */ +void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number) { spi_transmit_burst(CMD_NUMBER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); spi_transmit_burst((uint32_t) number); } -void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a progress bar. + */ +void EVE_cmd_progress(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -2847,10 +3186,10 @@ void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -2865,28 +3204,29 @@ void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_PROGRESS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) options) + ((uint32_t)val << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } } -void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a progress bar, only works in burst-mode. + */ +void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_PROGRESS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) options) + ((uint32_t)val << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } -/* Note: CMD_ROMFONT generates display list commands so it needs to be put in a display list. */ -/* A minimum display list to properly execute CMD_ROMFONT would be: */ -/* EVE_cmd_dl(CMD_DLSTART); */ -/* EVE_cmd_romfont(font, romslot); */ -/* ...other bitmap handle commands like more CMD_ROMFONT or CMD_SETFONT2 */ -/* EVE_cmd_dl(CMD_SWAP); */ +/** + * @brief Load a ROM font into bitmap handle. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_romfont(uint32_t font, uint32_t romslot) { if (0U == cmd_burst) @@ -2904,6 +3244,10 @@ void EVE_cmd_romfont(uint32_t font, uint32_t romslot) } } +/** + * @brief Load a ROM font into bitmap handle, only works in burst-mode. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot) { spi_transmit_burst(CMD_ROMFONT); @@ -2911,27 +3255,36 @@ void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot) spi_transmit_burst(romslot); } -void EVE_cmd_rotate(int32_t angle) +/** + * @brief Apply a rotation to the current matrix. + */ +void EVE_cmd_rotate(uint32_t angle) { if (0U == cmd_burst) { eve_begin_cmd(CMD_ROTATE); - spi_transmit_32((uint32_t) angle); + spi_transmit_32(angle & 0xFFFFUL); EVE_cs_clear(); } else { spi_transmit_burst(CMD_ROTATE); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); } } -void EVE_cmd_rotate_burst(int32_t angle) +/** + * @brief Apply a rotation to the current matrix, only works in burst-mode. + */ +void EVE_cmd_rotate_burst(uint32_t angle) { spi_transmit_burst(CMD_ROTATE); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); } +/** + * @brief Apply a scale to the current matrix. + */ void EVE_cmd_scale(int32_t scx, int32_t scy) { if (0U == cmd_burst) @@ -2949,6 +3302,9 @@ void EVE_cmd_scale(int32_t scx, int32_t scy) } } +/** + * @brief Apply a scale to the current matrix, only works in burst-mode. + */ void EVE_cmd_scale_burst(int32_t scx, int32_t scy) { spi_transmit_burst(CMD_SCALE); @@ -2956,7 +3312,10 @@ void EVE_cmd_scale_burst(int32_t scx, int32_t scy) spi_transmit_burst((uint32_t) scy); } -void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a scroll bar. + */ +void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { if (0U == cmd_burst) @@ -2966,10 +3325,10 @@ void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -2984,22 +3343,28 @@ void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_SCROLLBAR); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst(((uint32_t) size) + (((uint32_t) range) << 16U)); } } -void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a scroll bar, only works in burst-mode. + */ +void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { spi_transmit_burst(CMD_SCROLLBAR); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst(((uint32_t) size) + (((uint32_t) range) << 16U)); } +/** + * @brief Set the base for number output. + */ void EVE_cmd_setbase(uint32_t base) { if (0U == cmd_burst) @@ -3015,12 +3380,18 @@ void EVE_cmd_setbase(uint32_t base) } } +/** + * @brief Set the base for number output, only works in burst-mode. + */ void EVE_cmd_setbase_burst(uint32_t base) { spi_transmit_burst(CMD_SETBASE); spi_transmit_burst(base); } +/** + * @brief Generate the corresponding display list commands for given bitmap information. + */ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height) { @@ -3028,12 +3399,12 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, { eve_begin_cmd(CMD_SETBITMAP); spi_transmit_32(addr); - spi_transmit((uint8_t)(fmt)); - spi_transmit((uint8_t)(fmt >> 8U)); - spi_transmit((uint8_t)(width)); - spi_transmit((uint8_t)(width >> 8U)); - spi_transmit((uint8_t)(height)); - spi_transmit((uint8_t)(height >> 8U)); + spi_transmit((uint8_t) (fmt)); + spi_transmit((uint8_t) (fmt >> 8U)); + spi_transmit((uint8_t) (width)); + spi_transmit((uint8_t) (width >> 8U)); + spi_transmit((uint8_t) (height)); + spi_transmit((uint8_t) (height >> 8U)); spi_transmit(0U); spi_transmit(0U); EVE_cs_clear(); @@ -3042,20 +3413,27 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, { spi_transmit_burst(CMD_SETBITMAP); spi_transmit_burst(addr); - spi_transmit_burst((uint32_t) fmt + (((uint32_t) width) << 16U)); + spi_transmit_burst(((uint32_t) fmt) + (((uint32_t) width) << 16U)); spi_transmit_burst((uint32_t) height); } } +/** + * @brief Generate the corresponding display list commands for given bitmap information, only works in burst-mode. + */ void EVE_cmd_setbitmap_burst(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height) { spi_transmit_burst(CMD_SETBITMAP); spi_transmit_burst(addr); - spi_transmit_burst((uint32_t) fmt + (((uint32_t) width) << 16U)); + spi_transmit_burst(((uint32_t) fmt) + (((uint32_t) width) << 16U)); spi_transmit_burst((uint32_t) height); } +/** + * @brief Register one custom font into the coprocessor engine. + * @note - does not set up the bitmap parameters of the font + */ void EVE_cmd_setfont(uint32_t font, uint32_t ptr) { if (0U == cmd_burst) @@ -3073,6 +3451,10 @@ void EVE_cmd_setfont(uint32_t font, uint32_t ptr) } } +/** + * @brief Register one custom font into the coprocessor engine, only works in burst-mode. + * @note - does not set up the bitmap parameters of the font + */ void EVE_cmd_setfont_burst(uint32_t font, uint32_t ptr) { spi_transmit_burst(CMD_SETFONT); @@ -3080,12 +3462,10 @@ void EVE_cmd_setfont_burst(uint32_t font, uint32_t ptr) spi_transmit_burst(ptr); } -/* Note: CMD_SETFONT2 generates display list commands so it needs to be put in a display list. */ -/* A minimum display list to properly execute CMD_SETFONT2 would be: */ -/* EVE_cmd_dl(CMD_DLSTART); */ -/* EVE_cmd_setfont2(font, ptr, firstchar); */ -/* ...other bitmap handle commands like more CMD_SETFONT2 or CMD_ROMFONT */ -/* EVE_cmd_dl(CMD_SWAP); */ +/** + * @brief Set up a custom for use by the coprocessor engine. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar) { if (0U == cmd_burst) @@ -3105,6 +3485,10 @@ void EVE_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar) } } +/** + * @brief Set up a custom for use by the coprocessor engine, only works in burst-mode. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_setfont2_burst(uint32_t font, uint32_t ptr, uint32_t firstchar) { spi_transmit_burst(CMD_SETFONT2); @@ -3113,6 +3497,9 @@ void EVE_cmd_setfont2_burst(uint32_t font, uint32_t ptr, uint32_t firstchar) spi_transmit_burst(firstchar); } +/** + * @brief Set the scratch bitmap for widget use. + */ void EVE_cmd_setscratch(uint32_t handle) { if (0U == cmd_burst) @@ -3128,12 +3515,18 @@ void EVE_cmd_setscratch(uint32_t handle) } } +/** + * @brief Set the scratch bitmap for widget use, only works in burst-mode. + */ void EVE_cmd_setscratch_burst(uint32_t handle) { spi_transmit_burst(CMD_SETSCRATCH); spi_transmit_burst(handle); } +/** + * @brief Start a continuous sketch update. + */ void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format) { @@ -3165,6 +3558,9 @@ void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, } } +/** + * @brief Start a continuous sketch update, only works in burst-mode. + */ void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format) { @@ -3175,7 +3571,10 @@ void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, spi_transmit_burst((uint32_t) format); } -void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a slider. + */ +void EVE_cmd_slider(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -3185,10 +3584,10 @@ void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -3203,22 +3602,28 @@ void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_SLIDER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } } -void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a slider, only works in burst-mode. + */ +void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_SLIDER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } +/** + * @brief Start an animated spinner. + */ void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) { if (0U == cmd_burst) @@ -3242,6 +3647,9 @@ void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) } } +/** + * @brief Start an animated spinner, only works in burst-mode. + */ void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) { @@ -3250,7 +3658,10 @@ void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, spi_transmit_burst(((uint32_t) style) + (((uint32_t) scale) << 16U)); } -void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, +/** + * @brief Draw a text string. + */ +void EVE_cmd_text(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) @@ -3260,8 +3671,8 @@ void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -3271,21 +3682,27 @@ void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, only works in burst-mode. + */ +void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } -void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels. + */ +void EVE_cmd_toggle(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text) { if (0U == cmd_burst) @@ -3295,10 +3712,10 @@ void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (state)); @@ -3310,22 +3727,28 @@ void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); } } -void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, only works in burst-mode. + */ +void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text) { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); } +/** + * @brief Apply a translation to the current matrix. + */ void EVE_cmd_translate(int32_t tr_x, int32_t tr_y) { if (0U == cmd_burst) @@ -3343,6 +3766,9 @@ void EVE_cmd_translate(int32_t tr_x, int32_t tr_y) } } +/** + * @brief Apply a translation to the current matrix, only works in burst-mode. + */ void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y) { spi_transmit_burst(CMD_TRANSLATE); @@ -3350,21 +3776,33 @@ void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y) spi_transmit_burst((uint32_t) tr_y); } +/** + * @brief Set the current color red, green and blue. + */ void EVE_color_rgb(uint32_t color) { EVE_cmd_dl(DL_COLOR_RGB | (color & 0x00ffffffUL)); } +/** + * @brief Set the current color red, green and blue, only works in burst-mode. + */ void EVE_color_rgb_burst(uint32_t color) { spi_transmit_burst(DL_COLOR_RGB | (color & 0x00ffffffUL)); } +/** + * @brief Set the current color alpha, green and blue. + */ void EVE_color_a(uint8_t alpha) { EVE_cmd_dl(DL_COLOR_A | ((uint32_t) alpha)); } +/** + * @brief Set the current color alpha, green and blue, only works in burst-mode. + */ void EVE_color_a_burst(uint8_t alpha) { spi_transmit_burst(DL_COLOR_A | ((uint32_t) alpha)); @@ -3417,19 +3855,26 @@ void EVE_calibrate_manual(uint16_t width, uint16_t height) EVE_cmd_dl(CMD_DLSTART); EVE_cmd_dl(DL_CLEAR_COLOR_RGB); EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG); + EVE_cmd_dl(DL_VERTEX_FORMAT); /* set to 0 - reduce precision for VERTEX2F to 1 pixel instead of 1/16 pixel default */ /* draw Calibration Point on screen */ EVE_cmd_dl(DL_COLOR_RGB | 0x0000ffUL); EVE_cmd_dl(POINT_SIZE(15U * 16U)); EVE_cmd_dl((DL_BEGIN | EVE_POINTS)); - EVE_cmd_dl(VERTEX2F((uint32_t)(display_x[count]) * 16U, (uint32_t)((display_y[count])) * 16U)); + + int16_t xc0; + int16_t yc0; + + xc0 = (int16_t) display_x[count]; + yc0 = (int16_t) display_y[count]; + EVE_cmd_dl(VERTEX2F(xc0, yc0)); EVE_cmd_dl(DL_END); EVE_cmd_dl(DL_COLOR_RGB | 0xffffffUL); - EVE_cmd_text((int16_t) width / 2, 20, 26, EVE_OPT_CENTER, "tap on the dot"); + EVE_cmd_text((int16_t) width / 2, 20, 26U, EVE_OPT_CENTER, "tap on the dot"); calc = count + 0x31U; num[0U] = (char) calc; num[1U] = (char) 0U; /* null terminated string of one character */ - EVE_cmd_text((int16_t) display_x[count], (int16_t) display_y[count], 27, EVE_OPT_CENTER, num); + EVE_cmd_text((int16_t) display_x[count], (int16_t) display_y[count], 27U, EVE_OPT_CENTER, num); EVE_cmd_dl(DL_DISPLAY); EVE_cmd_dl(CMD_SWAP); diff --git a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.h b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.h index 912e493..144d7ed 100644 --- a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.h +++ b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_commands.h @@ -2,7 +2,7 @@ @file EVE_commands.h @brief contains FT8xx / BT8xx function prototypes @version 5.0 -@date 2023-07-28 +@date 2023-12-29 @author Rudolph Riedel @section LICENSE @@ -80,6 +80,10 @@ EVE_cmd_animstartram_burst() - put E_OK and E_NOT_OK in #ifndef/#endif guards as these are usually defined already in AUTOSAR projects - renamed EVE_FAIL_CHIPID_TIMEOUT to EVE_FAIL_REGID_TIMEOUT as suggested by #93 on github +- changed a number of function parameters from signed to unsigned following the + updated BT81x series programming guide V2.4 +- commented out EVE_cmd_regread() prototype +- removed prototype for EVE_cmd_hsf_burst() */ @@ -142,8 +146,8 @@ void EVE_execute_cmd(void); #if EVE_GEN > 3 void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num); -void EVE_cmd_fontcache(uint32_t font, int32_t ptr, uint32_t num); -void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used); +void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num); +void EVE_cmd_fontcachequery(uint32_t *p_total, uint32_t *p_used); void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, uint32_t *p_height, uint32_t *p_palette); void EVE_cmd_linetime(uint32_t dest); void EVE_cmd_newlist(uint32_t adr); @@ -180,15 +184,15 @@ void EVE_cmd_mediafifo(uint32_t ptr, uint32_t size); void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num); uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num); void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num); -/*(void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data); */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num); void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len); -uint32_t EVE_cmd_regread(uint32_t ptr); void EVE_cmd_setrotate(uint32_t rotation); void EVE_cmd_snapshot(uint32_t ptr); -void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt); -void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t tag); +void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt); +void EVE_cmd_track(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t tag); void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr); +/*void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data);*/ +/*uint32_t EVE_cmd_regread(uint32_t ptr);*/ /* ################################################################## patching and initialization @@ -221,7 +225,6 @@ void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, uint16_t h void EVE_cmd_calllist(uint32_t adr); void EVE_cmd_calllist_burst(uint32_t adr); void EVE_cmd_hsf(uint32_t hsf); -void EVE_cmd_hsf_burst(uint32_t hsf); void EVE_cmd_runanim(uint32_t waitmask, uint32_t play); void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play); @@ -250,15 +253,15 @@ void EVE_cmd_fillwidth(uint32_t pixel); void EVE_cmd_fillwidth_burst(uint32_t pixel); void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1); void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1); -void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale); -void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale); +void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale); +void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale); -void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_button_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_text_var(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); #endif /* EVE_GEN > 2 */ @@ -269,36 +272,36 @@ void EVE_cmd_append(uint32_t ptr, uint32_t num); void EVE_cmd_append_burst(uint32_t ptr, uint32_t num); void EVE_cmd_bgcolor(uint32_t color); void EVE_cmd_bgcolor_burst(uint32_t color); -void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); +void EVE_cmd_button(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); void EVE_cmd_calibrate(void); -void EVE_cmd_clock(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); -void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); -void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val); -void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val); +void EVE_cmd_clock(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); +void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); +void EVE_cmd_dial(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val); +void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val); void EVE_cmd_fgcolor(uint32_t color); void EVE_cmd_fgcolor_burst(uint32_t color); -void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); -void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); +void EVE_cmd_gauge(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); +void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, int32_t *p_d, int32_t *p_e, int32_t *p_f); void EVE_cmd_gradcolor(uint32_t color); void EVE_cmd_gradcolor_burst(uint32_t color); void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1); void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1); -void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, int32_t number); -void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, int32_t number); -void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); -void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_keys(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_number(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number); +void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number); +void EVE_cmd_progress(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); void EVE_cmd_romfont(uint32_t font, uint32_t romslot); void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot); -void EVE_cmd_rotate(int32_t angle); -void EVE_cmd_rotate_burst(int32_t angle); +void EVE_cmd_rotate(uint32_t angle); +void EVE_cmd_rotate_burst(uint32_t angle); void EVE_cmd_scale(int32_t scx, int32_t scy); void EVE_cmd_scale_burst(int32_t scx, int32_t scy); -void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); -void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); +void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); +void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); void EVE_cmd_setbase(uint32_t base); void EVE_cmd_setbase_burst(uint32_t base); void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height); @@ -311,14 +314,14 @@ void EVE_cmd_setscratch(uint32_t handle); void EVE_cmd_setscratch_burst(uint32_t handle); void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format); void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format); -void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); -void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_slider(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale); void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale); -void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text); -void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text); +void EVE_cmd_text(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_toggle(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text); +void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text); void EVE_cmd_translate(int32_t tr_x, int32_t tr_y); void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y); diff --git a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target.h b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target.h index 8891c85..e926cfd 100644 --- a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target.h +++ b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target.h @@ -2,7 +2,7 @@ @file EVE_target.h @brief target specific includes, definitions and functions @version 5.0 -@date 2023-09-01 +@date 2023-09-30 @author Rudolph Riedel @section LICENSE @@ -87,6 +87,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - fix: while working, the check for multiple different targets was not implemented correctly - added ARDUINO_HLK_w80x target for W801, W806 and Air103 boards - modified the RISC-V entry as there are ESP32 now with RISC-V core +- added detection of the Tasking compiler and added tc38x and tc39xb targets +- removed the unfortunately defunct WIZIOPICO */ @@ -285,8 +287,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif /* __GNUC__ */ -#endif /* !Arduino */ - /* ################################################################## */ /* ################################################################## */ @@ -312,6 +312,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* ################################################################## */ /* ################################################################## */ +#if defined(__TASKING__) + +#if (__CPU__ == tc38x) || (__CPU__ == tc39xb) + +#include "EVE_target/EVE_target_Tricore_Tasking.h" + +#endif +#endif + +/* ################################################################## */ +/* ################################################################## */ + +#endif /* !Arduino */ + #if defined (ARDUINO) #if defined (__AVR__) @@ -340,7 +354,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "EVE_target/EVE_target_Arduino_Nucleo_F446RE.h" -#elif defined (WIZIOPICO) || defined (PICOPI) +#elif defined (ARDUINO_RASPBERRY_PI_PICO) #include "EVE_target/EVE_target_Arduino_RP2040.h" diff --git a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMx5x.h b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMx5x.h index 45a000a..f3d31ab 100644 --- a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMx5x.h +++ b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/EVE_target/EVE_target_ATSAMx5x.h @@ -201,12 +201,12 @@ static inline uint8_t spi_receive(uint8_t data) { EVE_SPI_SERCOM->SPI.DATA.reg = data; while (0U == (EVE_SPI_SERCOM->SPI.INTFLAG.reg & SERCOM_SPI_INTFLAG_TXC)) {} - return EVE_SPI_SERCOM->SPI.DATA.reg; + return (EVE_SPI_SERCOM->SPI.DATA.reg); } static inline uint8_t fetch_flash_byte(const uint8_t *p_data) { - return *p_data; + return (*p_data); } #endif /* SAMx5x */ diff --git a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/LICENSE b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/LICENSE index e454a70..a6ab28b 100644 --- a/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/LICENSE +++ b/examples/EVE_Test_SAME51_EVE3-43G/EmbeddedVideoEngine/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2023 Rudolph Riedel +Copyright (c) 2016-2024 Rudolph Riedel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -18,4 +18,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/examples/EVE_Test_STM32_RiTFT50_PlatformIO/platformio.ini b/examples/EVE_Test_STM32_RiTFT50_PlatformIO/platformio.ini index 668f872..bff1cf5 100644 --- a/examples/EVE_Test_STM32_RiTFT50_PlatformIO/platformio.ini +++ b/examples/EVE_Test_STM32_RiTFT50_PlatformIO/platformio.ini @@ -13,6 +13,7 @@ platform = ststm32 framework = stm32cube build_flags = -D USE_FULL_LL_DRIVER -D EVE_RiTFT50 lib_deps = https://github.com/RudolphRiedel/FT800-FT813/archive/refs/heads/5.x.zip + check_tool = cppcheck check_flags = cppcheck: --addon=cert.py --suppress=unusedFunction @@ -75,3 +76,12 @@ board = nucleo_h743zi build_flags = ${env.build_flags} -D STM32H7 + +;[env:STM32C0C31] +;board = nucleo_c031c6 +;upload_protocol = jlink +;build_unflags = -Os +;build_flags = +; ${env.build_flags} +; -D STM32C0 +; -O2 diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.componentinfo.xml b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.componentinfo.xml index 8b8e1a8..1d1d980 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.componentinfo.xml +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.componentinfo.xml @@ -9,13 +9,13 @@ Atmel - 1.2.0 + 1.3.0 C:/Program Files (x86)\Atmel\Studio\7.0\Packs - C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.2.141\include\ + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.3.146\include\ include C @@ -26,29 +26,29 @@ - C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.2.141\include\avr\iox128a1.h + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.3.146\include\avr\iox128a1.h header C - LazE2pphWLvIb1TyUlkYLA== + eLWryPsBKY+hzVuCGkZEvQ== include/avr/iox128a1.h - C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.2.141\templates\main.c + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.3.146\templates\main.c template source C Exe - nGp20+S/Y6sd0Sp5OwBipQ== + KjvOcFWd++tbnsEMfVPd/w== templates/main.c Main file (.c) - C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.2.141\templates\main.cpp + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.3.146\templates\main.cpp template source C Exe @@ -59,7 +59,7 @@ - C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.2.141\gcc\dev\atxmega128a1 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.3.146\gcc\dev\atxmega128a1 libraryPrefix GCC @@ -71,8 +71,8 @@ XMEGAA_DFP - C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAA_DFP/1.2.141/Atmel.XMEGAA_DFP.pdsc - 1.2.141 + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAA_DFP/1.3.146/Atmel.XMEGAA_DFP.pdsc + 1.3.146 true ATxmega128A1 diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.cproj b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.cproj index 7dd0600..0af9b3c 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.cproj +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/Display_Test1.cproj @@ -75,81 +75,81 @@ - -mmcu=atxmega128a1 -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.2.141\gcc\dev\atxmega128a1" - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\atmel\XMEGAA_DFP\1.2.141\include\ - - - Optimize for size (-Os) - True - True - True - - - libm - - - - - %24(PackRepoDir)\atmel\XMEGAA_DFP\1.2.141\include\ - - - + -mmcu=atxmega128a1 -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.3.146\gcc\dev\atxmega128a1" + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\XMEGAA_DFP\1.3.146\include\ + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\XMEGAA_DFP\1.3.146\include\ + + + - -mmcu=atxmega128a1 -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.2.141\gcc\dev\atxmega128a1" - True - True - True - True - False - True - True - - - DEBUG - F_CPU=32000000UL - EVE_GEN4_FT813_50 - - - - - %24(PackRepoDir)\atmel\XMEGAA_DFP\1.2.141\include\ - - - Optimize debugging experience (-Og) - True - True - Default (-g2) - True - - - libm - - - - - %24(PackRepoDir)\atmel\XMEGAA_DFP\1.2.141\include\ - - - Default (-Wa,-g) - + -mmcu=atxmega128a1 -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.3.146\gcc\dev\atxmega128a1" + True + True + True + True + False + True + True + + + DEBUG + F_CPU=32000000UL + EVE_GEN4_FT813_50 + + + + + %24(PackRepoDir)\atmel\XMEGAA_DFP\1.3.146\include\ + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\XMEGAA_DFP\1.3.146\include\ + + + Default (-Wa,-g) + diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE.h b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE.h index ae2b9b2..e40010e 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE.h +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE.h @@ -2,7 +2,7 @@ @file EVE.h @brief Contains FT80x/FT81x/BT81x API definitions @version 5.0 -@date 2023-06-24 +@date 2024-01-07 @author Rudolph Riedel @section LICENSE @@ -63,6 +63,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - added #ifdef __cplusplus / extern "C" to allow adding EVE_ functions to C++ code - fix: typo REG_COPRO_PATCH_DTR -> REG_COPRO_PATCH_PTR +- started to convert the function-like macros to static inline functions to be + a little friendlier towards C++ in regards of type-safety +- added type-casts to all simple macros +- converted some more function-like macros to static inline functions +- converted the rest of the function-like macros to static inline functions +- fix: forgot to comment out the EVE2 BITMAP_TRANSFORM_E when converting it to an inline function */ @@ -80,561 +86,975 @@ extern "C" #include "EVE_commands.h" /* Memory */ -#define EVE_RAM_G 0x00000000UL -#define EVE_ROM_CHIPID 0x000C0000UL -#define EVE_ROM_FONT 0x001E0000UL -#define EVE_ROM_FONTROOT 0x002FFFFCUL -#define EVE_RAM_DL 0x00300000UL -#define EVE_RAM_REG 0x00302000UL -#define EVE_RAM_CMD 0x00308000UL +#define EVE_RAM_G ((uint32_t) 0x00000000UL) +#define EVE_ROM_CHIPID ((uint32_t) 0x000C0000UL) +#define EVE_ROM_FONT ((uint32_t) 0x001E0000UL) +#define EVE_ROM_FONTROOT ((uint32_t) 0x002FFFFCUL) +#define EVE_RAM_DL ((uint32_t) 0x00300000UL) +#define EVE_RAM_REG ((uint32_t) 0x00302000UL) +#define EVE_RAM_CMD ((uint32_t) 0x00308000UL) /* Memory buffer sizes */ -#define EVE_RAM_G_SIZE (1024U*1024UL) -#define EVE_CMDFIFO_SIZE (4U*1024UL) -#define EVE_RAM_DL_SIZE (8U*1024UL) +#define EVE_RAM_G_SIZE ((uint32_t) 1024U*1024UL) +#define EVE_CMDFIFO_SIZE ((uint32_t) 4U*1024UL) +#define EVE_RAM_DL_SIZE ((uint32_t) 8U*1024UL) /* diplay list list commands, most need OR's arguments */ -#define DL_DISPLAY 0x00000000UL -#define DL_BITMAP_SOURCE 0x01000000UL -#define DL_CLEAR_COLOR_RGB 0x02000000UL -#define DL_TAG 0x03000000UL -#define DL_COLOR_RGB 0x04000000UL -#define DL_BITMAP_HANDLE 0x05000000UL -#define DL_CELL 0x06000000UL -#define DL_BITMAP_LAYOUT 0x07000000UL -#define DL_BITMAP_SIZE 0x08000000UL -#define DL_ALPHA_FUNC 0x09000000UL -#define DL_STENCIL_FUNC 0x0A000000UL -#define DL_BLEND_FUNC 0x0B000000UL -#define DL_STENCIL_OP 0x0C000000UL -#define DL_POINT_SIZE 0x0D000000UL -#define DL_LINE_WIDTH 0x0E000000UL -#define DL_CLEAR_COLOR_A 0x0F000000UL -#define DL_COLOR_A 0x10000000UL -#define DL_CLEAR_STENCIL 0x11000000UL -#define DL_CLEAR_TAG 0x12000000UL -#define DL_STENCIL_MASK 0x13000000UL -#define DL_TAG_MASK 0x14000000UL -#define DL_BITMAP_TRANSFORM_A 0x15000000UL -#define DL_BITMAP_TRANSFORM_B 0x16000000UL -#define DL_BITMAP_TRANSFORM_C 0x17000000UL -#define DL_BITMAP_TRANSFORM_D 0x18000000UL -#define DL_BITMAP_TRANSFORM_E 0x19000000UL -#define DL_BITMAP_TRANSFORM_F 0x1A000000UL -#define DL_SCISSOR_XY 0x1B000000UL -#define DL_SCISSOR_SIZE 0x1C000000UL -#define DL_CALL 0x1D000000UL -#define DL_JUMP 0x1E000000UL -#define DL_BEGIN 0x1F000000UL -#define DL_COLOR_MASK 0x20000000UL -#define DL_END 0x21000000UL -#define DL_SAVE_CONTEXT 0x22000000UL -#define DL_RESTORE_CONTEXT 0x23000000UL -#define DL_RETURN 0x24000000UL -#define DL_MACRO 0x25000000UL -#define DL_CLEAR 0x26000000UL -#define DL_VERTEX_FORMAT 0x27000000UL -#define DL_BITMAP_LAYOUT_H 0x28000000UL -#define DL_BITMAP_SIZE_H 0x29000000UL -#define DL_PALETTE_SOURCE 0x2A000000UL -#define DL_VERTEX_TRANSLATE_X 0x2B000000UL -#define DL_VERTEX_TRANSLATE_Y 0x2C000000UL -#define DL_NOP 0x2D000000UL - -#define DL_VERTEX2F 0x40000000UL -#define DL_VERTEX2II 0x80000000UL - -#define CLR_COL 0x4U -#define CLR_STN 0x2U -#define CLR_TAG 0x1U +#define DL_DISPLAY ((uint32_t) 0x00000000UL) +#define DL_BITMAP_SOURCE ((uint32_t) 0x01000000UL) +#define DL_CLEAR_COLOR_RGB ((uint32_t) 0x02000000UL) +#define DL_TAG ((uint32_t) 0x03000000UL) +#define DL_COLOR_RGB ((uint32_t) 0x04000000UL) +#define DL_BITMAP_HANDLE ((uint32_t) 0x05000000UL) +#define DL_CELL ((uint32_t) 0x06000000UL) +#define DL_BITMAP_LAYOUT ((uint32_t) 0x07000000UL) +#define DL_BITMAP_SIZE ((uint32_t) 0x08000000UL) +#define DL_ALPHA_FUNC ((uint32_t) 0x09000000UL) +#define DL_STENCIL_FUNC ((uint32_t) 0x0A000000UL) +#define DL_BLEND_FUNC ((uint32_t) 0x0B000000UL) +#define DL_STENCIL_OP ((uint32_t) 0x0C000000UL) +#define DL_POINT_SIZE ((uint32_t) 0x0D000000UL) +#define DL_LINE_WIDTH ((uint32_t) 0x0E000000UL) +#define DL_CLEAR_COLOR_A ((uint32_t) 0x0F000000UL) +#define DL_COLOR_A ((uint32_t) 0x10000000UL) +#define DL_CLEAR_STENCIL ((uint32_t) 0x11000000UL) +#define DL_CLEAR_TAG ((uint32_t) 0x12000000UL) +#define DL_STENCIL_MASK ((uint32_t) 0x13000000UL) +#define DL_TAG_MASK ((uint32_t) 0x14000000UL) +#define DL_BITMAP_TRANSFORM_A ((uint32_t) 0x15000000UL) +#define DL_BITMAP_TRANSFORM_B ((uint32_t) 0x16000000UL) +#define DL_BITMAP_TRANSFORM_C ((uint32_t) 0x17000000UL) +#define DL_BITMAP_TRANSFORM_D ((uint32_t) 0x18000000UL) +#define DL_BITMAP_TRANSFORM_E ((uint32_t) 0x19000000UL) +#define DL_BITMAP_TRANSFORM_F ((uint32_t) 0x1A000000UL) +#define DL_SCISSOR_XY ((uint32_t) 0x1B000000UL) +#define DL_SCISSOR_SIZE ((uint32_t) 0x1C000000UL) +#define DL_CALL ((uint32_t) 0x1D000000UL) +#define DL_JUMP ((uint32_t) 0x1E000000UL) +#define DL_BEGIN ((uint32_t) 0x1F000000UL) +#define DL_COLOR_MASK ((uint32_t) 0x20000000UL) +#define DL_END ((uint32_t) 0x21000000UL) +#define DL_SAVE_CONTEXT ((uint32_t) 0x22000000UL) +#define DL_RESTORE_CONTEXT ((uint32_t) 0x23000000UL) +#define DL_RETURN ((uint32_t) 0x24000000UL) +#define DL_MACRO ((uint32_t) 0x25000000UL) +#define DL_CLEAR ((uint32_t) 0x26000000UL) +#define DL_VERTEX_FORMAT ((uint32_t) 0x27000000UL) +#define DL_BITMAP_LAYOUT_H ((uint32_t) 0x28000000UL) +#define DL_BITMAP_SIZE_H ((uint32_t) 0x29000000UL) +#define DL_PALETTE_SOURCE ((uint32_t) 0x2A000000UL) +#define DL_VERTEX_TRANSLATE_X ((uint32_t) 0x2B000000UL) +#define DL_VERTEX_TRANSLATE_Y ((uint32_t) 0x2C000000UL) +#define DL_NOP ((uint32_t) 0x2D000000UL) + +#define DL_VERTEX2F ((uint32_t) 0x40000000UL) +#define DL_VERTEX2II ((uint32_t) 0x80000000UL) + +#define CLR_COL ((uint8_t) 0x4U) +#define CLR_STN ((uint8_t) 0x2U) +#define CLR_TAG ((uint8_t) 0x1U) /* Host commands */ -#define EVE_ACTIVE 0x00U /* place FT8xx in active state */ -#define EVE_STANDBY 0x41U /* place FT8xx in Standby (clk running) */ -#define EVE_SLEEP 0x42U /* place FT8xx in Sleep (clk off) */ -#define EVE_CLKEXT 0x44U /* select external clock source */ +#define EVE_ACTIVE ((uint8_t) 0x00U) /* place EVE in active state */ +#define EVE_STANDBY ((uint8_t) 0x41U) /* place EVE in Standby (clk running) */ +#define EVE_SLEEP ((uint8_t) 0x42U) /* place EVE in Sleep (clk off) */ +#define EVE_CLKEXT ((uint8_t) 0x44U) /* select external clock source */ #if EVE_GEN < 4 -#define EVE_CLKINT 0x48U /* select internal clock source, not a valid option for BT817 / BT818 */ +#define EVE_CLKINT ((uint8_t) 0x48U) /* select internal clock source, not a valid option for BT817 / BT818 */ #endif -#define EVE_PWRDOWN 0x50U /* place FT8xx in Power Down (core off) */ -#define EVE_CLKSEL 0x61U /* configure system clock */ -#define EVE_RST_PULSE 0x68U /* reset core - all registers default and processors reset */ -#define EVE_CORERST 0x68U /* reset core - all registers default and processors reset */ -#define EVE_PINDRIVE 0x70U /* setup drive strength for various pins */ -#define EVE_PIN_PD_STATE 0x71U /* setup how pins behave during power down */ +#define EVE_PWRDOWN ((uint8_t) 0x50U) /* place EVE in Power Down (core off) */ +#define EVE_CLKSEL ((uint8_t) 0x61U) /* configure system clock */ +#define EVE_RST_PULSE ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define EVE_CORERST ((uint8_t) 0x68U) /* reset core - all registers default and processors reset */ +#define EVE_PINDRIVE ((uint8_t) 0x70U) /* setup drive strength for various pins */ +#define EVE_PIN_PD_STATE ((uint8_t) 0x71U) /* setup how pins behave during power down */ /* Graphic command defines */ -#define EVE_NEVER 0UL -#define EVE_LESS 1UL -#define EVE_LEQUAL 2UL -#define EVE_GREATER 3UL -#define EVE_GEQUAL 4UL -#define EVE_EQUAL 5UL -#define EVE_NOTEQUAL 6UL -#define EVE_ALWAYS 7UL +#define EVE_NEVER ((uint8_t) 0UL) +#define EVE_LESS ((uint8_t) 1UL) +#define EVE_LEQUAL ((uint8_t) 2UL) +#define EVE_GREATER ((uint8_t) 3UL) +#define EVE_GEQUAL ((uint8_t) 4UL) +#define EVE_EQUAL ((uint8_t) 5UL) +#define EVE_NOTEQUAL ((uint8_t) 6UL) +#define EVE_ALWAYS ((uint8_t) 7UL) /* Bitmap formats */ -#define EVE_ARGB1555 0UL -#define EVE_L1 1UL -#define EVE_L4 2UL -#define EVE_L8 3UL -#define EVE_RGB332 4UL -#define EVE_ARGB2 5UL -#define EVE_ARGB4 6UL -#define EVE_RGB565 7UL -#define EVE_PALETTED 8UL -#define EVE_TEXT8X8 9UL -#define EVE_TEXTVGA 10UL -#define EVE_BARGRAPH 11UL +#define EVE_ARGB1555 ((uint8_t) 0UL) +#define EVE_L1 ((uint8_t) 1UL) +#define EVE_L4 ((uint8_t) 2UL) +#define EVE_L8 ((uint8_t) 3UL) +#define EVE_RGB332 ((uint8_t) 4UL) +#define EVE_ARGB2 ((uint8_t) 5UL) +#define EVE_ARGB4 ((uint8_t) 6UL) +#define EVE_RGB565 ((uint8_t) 7UL) +#define EVE_PALETTED ((uint8_t) 8UL) +#define EVE_TEXT8X8 ((uint8_t) 9UL) +#define EVE_TEXTVGA ((uint8_t) 10UL) +#define EVE_BARGRAPH ((uint8_t) 11UL) /* Bitmap filter types */ -#define EVE_NEAREST 0UL -#define EVE_BILINEAR 1UL +#define EVE_NEAREST ((uint8_t) 0UL) +#define EVE_BILINEAR ((uint8_t) 1UL) /* Bitmap wrap types */ -#define EVE_BORDER 0UL -#define EVE_REPEAT 1UL +#define EVE_BORDER ((uint8_t) 0UL) +#define EVE_REPEAT ((uint8_t) 1UL) /* Stencil defines */ -#define EVE_KEEP 1UL -#define EVE_REPLACE 2UL -#define EVE_INCR 3UL -#define EVE_DECR 4UL -#define EVE_INVERT 5UL +#define EVE_KEEP ((uint8_t) 1UL) +#define EVE_REPLACE ((uint8_t) 2UL) +#define EVE_INCR ((uint8_t) 3UL) +#define EVE_DECR ((uint8_t) 4UL) +#define EVE_INVERT ((uint8_t) 5UL) /* Graphics display list swap defines */ -#define EVE_DLSWAP_DONE 0UL -#define EVE_DLSWAP_LINE 1UL -#define EVE_DLSWAP_FRAME 2UL +#define EVE_DLSWAP_DONE ((uint8_t) 0UL) +#define EVE_DLSWAP_LINE ((uint8_t) 1UL) +#define EVE_DLSWAP_FRAME ((uint8_t) 2UL) /* Interrupt bits */ -#define EVE_INT_SWAP 0x01 -#define EVE_INT_TOUCH 0x02 -#define EVE_INT_TAG 0x04 -#define EVE_INT_SOUND 0x08 -#define EVE_INT_PLAYBACK 0x10 -#define EVE_INT_CMDEMPTY 0x20 -#define EVE_INT_CMDFLAG 0x40 -#define EVE_INT_CONVCOMPLETE 0x80 +#define EVE_INT_SWAP ((uint8_t) 0x01) +#define EVE_INT_TOUCH ((uint8_t) 0x02) +#define EVE_INT_TAG ((uint8_t) 0x04) +#define EVE_INT_SOUND ((uint8_t) 0x08) +#define EVE_INT_PLAYBACK ((uint8_t) 0x10) +#define EVE_INT_CMDEMPTY ((uint8_t) 0x20) +#define EVE_INT_CMDFLAG ((uint8_t) 0x40) +#define EVE_INT_CONVCOMPLETE ((uint8_t) 0x80) /* Touch mode */ -#define EVE_TMODE_OFF 0U -#define EVE_TMODE_ONESHOT 1U -#define EVE_TMODE_FRAME 2U -#define EVE_TMODE_CONTINUOUS 3U +#define EVE_TMODE_OFF ((uint8_t) 0U) +#define EVE_TMODE_ONESHOT ((uint8_t) 1U) +#define EVE_TMODE_FRAME ((uint8_t) 2U) +#define EVE_TMODE_CONTINUOUS ((uint8_t) 3U) /* Alpha blending */ -#define EVE_ZERO 0UL -#define EVE_ONE 1UL -#define EVE_SRC_ALPHA 2UL -#define EVE_DST_ALPHA 3UL -#define EVE_ONE_MINUS_SRC_ALPHA 4UL -#define EVE_ONE_MINUS_DST_ALPHA 5UL +#define EVE_ZERO ((uint32_t) 0UL) +#define EVE_ONE ((uint32_t) 1UL) +#define EVE_SRC_ALPHA ((uint32_t) 2UL) +#define EVE_DST_ALPHA ((uint32_t) 3UL) +#define EVE_ONE_MINUS_SRC_ALPHA ((uint32_t) 4UL) +#define EVE_ONE_MINUS_DST_ALPHA ((uint32_t) 5UL) /* Graphics primitives */ -#define EVE_BITMAPS 1UL -#define EVE_POINTS 2UL -#define EVE_LINES 3UL -#define EVE_LINE_STRIP 4UL -#define EVE_EDGE_STRIP_R 5UL -#define EVE_EDGE_STRIP_L 6UL -#define EVE_EDGE_STRIP_A 7UL -#define EVE_EDGE_STRIP_B 8UL -#define EVE_RECTS 9UL -#define EVE_INT_G8 18UL -#define EVE_INT_L8C 12UL -#define EVE_INT_VGA 13UL -#define EVE_PALETTED565 14UL -#define EVE_PALETTED4444 15UL -#define EVE_PALETTED8 16UL -#define EVE_L2 17UL +#define EVE_BITMAPS ((uint32_t) 1UL) +#define EVE_POINTS ((uint32_t) 2UL) +#define EVE_LINES ((uint32_t) 3UL) +#define EVE_LINE_STRIP ((uint32_t) 4UL) +#define EVE_EDGE_STRIP_R ((uint32_t) 5UL) +#define EVE_EDGE_STRIP_L ((uint32_t) 6UL) +#define EVE_EDGE_STRIP_A ((uint32_t) 7UL) +#define EVE_EDGE_STRIP_B ((uint32_t) 8UL) +#define EVE_RECTS ((uint32_t) 9UL) +#define EVE_INT_G8 ((uint32_t) 18UL) +#define EVE_INT_L8C ((uint32_t) 12UL) +#define EVE_INT_VGA ((uint32_t) 13UL) +#define EVE_PALETTED565 ((uint32_t) 14UL) +#define EVE_PALETTED4444 ((uint32_t) 15UL) +#define EVE_PALETTED8 ((uint32_t) 16UL) +#define EVE_L2 ((uint32_t) 17UL) /* Widget command options */ -#define EVE_OPT_MONO 1U -#define EVE_OPT_NODL 2U -#define EVE_OPT_FLAT 256U -#define EVE_OPT_CENTERX 512U -#define EVE_OPT_CENTERY 1024U +#define EVE_OPT_MONO ((uint16_t) 1U) +#define EVE_OPT_NODL ((uint16_t) 2U) +#define EVE_OPT_FLAT ((uint16_t) 256U) +#define EVE_OPT_CENTERX ((uint16_t) 512U) +#define EVE_OPT_CENTERY ((uint16_t) 1024U) #define EVE_OPT_CENTER (EVE_OPT_CENTERX | EVE_OPT_CENTERY) -#define EVE_OPT_NOBACK 4096U -#define EVE_OPT_NOTICKS 8192U -#define EVE_OPT_NOHM 16384U -#define EVE_OPT_NOPOINTER 16384U -#define EVE_OPT_NOSECS 32768U -#define EVE_OPT_NOHANDS 49152U -#define EVE_OPT_RIGHTX 2048U -#define EVE_OPT_SIGNED 256U - -#define EVE_OPT_MEDIAFIFO 16U -#define EVE_OPT_FULLSCREEN 8U -#define EVE_OPT_NOTEAR 4U -#define EVE_OPT_SOUND 32U +#define EVE_OPT_NOBACK ((uint16_t) 4096U) +#define EVE_OPT_NOTICKS ((uint16_t) 8192U) +#define EVE_OPT_NOHM ((uint16_t) 16384U) +#define EVE_OPT_NOPOINTER ((uint16_t) 16384U) +#define EVE_OPT_NOSECS ((uint16_t) 32768U) +#define EVE_OPT_NOHANDS ((uint16_t) 49152U) +#define EVE_OPT_RIGHTX ((uint16_t) 2048U) +#define EVE_OPT_SIGNED ((uint16_t) 256U) + +#define EVE_OPT_MEDIAFIFO ((uint16_t) 16U) +#define EVE_OPT_FULLSCREEN ((uint16_t) 8U) +#define EVE_OPT_NOTEAR ((uint16_t) 4U) +#define EVE_OPT_SOUND ((uint16_t) 32U) /* ADC */ -#define EVE_ADC_DIFFERENTIAL 1UL -#define EVE_ADC_SINGLE_ENDED 0UL +#define EVE_ADC_DIFFERENTIAL ((uint32_t) 1UL) +#define EVE_ADC_SINGLE_ENDED ((uint32_t) 0UL) /* Fonts */ -#define EVE_NUMCHAR_PERFONT (128UL) /* number of font characters per bitmap handle */ -#define EVE_FONT_TABLE_SIZE (148UL) /* size of the font table - utilized for loopup by the graphics engine */ -#define EVE_FONT_TABLE_POINTER (0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ +#define EVE_NUMCHAR_PERFONT ((uint32_t) 128UL) /* number of font characters per bitmap handle */ +#define EVE_FONT_TABLE_SIZE ((uint32_t) 148UL) /* size of the font table - utilized for loopup by the graphics engine */ +#define EVE_FONT_TABLE_POINTER ((uint32_t) 0xFFFFCUL) /* pointer to the inbuilt font tables starting from bitmap handle 16 */ /* Audio sample type defines */ -#define EVE_LINEAR_SAMPLES 0UL /* 8bit signed samples */ -#define EVE_ULAW_SAMPLES 1UL /* 8bit ulaw samples */ -#define EVE_ADPCM_SAMPLES 2UL /* 4bit ima adpcm samples */ +#define EVE_LINEAR_SAMPLES ((uint32_t) 0UL) /* 8bit signed samples */ +#define EVE_ULAW_SAMPLES ((uint32_t) 1UL) /* 8bit ulaw samples */ +#define EVE_ADPCM_SAMPLES ((uint32_t) 2UL) /* 4bit ima adpcm samples */ /* Synthesized sound */ -#define EVE_SILENCE 0x00U -#define EVE_SQUAREWAVE 0x01U -#define EVE_SINEWAVE 0x02U -#define EVE_SAWTOOTH 0x03U -#define EVE_TRIANGLE 0x04U -#define EVE_BEEPING 0x05U -#define EVE_ALARM 0x06U -#define EVE_WARBLE 0x07U -#define EVE_CAROUSEL 0x08U -#define EVE_PIPS(n) (0x0FU + (n)) -#define EVE_HARP 0x40U -#define EVE_XYLOPHONE 0x41U -#define EVE_TUBA 0x42U -#define EVE_GLOCKENSPIEL 0x43U -#define EVE_ORGAN 0x44U -#define EVE_TRUMPET 0x45U -#define EVE_PIANO 0x46U -#define EVE_CHIMES 0x47U -#define EVE_MUSICBOX 0x48U -#define EVE_BELL 0x49U -#define EVE_CLICK 0x50U -#define EVE_SWITCH 0x51U -#define EVE_COWBELL 0x52U -#define EVE_NOTCH 0x53U -#define EVE_HIHAT 0x54U -#define EVE_KICKDRUM 0x55U -#define EVE_POP 0x56U -#define EVE_CLACK 0x57U -#define EVE_CHACK 0x58U -#define EVE_MUTE 0x60U -#define EVE_UNMUTE 0x61U +#define EVE_SILENCE ((uint8_t) 0x00U) +#define EVE_SQUAREWAVE ((uint8_t) 0x01U) +#define EVE_SINEWAVE ((uint8_t) 0x02U) +#define EVE_SAWTOOTH ((uint8_t) 0x03U) +#define EVE_TRIANGLE ((uint8_t) 0x04U) +#define EVE_BEEPING ((uint8_t) 0x05U) +#define EVE_ALARM ((uint8_t) 0x06U) +#define EVE_WARBLE ((uint8_t) 0x07U) +#define EVE_CAROUSEL ((uint8_t) 0x08U) +#define EVE_PIPS(n) ((uint8_t) (0x0FU + (n))) +#define EVE_HARP ((uint8_t) 0x40U) +#define EVE_XYLOPHONE ((uint8_t) 0x41U) +#define EVE_TUBA ((uint8_t) 0x42U) +#define EVE_GLOCKENSPIEL ((uint8_t) 0x43U) +#define EVE_ORGAN ((uint8_t) 0x44U) +#define EVE_TRUMPET ((uint8_t) 0x45U) +#define EVE_PIANO ((uint8_t) 0x46U) +#define EVE_CHIMES ((uint8_t) 0x47U) +#define EVE_MUSICBOX ((uint8_t) 0x48U) +#define EVE_BELL ((uint8_t) 0x49U) +#define EVE_CLICK ((uint8_t) 0x50U) +#define EVE_SWITCH ((uint8_t) 0x51U) +#define EVE_COWBELL ((uint8_t) 0x52U) +#define EVE_NOTCH ((uint8_t) 0x53U) +#define EVE_HIHAT ((uint8_t) 0x54U) +#define EVE_KICKDRUM ((uint8_t) 0x55U) +#define EVE_POP ((uint8_t) 0x56U) +#define EVE_CLACK ((uint8_t) 0x57U) +#define EVE_CHACK ((uint8_t) 0x58U) +#define EVE_MUTE ((uint8_t) 0x60U) +#define EVE_UNMUTE ((uint8_t) 0x61U) /* Synthesized sound frequencies, midi note */ -#define EVE_MIDI_A0 21U -#define EVE_MIDI_A_0 22U -#define EVE_MIDI_B0 23U -#define EVE_MIDI_C1 24U -#define EVE_MIDI_C_1 25U -#define EVE_MIDI_D1 26U -#define EVE_MIDI_D_1 27U -#define EVE_MIDI_E1 28U -#define EVE_MIDI_F1 29U -#define EVE_MIDI_F_1 30U -#define EVE_MIDI_G1 31U -#define EVE_MIDI_G_1 32U -#define EVE_MIDI_A1 33U -#define EVE_MIDI_A_1 34U -#define EVE_MIDI_B1 35U -#define EVE_MIDI_C2 36U -#define EVE_MIDI_C_2 37U -#define EVE_MIDI_D2 38U -#define EVE_MIDI_D_2 39U -#define EVE_MIDI_E2 40U -#define EVE_MIDI_F2 41U -#define EVE_MIDI_F_2 42U -#define EVE_MIDI_G2 43U -#define EVE_MIDI_G_2 44U -#define EVE_MIDI_A2 45U -#define EVE_MIDI_A_2 46U -#define EVE_MIDI_B2 47U -#define EVE_MIDI_C3 48U -#define EVE_MIDI_C_3 49U -#define EVE_MIDI_D3 50U -#define EVE_MIDI_D_3 51U -#define EVE_MIDI_E3 52U -#define EVE_MIDI_F3 53U -#define EVE_MIDI_F_3 54U -#define EVE_MIDI_G3 55U -#define EVE_MIDI_G_3 56U -#define EVE_MIDI_A3 57U -#define EVE_MIDI_A_3 58U -#define EVE_MIDI_B3 59U -#define EVE_MIDI_C4 60U -#define EVE_MIDI_C_4 61U -#define EVE_MIDI_D4 62U -#define EVE_MIDI_D_4 63U -#define EVE_MIDI_E4 64U -#define EVE_MIDI_F4 65U -#define EVE_MIDI_F_4 66U -#define EVE_MIDI_G4 67U -#define EVE_MIDI_G_4 68U -#define EVE_MIDI_A4 69U -#define EVE_MIDI_A_4 70U -#define EVE_MIDI_B4 71U -#define EVE_MIDI_C5 72U -#define EVE_MIDI_C_5 73U -#define EVE_MIDI_D5 74U -#define EVE_MIDI_D_5 75U -#define EVE_MIDI_E5 76U -#define EVE_MIDI_F5 77U -#define EVE_MIDI_F_5 78U -#define EVE_MIDI_G5 79U -#define EVE_MIDI_G_5 80U -#define EVE_MIDI_A5 81U -#define EVE_MIDI_A_5 82U -#define EVE_MIDI_B5 83U -#define EVE_MIDI_C6 84U -#define EVE_MIDI_C_6 85U -#define EVE_MIDI_D6 86U -#define EVE_MIDI_D_6 87U -#define EVE_MIDI_E6 88U -#define EVE_MIDI_F6 89U -#define EVE_MIDI_F_6 90U -#define EVE_MIDI_G6 91U -#define EVE_MIDI_G_6 92U -#define EVE_MIDI_A6 93U -#define EVE_MIDI_A_6 94U -#define EVE_MIDI_B6 95U -#define EVE_MIDI_C7 96U -#define EVE_MIDI_C_7 97U -#define EVE_MIDI_D7 98U -#define EVE_MIDI_D_7 99U -#define EVE_MIDI_E7 100U -#define EVE_MIDI_F7 101U -#define EVE_MIDI_F_7 102U -#define EVE_MIDI_G7 103U -#define EVE_MIDI_G_7 104U -#define EVE_MIDI_A7 105U -#define EVE_MIDI_A_7 106U -#define EVE_MIDI_B7 107U -#define EVE_MIDI_C8 108U +#define EVE_MIDI_A0 ((uint8_t) 21U) +#define EVE_MIDI_A_0 ((uint8_t) 22U) +#define EVE_MIDI_B0 ((uint8_t) 23U) +#define EVE_MIDI_C1 ((uint8_t) 24U) +#define EVE_MIDI_C_1 ((uint8_t) 25U) +#define EVE_MIDI_D1 ((uint8_t) 26U) +#define EVE_MIDI_D_1 ((uint8_t) 27U) +#define EVE_MIDI_E1 ((uint8_t) 28U) +#define EVE_MIDI_F1 ((uint8_t) 29U) +#define EVE_MIDI_F_1 ((uint8_t) 30U) +#define EVE_MIDI_G1 ((uint8_t) 31U) +#define EVE_MIDI_G_1 ((uint8_t) 32U) +#define EVE_MIDI_A1 ((uint8_t) 33U) +#define EVE_MIDI_A_1 ((uint8_t) 34U) +#define EVE_MIDI_B1 ((uint8_t) 35U) +#define EVE_MIDI_C2 ((uint8_t) 36U) +#define EVE_MIDI_C_2 ((uint8_t) 37U) +#define EVE_MIDI_D2 ((uint8_t) 38U) +#define EVE_MIDI_D_2 ((uint8_t) 39U) +#define EVE_MIDI_E2 ((uint8_t) 40U) +#define EVE_MIDI_F2 ((uint8_t) 41U) +#define EVE_MIDI_F_2 ((uint8_t) 42U) +#define EVE_MIDI_G2 ((uint8_t) 43U) +#define EVE_MIDI_G_2 ((uint8_t) 44U) +#define EVE_MIDI_A2 ((uint8_t) 45U) +#define EVE_MIDI_A_2 ((uint8_t) 46U) +#define EVE_MIDI_B2 ((uint8_t) 47U) +#define EVE_MIDI_C3 ((uint8_t) 48U) +#define EVE_MIDI_C_3 ((uint8_t) 49U) +#define EVE_MIDI_D3 ((uint8_t) 50U) +#define EVE_MIDI_D_3 ((uint8_t) 51U) +#define EVE_MIDI_E3 ((uint8_t) 52U) +#define EVE_MIDI_F3 ((uint8_t) 53U) +#define EVE_MIDI_F_3 ((uint8_t) 54U) +#define EVE_MIDI_G3 ((uint8_t) 55U) +#define EVE_MIDI_G_3 ((uint8_t) 56U) +#define EVE_MIDI_A3 ((uint8_t) 57U) +#define EVE_MIDI_A_3 ((uint8_t) 58U) +#define EVE_MIDI_B3 ((uint8_t) 59U) +#define EVE_MIDI_C4 ((uint8_t) 60U) +#define EVE_MIDI_C_4 ((uint8_t) 61U) +#define EVE_MIDI_D4 ((uint8_t) 62U) +#define EVE_MIDI_D_4 ((uint8_t) 63U) +#define EVE_MIDI_E4 ((uint8_t) 64U) +#define EVE_MIDI_F4 ((uint8_t) 65U) +#define EVE_MIDI_F_4 ((uint8_t) 66U) +#define EVE_MIDI_G4 ((uint8_t) 67U) +#define EVE_MIDI_G_4 ((uint8_t) 68U) +#define EVE_MIDI_A4 ((uint8_t) 69U) +#define EVE_MIDI_A_4 ((uint8_t) 70U) +#define EVE_MIDI_B4 ((uint8_t) 71U) +#define EVE_MIDI_C5 ((uint8_t) 72U) +#define EVE_MIDI_C_5 ((uint8_t) 73U) +#define EVE_MIDI_D5 ((uint8_t) 74U) +#define EVE_MIDI_D_5 ((uint8_t) 75U) +#define EVE_MIDI_E5 ((uint8_t) 76U) +#define EVE_MIDI_F5 ((uint8_t) 77U) +#define EVE_MIDI_F_5 ((uint8_t) 78U) +#define EVE_MIDI_G5 ((uint8_t) 79U) +#define EVE_MIDI_G_5 ((uint8_t) 80U) +#define EVE_MIDI_A5 ((uint8_t) 81U) +#define EVE_MIDI_A_5 ((uint8_t) 82U) +#define EVE_MIDI_B5 ((uint8_t) 83U) +#define EVE_MIDI_C6 ((uint8_t) 84U) +#define EVE_MIDI_C_6 ((uint8_t) 85U) +#define EVE_MIDI_D6 ((uint8_t) 86U) +#define EVE_MIDI_D_6 ((uint8_t) 87U) +#define EVE_MIDI_E6 ((uint8_t) 88U) +#define EVE_MIDI_F6 ((uint8_t) 89U) +#define EVE_MIDI_F_6 ((uint8_t) 90U) +#define EVE_MIDI_G6 ((uint8_t) 91U) +#define EVE_MIDI_G_6 ((uint8_t) 92U) +#define EVE_MIDI_A6 ((uint8_t) 93U) +#define EVE_MIDI_A_6 ((uint8_t) 94U) +#define EVE_MIDI_B6 ((uint8_t) 95U) +#define EVE_MIDI_C7 ((uint8_t) 96U) +#define EVE_MIDI_C_7 ((uint8_t) 97U) +#define EVE_MIDI_D7 ((uint8_t) 98U) +#define EVE_MIDI_D_7 ((uint8_t) 99U) +#define EVE_MIDI_E7 ((uint8_t) 100U) +#define EVE_MIDI_F7 ((uint8_t) 101U) +#define EVE_MIDI_F_7 ((uint8_t) 102U) +#define EVE_MIDI_G7 ((uint8_t) 103U) +#define EVE_MIDI_G_7 ((uint8_t) 104U) +#define EVE_MIDI_A7 ((uint8_t) 105U) +#define EVE_MIDI_A_7 ((uint8_t) 106U) +#define EVE_MIDI_B7 ((uint8_t) 107U) +#define EVE_MIDI_C8 ((uint8_t) 108U) /* GPIO bits */ -#define EVE_GPIO0 0U -#define EVE_GPIO1 1U /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ -#define EVE_GPIO7 7U /* default gpio pin for display enable, 1 - enable, 0 - disable */ +#define EVE_GPIO0 ((uint8_t) 0U) +#define EVE_GPIO1 ((uint8_t) 1U) /* default gpio pin for audio shutdown, 1 - enable, 0 - disable */ +#define EVE_GPIO7 ((uint8_t) 7U) /* default gpio pin for display enable, 1 - enable, 0 - disable */ /* Display rotation */ -#define EVE_DISPLAY_0 0U /* 0 degrees rotation */ -#define EVE_DISPLAY_180 1U /* 180 degrees rotation */ +#define EVE_DISPLAY_0 ((uint8_t) 0U) /* 0 degrees rotation */ +#define EVE_DISPLAY_180 ((uint8_t) 1U) /* 180 degrees rotation */ /* Commands */ -#define CMD_APPEND 0xFFFFFF1EUL -#define CMD_BGCOLOR 0xFFFFFF09UL -#define CMD_BUTTON 0xFFFFFF0DUL -#define CMD_CALIBRATE 0xFFFFFF15UL -#define CMD_CLOCK 0xFFFFFF14UL -#define CMD_COLDSTART 0xFFFFFF32UL -#define CMD_DIAL 0xFFFFFF2DUL -#define CMD_DLSTART 0xFFFFFF00UL -#define CMD_FGCOLOR 0xFFFFFF0AUL -#define CMD_GAUGE 0xFFFFFF13UL -#define CMD_GETMATRIX 0xFFFFFF33UL -#define CMD_GETPROPS 0xFFFFFF25UL -#define CMD_GETPTR 0xFFFFFF23UL -#define CMD_GRADCOLOR 0xFFFFFF34UL -#define CMD_GRADIENT 0xFFFFFF0BUL -#define CMD_INFLATE 0xFFFFFF22UL -#define CMD_INTERRUPT 0xFFFFFF02UL -#define CMD_KEYS 0xFFFFFF0EUL -#define CMD_LOADIDENTITY 0xFFFFFF26UL -#define CMD_LOADIMAGE 0xFFFFFF24UL -#define CMD_LOGO 0xFFFFFF31UL -#define CMD_MEDIAFIFO 0xFFFFFF39UL -#define CMD_MEMCPY 0xFFFFFF1DUL -#define CMD_MEMCRC 0xFFFFFF18UL -#define CMD_MEMSET 0xFFFFFF1BUL -#define CMD_MEMWRITE 0xFFFFFF1AUL -#define CMD_MEMZERO 0xFFFFFF1CUL -#define CMD_NUMBER 0xFFFFFF2EUL -#define CMD_PLAYVIDEO 0xFFFFFF3AUL -#define CMD_PROGRESS 0xFFFFFF0FUL -#define CMD_REGREAD 0xFFFFFF19UL -#define CMD_ROMFONT 0xFFFFFF3FUL -#define CMD_ROTATE 0xFFFFFF29UL -#define CMD_SCALE 0xFFFFFF28UL -#define CMD_SCREENSAVER 0xFFFFFF2FUL -#define CMD_SCROLLBAR 0xFFFFFF11UL -#define CMD_SETBASE 0xFFFFFF38UL -#define CMD_SETBITMAP 0xFFFFFF43UL -#define CMD_SETFONT 0xFFFFFF2BUL -#define CMD_SETFONT2 0xFFFFFF3BUL -#define CMD_SETMATRIX 0xFFFFFF2AUL -#define CMD_SETROTATE 0xFFFFFF36UL -#define CMD_SETSCRATCH 0xFFFFFF3CUL -#define CMD_SKETCH 0xFFFFFF30UL -#define CMD_SLIDER 0xFFFFFF10UL -#define CMD_SNAPSHOT 0xFFFFFF1FUL -#define CMD_SNAPSHOT2 0xFFFFFF37UL -#define CMD_SPINNER 0xFFFFFF16UL -#define CMD_STOP 0xFFFFFF17UL -#define CMD_SWAP 0xFFFFFF01UL -#define CMD_TEXT 0xFFFFFF0CUL -#define CMD_TOGGLE 0xFFFFFF12UL -#define CMD_TRACK 0xFFFFFF2CUL -#define CMD_TRANSLATE 0xFFFFFF27UL -#define CMD_VIDEOFRAME 0xFFFFFF41UL -#define CMD_VIDEOSTART 0xFFFFFF40UL +#define CMD_APPEND ((uint32_t) 0xFFFFFF1EUL) +#define CMD_BGCOLOR ((uint32_t) 0xFFFFFF09UL) +#define CMD_BUTTON ((uint32_t) 0xFFFFFF0DUL) +#define CMD_CALIBRATE ((uint32_t) 0xFFFFFF15UL) +#define CMD_CLOCK ((uint32_t) 0xFFFFFF14UL) +#define CMD_COLDSTART ((uint32_t) 0xFFFFFF32UL) +#define CMD_DIAL ((uint32_t) 0xFFFFFF2DUL) +#define CMD_DLSTART ((uint32_t) 0xFFFFFF00UL) +#define CMD_FGCOLOR ((uint32_t) 0xFFFFFF0AUL) +#define CMD_GAUGE ((uint32_t) 0xFFFFFF13UL) +#define CMD_GETMATRIX ((uint32_t) 0xFFFFFF33UL) +#define CMD_GETPROPS ((uint32_t) 0xFFFFFF25UL) +#define CMD_GETPTR ((uint32_t) 0xFFFFFF23UL) +#define CMD_GRADCOLOR ((uint32_t) 0xFFFFFF34UL) +#define CMD_GRADIENT ((uint32_t) 0xFFFFFF0BUL) +#define CMD_INFLATE ((uint32_t) 0xFFFFFF22UL) +#define CMD_INTERRUPT ((uint32_t) 0xFFFFFF02UL) +#define CMD_KEYS ((uint32_t) 0xFFFFFF0EUL) +#define CMD_LOADIDENTITY ((uint32_t) 0xFFFFFF26UL) +#define CMD_LOADIMAGE ((uint32_t) 0xFFFFFF24UL) +#define CMD_LOGO ((uint32_t) 0xFFFFFF31UL) +#define CMD_MEDIAFIFO ((uint32_t) 0xFFFFFF39UL) +#define CMD_MEMCPY ((uint32_t) 0xFFFFFF1DUL) +#define CMD_MEMCRC ((uint32_t) 0xFFFFFF18UL) +#define CMD_MEMSET ((uint32_t) 0xFFFFFF1BUL) +#define CMD_MEMWRITE ((uint32_t) 0xFFFFFF1AUL) +#define CMD_MEMZERO ((uint32_t) 0xFFFFFF1CUL) +#define CMD_NUMBER ((uint32_t) 0xFFFFFF2EUL) +#define CMD_PLAYVIDEO ((uint32_t) 0xFFFFFF3AUL) +#define CMD_PROGRESS ((uint32_t) 0xFFFFFF0FUL) +#define CMD_REGREAD ((uint32_t) 0xFFFFFF19UL) +#define CMD_ROMFONT ((uint32_t) 0xFFFFFF3FUL) +#define CMD_ROTATE ((uint32_t) 0xFFFFFF29UL) +#define CMD_SCALE ((uint32_t) 0xFFFFFF28UL) +#define CMD_SCREENSAVER ((uint32_t) 0xFFFFFF2FUL) +#define CMD_SCROLLBAR ((uint32_t) 0xFFFFFF11UL) +#define CMD_SETBASE ((uint32_t) 0xFFFFFF38UL) +#define CMD_SETBITMAP ((uint32_t) 0xFFFFFF43UL) +#define CMD_SETFONT ((uint32_t) 0xFFFFFF2BUL) +#define CMD_SETFONT2 ((uint32_t) 0xFFFFFF3BUL) +#define CMD_SETMATRIX ((uint32_t) 0xFFFFFF2AUL) +#define CMD_SETROTATE ((uint32_t) 0xFFFFFF36UL) +#define CMD_SETSCRATCH ((uint32_t) 0xFFFFFF3CUL) +#define CMD_SKETCH ((uint32_t) 0xFFFFFF30UL) +#define CMD_SLIDER ((uint32_t) 0xFFFFFF10UL) +#define CMD_SNAPSHOT ((uint32_t) 0xFFFFFF1FUL) +#define CMD_SNAPSHOT2 ((uint32_t) 0xFFFFFF37UL) +#define CMD_SPINNER ((uint32_t) 0xFFFFFF16UL) +#define CMD_STOP ((uint32_t) 0xFFFFFF17UL) +#define CMD_SWAP ((uint32_t) 0xFFFFFF01UL) +#define CMD_TEXT ((uint32_t) 0xFFFFFF0CUL) +#define CMD_TOGGLE ((uint32_t) 0xFFFFFF12UL) +#define CMD_TRACK ((uint32_t) 0xFFFFFF2CUL) +#define CMD_TRANSLATE ((uint32_t) 0xFFFFFF27UL) +#define CMD_VIDEOFRAME ((uint32_t) 0xFFFFFF41UL) +#define CMD_VIDEOSTART ((uint32_t) 0xFFFFFF40UL) /* Registers */ -#define REG_ANA_COMP 0x00302184UL /* only listed in datasheet */ -#define REG_BIST_EN 0x00302174UL /* only listed in datasheet */ -#define REG_CLOCK 0x00302008UL -#define REG_CMDB_SPACE 0x00302574UL -#define REG_CMDB_WRITE 0x00302578UL -#define REG_CMD_DL 0x00302100UL -#define REG_CMD_READ 0x003020f8UL -#define REG_CMD_WRITE 0x003020fcUL -#define REG_CPURESET 0x00302020UL -#define REG_CSPREAD 0x00302068UL -#define REG_CTOUCH_EXTENDED 0x00302108UL -#define REG_CTOUCH_TOUCH0_XY 0x00302124UL /* only listed in datasheet */ -#define REG_CTOUCH_TOUCH4_X 0x0030216cUL -#define REG_CTOUCH_TOUCH4_Y 0x00302120UL -#define REG_CTOUCH_TOUCH1_XY 0x0030211cUL -#define REG_CTOUCH_TOUCH2_XY 0x0030218cUL -#define REG_CTOUCH_TOUCH3_XY 0x00302190UL -#define REG_TOUCH_CONFIG 0x00302168UL -#define REG_DATESTAMP 0x00302564UL /* only listed in datasheet */ -#define REG_DITHER 0x00302060UL -#define REG_DLSWAP 0x00302054UL -#define REG_FRAMES 0x00302004UL -#define REG_FREQUENCY 0x0030200cUL -#define REG_GPIO 0x00302094UL -#define REG_GPIOX 0x0030209cUL -#define REG_GPIOX_DIR 0x00302098UL -#define REG_GPIO_DIR 0x00302090UL -#define REG_HCYCLE 0x0030202cUL -#define REG_HOFFSET 0x00302030UL -#define REG_HSIZE 0x00302034UL -#define REG_HSYNC0 0x00302038UL -#define REG_HSYNC1 0x0030203cUL -#define REG_ID 0x00302000UL -#define REG_INT_EN 0x003020acUL -#define REG_INT_FLAGS 0x003020a8UL -#define REG_INT_MASK 0x003020b0UL -#define REG_MACRO_0 0x003020d8UL -#define REG_MACRO_1 0x003020dcUL -#define REG_MEDIAFIFO_READ 0x00309014UL /* only listed in programmers guide */ -#define REG_MEDIAFIFO_WRITE 0x00309018UL /* only listed in programmers guide */ -#define REG_OUTBITS 0x0030205cUL -#define REG_PCLK 0x00302070UL -#define REG_PCLK_POL 0x0030206cUL -#define REG_PLAY 0x0030208cUL -#define REG_PLAYBACK_FORMAT 0x003020c4UL -#define REG_PLAYBACK_FREQ 0x003020c0UL -#define REG_PLAYBACK_LENGTH 0x003020b8UL -#define REG_PLAYBACK_LOOP 0x003020c8UL -#define REG_PLAYBACK_PLAY 0x003020ccUL -#define REG_PLAYBACK_READPTR 0x003020bcUL -#define REG_PLAYBACK_START 0x003020b4UL -#define REG_PWM_DUTY 0x003020d4UL -#define REG_PWM_HZ 0x003020d0UL -#define REG_RENDERMODE 0x00302010UL /* only listed in datasheet */ -#define REG_ROTATE 0x00302058UL -#define REG_SNAPFORMAT 0x0030201cUL /* only listed in datasheet */ -#define REG_SNAPSHOT 0x00302018UL /* only listed in datasheet */ -#define REG_SNAPY 0x00302014UL /* only listed in datasheet */ -#define REG_SOUND 0x00302088UL -#define REG_SPI_WIDTH 0x00302188UL /* listed with false offset in programmers guide V1.1 */ -#define REG_SWIZZLE 0x00302064UL -#define REG_TAG 0x0030207cUL -#define REG_TAG_X 0x00302074UL -#define REG_TAG_Y 0x00302078UL -#define REG_TAP_CRC 0x00302024UL /* only listed in datasheet */ -#define REG_TAP_MASK 0x00302028UL /* only listed in datasheet */ -#define REG_TOUCH_ADC_MODE 0x00302108UL -#define REG_TOUCH_CHARGE 0x0030210cUL -#define REG_TOUCH_DIRECT_XY 0x0030218cUL -#define REG_TOUCH_DIRECT_Z1Z2 0x00302190UL -#define REG_TOUCH_MODE 0x00302104UL -#define REG_TOUCH_OVERSAMPLE 0x00302114UL -#define REG_TOUCH_RAW_XY 0x0030211cUL -#define REG_TOUCH_RZ 0x00302120UL -#define REG_TOUCH_RZTHRESH 0x00302118UL -#define REG_TOUCH_SCREEN_XY 0x00302124UL -#define REG_TOUCH_SETTLE 0x00302110UL -#define REG_TOUCH_TAG 0x0030212cUL -#define REG_TOUCH_TAG1 0x00302134UL /* only listed in datasheet */ -#define REG_TOUCH_TAG1_XY 0x00302130UL /* only listed in datasheet */ -#define REG_TOUCH_TAG2 0x0030213cUL /* only listed in datasheet */ -#define REG_TOUCH_TAG2_XY 0x00302138UL /* only listed in datasheet */ -#define REG_TOUCH_TAG3 0x00302144UL /* only listed in datasheet */ -#define REG_TOUCH_TAG3_XY 0x00302140UL /* only listed in datasheet */ -#define REG_TOUCH_TAG4 0x0030214cUL /* only listed in datasheet */ -#define REG_TOUCH_TAG4_XY 0x00302148UL /* only listed in datasheet */ -#define REG_TOUCH_TAG_XY 0x00302128UL -#define REG_TOUCH_TRANSFORM_A 0x00302150UL -#define REG_TOUCH_TRANSFORM_B 0x00302154UL -#define REG_TOUCH_TRANSFORM_C 0x00302158UL -#define REG_TOUCH_TRANSFORM_D 0x0030215cUL -#define REG_TOUCH_TRANSFORM_E 0x00302160UL -#define REG_TOUCH_TRANSFORM_F 0x00302164UL -#define REG_TRACKER 0x00309000UL /* only listed in programmers guide */ -#define REG_TRACKER_1 0x00309004UL /* only listed in programmers guide */ -#define REG_TRACKER_2 0x00309008UL /* only listed in programmers guide */ -#define REG_TRACKER_3 0x0030900cUL /* only listed in programmers guide */ -#define REG_TRACKER_4 0x00309010UL /* only listed in programmers guide */ -#define REG_TRIM 0x00302180UL -#define REG_VCYCLE 0x00302040UL -#define REG_VOFFSET 0x00302044UL -#define REG_VOL_PB 0x00302080UL -#define REG_VOL_SOUND 0x00302084UL -#define REG_VSIZE 0x00302048UL -#define REG_VSYNC0 0x0030204cUL -#define REG_VSYNC1 0x00302050UL +#define REG_ANA_COMP ((uint32_t) 0x00302184UL) /* only listed in datasheet */ +#define REG_BIST_EN ((uint32_t) 0x00302174UL) /* only listed in datasheet */ +#define REG_CLOCK ((uint32_t) 0x00302008UL) +#define REG_CMDB_SPACE ((uint32_t) 0x00302574UL) +#define REG_CMDB_WRITE ((uint32_t) 0x00302578UL) +#define REG_CMD_DL ((uint32_t) 0x00302100UL) +#define REG_CMD_READ ((uint32_t) 0x003020f8UL) +#define REG_CMD_WRITE ((uint32_t) 0x003020fcUL) +#define REG_CPURESET ((uint32_t) 0x00302020UL) +#define REG_CSPREAD ((uint32_t) 0x00302068UL) +#define REG_CTOUCH_EXTENDED ((uint32_t) 0x00302108UL) +#define REG_CTOUCH_TOUCH0_XY ((uint32_t) 0x00302124UL) /* only listed in datasheet */ +#define REG_CTOUCH_TOUCH4_X ((uint32_t) 0x0030216cUL) +#define REG_CTOUCH_TOUCH4_Y ((uint32_t) 0x00302120UL) +#define REG_CTOUCH_TOUCH1_XY ((uint32_t) 0x0030211cUL) +#define REG_CTOUCH_TOUCH2_XY ((uint32_t) 0x0030218cUL) +#define REG_CTOUCH_TOUCH3_XY ((uint32_t) 0x00302190UL) +#define REG_TOUCH_CONFIG ((uint32_t) 0x00302168UL) +#define REG_DATESTAMP ((uint32_t) 0x00302564UL) /* only listed in datasheet */ +#define REG_DITHER ((uint32_t) 0x00302060UL) +#define REG_DLSWAP ((uint32_t) 0x00302054UL) +#define REG_FRAMES ((uint32_t) 0x00302004UL) +#define REG_FREQUENCY ((uint32_t) 0x0030200cUL) +#define REG_GPIO ((uint32_t) 0x00302094UL) +#define REG_GPIOX ((uint32_t) 0x0030209cUL) +#define REG_GPIOX_DIR ((uint32_t) 0x00302098UL) +#define REG_GPIO_DIR ((uint32_t) 0x00302090UL) +#define REG_HCYCLE ((uint32_t) 0x0030202cUL) +#define REG_HOFFSET ((uint32_t) 0x00302030UL) +#define REG_HSIZE ((uint32_t) 0x00302034UL) +#define REG_HSYNC0 ((uint32_t) 0x00302038UL) +#define REG_HSYNC1 ((uint32_t) 0x0030203cUL) +#define REG_ID ((uint32_t) 0x00302000UL) +#define REG_INT_EN ((uint32_t) 0x003020acUL) +#define REG_INT_FLAGS ((uint32_t) 0x003020a8UL) +#define REG_INT_MASK ((uint32_t) 0x003020b0UL) +#define REG_MACRO_0 ((uint32_t) 0x003020d8UL) +#define REG_MACRO_1 ((uint32_t) 0x003020dcUL) +#define REG_MEDIAFIFO_READ ((uint32_t) 0x00309014UL) /* only listed in programmers guide */ +#define REG_MEDIAFIFO_WRITE ((uint32_t) 0x00309018UL) /* only listed in programmers guide */ +#define REG_OUTBITS ((uint32_t) 0x0030205cUL) +#define REG_PCLK ((uint32_t) 0x00302070UL) +#define REG_PCLK_POL ((uint32_t) 0x0030206cUL) +#define REG_PLAY ((uint32_t) 0x0030208cUL) +#define REG_PLAYBACK_FORMAT ((uint32_t) 0x003020c4UL) +#define REG_PLAYBACK_FREQ ((uint32_t) 0x003020c0UL) +#define REG_PLAYBACK_LENGTH ((uint32_t) 0x003020b8UL) +#define REG_PLAYBACK_LOOP ((uint32_t) 0x003020c8UL) +#define REG_PLAYBACK_PLAY ((uint32_t) 0x003020ccUL) +#define REG_PLAYBACK_READPTR ((uint32_t) 0x003020bcUL) +#define REG_PLAYBACK_START ((uint32_t) 0x003020b4UL) +#define REG_PWM_DUTY ((uint32_t) 0x003020d4UL) +#define REG_PWM_HZ ((uint32_t) 0x003020d0UL) +#define REG_RENDERMODE ((uint32_t) 0x00302010UL) /* only listed in datasheet */ +#define REG_ROTATE ((uint32_t) 0x00302058UL) +#define REG_SNAPFORMAT ((uint32_t) 0x0030201cUL) /* only listed in datasheet */ +#define REG_SNAPSHOT ((uint32_t) 0x00302018UL) /* only listed in datasheet */ +#define REG_SNAPY ((uint32_t) 0x00302014UL) /* only listed in datasheet */ +#define REG_SOUND ((uint32_t) 0x00302088UL) +#define REG_SPI_WIDTH ((uint32_t) 0x00302188UL) /* listed with false offset in programmers guide V1.1 */ +#define REG_SWIZZLE ((uint32_t) 0x00302064UL) +#define REG_TAG ((uint32_t) 0x0030207cUL) +#define REG_TAG_X ((uint32_t) 0x00302074UL) +#define REG_TAG_Y ((uint32_t) 0x00302078UL) +#define REG_TAP_CRC ((uint32_t) 0x00302024UL) /* only listed in datasheet */ +#define REG_TAP_MASK ((uint32_t) 0x00302028UL) /* only listed in datasheet */ +#define REG_TOUCH_ADC_MODE ((uint32_t) 0x00302108UL) +#define REG_TOUCH_CHARGE ((uint32_t) 0x0030210cUL) +#define REG_TOUCH_DIRECT_XY ((uint32_t) 0x0030218cUL) +#define REG_TOUCH_DIRECT_Z1Z2 ((uint32_t) 0x00302190UL) +#define REG_TOUCH_MODE ((uint32_t) 0x00302104UL) +#define REG_TOUCH_OVERSAMPLE ((uint32_t) 0x00302114UL) +#define REG_TOUCH_RAW_XY ((uint32_t) 0x0030211cUL) +#define REG_TOUCH_RZ ((uint32_t) 0x00302120UL) +#define REG_TOUCH_RZTHRESH ((uint32_t) 0x00302118UL) +#define REG_TOUCH_SCREEN_XY ((uint32_t) 0x00302124UL) +#define REG_TOUCH_SETTLE ((uint32_t) 0x00302110UL) +#define REG_TOUCH_TAG ((uint32_t) 0x0030212cUL) +#define REG_TOUCH_TAG1 ((uint32_t) 0x00302134UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG1_XY ((uint32_t) 0x00302130UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG2 ((uint32_t) 0x0030213cUL) /* only listed in datasheet */ +#define REG_TOUCH_TAG2_XY ((uint32_t) 0x00302138UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG3 ((uint32_t) 0x00302144UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG3_XY ((uint32_t) 0x00302140UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG4 ((uint32_t) 0x0030214cUL)/* only listed in datasheet */ +#define REG_TOUCH_TAG4_XY ((uint32_t) 0x00302148UL) /* only listed in datasheet */ +#define REG_TOUCH_TAG_XY ((uint32_t) 0x00302128UL) +#define REG_TOUCH_TRANSFORM_A ((uint32_t) 0x00302150UL) +#define REG_TOUCH_TRANSFORM_B ((uint32_t) 0x00302154UL) +#define REG_TOUCH_TRANSFORM_C ((uint32_t) 0x00302158UL) +#define REG_TOUCH_TRANSFORM_D ((uint32_t) 0x0030215cUL) +#define REG_TOUCH_TRANSFORM_E ((uint32_t) 0x00302160UL) +#define REG_TOUCH_TRANSFORM_F ((uint32_t) 0x00302164UL) +#define REG_TRACKER ((uint32_t) 0x00309000UL) /* only listed in programmers guide */ +#define REG_TRACKER_1 ((uint32_t) 0x00309004UL) /* only listed in programmers guide */ +#define REG_TRACKER_2 ((uint32_t) 0x00309008UL) /* only listed in programmers guide */ +#define REG_TRACKER_3 ((uint32_t) 0x0030900cUL) /* only listed in programmers guide */ +#define REG_TRACKER_4 ((uint32_t) 0x00309010UL) /* only listed in programmers guide */ +#define REG_TRIM ((uint32_t) 0x00302180UL) +#define REG_VCYCLE ((uint32_t) 0x00302040UL) +#define REG_VOFFSET ((uint32_t) 0x00302044UL) +#define REG_VOL_PB ((uint32_t) 0x00302080UL) +#define REG_VOL_SOUND ((uint32_t) 0x00302084UL) +#define REG_VSIZE ((uint32_t) 0x00302048UL) +#define REG_VSYNC0 ((uint32_t) 0x0030204cUL) +#define REG_VSYNC1 ((uint32_t) 0x00302050UL) /* Macros for static display list generation */ -#define ALPHA_FUNC(func,ref) ((DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) -#define BITMAP_HANDLE(handle) ((DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) -#define BITMAP_LAYOUT(format,linestride,height) ((DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) -#define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) -/* beware, this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits */ -#define BITMAP_LAYOUT_H(linestride,height) ((DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +//#define ALPHA_FUNC(func,ref) ((DL_ALPHA_FUNC) | (((func) & 7UL) << 8U) | ((ref) & 0xFFUL)) +/** + * @brief Set the alpha test function. + * + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t ALPHA_FUNC(uint8_t func, uint8_t ref) +{ + uint32_t const funcv = ((uint32_t) func & 7U) << 8U; + return (DL_ALPHA_FUNC | funcv | ref); +} -/* beware, this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits */ -#define BITMAP_SIZE_H(width,height) ((DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +//#define BITMAP_HANDLE(handle) ((DL_BITMAP_HANDLE) | ((handle) & 0x1FUL)) +/** + * @brief Set the bitmap handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_HANDLE(uint8_t handle) +{ + return (DL_BITMAP_HANDLE | ((handle) & 0x1FUL)); +} -#define BITMAP_SOURCE(addr) ((DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +//#define BITMAP_LAYOUT(format,linestride,height) ((DL_BITMAP_LAYOUT) | (((format) & 0x1FUL) << 19U) | (((linestride) & 0x3FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint8_t height) +{ + uint32_t const formatv = ((uint32_t) format & 0x1FUL) << 19U; + uint32_t const linestridev = ((uint32_t) linestride & 0x3FFUL) << 9U; + return (DL_BITMAP_LAYOUT | formatv | linestridev | height); +} + +//#define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((DL_BITMAP_SIZE) | (((filter) & 1UL) << 20U) | (((wrapx) & 1UL) << 19U) | (((wrapy) & 1UL) << 18U) | (((width) & 0x1FFUL) << 9U) | ((height) & 0x1FFUL)) +/** + * @brief Set the source bitmap memory format and layout for the current handle. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) +{ + uint32_t const filterv = (filter & 0x1UL) << 20U; + uint32_t const wrapxv = (wrapx & 0x1UL) << 19U; + uint32_t const wrapyv = (wrapy & 0x1UL) << 18U; + uint32_t const widthv = (width & 0x1FFUL) << 9U; + uint32_t const heightv = (height & 0x1FFUL) << 9U; + return (DL_BITMAP_SIZE | filterv | wrapxv | wrapyv | widthv | heightv); +} + +//#define BITMAP_LAYOUT_H(linestride,height) ((DL_BITMAP_LAYOUT_H) | (((((linestride) & 0xC00U) >> 10U)&3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of the source bitmap memory format and layout for the current handle. + * @param linestride 12-bit value specified to BITMAP_LAYOUT + * @param height 11-bit value specified to BITMAP_LAYOUT + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_LAYOUT_H(uint16_t linestride, uint16_t height) +{ + uint32_t const linestridev = (uint32_t) ((((linestride & 0xC00U) >> 10U) &3UL) << 2U); + uint32_t const heightv = (uint32_t) (((height & 0x600U) >> 9U) & 3UL); + return (DL_BITMAP_LAYOUT_H | linestridev | heightv); +} + +//#define BITMAP_SIZE_H(width,height) ((DL_BITMAP_SIZE_H) | (((((width) & 0x600U) >> 9U) & 3UL) << 2U) | ((((height) & 0x600U) >> 9U) & 3UL)) +/** + * @brief Set the 2 most significant bits of bitmaps dimension for the current handle. + * @param linestride 11-bit value of bitmap width, the 2 most significant bits are used + * @param height 11-bit value of bitmap width, the 2 most significant bits are used + * @note this is different to FTDIs implementation as this takes the original values as parameters and not only the upper bits + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SIZE_H(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t) ((((width & 0x600U) >> 9U) & 3UL) << 2U); + uint32_t const heightv = (uint32_t) (((height & 0x600U) >> 9U) & 3UL); + return ((DL_BITMAP_SIZE_H) | widthv | heightv); +} + +//#define BITMAP_SOURCE(addr) ((DL_BITMAP_SOURCE) | ((addr) & 0x3FFFFFUL)) +/** + * @brief Set the source address of bitmap data in RAM_G or flash memory. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SOURCE(uint32_t addr) +{ + return (DL_BITMAP_SOURCE | (addr & 0x3FFFFFUL)); +} #if EVE_GEN < 3 /* only define these for FT81x */ -#define BITMAP_TRANSFORM_A(a) ((DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_B(b) ((DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_D(d) ((DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_E(e) ((DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +//#define BITMAP_TRANSFORM_A(a) ((DL_BITMAP_TRANSFORM_A) | ((a) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_A(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_A | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_B(b) ((DL_BITMAP_TRANSFORM_B) | ((b) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_B(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_B | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_D(d) ((DL_BITMAP_TRANSFORM_D) | ((d) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_D(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_D | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_E(e) ((DL_BITMAP_TRANSFORM_E) | ((e) & 0x1FFFFUL)) +/** + * @brief Set he E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_E(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_E | (val & 0x1FFFFUL)); +} + #endif -#define BITMAP_TRANSFORM_C(c) ((DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_F(f) ((DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) - -#define BLEND_FUNC(src,dst) ((DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) -#define CALL(dest) ((DL_CALL) | ((dest) & 0xFFFFUL)) -#define CELL(cell) ((DL_CELL) | ((cell) & 0x7FUL)) -#define CLEAR(c,s,t) ((DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) -#define CLEAR_COLOR_A(alpha) ((DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) -#define CLEAR_COLOR_RGB(red,green,blue) ((DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -#define CLEAR_STENCIL(s) ((DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) -#define CLEAR_TAG(s) ((DL_CLEAR_TAG) | ((s) & 0xFFUL)) -#define COLOR_A(alpha) ((DL_COLOR_A) | ((alpha) & 0xFFUL)) -#define COLOR_MASK(r,g,b,a) ((DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) -#define COLOR_RGB(red,green,blue) ((DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) -#define JUMP(dest) ((DL_JUMP) | ((dest) & 0xFFFFUL)) -#define LINE_WIDTH(width) ((DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) -#define MACRO(m) ((DL_MACRO) | ((m) & 1UL)) -#define PALETTE_SOURCE(addr) ((DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) -#define POINT_SIZE(size) ((DL_POINT_SIZE) | ((size) & 0x1FFFUL)) -#define SCISSOR_SIZE(width,height) ((DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) -#define SCISSOR_XY(x,y) ((DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) -#define STENCIL_FUNC(func,ref,mask) ((DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) -#define STENCIL_MASK(mask) ((DL_STENCIL_MASK) | ((mask) & 0xFFUL)) -#define STENCIL_OP(sfail,spass) ((DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) -#define TAG(s) ((DL_TAG) | ((s) & 0xFFUL)) -#define TAG_MASK(mask) ((DL_TAG_MASK) | ((mask) & 1UL)) -#define VERTEX2F(x,y) ((DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) -#define VERTEX2II(x,y,handle,cell) ((DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) -#define VERTEX_FORMAT(frac) ((DL_VERTEX_FORMAT) | ((frac) & 7UL)) -#define VERTEX_TRANSLATE_X(x) ((DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) -#define VERTEX_TRANSLATE_Y(y) ((DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +//#define BITMAP_TRANSFORM_C(c) ((DL_BITMAP_TRANSFORM_C) | ((c) & 0x1FFFFUL)) +/** + * @brief Set the C coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_C(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_C | (val & 0x1FFFFUL)); +} + +//#define BITMAP_TRANSFORM_F(f) ((DL_BITMAP_TRANSFORM_F) | ((f) & 0x1FFFFUL)) +/** + * @brief Set the F coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_F(uint32_t val) +{ + return (DL_BITMAP_TRANSFORM_F | (val & 0x1FFFFUL)); +} + +//#define BLEND_FUNC(src,dst) ((DL_BLEND_FUNC) | (((src) & 7UL) << 3U) | ((dst) & 7UL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BLEND_FUNC(uint8_t src, uint8_t dst) +{ + uint32_t const srcv = (uint32_t) ((src & 7UL) << 3U); + uint32_t const dstv = (uint32_t) (dst & 7UL); + return (DL_BLEND_FUNC | srcv | dstv); +} + +//#define CALL(dest) ((DL_CALL) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute a sequence of commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CALL(uint16_t dest) +{ + return (DL_CALL | (dest & 0x7FFUL)); +} + +//#define JUMP(dest) ((DL_JUMP) | ((dest) & 0xFFFFUL)) +/** + * @brief Execute commands at another location in the display list. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t JUMP(uint16_t dest) +{ + return (DL_JUMP | (dest & 0x7FFUL)); +} + +//#define CELL(cell) ((DL_CELL) | ((cell) & 0x7FUL)) +/** + * @brief Set the bitmap cell number for the VERTEX2F command. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CELL(uint8_t cell) +{ + return (DL_CELL | (cell & 0x7FUL)); +} + +//#define CLEAR(c,s,t) ((DL_CLEAR) | (((c) & 1UL) << 2U) | (((s) & 1UL) << 1U) | ((t) & 1UL)) +/** + * @brief Clear buffers to preset values. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR(uint8_t color, uint8_t stencil, uint8_t tag) +{ + uint32_t const colorv = (color & 1UL) << 2U; + uint32_t const stencilv = (stencil & 1UL) << 1U; + uint32_t const tagv = (tag & 1UL); + return (DL_CLEAR | colorv | stencilv | tagv); +} + +//#define CLEAR_COLOR_A(alpha) ((DL_CLEAR_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set clear value for the alpha channel. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_COLOR_A(uint8_t alpha) +{ + return (DL_CLEAR_COLOR_A | alpha); +} + +//#define CLEAR_COLOR_RGB(red,green,blue) ((DL_CLEAR_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set clear values for red, green and blue channels. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (DL_CLEAR_COLOR_RGB | redv | greenv | bluev); +} + +//#define CLEAR_STENCIL(s) ((DL_CLEAR_STENCIL) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the stencil buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_STENCIL(uint8_t val) +{ + return (DL_CLEAR_STENCIL | val); +} + +//#define CLEAR_TAG(s) ((DL_CLEAR_TAG) | ((s) & 0xFFUL)) +/** + * @brief Set clear value for the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t CLEAR_TAG(uint8_t val) +{ + return (DL_CLEAR_TAG | val); +} + +//#define COLOR_A(alpha) ((DL_COLOR_A) | ((alpha) & 0xFFUL)) +/** + * @brief Set the current color alpha. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_A(uint8_t alpha) +{ + return (DL_COLOR_A | alpha); +} + +//#define COLOR_MASK(r,g,b,a) ((DL_COLOR_MASK) | (((r) & 1UL) << 3U) | (((g) & 1UL) << 2U) | (((b) & 1UL) << 1U) | ((a) & 1UL)) +/** + * @brief Enable or disable writing of color components. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_MASK(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 1UL) << 3U); + uint32_t const greenv = ((green & 1UL) << 2U); + uint32_t const bluev = ((blue & 1UL) << 1U); + uint32_t const alphav = (alpha & 1UL); + return (DL_COLOR_MASK | redv | greenv | bluev | alphav); +} + +//#define COLOR_RGB(red,green,blue) ((DL_COLOR_RGB) | (((red) & 0xFFUL) << 16U) | (((green) & 0xFFUL) << 8U) | ((blue) & 0xFFUL)) +/** + * @brief Set the current color red, green and blue. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) +{ + uint32_t const redv = ((red & 0xFFUL) << 16U); + uint32_t const greenv = ((green & 0xFFUL) << 8U); + uint32_t const bluev = (blue & 0xFFUL); + return (DL_COLOR_RGB | redv | greenv | bluev); +} + +//#define LINE_WIDTH(width) ((DL_LINE_WIDTH) | (((uint32_t) (width)) & 0xFFFUL)) +/** + * @brief Set the width of lines to be drawn with primitive LINES in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t LINE_WIDTH(uint16_t width) +{ + return (DL_LINE_WIDTH | (width & 0xFFFUL)); +} + +//#define MACRO(m) ((DL_MACRO) | ((m) & 1UL)) +/** + * @brief Execute a single command from a macro register. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t MACRO(uint8_t macro) +{ + return (DL_MACRO | (macro & 0x1UL)); +} + +//#define PALETTE_SOURCE(addr) ((DL_PALETTE_SOURCE) | ((addr) & 0x3FFFFF3UL)) +/** + * @brief Set the base address of the palette. + * @note 2-byte alignment is required if pixel format is PALETTE4444 or PALETTE565. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t PALETTE_SOURCE(uint32_t addr) +{ + return (DL_PALETTE_SOURCE | (addr & 0x3FFFFFUL)); +} + +//#define POINT_SIZE(size) ((DL_POINT_SIZE) | ((size) & 0x1FFFUL)) +/** + * @brief Set the radius of points to be drawn with primitive POINTS in 1/16 pixel precision. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t POINT_SIZE(uint16_t size) +{ + return (DL_POINT_SIZE | (size & 0x1FFFUL)); +} + +//#define SCISSOR_SIZE(width,height) ((DL_SCISSOR_SIZE) | (((width) & 0xFFFUL) << 12U) | ((height) & 0xFFFUL)) +/** + * @brief Set the size of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2048 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t SCISSOR_SIZE(uint16_t width, uint16_t height) +{ + uint32_t const widthv = (uint32_t) ((width & 0xFFFUL) << 12U); + uint32_t const heightv = (uint32_t) (height & 0xFFFUL); + return (DL_SCISSOR_SIZE | widthv | heightv); +} + +//#define SCISSOR_XY(x,y) ((DL_SCISSOR_XY) | (((x) & 0x7FFUL) << 11U) | ((y) & 0x7FFUL)) +/** + * @brief Set the top left corner of the scissor clip rectangle. + * @note valid range for width and height is from zero to 2047 + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t SCISSOR_XY(uint16_t xc0, uint16_t yc0) +{ + uint32_t const xc0v = (uint32_t) ((xc0 & 0x7FFUL) << 11U); + uint32_t const yc0v = (uint32_t) (yc0 & 0x7FFUL); + return (DL_SCISSOR_XY | xc0v | yc0v); +} + +//#define STENCIL_FUNC(func,ref,mask) ((DL_STENCIL_FUNC) | (((func) & 7UL) << 16U) | (((ref) & 0xFFUL) << 8U)|((mask) & 0xFFUL)) +/** + * @brief Set function and reference value for stencil testing. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_FUNC(uint8_t func, uint8_t ref, uint8_t mask) +{ + uint32_t const funcv = (uint32_t) ((func & 7UL) << 16U); + uint32_t const refv = (uint32_t) ((ref & 0xFFUL) << 8U); + uint32_t const maskv = (uint32_t) (mask & 0xFFUL); + return (DL_STENCIL_FUNC | funcv | refv | maskv); +} + +//#define STENCIL_MASK(mask) ((DL_STENCIL_MASK) | ((mask) & 0xFFUL)) +/** + * @brief Control the writing of individual bits in the stencil planes. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_MASK(uint8_t mask) +{ + return (DL_STENCIL_MASK | mask); +} + +//#define STENCIL_OP(sfail,spass) ((DL_STENCIL_OP) | (((sfail) & 7UL) << 3U) | ((spass) & 7UL)) +/** + * @brief Set stencil test actions. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t STENCIL_OP(uint8_t sfail, uint8_t spass) +{ + uint32_t const sfailv = (uint32_t) ((sfail & 0x07UL) << 3U); + uint32_t const spassv = (uint32_t) (spass & 0x07UL); + return (DL_STENCIL_OP | sfailv | spassv); +} + +//#define TAG(s) ((DL_TAG) | ((s) & 0xFFUL)) +/** + * @brief Attach the tag value for the following graphics objects drawn on the screen. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t TAG(uint8_t tagval) +{ + return (DL_TAG | tagval); +} + +//#define TAG_MASK(mask) ((DL_TAG_MASK) | ((mask) & 1UL)) +/** + * @brief Control the writing of the tag buffer. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t TAG_MASK(uint8_t mask) +{ + return (DL_TAG_MASK | ((mask) & 1UL)); +} + +//#define VERTEX2F(x,y) ((DL_VERTEX2F) | ((((uint32_t) (x)) & 0x7FFFUL) << 15U) | (((uint32_t) (y)) & 0x7FFFUL)) +/** + * @brief Set coordinates for graphics primitves. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX2F(int16_t xc0, int16_t yc0) +{ + uint32_t const xc0v = ((((uint32_t) ((uint16_t) xc0)) & 0x7FFFUL) << 15U); + uint32_t const yc0v = (((uint32_t) ((uint16_t) yc0)) & 0x7FFFUL); + return (DL_VERTEX2F | xc0v | yc0v); +} + +//#define VERTEX2II(x,y,handle,cell) ((DL_VERTEX2II) | (((x) & 0x1FFUL) << 21U) | (((y) & 0x1FFUL) << 12U) | (((handle) & 0x1FUL) << 7U) | ((cell) & 0x7FUL)) +/** + * @brief Set coordinates, bitmap-handle and cell-number for graphics primitves. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX2II(uint16_t xc0, uint16_t yc0, uint8_t handle, uint8_t cell) +{ + uint32_t const xc0v = ((((uint32_t) xc0) & 0x1FFUL) << 21U); + uint32_t const yc0v = ((((uint32_t) yc0) & 0x1FFUL) << 12U); + uint32_t const handlev = ((((uint32_t) handle) & 0x1FUL) << 7U); + uint32_t const cellv = (((uint32_t) cell) & 0x7FUL); + return (DL_VERTEX2II | xc0v | yc0v | handlev | cellv); +} + +//#define VERTEX_FORMAT(frac) ((DL_VERTEX_FORMAT) | ((frac) & 7UL)) +/** + * @brief Set the precision of VERTEX2F coordinates. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_FORMAT(uint8_t frac) +{ + return (DL_VERTEX_FORMAT | ((frac) & 7UL)); +} + +//#define VERTEX_TRANSLATE_X(x) ((DL_VERTEX_TRANSLATE_X) | ((x) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations X translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_TRANSLATE_X(int32_t xco) +{ + return (DL_VERTEX_TRANSLATE_X | (((uint32_t) xco) & 0x1FFFFUL)); +} + +//#define VERTEX_TRANSLATE_Y(y) ((DL_VERTEX_TRANSLATE_Y) | ((y) & 0x1FFFFUL)) +/** + * @brief Set the vertex transformations Y translation component. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t VERTEX_TRANSLATE_Y(int32_t yco) +{ + return (DL_VERTEX_TRANSLATE_Y | (((uint32_t) yco) & 0x1FFFFUL)); +} /* #define BEGIN(prim) ((DL_BEGIN) | ((prim) & 15UL)) */ /* use define DL_BEGIN */ /* #define DISPLAY() ((DL_DISPLAY)) */ /* use define DL_DISPLAY */ @@ -648,86 +1068,151 @@ extern "C" #if EVE_GEN > 2 -#define EVE_GLFORMAT 31UL /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ +#define EVE_GLFORMAT ((uint32_t) 31UL) /* used with BITMAP_LAYOUT to indicate bitmap-format is specified by BITMAP_EXT_FORMAT */ -#define DL_BITMAP_EXT_FORMAT 0x2E000000UL /* requires OR'd arguments */ -#define DL_BITMAP_SWIZZLE 0x2F000000UL -/* #define DL_INT_FRR 0x30000000UL */ /* ESE displays "Internal: flash read result" - undocumented display list command */ +#define DL_BITMAP_EXT_FORMAT ((uint32_t) 0x2E000000UL) /* requires OR'd arguments */ +#define DL_BITMAP_SWIZZLE ((uint32_t) 0x2F000000UL) +/* #define DL_INT_FRR ((uint32_t) 0x30000000UL) */ /* ESE displays "Internal: flash read result" - undocumented display list command */ /* Extended Bitmap formats */ -#define EVE_ASTC_4X4 37808UL -#define EVE_ASTC_5X4 37809UL -#define EVE_ASTC_5X5 37810UL -#define EVE_ASTC_6X5 37811UL -#define EVE_ASTC_6X6 37812UL -#define EVE_ASTC_8X5 37813UL -#define EVE_ASTC_8X6 37814UL -#define EVE_ASTC_8X8 37815UL -#define EVE_ASTC_10X5 37816UL -#define EVE_ASTC_10X6 37817UL -#define EVE_ASTC_10X8 37818UL -#define EVE_ASTC_10X10 37819UL -#define EVE_ASTC_12X10 37820UL -#define EVE_ASTC_12X12 37821UL - -#define EVE_RAM_ERR_REPORT 0x309800UL /* max 128 bytes null terminated string */ -#define EVE_RAM_FLASH 0x800000UL -#define EVE_RAM_FLASH_POSTBLOB 0x801000UL - -#define EVE_OPT_FLASH 64U -#define EVE_OPT_OVERLAY 128U -#define EVE_OPT_FORMAT 4096U -#define EVE_OPT_FILL 8192U +#define EVE_ASTC_4X4 ((uint32_t) 37808UL) +#define EVE_ASTC_5X4 ((uint32_t) 37809UL) +#define EVE_ASTC_5X5 ((uint32_t) 37810UL) +#define EVE_ASTC_6X5 ((uint32_t) 37811UL) +#define EVE_ASTC_6X6 ((uint32_t) 37812UL) +#define EVE_ASTC_8X5 ((uint32_t) 37813UL) +#define EVE_ASTC_8X6 ((uint32_t) 37814UL) +#define EVE_ASTC_8X8 ((uint32_t) 37815UL) +#define EVE_ASTC_10X5 ((uint32_t) 37816UL) +#define EVE_ASTC_10X6 ((uint32_t) 37817UL) +#define EVE_ASTC_10X8 ((uint32_t) 37818UL) +#define EVE_ASTC_10X10 ((uint32_t) 37819UL) +#define EVE_ASTC_12X10 ((uint32_t) 37820UL) +#define EVE_ASTC_12X12 ((uint32_t) 37821UL) + +#define EVE_RAM_ERR_REPORT ((uint32_t) 0x309800UL) /* max 128 bytes null terminated string */ +#define EVE_RAM_FLASH ((uint32_t) 0x800000UL) +#define EVE_RAM_FLASH_POSTBLOB ((uint32_t) 0x801000UL) + +#define EVE_OPT_FLASH ((uint16_t) 64U) +#define EVE_OPT_OVERLAY ((uint16_t) 128U) +#define EVE_OPT_FORMAT ((uint16_t) 4096U) +#define EVE_OPT_FILL ((uint16_t) 8192U) /* Commands for BT815 / BT816 */ -#define CMD_BITMAP_TRANSFORM 0xFFFFFF21UL -#define CMD_SYNC 0xFFFFFF42UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ -#define CMD_FLASHERASE 0xFFFFFF44UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ -#define CMD_FLASHWRITE 0xFFFFFF45UL -#define CMD_FLASHREAD 0xFFFFFF46UL -#define CMD_FLASHUPDATE 0xFFFFFF47UL -#define CMD_FLASHDETACH 0xFFFFFF48UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ -#define CMD_FLASHATTACH 0xFFFFFF49UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ -#define CMD_FLASHFAST 0xFFFFFF4AUL -#define CMD_FLASHSPIDESEL 0xFFFFFF4BUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ -#define CMD_FLASHSPITX 0xFFFFFF4CUL -#define CMD_FLASHSPIRX 0xFFFFFF4DUL -#define CMD_FLASHSOURCE 0xFFFFFF4EUL -#define CMD_CLEARCACHE 0xFFFFFF4FUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ -#define CMD_INFLATE2 0xFFFFFF50UL -#define CMD_ROTATEAROUND 0xFFFFFF51UL -#define CMD_RESETFONTS 0xFFFFFF52UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ -#define CMD_ANIMSTART 0xFFFFFF53UL -#define CMD_ANIMSTOP 0xFFFFFF54UL -#define CMD_ANIMXY 0xFFFFFF55UL -#define CMD_ANIMDRAW 0xFFFFFF56UL -#define CMD_GRADIENTA 0xFFFFFF57UL -#define CMD_FILLWIDTH 0xFFFFFF58UL -#define CMD_APPENDF 0xFFFFFF59UL -#define CMD_ANIMFRAME 0xFFFFFF5AUL -#define CMD_VIDEOSTARTF 0xFFFFFF5FUL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ +#define CMD_BITMAP_TRANSFORM ((uint32_t) 0xFFFFFF21UL) +#define CMD_SYNC ((uint32_t) 0xFFFFFF42UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_SYNC) */ +#define CMD_FLASHERASE ((uint32_t) 0xFFFFFF44UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHERASE) */ +#define CMD_FLASHWRITE ((uint32_t) 0xFFFFFF45UL) +#define CMD_FLASHREAD ((uint32_t) 0xFFFFFF46UL) +#define CMD_FLASHUPDATE ((uint32_t) 0xFFFFFF47UL) +#define CMD_FLASHDETACH ((uint32_t) 0xFFFFFF48UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHDETACH) */ +#define CMD_FLASHATTACH ((uint32_t) 0xFFFFFF49UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHATTACH) */ +#define CMD_FLASHFAST ((uint32_t) 0xFFFFFF4AUL) +#define CMD_FLASHSPIDESEL ((uint32_t) 0xFFFFFF4BUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_FLASHSPIDESEL) */ +#define CMD_FLASHSPITX ((uint32_t) 0xFFFFFF4CUL) +#define CMD_FLASHSPIRX ((uint32_t) 0xFFFFFF4DUL) +#define CMD_FLASHSOURCE ((uint32_t) 0xFFFFFF4EUL) +#define CMD_CLEARCACHE ((uint32_t) 0xFFFFFF4FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_CLEARCACHE) */ +#define CMD_INFLATE2 ((uint32_t) 0xFFFFFF50UL) +#define CMD_ROTATEAROUND ((uint32_t) 0xFFFFFF51UL) +#define CMD_RESETFONTS ((uint32_t) 0xFFFFFF52UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RESETFONTS) */ +#define CMD_ANIMSTART ((uint32_t) 0xFFFFFF53UL) +#define CMD_ANIMSTOP ((uint32_t) 0xFFFFFF54UL) +#define CMD_ANIMXY ((uint32_t) 0xFFFFFF55UL) +#define CMD_ANIMDRAW ((uint32_t) 0xFFFFFF56UL) +#define CMD_GRADIENTA ((uint32_t) 0xFFFFFF57UL) +#define CMD_FILLWIDTH ((uint32_t) 0xFFFFFF58UL) +#define CMD_APPENDF ((uint32_t) 0xFFFFFF59UL) +#define CMD_ANIMFRAME ((uint32_t) 0xFFFFFF5AUL) +#define CMD_VIDEOSTARTF ((uint32_t) 0xFFFFFF5FUL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_VIDEOSTARTF) */ /* Registers for BT815 / BT816 */ -#define REG_ADAPTIVE_FRAMERATE 0x0030257cUL -#define REG_PLAYBACK_PAUSE 0x003025ecUL -#define REG_FLASH_STATUS 0x003025f0UL -#define REG_FLASH_SIZE 0x00309024UL -#define REG_PLAY_CONTROL 0x0030914eUL -#define REG_COPRO_PATCH_PTR 0x00309162UL +#define REG_ADAPTIVE_FRAMERATE ((uint32_t) 0x0030257cUL) +#define REG_PLAYBACK_PAUSE ((uint32_t) 0x003025ecUL) +#define REG_FLASH_STATUS ((uint32_t) 0x003025f0UL) +#define REG_FLASH_SIZE ((uint32_t) 0x00309024UL) +#define REG_PLAY_CONTROL ((uint32_t) 0x0030914eUL) +#define REG_COPRO_PATCH_PTR ((uint32_t) 0x00309162UL) /* Macros for BT815 / BT816 */ -#define BITMAP_EXT_FORMAT(format) ((DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) -#define BITMAP_SWIZZLE(r,g,b,a) ((DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) -#define BITMAP_TRANSFORM_A_EXT(p,v) ((DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_B_EXT(p,v) ((DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_D_EXT(p,v) ((DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) -#define BITMAP_TRANSFORM_E_EXT(p,v) ((DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +//#define BITMAP_EXT_FORMAT(format) ((DL_BITMAP_EXT_FORMAT) | ((format) & 0xFFFFUL)) +/** + * @brief Set the extended format of the bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_EXT_FORMAT(uint16_t format) +{ + return (DL_BITMAP_EXT_FORMAT | format); +} + +//#define BITMAP_SWIZZLE(r,g,b,a) ((DL_BITMAP_SWIZZLE) | (((r) & 7UL) << 9U) | (((g) & 7UL) << 6U) | (((b) & 7UL) << 3U) | ((a) & 7UL)) +/** + * @brief Set the source for the red, green, blue and alpha channels of a bitmap. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_SWIZZLE(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +{ + uint32_t const redv = ((red & 7UL) << 9U); + uint32_t const greenv = ((green & 7UL) << 6U); + uint32_t const bluev = ((blue & 7UL) << 3U); + uint32_t const alphav = (alpha & 7UL); + return (DL_BITMAP_SWIZZLE | redv | greenv | bluev | alphav); +} + +//#define BITMAP_TRANSFORM_A_EXT(p,v) ((DL_BITMAP_TRANSFORM_A) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the A coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_A(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_A | prcv | valv); +} + +//#define BITMAP_TRANSFORM_B_EXT(p,v) ((DL_BITMAP_TRANSFORM_B) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the B coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_B(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_B | prcv | valv); +} + +//#define BITMAP_TRANSFORM_D_EXT(p,v) ((DL_BITMAP_TRANSFORM_D) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the D coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_D(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_D | prcv | valv); +} + +//#define BITMAP_TRANSFORM_E_EXT(p,v) ((DL_BITMAP_TRANSFORM_E) | (((p) & 1UL) << 17U) | ((v) & 0x1FFFFUL)) +/** + * @brief Set the E coefficient of the bitmap transform matrix. + * @return a 32 bit word for use with EVE_cmd_dl() + */ +static inline uint32_t BITMAP_TRANSFORM_E(uint8_t prc, uint32_t val) +{ + uint32_t const prcv = ((prc & 1UL) << 17U); + uint32_t const valv = (val & 0x1FFFFUL); + return (DL_BITMAP_TRANSFORM_E | prcv | valv); +} -#define BITMAP_TRANSFORM_A(a) BITMAP_TRANSFORM_A_EXT(0UL,(a)) -#define BITMAP_TRANSFORM_B(b) BITMAP_TRANSFORM_B_EXT(0UL,(b)) -#define BITMAP_TRANSFORM_D(d) BITMAP_TRANSFORM_D_EXT(0UL,(d)) -#define BITMAP_TRANSFORM_E(e) BITMAP_TRANSFORM_E_EXT(0UL,(e)) +//#define BITMAP_TRANSFORM_A(a) BITMAP_TRANSFORM_A_EXT(0UL,(a)) +//#define BITMAP_TRANSFORM_B(b) BITMAP_TRANSFORM_B_EXT(0UL,(b)) +//#define BITMAP_TRANSFORM_D(d) BITMAP_TRANSFORM_D_EXT(0UL,(d)) +//#define BITMAP_TRANSFORM_E(e) BITMAP_TRANSFORM_E_EXT(0UL,(e)) #endif /* EVE_GEN > 2 */ @@ -736,31 +1221,31 @@ extern "C" #if EVE_GEN > 3 /* Commands for BT817 / BT818 */ -#define CMD_ANIMFRAMERAM 0xFFFFFF6DUL -#define CMD_ANIMSTARTRAM 0xFFFFFF6EUL -#define CMD_APILEVEL 0xFFFFFF63UL -#define CMD_CALIBRATESUB 0xFFFFFF60UL -#define CMD_CALLLIST 0xFFFFFF67UL -#define CMD_ENDLIST 0xFFFFFF69UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ -#define CMD_FLASHPROGRAM 0xFFFFFF70UL -#define CMD_FONTCACHE 0xFFFFFF6BUL -#define CMD_FONTCACHEQUERY 0xFFFFFF6CUL -#define CMD_GETIMAGE 0xFFFFFF64UL -#define CMD_HSF 0xFFFFFF62UL -#define CMD_LINETIME 0xFFFFFF5EUL -#define CMD_NEWLIST 0xFFFFFF68UL -#define CMD_PCLKFREQ 0xFFFFFF6AUL -#define CMD_RETURN 0xFFFFFF66UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ -#define CMD_RUNANIM 0xFFFFFF6FUL -#define CMD_TESTCARD 0xFFFFFF61UL /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ -#define CMD_WAIT 0xFFFFFF65UL +#define CMD_ANIMFRAMERAM ((uint32_t) 0xFFFFFF6DUL) +#define CMD_ANIMSTARTRAM ((uint32_t) 0xFFFFFF6EUL) +#define CMD_APILEVEL ((uint32_t) 0xFFFFFF63UL) +#define CMD_CALIBRATESUB ((uint32_t) 0xFFFFFF60UL) +#define CMD_CALLLIST ((uint32_t) 0xFFFFFF67UL) +#define CMD_ENDLIST ((uint32_t) 0xFFFFFF69UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_ENDLIST) */ +#define CMD_FLASHPROGRAM ((uint32_t) 0xFFFFFF70UL) +#define CMD_FONTCACHE ((uint32_t) 0xFFFFFF6BUL) +#define CMD_FONTCACHEQUERY ((uint32_t) 0xFFFFFF6CUL) +#define CMD_GETIMAGE ((uint32_t) 0xFFFFFF64UL) +#define CMD_HSF ((uint32_t) 0xFFFFFF62UL) +#define CMD_LINETIME ((uint32_t) 0xFFFFFF5EUL) +#define CMD_NEWLIST ((uint32_t) 0xFFFFFF68UL) +#define CMD_PCLKFREQ ((uint32_t) 0xFFFFFF6AUL) +#define CMD_RETURN ((uint32_t) 0xFFFFFF66UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_RETURN) */ +#define CMD_RUNANIM ((uint32_t) 0xFFFFFF6FUL) +#define CMD_TESTCARD ((uint32_t) 0xFFFFFF61UL) /* does not need a dedicated function, just use EVE_cmd_dl(CMD_TESTCARD) */ +#define CMD_WAIT ((uint32_t) 0xFFFFFF65UL) /* Registers for BT817 / BT818 */ -#define REG_UNDERRUN 0x0030260cUL -#define REG_AH_HCYCLE_MAX 0x00302610UL -#define REG_PCLK_FREQ 0x00302614UL -#define REG_PCLK_2X 0x00302618UL -#define REG_ANIM_ACTIVE 0x0030902CUL +#define REG_UNDERRUN ((uint32_t) 0x0030260cUL) +#define REG_AH_HCYCLE_MAX ((uint32_t) 0x00302610UL) +#define REG_PCLK_FREQ ((uint32_t) 0x00302614UL) +#define REG_PCLK_2X ((uint32_t) 0x00302618UL) +#define REG_ANIM_ACTIVE ((uint32_t) 0x0030902CUL) #endif /* EVE_GEN > 3 */ diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.c b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.c index 4808fb3..c213b91 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.c +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.c @@ -2,7 +2,7 @@ @file EVE_commands.c @brief contains FT8xx / BT8xx functions @version 5.0 -@date 2023-08-17 +@date 2023-12-29 @author Rudolph Riedel @section info @@ -49,7 +49,7 @@ has EVE_PCLK_FREQ defined - removed the meta-commands EVE_cmd_point(), EVE_cmd_line() and EVE_cmd_rect() - split all display-list commands into two functions: EVE_cmd_XXX() and EVE_cmd_XXX_burst() - switched from using EVE_RAM_CMD + cmdOffset to REG_CMDB_WRITE -- as a side effect from switching to REG_CMDB_WRITE, every co-processor command is automatically executed now +- as a side effect from switching to REG_CMDB_WRITE, every coprocessor command is automatically executed now - renamed EVE_LIB_GetProps() back to EVE_cmd_getprops() since it does not do anything special to justify a special name - added helper function EVE_memWrite_sram_buffer() - added EVE_cmd_bitmap_transform() and EVE_cmd_bitmap_transform_burst() @@ -136,9 +136,9 @@ without the traling _burst in the name when exceution speed is not an issue - e. - switched from using CMD_PCLKFREQ to writing to REG_PCLK_FREQ directly - added define EVE_SET_REG_PCLK_2X to set REG_PCLK_2X to 1 when necessary - Bugfix: EVE_init() did not set the audio engine to "mute" as intended, but to "silent" -- Bugfix: EVE_busy() returns E_NOT_OK now on co-processor faults. +- Bugfix: EVE_busy() returns E_NOT_OK now on coprocessor faults. thanks for the report to Z0ld3n on Github! -- Fix: reworked EVE_busy() to return EVE_FAULT_RECOVERED on deteced co-processor faults, +- Fix: reworked EVE_busy() to return EVE_FAULT_RECOVERED on deteced coprocessor faults, removed the flash commands from the fault recovery sequence as these are project specific. - added EVE_get_and_reset_fault_state() to check if EVE_busy() triggered a fault recovery - added notes on how to use to EVE_cmd_setfont2() and EVE_cmd_romfont() @@ -147,6 +147,12 @@ without the traling _burst in the name when exceution speed is not an issue - e. - reworked the burst part of private_string_write() to be less complex - renamed chipid references to regid as suggested by #93 on github - Bugfix: broke transfers of buffers larger than 3840 when fixing issues from static code analysis +- changed a number of function parameters from signed to unsigned following the + updated BT81x series programming guide V2.4 +- did another linter pass and fixed some things +- started to improve the embedded documentation +- added more documentation +- removed EVE_cmd_hsf_burst() */ @@ -168,7 +174,9 @@ static volatile uint8_t fault_recovered = E_OK; /* flag to indicate if EVE_busy helper functions ##################################################################### */ - +/** + * @brief Send a host command. + */ void EVE_cmdWrite(uint8_t const command, uint8_t const parameter) { EVE_cs_set(); @@ -178,6 +186,9 @@ void EVE_cmdWrite(uint8_t const command, uint8_t const parameter) EVE_cs_clear(); } +/** + * @brief Implementation of rd8() function, reads 8 bits. + */ uint8_t EVE_memRead8(uint32_t const ft_address) { uint8_t data; @@ -185,21 +196,28 @@ uint8_t EVE_memRead8(uint32_t const ft_address) spi_transmit_32(((ft_address >> 16U) & 0x0000007fUL) + (ft_address & 0x0000ff00UL) + ((ft_address & 0x000000ffUL) << 16U)); data = spi_receive(0U); /* read data byte by sending another dummy byte */ EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of rd16() function, reads 16 bits. + */ uint16_t EVE_memRead16(uint32_t const ft_address) { uint16_t data; + EVE_cs_set(); spi_transmit_32(((ft_address >> 16U) & 0x0000007fUL) + (ft_address & 0x0000ff00UL) + ((ft_address & 0x000000ffUL) << 16U)); - uint8_t lowbyte = spi_receive(0U); /* read low byte */ - uint8_t hibyte = spi_receive(0U); /* read high byte */ + uint8_t const lowbyte = spi_receive(0U); /* read low byte */ + uint8_t const hibyte = spi_receive(0U); /* read high byte */ data = ((uint16_t) hibyte * 256U) | lowbyte; EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of rd32() function, reads 32 bits. + */ uint32_t EVE_memRead32(uint32_t const ft_address) { uint32_t data; @@ -210,49 +228,60 @@ uint32_t EVE_memRead32(uint32_t const ft_address) data = ((uint32_t) spi_receive(0U) << 16U) | data; data = ((uint32_t) spi_receive(0U) << 24U) | data; /* read high byte */ EVE_cs_clear(); - return data; + return (data); } +/** + * @brief Implementation of wr8() function, writes 8 bits. + */ void EVE_memWrite8(uint32_t const ft_address, uint8_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); spi_transmit(ft_data); EVE_cs_clear(); } +/** + * @brief Implementation of wr16() function, writes 16 bits. + */ void EVE_memWrite16(uint32_t const ft_address, uint16_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ - spi_transmit((uint8_t)(ft_address >> 8U)); /* send middle address byte */ - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); /* send low address byte */ - spi_transmit((uint8_t)(ft_data & 0x00ffU)); /* send data low byte */ - spi_transmit((uint8_t)(ft_data >> 8U)); /* send data high byte */ + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ + spi_transmit((uint8_t) (ft_address >> 8U)); /* send middle address byte */ + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); /* send low address byte */ + spi_transmit((uint8_t) (ft_data & 0x00ffU)); /* send data low byte */ + spi_transmit((uint8_t) (ft_data >> 8U)); /* send data high byte */ EVE_cs_clear(); } +/** + * @brief Implementation of wr32() function, writes 32 bits. + */ void EVE_memWrite32(uint32_t const ft_address, uint32_t const ft_data) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ - spi_transmit((uint8_t)(ft_address >> 8U)); /* send middle address byte */ - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); /* send low address byte */ + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); /* send Memory Write plus high address byte */ + spi_transmit((uint8_t) (ft_address >> 8U)); /* send middle address byte */ + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); /* send low address byte */ spi_transmit_32(ft_data); EVE_cs_clear(); } -/* Helper function, write a block of memory from the FLASH of the host controller to EVE. */ +/** + * @brief Helper function, write a block of memory from the FLASH of the host controller to EVE. + */ void EVE_memWrite_flash_buffer(uint32_t const ft_address, const uint8_t *p_data, uint32_t const len) { if (p_data != NULL) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); // uint32_t length = (len + 3U) & (~3U); @@ -265,15 +294,17 @@ void EVE_memWrite_flash_buffer(uint32_t const ft_address, const uint8_t *p_data, } } -/* Helper function, write a block of memory from the SRAM of the host controller to EVE. */ +/** + * @brief Helper function, write a block of memory from the SRAM of the host controller to EVE. + */ void EVE_memWrite_sram_buffer(uint32_t const ft_address, const uint8_t *p_data, uint32_t const len) { if (p_data != NULL) { EVE_cs_set(); - spi_transmit((uint8_t)(ft_address >> 16U) | MEM_WRITE); - spi_transmit((uint8_t)(ft_address >> 8U)); - spi_transmit((uint8_t)(ft_address & 0x000000ffUL)); + spi_transmit((uint8_t) (ft_address >> 16U) | MEM_WRITE); + spi_transmit((uint8_t) (ft_address >> 8U)); + spi_transmit((uint8_t) (ft_address & 0x000000ffUL)); // uint32_t length = (len + 3U) & (~3U); @@ -286,7 +317,9 @@ void EVE_memWrite_sram_buffer(uint32_t const ft_address, const uint8_t *p_data, } } -/* Helper function, read a block of memory from EVE to the SRAM of the host controller */ +/** + * @brief Helper function, read a block of memory from EVE to the SRAM of the host controller. + */ void EVE_memRead_sram_buffer(uint32_t const ft_address, uint8_t *p_data, uint32_t const len) { if (p_data != NULL) @@ -310,7 +343,7 @@ static void CoprocessorFaultRecover(void) copro_patch_pointer = EVE_memRead16(REG_COPRO_PATCH_PTR); #endif - EVE_memWrite8(REG_CPURESET, 1U); /* hold co-processor engine in the reset condition */ + EVE_memWrite8(REG_CPURESET, 1U); /* hold coprocessor engine in the reset condition */ EVE_memWrite16(REG_CMD_READ, 0U); /* set REG_CMD_READ to 0 */ EVE_memWrite16(REG_CMD_WRITE, 0U); /* set REG_CMD_WRITE to 0 */ EVE_memWrite16(REG_CMD_DL, 0U); /* reset REG_CMD_DL to 0 as required by the BT81x programming guide, should not hurt FT8xx */ @@ -327,21 +360,18 @@ static void CoprocessorFaultRecover(void) #endif #endif - EVE_memWrite8(REG_CPURESET, 0U); /* set REG_CPURESET to 0 to restart the co-processor engine*/ + EVE_memWrite8(REG_CPURESET, 0U); /* set REG_CPURESET to 0 to restart the coprocessor engine*/ DELAY_MS(10U); /* just to be safe */ } -/* Check if the co-processor completed executing the current command list. */ -/* Returns E_OK in case EVE is not busy (no DMA transfer active and */ -/* REG_CMDB_SPACE has the value 0xffc, meaning the CMD-FIFO is empty. */ -/* If there was a coprocessor fault the recovery sequence is */ -/* executed and E_NOT_OK is returned. */ -/* note: in case of recovery the graphics context gets reset and the */ -/* external flash needs to be reinitialized if needed */ -/* Returns EVE_FIFO_HALF_EMPTY if no DMA transfer is active */ -/* and REG_CMDB_SPACE shows more than 2048 bytes available. */ -/* Returns EVE_IS_BUSY if a DMA transfer is active */ -/* or REG_CMDB_SPACE has a value smaller than 0xffc. */ +/** + * @brief Check if the coprocessor completed executing the current command list. + * @return - E_OK - if EVE is not busy (no DMA transfer active and REG_CMDB_SPACE has the value 0xffc, meaning the CMD-FIFO is empty + * @return - EVE_IS_BUSY - if a DMA transfer is active or REG_CMDB_SPACE has a value smaller than 0xffc + * @return - EVE_FIFO_HALF_EMPTY - if no DMA transfer is active and REG_CMDB_SPACE shows more than 2048 bytes available + * @return - E_NOT_OK - if there was a coprocessor fault and the recovery sequence was executed + * @note - if there is a coprocessor fault the external flash is not reinitialized by EVE_busy() + */ uint8_t EVE_busy(void) { uint16_t space; @@ -354,8 +384,8 @@ uint8_t EVE_busy(void) space = EVE_memRead16(REG_CMDB_SPACE); - /* (REG_CMDB_SPACE & 0x03) != 0 -> we have a co-processor fault */ - if ((space & 3U) != 0U) /* we have a co-processor fault, make EVE play with us again */ + /* (REG_CMDB_SPACE & 0x03) != 0 -> we have a coprocessor fault */ + if ((space & 3U) != 0U) /* we have a coprocessor fault, make EVE play with us again */ { ret = EVE_FAULT_RECOVERED; fault_recovered = EVE_FAULT_RECOVERED; /* save fault recovery state */ @@ -381,16 +411,14 @@ uint8_t EVE_busy(void) } #endif - return ret; + return (ret); } /** - * @brief Helper function to check if EVE_busy() tried to recover from - * a coprocessor fault. + * @brief Helper function to check if EVE_busy() tried to recover from a coprocessor fault. * The internal fault indicator is cleared so it could be set by EVE_busy() again. - * - * @return Returns EVE_FAULT_RECOVERED if EVE_busy() detected a coprocessor fault. - * Returns E_OK if EVE_busy() did not detect a coprocessor fault. + * @return - EVE_FAULT_RECOVERED - if EVE_busy() detected a coprocessor fault + * @return - E_OK - if EVE_busy() did not detect a coprocessor fault */ uint8_t EVE_get_and_reset_fault_state(void) { @@ -401,10 +429,12 @@ uint8_t EVE_get_and_reset_fault_state(void) ret = EVE_FAULT_RECOVERED; fault_recovered = E_OK; } - return ret; + return (ret); } -/* Wait for the co-processor to complete the FIFO queue.*/ +/** + * @brief Helper function, wait for the coprocessor to complete the FIFO queue. + */ void EVE_execute_cmd(void) { while (EVE_busy() != E_OK) @@ -412,7 +442,7 @@ void EVE_execute_cmd(void) } } -/* Begin a co-processor command, this is used for non-display-list and non-burst-mode commands.*/ +/* begin a coprocessor command, this is used for non-display-list and non-burst-mode commands.*/ static void eve_begin_cmd(uint32_t command) { EVE_cs_set(); @@ -471,21 +501,23 @@ void block_transfer(const uint8_t *p_data, uint32_t len) } /* ################################################################## - co-processor commands that are not used in displays lists, + coprocessor commands that are not used in displays lists, these are not to be used with burst transfers ################################################################### */ /* BT817 / BT818 */ #if EVE_GEN > 3 -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in RAM_G to to the external flash on a BT81x board at address dest */ -/* note: dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ -/* note: this looks exactly the same as EVE_cmd_flashupdate() but it needs the flash to be empty */ +/** + * @brief Write "num" bytes from src in RAM_G to the previously erased external flash of a BT81x at address dest. + * @note - dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 + * @note - EVE will not do anything if the alignment requirements are not met + * @note - the address ptr is relative to the flash so the first address is 0x000000 not 0x800000 + * @note - this looks exactly the same as EVE_cmd_flashupdate() but it needs the flash to be empty + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHPROGRAM); @@ -496,23 +528,29 @@ void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_fontcache(uint32_t font, int32_t ptr, uint32_t num) +/** + * @brief Enable the font cache. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num) { eve_begin_cmd(CMD_FONTCACHE); spi_transmit_32(font); - spi_transmit_32((uint32_t) ptr); + spi_transmit_32(ptr); spi_transmit_32(num); EVE_cs_clear(); EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used) +/** + * @brief Queries the capacity and utilization of the font cache. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_fontcachequery(uint32_t *p_total, uint32_t *p_used) { uint16_t cmdoffset; @@ -522,21 +560,24 @@ void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used) EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_total != NULL) { - *p_total = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_total = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_used != NULL) { - *p_used = (int32_t) EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_used = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Returns all the attributes of the bitmap made by the previous CMD_LOADIMAGE, CMD_PLAYVIDEO, CMD_VIDEOSTART or CMD_VIDEOSTARTF. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, uint32_t *p_height, uint32_t *p_palette) { uint16_t cmdoffset; @@ -550,33 +591,36 @@ void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, ui EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_palette != NULL) { - *p_palette = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_palette = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } if (p_height != NULL) { - *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_width != NULL) { - *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU)); + *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL)); } if (p_fmt != NULL) { - *p_fmt = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 16U) & 0xfffU)); + *p_fmt = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 16UL) & 0xfffUL)); } if (p_source != NULL) { - *p_source = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 20U) & 0xfffU)); + *p_source = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 20UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Undocumented command. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_linetime(uint32_t dest) { eve_begin_cmd(CMD_LINETIME); @@ -585,9 +629,12 @@ void EVE_cmd_linetime(uint32_t dest) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Starts the compilation of a command list into RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_newlist(uint32_t adr) { eve_begin_cmd(CMD_NEWLIST); @@ -596,12 +643,14 @@ void EVE_cmd_newlist(uint32_t adr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* This command sets REG_PCLK_FREQ to generate the closest possible */ -/* frequency to the one requested. */ -/* Returns the frequency achieved or zero if no frequency was found. */ +/** + * @brief Sets REG_PCLK_FREQ to generate the closest possible frequency to the one requested. + * @return - the frequency achieved or zero if no frequency was found + * @note - When using this command, the flash BLOB is required. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_pclkfreq(uint32_t ftarget, int32_t rounding) { uint16_t cmdoffset; @@ -612,15 +661,18 @@ uint32_t EVE_cmd_pclkfreq(uint32_t ftarget, int32_t rounding) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Waits for a specified number of microseconds. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_wait(uint32_t usec) { eve_begin_cmd(CMD_WAIT); @@ -634,11 +686,13 @@ void EVE_cmd_wait(uint32_t usec) /* BT815 / BT816 */ #if EVE_GEN > 2 -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this command clears the graphics systems flash cache and to do so */ -/* it needs to empty the display lists first */ +/** + * @brief Clears the graphics engine’s internal flash cache. + * @note - This function includes clearing out the display list. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_clearcache(void) { EVE_cmd_dl(CMD_DLSTART); @@ -653,11 +707,12 @@ void EVE_cmd_clearcache(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHATTACH); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Re-connect to the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashattach(void) { eve_begin_cmd(CMD_FLASHATTACH); @@ -665,11 +720,12 @@ void EVE_cmd_flashattach(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHDETACH); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Dis-connect from the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashdetach(void) { eve_begin_cmd(CMD_FLASHDETACH); @@ -677,11 +733,12 @@ void EVE_cmd_flashdetach(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHERASE); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief Erases the attached SPI flash storage. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flasherase(void) { eve_begin_cmd(CMD_FLASHERASE); @@ -689,9 +746,14 @@ void EVE_cmd_flasherase(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Drive the attached SPI flash storage in full-speed mode, if possible. + * @return - Zero on success, error code on failure + * @note - When using this command, the flash BLOB is required. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_flashfast(void) { uint16_t cmdoffset; @@ -700,17 +762,19 @@ uint32_t EVE_cmd_flashfast(void) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is added for conveniance, using EVE_cmd_dl(CMD_FLASHSPIDESEL); */ -/* followed by EVE_execute_cmd(); would work as well */ +/** + * @brief De-asserts the SPI CS signal of the attached SPI flash storage. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspidesel(void) { eve_begin_cmd(CMD_FLASHSPIDESEL); @@ -718,13 +782,15 @@ void EVE_cmd_flashspidesel(void) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in the external flash on a BT81x board to dest in RAM_G */ -/* note: src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the src pointer is relative to the flash so the first address is 0x00000000 not 0x800000 */ +/** + * @brief Copies "num" bytes from "src" in attached SPI flash storage to "dest" in RAM_G. + * @note - src must be 64-byte aligned, dest must be 4-byte aligned, num must be a multiple of 4 + * @note - EVE will not do anything if the alignment requirements are not met + * @note - The src pointer is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHREAD); @@ -735,9 +801,15 @@ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Set the source address for flash data loaded by the CMD_LOADIMAGE, CMD_PLAYVIDEO, CMD_VIDEOSTARTF and CMD_INFLATE2 commands with the OPT_FLASH option. + * @note - Address must be 64-byte aligned. + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The pointer is relative to the flash, so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashsource(uint32_t ptr) { eve_begin_cmd(CMD_FLASHSOURCE); @@ -746,11 +818,13 @@ void EVE_cmd_flashsource(uint32_t ptr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from the BT81x SPI interface dest in RAM_G */ -/* note: raw direct access, not really useful for anything */ +/** + * @brief Receives bytes from the flash SPI interface and writes them to main memory. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspirx(uint32_t dest, uint32_t num) { eve_begin_cmd(CMD_FLASHSPIRX); @@ -760,11 +834,13 @@ void EVE_cmd_flashspirx(uint32_t dest, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from *p_data to the BT81x SPI interface */ -/* note: raw direct access, not really useful for anything */ +/** + * @brief Transmits bytes over the flash SPI interface. + * @note - Only works when the attached SPI flash storage has been detached. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *p_data) { eve_begin_cmd(CMD_FLASHSPITX); @@ -773,13 +849,15 @@ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *p_data) block_transfer(p_data, num); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from src in RAM_G to to the external flash on a BT81x board at address dest */ -/* note: dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ +/** + * @brief Write "num" bytes from src in RAM_G to the attached SPI flash storage at address dest. + * @note - dest must be 4096-byte aligned, src must be 4-byte aligned, num must be a multiple of 4096 + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The address ptr is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_FLASHUPDATE); @@ -790,14 +868,15 @@ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* write "num" bytes from *p_data to the external flash on a BT81x board at address ptr */ -/* note: ptr must be 256 byte aligned, num must be a multiple of 256 */ -/* note: EVE will not do anything if the alignment requirements are not met */ -/* note: the address ptr is relative to the flash so the first address is 0x00000000 not 0x800000 */ -/* note: on AVR controllers this expects the data to be located in the controllers flash memory */ +/** + * @brief Write "num" bytes to the attached SPI flash storage at address dest. + * @note - dest must be 256-byte aligned, num must be a multiple of 256 + * @note - EVE will not do anything if the alignment requirements are not met. + * @note - The address ptr is relative to the flash so the first address is 0x000000 not 0x800000. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *p_data) { eve_begin_cmd(CMD_FLASHWRITE); @@ -810,9 +889,13 @@ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *p_data) } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Decompress data into RAM_G. + * @note - The data must be correct and complete. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_inflate2(uint32_t ptr, uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_INFLATE2); @@ -831,10 +914,12 @@ void EVE_cmd_inflate2(uint32_t ptr, uint32_t options, const uint8_t *p_data, uin #endif /* EVE_GEN > 2 */ -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* get the properties of an image after a CMD_LOADIMAGE operation and write the values to the variables that are supplied by pointers*/ +/** + * @brief Returns the source address and size of the bitmap loaded by the previous CMD_LOADIMAGE. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_getprops(uint32_t *p_pointer, uint32_t *p_width, uint32_t *p_height) { uint16_t cmdoffset; @@ -845,25 +930,28 @@ void EVE_cmd_getprops(uint32_t *p_pointer, uint32_t *p_width, uint32_t *p_height spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ if (p_pointer != NULL) { - *p_pointer = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU)); + *p_pointer = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL)); } if (p_width != NULL) { - *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU)); + *p_width = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL)); } if (p_height != NULL) { - *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU)); + *p_height = EVE_memRead32(EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL)); } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Returns the next address after a CMD_INFLATE and other commands. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_getptr(void) { uint16_t cmdoffset; @@ -872,15 +960,19 @@ uint32_t EVE_cmd_getptr(void) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Decompress data into RAM_G. + * @note - The data must be correct and complete. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_INFLATE); @@ -892,18 +984,29 @@ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *p_data, uint32_t len) } } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Trigger interrupt INT_CMDFLAG. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_interrupt(uint32_t msec) { eve_begin_cmd(CMD_INTERRUPT); spi_transmit_32(msec); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Loads and decodes a JPEG/PNG image into RAM_G. + * @note - Decoding PNG images takes significantly more time than decoding JPEG images. + * @note - In doubt use the EVE Asset Builder to check if PNG/JPEG files are compatible. + * @note - If the image is in PNG format, the top 42kiB of RAM_G will be overwritten. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_LOADIMAGE); @@ -925,19 +1028,27 @@ void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *p_data, ui } } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Set up a streaming media FIFO in RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_mediafifo(uint32_t ptr, uint32_t size) { eve_begin_cmd(CMD_MEDIAFIFO); spi_transmit_32(ptr); spi_transmit_32(size); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Copy a block of RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num) { eve_begin_cmd(CMD_MEMCPY); @@ -948,9 +1059,12 @@ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Compute a CRC-32 for RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num) { uint16_t cmdoffset; @@ -961,14 +1075,18 @@ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num) spi_transmit_32(0UL); EVE_cs_clear(); EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ + cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the coprocessor write pointer */ cmdoffset -= 4U; cmdoffset &= 0x0fffU; return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); } -/* This is meant to be called outside display-list building, */ -/* does not support cmd-burst.*/ +/** + * @brief Fill RAM_G with a byte value. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num) { eve_begin_cmd(CMD_MEMSET); @@ -976,12 +1094,16 @@ void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num) spi_transmit_32((uint32_t)value); spi_transmit_32(num); EVE_cs_clear(); + EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* this is a pointless command, just use one of the EVE_memWrite* helper functions to directly write to EVEs memory */ +/** + * @brief Write bytes into RAM_G using the coprocessor. + * @note - Commented out, just use one of the EVE_memWrite* helper functions to directly write to EVEs memory. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ /* void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data) { @@ -1001,9 +1123,36 @@ void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data) } */ -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Read a register value using the coprocessor. + * @note - Commented out, just read the register directly. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +/* +uint32_t EVE_cmd_regread(uint32_t ptr) +{ + uint16_t cmdoffset; + + eve_begin_cmd(CMD_REGREAD); + spi_transmit_32(ptr); + spi_transmit_32(0UL); + EVE_cs_clear(); + EVE_execute_cmd(); + cmdoffset = EVE_memRead16(REG_CMD_WRITE); // read the coprocessor write pointer + cmdoffset -= 4U; + cmdoffset &= 0x0fffU; + return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); +} +*/ + +/** + * @brief Write zero to RAM_G. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num) { eve_begin_cmd(CMD_MEMZERO); @@ -1013,8 +1162,13 @@ void EVE_cmd_memzero(uint32_t ptr, uint32_t num) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, it includes executing the command, does not support cmd-burst.*/ -/* it does not wait for completion in order to allow the video to be paused or terminated by REG_PLAY_CONTROL */ +/** + * @brief Play back motion-JPEG encoded AVI video. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command. + * @note - Does not support burst-mode. + * @note - Does not wait for completion in order to allow the video to be paused or terminated by REG_PLAY_CONTROL + */ void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len) { eve_begin_cmd(CMD_PLAYVIDEO); @@ -1035,30 +1189,12 @@ void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len) } } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -/* regvalue = EVE_cmd_regread(ptr); */ -/* this seems to be completely pointless, there is no real use for it outside a display-list since the register could be read directly */ -/* and for what purpose would this be implemented to be used in a display list?? */ -uint32_t EVE_cmd_regread(uint32_t ptr) -{ - uint16_t cmdoffset; - - eve_begin_cmd(CMD_REGREAD); - spi_transmit_32(ptr); - spi_transmit_32(0UL); - EVE_cs_clear(); - EVE_execute_cmd(); - cmdoffset = EVE_memRead16(REG_CMD_WRITE); /* read the co-processor write pointer */ - cmdoffset -= 4U; - cmdoffset &= 0x0fffU; - return (EVE_memRead32(EVE_RAM_CMD + cmdoffset)); -} - -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Rotate the screen and set up transform matrix accordingly. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_setrotate(uint32_t rotation) { eve_begin_cmd(CMD_SETROTATE); @@ -1067,9 +1203,12 @@ void EVE_cmd_setrotate(uint32_t rotation) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Take a snapshot of the current screen. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_snapshot(uint32_t ptr) { eve_begin_cmd(CMD_SNAPSHOT); @@ -1078,10 +1217,13 @@ void EVE_cmd_snapshot(uint32_t ptr) EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt) +/** + * @brief Take a snapshot of part of the current screen with format option. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt) { eve_begin_cmd(CMD_SNAPSHOT2); spi_transmit_32(fmt); @@ -1092,19 +1234,22 @@ void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); EVE_cs_clear(); EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ -void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t tag) +/** + * @brief Track touches for a graphics object. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ +void EVE_cmd_track(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t tag) { eve_begin_cmd(CMD_TRACK); @@ -1113,13 +1258,13 @@ void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t t spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); - spi_transmit((uint8_t) ((uint16_t) tag)); - spi_transmit((uint8_t) (((uint16_t) tag) >> 8U)); + spi_transmit((uint8_t) (tag)); + spi_transmit((uint8_t) (tag >> 8U)); spi_transmit(0U); spi_transmit(0U); @@ -1127,9 +1272,12 @@ void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t t EVE_execute_cmd(); } -/* This is meant to be called outside display-list building, */ -/* it includes executing the command and waiting for completion, */ -/* does not support cmd-burst.*/ +/** + * @brief Load the next frame of a video. + * @note - Meant to be called outside display-list building. + * @note - Includes executing the command and waiting for completion. + * @note - Does not support burst-mode. + */ void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr) { eve_begin_cmd(CMD_VIDEOFRAME); @@ -1147,7 +1295,6 @@ void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr) /** * @brief EVE flash initialization for BT81x, switches the FLASH attached to a BT81x to full-speed mode - * * @return Returns E_OK in case of success, EVE_FAIL_FLASH_STATUS_INIT if the status remains init, * EVE_FAIL_FLASH_STATUS_DETACHED if no flash chip was found, a number of different values for failures with * cmd_flashfast and E_NOT_OK if a not supported status is returned in REG_FLASH_STATUS. @@ -1229,7 +1376,7 @@ uint8_t EVE_init_flash(void) ret_val = E_OK; } - return ret_val; + return (ret_val); } #endif /* EVE_GEN > 2 */ @@ -1253,7 +1400,8 @@ void use_gt911(void) #else /* FT811 / FT813 binary-blob from FTDIs AN_336 to patch the touch-engine for Goodix GT911 / GT9271 touch controllers */ -const uint8_t eve_gt911_data[1184U] PROGMEM = { +const uint8_t eve_gt911_data[1184U] PROGMEM = +{ 26, 255, 255, 255, 32, 32, 48, 0, 4, 0, 0, 0, 2, 0, 0, 0, 34, 255, 255, 255, 0, 176, 48, 0, 120, 218, 237, 84, 221, 111, 84, 69, 20, 63, 51, 179, 93, 160, 148, 101, 111, 76, 5, 44, 141, 123, 111, 161, 11, 219, 154, 16, 9, 16, 17, 229, 156, 75, 26, 11, 13, 21, 227, 3, 16, 252, 184, 179, 45, @@ -1305,7 +1453,8 @@ const uint8_t eve_gt911_data[1184U] PROGMEM = { 188, 11, 55, 240, 31, 243, 122, 152, 226, 183, 207, 154, 73, 188, 39, 219, 43, 105, 222, 87, 41, 143, 141, 140, 175, 73, 112, 184, 252, 61, 184, 16, 90, 250, 35, 168, 82, 119, 176, 57, 116, 94, 200, 150, 22, 190, 179, 44, 104, 12, 235, 84, 149, 102, 252, 89, 154, 193, 99, 228, 106, 242, 125, 248, 64, 194, 255, 223, 127, - 242, 83, 11, 255, 2, 70, 214, 226, 128, 0, 0}; + 242, 83, 11, 255, 2, 70, 214, 226, 128, 0, 0 +}; EVE_cs_set(); spi_transmit((uint8_t) 0xB0U); /* high-byte of REG_CMDB_WRITE + MEM_WRITE */ @@ -1333,7 +1482,6 @@ const uint8_t eve_gt911_data[1184U] PROGMEM = { /** * @brief Waits for either reading REG_ID with a value of 0x7c, indicating that * an EVE chip is present and ready to communicate, or untill a timeout of 400ms has passed. - * * @return Returns E_OK in case of success, EVE_FAIL_REGID_TIMEOUT if the * value of 0x7c could not be read. */ @@ -1354,14 +1502,13 @@ static uint8_t wait_regid(void) } } - return ret; + return (ret); } /** * @brief Waits for either REG_CPURESET to indicate that the audio, touch and * coprocessor units finished their respective reset cycles, * or untill a timeout of 50ms has passed. - * * @return Returns E_OK in case of success, EVE_FAIL_RESET_TIMEOUT if either the * audio, touch or coprocessor unit indicate a fault by not returning from reset. */ @@ -1382,11 +1529,11 @@ static uint8_t wait_reset(void) } } - return ret; + return (ret); } /** - * @brief Writes all parameters defined for the display selected in EVE_config.h + * @brief Writes all parameters defined for the display selected in EVE_config.h. * to the corresponding registers. * It is used by EVE_init() and can be used to refresh the register values if needed. */ @@ -1438,15 +1585,17 @@ static void enable_pixel_clock(void) #endif } -/* EVE chip initialization, has to be executed with the SPI setup to 11 MHz or less as required by FT8xx / BT8xx! */ -/* Takes no parameters but has a few optional parameters that are used by setting up defines. */ -/* EVE_TOUCH_RZTHRESH - configure the sensitivity of resistive touch, defaults to 1200. */ -/* EVE_ROTATE - set the screen rotation: bit0 = invert, bit2 = portrait, bit3 = mirrored */ -/* Note: if you use this you need a set of calibration values for the selected rotation since this rotates before - * calibration! */ -/* EVE_BACKLIGHT_FREQ - configure the backlight frequency, default is not writing it which results in 250Hz */ -/* EVE_BACKLIGHT_PWM - configure the backlight pwm, defaults to 0x20 / 25% */ -/* Returns E_OK in case of success. */ +/** + * @brief Initializes EVE according to the selected configuration from EVE_config.h. + * @return E_OK in case of success + * @note - Has to be executed with the SPI setup to 11 MHz or less as required by FT8xx / BT8xx! + * @note - Additional settings can be made through extra macros. + * @note - EVE_TOUCH_RZTHRESH - configure the sensitivity of resistive touch, defaults to 1200. + * @note - EVE_ROTATE - set the screen rotation: bit0 = invert, bit1 = portrait, bit2 = mirrored. + * @note - needs a set of calibration values for the selected rotation since this rotates before calibration! + * @note - EVE_BACKLIGHT_FREQ - configure the backlight frequency, default is not writing it which results in 250Hz. + * @note - EVE_BACKLIGHT_PWM - configure the backlight pwm, defaults to 0x20 / 25%. + */ uint8_t EVE_init(void) { uint8_t ret; @@ -1537,16 +1686,19 @@ uint8_t EVE_init(void) } } - return ret; + return (ret); } /* ################################################################## functions for display lists ##################################################################### */ -/* Begin a sequence of commands or prepare a DMA transfer if applicable. */ -/* Needs to be used with EVE_end_cmd_burst(). */ -/* Be careful to not use any functions in the sequence that do not address the command-fifo as for example any of EVE_mem...() functions. */ +/** + * @brief Begin a sequence of commands or prepare a DMA transfer if applicable. + * @note - Needs to be used with EVE_end_cmd_burst(). + * @note - Do not use any functions in the sequence that do not address the command-fifo as for example any of EVE_mem...() functions. + * @note - Do not use any of the functions that do not support burst-mode. + */ void EVE_start_cmd_burst(void) { #if defined (EVE_DMA) @@ -1560,7 +1712,7 @@ void EVE_start_cmd_burst(void) #if defined (EVE_DMA) EVE_dma_buffer[0U] = 0x7825B000UL; /* REG_CMDB_WRITE + MEM_WRITE low mid hi 00 */ -// ((uint8_t)(ft_address >> 16U) | MEM_WRITE) | (ft_address & 0x0000ff00UL) | ((uint8_t)(ft_address) << 16U); +// ((uint8_t) (ft_address >> 16U) | MEM_WRITE) | (ft_address & 0x0000ff00UL) | ((uint8_t) (ft_address) << 16U); // EVE_dma_buffer[0U] = EVE_dma_buffer[0U] << 8U; EVE_dma_buffer_index = 1U; #else @@ -1571,8 +1723,10 @@ void EVE_start_cmd_burst(void) #endif } -/* End a sequence of commands or trigger a prepared DMA transfer if applicable. */ -/* Needs to be used with EVE_start_cmd_burst(). */ +/** + * @brief End a sequence of commands or trigger a prepared DMA transfer if applicable. + * @note - Needs to be used with EVE_start_cmd_burst(). + */ void EVE_end_cmd_burst(void) { cmd_burst = 0U; @@ -1584,7 +1738,7 @@ void EVE_end_cmd_burst(void) #endif } -/* write a string to co-processor memory in context of a command: */ +/* write a string to coprocessor memory in context of a command: */ /* no chip-select, just plain SPI-transfers */ static void private_string_write(const char *p_text) { @@ -1622,7 +1776,9 @@ static void private_string_write(const char *p_text) for (uint8_t index = 0U; index < 4U; index++) { - uint8_t data = p_bytes[textindex + index]; + uint8_t data; + + data = p_bytes[textindex + index]; if (0U == data) { @@ -1643,8 +1799,10 @@ static void private_string_write(const char *p_text) /* BT817 / BT818 */ #if EVE_GEN > 3 -void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, - uint32_t frame) +/** + * @brief Render one frame in RAM_G of an animation. + */ +void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { if (0U == cmd_burst) { @@ -1666,6 +1824,9 @@ void EVE_cmd_animframeram(int16_t xc0, int16_t yc0, uint32_t aoptr, } } +/** + * @brief Render one frame in RAM_G of an animation, only works in burst-mode. + */ void EVE_cmd_animframeram_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { @@ -1675,6 +1836,9 @@ void EVE_cmd_animframeram_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, spi_transmit_burst(frame); } +/** + * @brief Start an animation in RAM_G. + */ void EVE_cmd_animstartram(int32_t chnl, uint32_t aoptr, uint32_t loop) { if (0U == cmd_burst) @@ -1694,6 +1858,9 @@ void EVE_cmd_animstartram(int32_t chnl, uint32_t aoptr, uint32_t loop) } } +/** + * @brief Start an animation in RAM_G, only works in burst-mode. + */ void EVE_cmd_animstartram_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) { spi_transmit_burst(CMD_ANIMSTARTRAM); @@ -1702,6 +1869,9 @@ void EVE_cmd_animstartram_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) spi_transmit_burst(loop); } +/** + * @brief Sets the API level used by the coprocessor. + */ void EVE_cmd_apilevel(uint32_t level) { if (0U == cmd_burst) @@ -1717,14 +1887,20 @@ void EVE_cmd_apilevel(uint32_t level) } } +/** + * @brief Sets the API level used by the coprocessor, only works in burst-mode. + */ void EVE_cmd_apilevel_burst(uint32_t level) { spi_transmit_burst(CMD_APILEVEL); spi_transmit_burst(level); } -void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, - uint16_t height) +/** + * @brief Execute the touch screen calibration routine for a sub-window. + * @note - Does not support burst-mode. + */ +void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, uint16_t height) { if (0U == cmd_burst) { @@ -1741,6 +1917,9 @@ void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, } } +/** + * @brief Calls a command list in RAM_G. + */ void EVE_cmd_calllist(uint32_t adr) { if (0U == cmd_burst) @@ -1756,12 +1935,19 @@ void EVE_cmd_calllist(uint32_t adr) } } +/** + * @brief Calls a command list in RAM_G, only works in burst-mode. + */ void EVE_cmd_calllist_burst(uint32_t adr) { spi_transmit_burst(CMD_CALLLIST); spi_transmit_burst(adr); } +/** + * @brief Setup the Horizontal Scan out Filter for non-square pixel LCD support. + * @note - Does not support burst-mode. + */ void EVE_cmd_hsf(uint32_t hsf) { if (0U == cmd_burst) @@ -1770,19 +1956,11 @@ void EVE_cmd_hsf(uint32_t hsf) spi_transmit_32(hsf); EVE_cs_clear(); } - else - { - spi_transmit_burst(CMD_HSF); - spi_transmit_burst(hsf); - } -} - -void EVE_cmd_hsf_burst(uint32_t hsf) -{ - spi_transmit_burst(CMD_HSF); - spi_transmit_burst(hsf); } +/** + * @brief Play/run animations until complete. + */ void EVE_cmd_runanim(uint32_t waitmask, uint32_t play) { if (0U == cmd_burst) @@ -1800,6 +1978,9 @@ void EVE_cmd_runanim(uint32_t waitmask, uint32_t play) } } +/** + * @brief Play/run animations until complete, only works in burst-mode. + */ void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play) { spi_transmit_burst(CMD_RUNANIM); @@ -1812,6 +1993,9 @@ void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play) /* BT815 / BT816 */ #if EVE_GEN > 2 +/** + * @brief Draw one or more active animations. + */ void EVE_cmd_animdraw(int32_t chnl) { if (0U == cmd_burst) @@ -1827,12 +2011,18 @@ void EVE_cmd_animdraw(int32_t chnl) } } +/** + * @brief Draw one or more active animations, only works in burst-mode. + */ void EVE_cmd_animdraw_burst(int32_t chnl) { spi_transmit_burst(CMD_ANIMDRAW); spi_transmit_burst((uint32_t) chnl); } +/** + * @brief Draw the specified frame of an animation. + */ void EVE_cmd_animframe(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { if (0U == cmd_burst) @@ -1855,6 +2045,9 @@ void EVE_cmd_animframe(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) } } +/** + * @brief Draw the specified frame of an animation, only works in burst-mode. + */ void EVE_cmd_animframe_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, uint32_t frame) { @@ -1864,6 +2057,9 @@ void EVE_cmd_animframe_burst(int16_t xc0, int16_t yc0, uint32_t aoptr, spi_transmit_burst(frame); } +/** + * @brief Start an animation. + */ void EVE_cmd_animstart(int32_t chnl, uint32_t aoptr, uint32_t loop) { if (0U == cmd_burst) @@ -1883,6 +2079,9 @@ void EVE_cmd_animstart(int32_t chnl, uint32_t aoptr, uint32_t loop) } } +/** + * @brief Start an animation, only works in burst-mode. + */ void EVE_cmd_animstart_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) { spi_transmit_burst(CMD_ANIMSTART); @@ -1891,6 +2090,9 @@ void EVE_cmd_animstart_burst(int32_t chnl, uint32_t aoptr, uint32_t loop) spi_transmit_burst(loop); } +/** + * @brief Stops one or more active animations. + */ void EVE_cmd_animstop(int32_t chnl) { if (0U == cmd_burst) @@ -1906,12 +2108,18 @@ void EVE_cmd_animstop(int32_t chnl) } } +/** + * @brief Stops one or more active animations, only works in burst-mode. + */ void EVE_cmd_animstop_burst(int32_t chnl) { spi_transmit_burst(CMD_ANIMSTOP); spi_transmit_burst((uint32_t) chnl); } +/** + * @brief Sets the coordinates of an animation. + */ void EVE_cmd_animxy(int32_t chnl, int16_t xc0, int16_t yc0) { if (0U == cmd_burst) @@ -1932,6 +2140,9 @@ void EVE_cmd_animxy(int32_t chnl, int16_t xc0, int16_t yc0) } } +/** + * @brief Sets the coordinates of an animation, only works in burst-mode. + */ void EVE_cmd_animxy_burst(int32_t chnl, int16_t xc0, int16_t yc0) { spi_transmit_burst(CMD_ANIMXY); @@ -1939,6 +2150,9 @@ void EVE_cmd_animxy_burst(int32_t chnl, int16_t xc0, int16_t yc0) spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); } +/** + * @brief Append flash data to the display list. + */ void EVE_cmd_appendf(uint32_t ptr, uint32_t num) { if (0U == cmd_burst) @@ -1956,6 +2170,9 @@ void EVE_cmd_appendf(uint32_t ptr, uint32_t num) } } +/** + * @brief Append flash data to the display list, only works in burst-mode. + */ void EVE_cmd_appendf_burst(uint32_t ptr, uint32_t num) { spi_transmit_burst(CMD_APPENDF); @@ -1963,6 +2180,9 @@ void EVE_cmd_appendf_burst(uint32_t ptr, uint32_t num) spi_transmit_burst(num); } +/** + * @brief Computes a bitmap transform and appends commands BITMAP_TRANSFORM_A...BITMAP_TRANSFORM_F to the display list. + */ uint16_t EVE_cmd_bitmap_transform(int32_t xc0, int32_t yc0, int32_t xc1, int32_t yc1, int32_t xc2, int32_t yc2, int32_t tx0, int32_t ty0, int32_t tx1, @@ -2012,11 +2232,13 @@ uint16_t EVE_cmd_bitmap_transform(int32_t xc0, int32_t yc0, int32_t xc1, spi_transmit_burst((uint32_t) ty2); spi_transmit_burst(0UL); } - return ret_val; + return (ret_val); } -/* note: as this is meant for use in burst-mode display-list generation */ -/* the result parameter is ignored */ +/** + * @brief Computes a bitmap transform and appends commands BITMAP_TRANSFORM_A...BITMAP_TRANSFORM_F to the display list. + * @note - Only works in burst-mode, the result parameter is ignored. + */ void EVE_cmd_bitmap_transform_burst(int32_t xc0, int32_t yc0, int32_t xc1, int32_t yc1, int32_t xc2, int32_t yc2, int32_t tx0, int32_t ty0, int32_t tx1, @@ -2038,6 +2260,9 @@ void EVE_cmd_bitmap_transform_burst(int32_t xc0, int32_t yc0, int32_t xc1, spi_transmit_burst(0UL); } +/** + * @brief Sets the pixel fill width for CMD_TEXT,CMD_BUTTON,CMD_BUTTON with the OPT_FILL option. + */ void EVE_cmd_fillwidth(uint32_t pixel) { if (0U == cmd_burst) @@ -2053,14 +2278,20 @@ void EVE_cmd_fillwidth(uint32_t pixel) } } +/** + * @brief Sets the pixel fill width for CMD_TEXT,CMD_BUTTON,CMD_BUTTON with the OPT_FILL option. + * @note - Only works in burst-mode. + */ void EVE_cmd_fillwidth_burst(uint32_t pixel) { spi_transmit_burst(CMD_FILLWIDTH); spi_transmit_burst(pixel); } -void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, - int16_t yc1, uint32_t argb1) +/** + * @brief Draw a smooth color gradient with transparency. + */ +void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1) { if (0U == cmd_burst) { @@ -2087,8 +2318,10 @@ void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, } } -void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, - int16_t xc1, int16_t yc1, uint32_t argb1) +/** + * @brief Draw a smooth color gradient with transparency, only works in burst-mode. + */ +void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1) { spi_transmit_burst(CMD_GRADIENTA); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); @@ -2097,14 +2330,17 @@ void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, spi_transmit_burst(argb1); } -void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale) +/** + * @brief Apply a rotation and scale around a specified coordinate. + */ +void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale) { if (0U == cmd_burst) { eve_begin_cmd(CMD_ROTATEAROUND); spi_transmit_32((uint32_t) xc0); spi_transmit_32((uint32_t) yc0); - spi_transmit_32((uint32_t) angle); + spi_transmit_32(angle & 0xFFFFUL); spi_transmit_32((uint32_t) scale); EVE_cs_clear(); } @@ -2113,24 +2349,31 @@ void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale spi_transmit_burst(CMD_ROTATEAROUND); spi_transmit_burst((uint32_t) xc0); spi_transmit_burst((uint32_t) yc0); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); spi_transmit_burst((uint32_t) scale); } } -void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, int32_t angle, +/** + * @brief Apply a rotation and scale around a specified coordinate, only works in burst-mode. + */ +void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale) { spi_transmit_burst(CMD_ROTATEAROUND); spi_transmit_burst((uint32_t) xc0); spi_transmit_burst((uint32_t) yc0); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); spi_transmit_burst((uint32_t) scale); } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text, +/** + * @brief Draw a button with a label, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_button_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { if (0U == cmd_burst) @@ -2140,12 +2383,12 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2166,8 +2409,8 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + ((uint32_t) options << 16U)); + spi_transmit_burst(((uint32_t) wid) + ((uint32_t) hgt << 16U)); + spi_transmit_burst(((uint32_t) font) + ((uint32_t) options << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2183,15 +2426,19 @@ void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text, +/** + * @brief Draw a button with a label, varargs version, only works in burst-mode. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + ((uint32_t) options << 16U)); + spi_transmit_burst(((uint32_t) wid) + ((uint32_t) hgt << 16U)); + spi_transmit_burst(((uint32_t) font) + ((uint32_t) options << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2206,8 +2453,12 @@ void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_text_var(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { @@ -2218,8 +2469,8 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2240,7 +2491,7 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2256,14 +2507,18 @@ void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2278,8 +2533,12 @@ void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, varargs version. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { @@ -2290,10 +2549,10 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (state)); @@ -2316,8 +2575,8 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font) << 16U))); - spi_transmit_burst((uint32_t) options + (((uint32_t) state) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2333,15 +2592,19 @@ void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, } } -/* "num_args" is the number of elements provided in "p_arguments[]" */ -void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, varargs version, only works in burst-mode. + * @param p_arguments[] pointer to an array of values converted to uint32_t to be used when using EVE_OPT_FORMAT + * @param num_args the number of elements provided in p_arguments[] + */ +void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]) { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font) << 16U))); - spi_transmit_burst((uint32_t) options + (((uint32_t) state) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); if ((options & EVE_OPT_FORMAT) != 0U) @@ -2358,18 +2621,14 @@ void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t fon #endif /* EVE_GEN > 2 */ -/* generic function for: */ -/* all co-processor commands that have no arguments */ -/* all display-list commands */ -/* - examples: - EVE_cmd_dl(CMD_DLSTART); - EVE_cmd_dl(CMD_SWAP); - EVE_cmd_dl(CMD_SCREENSAVER); - EVE_cmd_dl(LINE_WIDTH(1*16)); - EVE_cmd_dl(VERTEX2F(0,0)); - EVE_cmd_dl(DL_BEGIN | EVE_RECTS); -*/ +/** + * @brief Generic function for display-list and coprocessor commands with no arguments, only works in burst-mode. + * @note - EVE_cmd_dl(CMD_DLSTART); + * @note - EVE_cmd_dl(CMD_SWAP); + * @note - EVE_cmd_dl(CMD_SCREENSAVER); + * @note - EVE_cmd_dl(VERTEX2F(0,0)); + * @note - EVE_cmd_dl(DL_BEGIN | EVE_RECTS); + */ void EVE_cmd_dl(uint32_t command) { if (0U == cmd_burst) @@ -2383,11 +2642,17 @@ void EVE_cmd_dl(uint32_t command) } } +/** + * @brief Generic function for display-list and coprocessor commands with no arguments, only works in burst-mode. + */ void EVE_cmd_dl_burst(uint32_t command) { spi_transmit_burst(command); } +/** + * @brief Appends commands from RAM_G to the display list. + */ void EVE_cmd_append(uint32_t ptr, uint32_t num) { if (0U == cmd_burst) @@ -2405,6 +2670,9 @@ void EVE_cmd_append(uint32_t ptr, uint32_t num) } } +/** + * @brief Appends commands from RAM_G to the display list, only works in burst-mode. + */ void EVE_cmd_append_burst(uint32_t ptr, uint32_t num) { spi_transmit_burst(CMD_APPEND); @@ -2412,6 +2680,9 @@ void EVE_cmd_append_burst(uint32_t ptr, uint32_t num) spi_transmit_burst(num); } +/** + * @brief Set the background color. + */ void EVE_cmd_bgcolor(uint32_t color) { if (0U == cmd_burst) @@ -2430,14 +2701,20 @@ void EVE_cmd_bgcolor(uint32_t color) } } +/** + * @brief Set the background color, only works in burst-mode. + */ void EVE_cmd_bgcolor_burst(uint32_t color) { spi_transmit_burst(CMD_BGCOLOR); spi_transmit_burst(color); } -void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a button with a label. + */ +void EVE_cmd_button(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) { @@ -2446,12 +2723,12 @@ void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2461,22 +2738,29 @@ void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a button with a label, only works in burst-mode. + */ +void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_BUTTON); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } +/** + * @brief Execute the touch screen calibration routine. + * @note - does not support burst-mode + */ void EVE_cmd_calibrate(void) { if (0U == cmd_burst) @@ -2487,65 +2771,74 @@ void EVE_cmd_calibrate(void) } } -void EVE_cmd_clock(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, - uint16_t mins, uint16_t secs, uint16_t msecs) +/** + * @brief Draw an analog clock. + */ +void EVE_cmd_clock(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, + uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs) { if (0U == cmd_burst) { eve_begin_cmd(CMD_CLOCK); - spi_transmit((uint8_t)((uint16_t) xc0)); - spi_transmit((uint8_t)(((uint16_t) xc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) yc0)); - spi_transmit((uint8_t)(((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) rad)); - spi_transmit((uint8_t)(((uint16_t) rad) >> 8U)); - spi_transmit((uint8_t)(options)); - spi_transmit((uint8_t)(options >> 8U)); - spi_transmit((uint8_t)(hours)); - spi_transmit((uint8_t)(hours >> 8U)); - spi_transmit((uint8_t)(mins)); - spi_transmit((uint8_t)(mins >> 8U)); - spi_transmit((uint8_t)(secs)); - spi_transmit((uint8_t)(secs >> 8U)); - spi_transmit((uint8_t)(msecs)); - spi_transmit((uint8_t)(msecs >> 8U)); + spi_transmit((uint8_t) ((uint16_t) xc0)); + spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); + spi_transmit((uint8_t) ((uint16_t) yc0)); + spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); + spi_transmit((uint8_t) (options)); + spi_transmit((uint8_t) (options >> 8U)); + spi_transmit((uint8_t) (hours)); + spi_transmit((uint8_t) (hours >> 8U)); + spi_transmit((uint8_t) (mins)); + spi_transmit((uint8_t) (mins >> 8U)); + spi_transmit((uint8_t) (secs)); + spi_transmit((uint8_t) (secs >> 8U)); + spi_transmit((uint8_t) (msecs)); + spi_transmit((uint8_t) (msecs >> 8U)); EVE_cs_clear(); } else { spi_transmit_burst(CMD_CLOCK); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); - spi_transmit_burst((uint32_t) hours + (((uint32_t) mins) << 16U)); - spi_transmit_burst((uint32_t) secs + (((uint32_t) msecs) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) hours) + (((uint32_t) mins) << 16U)); + spi_transmit_burst(((uint32_t) secs) + (((uint32_t) msecs) << 16U)); } } -void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, +/** + * @brief Draw an analog clock, only works in burst-mode. + */ +void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs) { spi_transmit_burst(CMD_CLOCK); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); - spi_transmit_burst((uint32_t) hours + (((uint32_t) mins) << 16U)); - spi_transmit_burst((uint32_t) secs + (((uint32_t) msecs) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) hours) + (((uint32_t) mins) << 16U)); + spi_transmit_burst(((uint32_t) secs) + (((uint32_t) msecs) << 16U)); } -void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val) +/** + * @brief Draw a rotary dial control. + */ +void EVE_cmd_dial(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val) { if (0U == cmd_burst) { eve_begin_cmd(CMD_DIAL); - spi_transmit((uint8_t)((uint16_t) xc0)); - spi_transmit((uint8_t)(((uint16_t) xc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) yc0)); - spi_transmit((uint8_t)(((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t)((uint16_t) rad)); - spi_transmit((uint8_t)(((uint16_t) rad) >> 8U)); - spi_transmit((uint8_t)(options)); - spi_transmit((uint8_t)(options >> 8U)); - spi_transmit((uint8_t)(val)); - spi_transmit((uint8_t)(val >> 8U)); + spi_transmit((uint8_t) ((uint16_t) xc0)); + spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); + spi_transmit((uint8_t) ((uint16_t) yc0)); + spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); + spi_transmit((uint8_t) (options)); + spi_transmit((uint8_t) (options >> 8U)); + spi_transmit((uint8_t) (val)); + spi_transmit((uint8_t) (val >> 8U)); spi_transmit(0U); spi_transmit(0U); EVE_cs_clear(); @@ -2553,29 +2846,35 @@ void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint1 else { spi_transmit_burst(CMD_DIAL); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(val); } } -void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a rotary dial control, only works in burst-mode. + */ +void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val) { spi_transmit_burst(CMD_DIAL); - spi_transmit_burst((uint32_t) ((uint16_t) xc0) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst((uint32_t) ((uint16_t) rad) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(val); } +/** + * @brief Set the foreground color. + */ void EVE_cmd_fgcolor(uint32_t color) { if (0U == cmd_burst) { eve_begin_cmd(CMD_FGCOLOR); - spi_transmit((uint8_t)(color)); - spi_transmit((uint8_t)(color >> 8U)); - spi_transmit((uint8_t)(color >> 16U)); + spi_transmit((uint8_t) (color)); + spi_transmit((uint8_t) (color >> 8U)); + spi_transmit((uint8_t) (color >> 16U)); spi_transmit(0U); EVE_cs_clear(); } @@ -2586,13 +2885,19 @@ void EVE_cmd_fgcolor(uint32_t color) } } +/** + * @brief Set the foreground color, only works in burst-mode. + */ void EVE_cmd_fgcolor_burst(uint32_t color) { spi_transmit_burst(CMD_FGCOLOR); spi_transmit_burst(color); } -void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a gauge. + */ +void EVE_cmd_gauge(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -2602,8 +2907,8 @@ void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) rad)); - spi_transmit((uint8_t) (((uint16_t) rad) >> 8U)); + spi_transmit((uint8_t) (rad)); + spi_transmit((uint8_t) (rad >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (major)); @@ -2620,27 +2925,30 @@ void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, { spi_transmit_burst(CMD_GAUGE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) rad)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(((uint32_t) major) + (((uint32_t) minor) << 16U)); spi_transmit_burst(((uint32_t) val) + (((uint32_t) range) << 16U)); } } -void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, +/** + * @brief Draw a gauge, only works in burst-mode. + */ +void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_GAUGE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) rad)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) rad) + (((uint32_t) options) << 16U)); spi_transmit_burst(((uint32_t) major) + (((uint32_t) minor) << 16U)); spi_transmit_burst(((uint32_t) val) + (((uint32_t) range) << 16U)); } -/* EVE_cmd_getmatrix() is meant to be called with display-list building. */ -/* but it waits for completion as it returns values by writing */ -/* to the command-fifo, it can not be used with cmd-burst */ -/* gets the properties of the bitmap transform matrix and write the values */ -/* to the variables that are supplied by pointers */ +/** + * @brief Retrieves the current matrix within the context of the coprocessor engine. + * @note - waits for completion and reads values from RAM_CMD after completion + * @note - can not be used with cmd-burst + */ void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, int32_t *p_d, int32_t *p_e, int32_t *p_f) { @@ -2662,45 +2970,48 @@ void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, if (p_f != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 4U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 4UL) & 0xfffUL); *p_f = (int32_t) EVE_memRead32(address); } if (p_e != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 8U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 8UL) & 0xfffUL); *p_e = (int32_t) EVE_memRead32(address); } if (p_d != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 12U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 12UL) & 0xfffUL); *p_d = (int32_t) EVE_memRead32(address); } if (p_c != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 16U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 16UL) & 0xfffUL); *p_c = (int32_t) EVE_memRead32(address); } if (p_b != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 20U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 20UL) & 0xfffUL); *p_b = (int32_t) EVE_memRead32(address); } if (p_a != NULL) { - address = EVE_RAM_CMD + ((cmdoffset - 24U) & 0xfffU); + address = EVE_RAM_CMD + ((cmdoffset - 24UL) & 0xfffUL); *p_a = (int32_t) EVE_memRead32(address); } } } +/** + * @brief Set up the highlight color used in 3D effects for CMD_BUTTON and CMD_KEYS. + */ void EVE_cmd_gradcolor(uint32_t color) { if (0U == cmd_burst) { eve_begin_cmd(CMD_GRADCOLOR); - spi_transmit((uint8_t)(color)); - spi_transmit((uint8_t)(color >> 8U)); - spi_transmit((uint8_t)(color >> 16U)); + spi_transmit((uint8_t) (color)); + spi_transmit((uint8_t) (color >> 8U)); + spi_transmit((uint8_t) (color >> 16U)); spi_transmit(0U); EVE_cs_clear(); } @@ -2711,12 +3022,18 @@ void EVE_cmd_gradcolor(uint32_t color) } } +/** + * @brief Set up the highlight color used in 3D effects for CMD_BUTTON and CMD_KEYS, only works in burst-mode. + */ void EVE_cmd_gradcolor_burst(uint32_t color) { spi_transmit_burst(CMD_GRADCOLOR); spi_transmit_burst(color); } +/** + * @brief Draw a smooth color gradient. + */ void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1) { @@ -2751,6 +3068,9 @@ void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, } } +/** + * @brief Draw a smooth color gradient, only works in burst-mode. + */ void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1) { @@ -2761,8 +3081,13 @@ void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1 spi_transmit_burst(rgb1); } -void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a row of key buttons with labels. + * @note - The tag value of each button is set to the ASCII value of its label. + * @note - Does not work with UTF-8. + */ +void EVE_cmd_keys(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) { @@ -2771,12 +3096,12 @@ void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -2786,24 +3111,32 @@ void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_KEYS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, - int16_t font, uint16_t options, const char *p_text) +/** + * @brief Draw a row of key buttons with labels, only works in burst-mode. + * @note - The tag value of each button is set to the ASCII value of its label. + * @note - Does not work with UTF-8. + */ +void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, + uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_KEYS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } -void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, - int32_t number) +/** + * @brief Draw a number. + */ +void EVE_cmd_number(int16_t xc0, int16_t yc0, uint16_t font, + uint16_t options, int32_t number) { if (0U == cmd_burst) { @@ -2812,8 +3145,8 @@ void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit_32((uint32_t) number); @@ -2823,21 +3156,27 @@ void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, { spi_transmit_burst(CMD_NUMBER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); spi_transmit_burst((uint32_t) number); } } -void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a number, only works in burst-mode. + */ +void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number) { spi_transmit_burst(CMD_NUMBER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); spi_transmit_burst((uint32_t) number); } -void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a progress bar. + */ +void EVE_cmd_progress(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -2847,10 +3186,10 @@ void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -2865,28 +3204,29 @@ void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_PROGRESS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) options) + ((uint32_t)val << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } } -void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a progress bar, only works in burst-mode. + */ +void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_PROGRESS); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); - spi_transmit_burst(((uint32_t) options) + ((uint32_t)val << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); + spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } -/* Note: CMD_ROMFONT generates display list commands so it needs to be put in a display list. */ -/* A minimum display list to properly execute CMD_ROMFONT would be: */ -/* EVE_cmd_dl(CMD_DLSTART); */ -/* EVE_cmd_romfont(font, romslot); */ -/* ...other bitmap handle commands like more CMD_ROMFONT or CMD_SETFONT2 */ -/* EVE_cmd_dl(CMD_SWAP); */ +/** + * @brief Load a ROM font into bitmap handle. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_romfont(uint32_t font, uint32_t romslot) { if (0U == cmd_burst) @@ -2904,6 +3244,10 @@ void EVE_cmd_romfont(uint32_t font, uint32_t romslot) } } +/** + * @brief Load a ROM font into bitmap handle, only works in burst-mode. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot) { spi_transmit_burst(CMD_ROMFONT); @@ -2911,27 +3255,36 @@ void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot) spi_transmit_burst(romslot); } -void EVE_cmd_rotate(int32_t angle) +/** + * @brief Apply a rotation to the current matrix. + */ +void EVE_cmd_rotate(uint32_t angle) { if (0U == cmd_burst) { eve_begin_cmd(CMD_ROTATE); - spi_transmit_32((uint32_t) angle); + spi_transmit_32(angle & 0xFFFFUL); EVE_cs_clear(); } else { spi_transmit_burst(CMD_ROTATE); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); } } -void EVE_cmd_rotate_burst(int32_t angle) +/** + * @brief Apply a rotation to the current matrix, only works in burst-mode. + */ +void EVE_cmd_rotate_burst(uint32_t angle) { spi_transmit_burst(CMD_ROTATE); - spi_transmit_burst((uint32_t) angle); + spi_transmit_burst(angle & 0xFFFFUL); } +/** + * @brief Apply a scale to the current matrix. + */ void EVE_cmd_scale(int32_t scx, int32_t scy) { if (0U == cmd_burst) @@ -2949,6 +3302,9 @@ void EVE_cmd_scale(int32_t scx, int32_t scy) } } +/** + * @brief Apply a scale to the current matrix, only works in burst-mode. + */ void EVE_cmd_scale_burst(int32_t scx, int32_t scy) { spi_transmit_burst(CMD_SCALE); @@ -2956,7 +3312,10 @@ void EVE_cmd_scale_burst(int32_t scx, int32_t scy) spi_transmit_burst((uint32_t) scy); } -void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a scroll bar. + */ +void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { if (0U == cmd_burst) @@ -2966,10 +3325,10 @@ void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -2984,22 +3343,28 @@ void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_SCROLLBAR); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst(((uint32_t) size) + (((uint32_t) range) << 16U)); } } -void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a scroll bar, only works in burst-mode. + */ +void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { spi_transmit_burst(CMD_SCROLLBAR); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst(((uint32_t) size) + (((uint32_t) range) << 16U)); } +/** + * @brief Set the base for number output. + */ void EVE_cmd_setbase(uint32_t base) { if (0U == cmd_burst) @@ -3015,12 +3380,18 @@ void EVE_cmd_setbase(uint32_t base) } } +/** + * @brief Set the base for number output, only works in burst-mode. + */ void EVE_cmd_setbase_burst(uint32_t base) { spi_transmit_burst(CMD_SETBASE); spi_transmit_burst(base); } +/** + * @brief Generate the corresponding display list commands for given bitmap information. + */ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height) { @@ -3028,12 +3399,12 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, { eve_begin_cmd(CMD_SETBITMAP); spi_transmit_32(addr); - spi_transmit((uint8_t)(fmt)); - spi_transmit((uint8_t)(fmt >> 8U)); - spi_transmit((uint8_t)(width)); - spi_transmit((uint8_t)(width >> 8U)); - spi_transmit((uint8_t)(height)); - spi_transmit((uint8_t)(height >> 8U)); + spi_transmit((uint8_t) (fmt)); + spi_transmit((uint8_t) (fmt >> 8U)); + spi_transmit((uint8_t) (width)); + spi_transmit((uint8_t) (width >> 8U)); + spi_transmit((uint8_t) (height)); + spi_transmit((uint8_t) (height >> 8U)); spi_transmit(0U); spi_transmit(0U); EVE_cs_clear(); @@ -3042,20 +3413,27 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, { spi_transmit_burst(CMD_SETBITMAP); spi_transmit_burst(addr); - spi_transmit_burst((uint32_t) fmt + (((uint32_t) width) << 16U)); + spi_transmit_burst(((uint32_t) fmt) + (((uint32_t) width) << 16U)); spi_transmit_burst((uint32_t) height); } } +/** + * @brief Generate the corresponding display list commands for given bitmap information, only works in burst-mode. + */ void EVE_cmd_setbitmap_burst(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height) { spi_transmit_burst(CMD_SETBITMAP); spi_transmit_burst(addr); - spi_transmit_burst((uint32_t) fmt + (((uint32_t) width) << 16U)); + spi_transmit_burst(((uint32_t) fmt) + (((uint32_t) width) << 16U)); spi_transmit_burst((uint32_t) height); } +/** + * @brief Register one custom font into the coprocessor engine. + * @note - does not set up the bitmap parameters of the font + */ void EVE_cmd_setfont(uint32_t font, uint32_t ptr) { if (0U == cmd_burst) @@ -3073,6 +3451,10 @@ void EVE_cmd_setfont(uint32_t font, uint32_t ptr) } } +/** + * @brief Register one custom font into the coprocessor engine, only works in burst-mode. + * @note - does not set up the bitmap parameters of the font + */ void EVE_cmd_setfont_burst(uint32_t font, uint32_t ptr) { spi_transmit_burst(CMD_SETFONT); @@ -3080,12 +3462,10 @@ void EVE_cmd_setfont_burst(uint32_t font, uint32_t ptr) spi_transmit_burst(ptr); } -/* Note: CMD_SETFONT2 generates display list commands so it needs to be put in a display list. */ -/* A minimum display list to properly execute CMD_SETFONT2 would be: */ -/* EVE_cmd_dl(CMD_DLSTART); */ -/* EVE_cmd_setfont2(font, ptr, firstchar); */ -/* ...other bitmap handle commands like more CMD_SETFONT2 or CMD_ROMFONT */ -/* EVE_cmd_dl(CMD_SWAP); */ +/** + * @brief Set up a custom for use by the coprocessor engine. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar) { if (0U == cmd_burst) @@ -3105,6 +3485,10 @@ void EVE_cmd_setfont2(uint32_t font, uint32_t ptr, uint32_t firstchar) } } +/** + * @brief Set up a custom for use by the coprocessor engine, only works in burst-mode. + * @note - generates display list commands, so it needs to be put in a display list + */ void EVE_cmd_setfont2_burst(uint32_t font, uint32_t ptr, uint32_t firstchar) { spi_transmit_burst(CMD_SETFONT2); @@ -3113,6 +3497,9 @@ void EVE_cmd_setfont2_burst(uint32_t font, uint32_t ptr, uint32_t firstchar) spi_transmit_burst(firstchar); } +/** + * @brief Set the scratch bitmap for widget use. + */ void EVE_cmd_setscratch(uint32_t handle) { if (0U == cmd_burst) @@ -3128,12 +3515,18 @@ void EVE_cmd_setscratch(uint32_t handle) } } +/** + * @brief Set the scratch bitmap for widget use, only works in burst-mode. + */ void EVE_cmd_setscratch_burst(uint32_t handle) { spi_transmit_burst(CMD_SETSCRATCH); spi_transmit_burst(handle); } +/** + * @brief Start a continuous sketch update. + */ void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format) { @@ -3165,6 +3558,9 @@ void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, } } +/** + * @brief Start a continuous sketch update, only works in burst-mode. + */ void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format) { @@ -3175,7 +3571,10 @@ void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, spi_transmit_burst((uint32_t) format); } -void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a slider. + */ +void EVE_cmd_slider(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { if (0U == cmd_burst) @@ -3185,10 +3584,10 @@ void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) hgt)); - spi_transmit((uint8_t) (((uint16_t) hgt) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (hgt)); + spi_transmit((uint8_t) (hgt >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (val)); @@ -3203,22 +3602,28 @@ void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, { spi_transmit_burst(CMD_SLIDER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } } -void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, +/** + * @brief Draw a slider, only works in burst-mode. + */ +void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range) { spi_transmit_burst(CMD_SLIDER); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) hgt)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) hgt) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) val) << 16U)); spi_transmit_burst((uint32_t) range); } +/** + * @brief Start an animated spinner. + */ void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) { if (0U == cmd_burst) @@ -3242,6 +3647,9 @@ void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) } } +/** + * @brief Start an animated spinner, only works in burst-mode. + */ void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale) { @@ -3250,7 +3658,10 @@ void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, spi_transmit_burst(((uint32_t) style) + (((uint32_t) scale) << 16U)); } -void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, +/** + * @brief Draw a text string. + */ +void EVE_cmd_text(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text) { if (0U == cmd_burst) @@ -3260,8 +3671,8 @@ void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); private_string_write(p_text); @@ -3271,21 +3682,27 @@ void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } } -void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, int16_t font, +/** + * @brief Draw a text string, only works in burst-mode. + */ +void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text) { spi_transmit_burst(CMD_TEXT); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) font)) + (((uint32_t) options) << 16U)); + spi_transmit_burst(((uint32_t) font) + (((uint32_t) options) << 16U)); private_string_write(p_text); } -void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels. + */ +void EVE_cmd_toggle(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text) { if (0U == cmd_burst) @@ -3295,10 +3712,10 @@ void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, spi_transmit((uint8_t) (((uint16_t) xc0) >> 8U)); spi_transmit((uint8_t) ((uint16_t) yc0)); spi_transmit((uint8_t) (((uint16_t) yc0) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) wid)); - spi_transmit((uint8_t) (((uint16_t) wid) >> 8U)); - spi_transmit((uint8_t) ((uint16_t) font)); - spi_transmit((uint8_t) (((uint16_t) font) >> 8U)); + spi_transmit((uint8_t) (wid)); + spi_transmit((uint8_t) (wid >> 8U)); + spi_transmit((uint8_t) (font)); + spi_transmit((uint8_t) (font >> 8U)); spi_transmit((uint8_t) (options)); spi_transmit((uint8_t) (options >> 8U)); spi_transmit((uint8_t) (state)); @@ -3310,22 +3727,28 @@ void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); } } -void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, +/** + * @brief Draw a toggle switch with labels, only works in burst-mode. + */ +void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text) { spi_transmit_burst(CMD_TOGGLE); spi_transmit_burst(((uint32_t) ((uint16_t) xc0)) + (((uint32_t) ((uint16_t) yc0)) << 16U)); - spi_transmit_burst(((uint32_t) ((uint16_t) wid)) + (((uint32_t) ((uint16_t) font)) << 16U)); + spi_transmit_burst(((uint32_t) wid) + (((uint32_t) font) << 16U)); spi_transmit_burst(((uint32_t) options) + (((uint32_t) state) << 16U)); private_string_write(p_text); } +/** + * @brief Apply a translation to the current matrix. + */ void EVE_cmd_translate(int32_t tr_x, int32_t tr_y) { if (0U == cmd_burst) @@ -3343,6 +3766,9 @@ void EVE_cmd_translate(int32_t tr_x, int32_t tr_y) } } +/** + * @brief Apply a translation to the current matrix, only works in burst-mode. + */ void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y) { spi_transmit_burst(CMD_TRANSLATE); @@ -3350,21 +3776,33 @@ void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y) spi_transmit_burst((uint32_t) tr_y); } +/** + * @brief Set the current color red, green and blue. + */ void EVE_color_rgb(uint32_t color) { EVE_cmd_dl(DL_COLOR_RGB | (color & 0x00ffffffUL)); } +/** + * @brief Set the current color red, green and blue, only works in burst-mode. + */ void EVE_color_rgb_burst(uint32_t color) { spi_transmit_burst(DL_COLOR_RGB | (color & 0x00ffffffUL)); } +/** + * @brief Set the current color alpha, green and blue. + */ void EVE_color_a(uint8_t alpha) { EVE_cmd_dl(DL_COLOR_A | ((uint32_t) alpha)); } +/** + * @brief Set the current color alpha, green and blue, only works in burst-mode. + */ void EVE_color_a_burst(uint8_t alpha) { spi_transmit_burst(DL_COLOR_A | ((uint32_t) alpha)); @@ -3417,19 +3855,26 @@ void EVE_calibrate_manual(uint16_t width, uint16_t height) EVE_cmd_dl(CMD_DLSTART); EVE_cmd_dl(DL_CLEAR_COLOR_RGB); EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG); + EVE_cmd_dl(DL_VERTEX_FORMAT); /* set to 0 - reduce precision for VERTEX2F to 1 pixel instead of 1/16 pixel default */ /* draw Calibration Point on screen */ EVE_cmd_dl(DL_COLOR_RGB | 0x0000ffUL); EVE_cmd_dl(POINT_SIZE(15U * 16U)); EVE_cmd_dl((DL_BEGIN | EVE_POINTS)); - EVE_cmd_dl(VERTEX2F((uint32_t)(display_x[count]) * 16U, (uint32_t)((display_y[count])) * 16U)); + + int16_t xc0; + int16_t yc0; + + xc0 = (int16_t) display_x[count]; + yc0 = (int16_t) display_y[count]; + EVE_cmd_dl(VERTEX2F(xc0, yc0)); EVE_cmd_dl(DL_END); EVE_cmd_dl(DL_COLOR_RGB | 0xffffffUL); - EVE_cmd_text((int16_t) width / 2, 20, 26, EVE_OPT_CENTER, "tap on the dot"); + EVE_cmd_text((int16_t) width / 2, 20, 26U, EVE_OPT_CENTER, "tap on the dot"); calc = count + 0x31U; num[0U] = (char) calc; num[1U] = (char) 0U; /* null terminated string of one character */ - EVE_cmd_text((int16_t) display_x[count], (int16_t) display_y[count], 27, EVE_OPT_CENTER, num); + EVE_cmd_text((int16_t) display_x[count], (int16_t) display_y[count], 27U, EVE_OPT_CENTER, num); EVE_cmd_dl(DL_DISPLAY); EVE_cmd_dl(CMD_SWAP); diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.h b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.h index 912e493..144d7ed 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.h +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_commands.h @@ -2,7 +2,7 @@ @file EVE_commands.h @brief contains FT8xx / BT8xx function prototypes @version 5.0 -@date 2023-07-28 +@date 2023-12-29 @author Rudolph Riedel @section LICENSE @@ -80,6 +80,10 @@ EVE_cmd_animstartram_burst() - put E_OK and E_NOT_OK in #ifndef/#endif guards as these are usually defined already in AUTOSAR projects - renamed EVE_FAIL_CHIPID_TIMEOUT to EVE_FAIL_REGID_TIMEOUT as suggested by #93 on github +- changed a number of function parameters from signed to unsigned following the + updated BT81x series programming guide V2.4 +- commented out EVE_cmd_regread() prototype +- removed prototype for EVE_cmd_hsf_burst() */ @@ -142,8 +146,8 @@ void EVE_execute_cmd(void); #if EVE_GEN > 3 void EVE_cmd_flashprogram(uint32_t dest, uint32_t src, uint32_t num); -void EVE_cmd_fontcache(uint32_t font, int32_t ptr, uint32_t num); -void EVE_cmd_fontcachequery(uint32_t *p_total, int32_t *p_used); +void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num); +void EVE_cmd_fontcachequery(uint32_t *p_total, uint32_t *p_used); void EVE_cmd_getimage(uint32_t *p_source, uint32_t *p_fmt, uint32_t *p_width, uint32_t *p_height, uint32_t *p_palette); void EVE_cmd_linetime(uint32_t dest); void EVE_cmd_newlist(uint32_t adr); @@ -180,15 +184,15 @@ void EVE_cmd_mediafifo(uint32_t ptr, uint32_t size); void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num); uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num); void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num); -/*(void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data); */ void EVE_cmd_memzero(uint32_t ptr, uint32_t num); void EVE_cmd_playvideo(uint32_t options, const uint8_t *p_data, uint32_t len); -uint32_t EVE_cmd_regread(uint32_t ptr); void EVE_cmd_setrotate(uint32_t rotation); void EVE_cmd_snapshot(uint32_t ptr); -void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt); -void EVE_cmd_track(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t tag); +void EVE_cmd_snapshot2(uint32_t fmt, uint32_t ptr, int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt); +void EVE_cmd_track(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t tag); void EVE_cmd_videoframe(uint32_t dest, uint32_t result_ptr); +/*void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *p_data);*/ +/*uint32_t EVE_cmd_regread(uint32_t ptr);*/ /* ################################################################## patching and initialization @@ -221,7 +225,6 @@ void EVE_cmd_calibratesub(uint16_t xc0, uint16_t yc0, uint16_t width, uint16_t h void EVE_cmd_calllist(uint32_t adr); void EVE_cmd_calllist_burst(uint32_t adr); void EVE_cmd_hsf(uint32_t hsf); -void EVE_cmd_hsf_burst(uint32_t hsf); void EVE_cmd_runanim(uint32_t waitmask, uint32_t play); void EVE_cmd_runanim_burst(uint32_t waitmask, uint32_t play); @@ -250,15 +253,15 @@ void EVE_cmd_fillwidth(uint32_t pixel); void EVE_cmd_fillwidth_burst(uint32_t pixel); void EVE_cmd_gradienta(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1); void EVE_cmd_gradienta_burst(int16_t xc0, int16_t yc0, uint32_t argb0, int16_t xc1, int16_t yc1, uint32_t argb1); -void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale); -void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, int32_t angle, int32_t scale); +void EVE_cmd_rotatearound(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale); +void EVE_cmd_rotatearound_burst(int32_t xc0, int32_t yc0, uint32_t angle, int32_t scale); -void EVE_cmd_button_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_text_var(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); -void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_button_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_button_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_text_var(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_text_var_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_toggle_var(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); +void EVE_cmd_toggle_var_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text, uint8_t num_args, const uint32_t p_arguments[]); #endif /* EVE_GEN > 2 */ @@ -269,36 +272,36 @@ void EVE_cmd_append(uint32_t ptr, uint32_t num); void EVE_cmd_append_burst(uint32_t ptr, uint32_t num); void EVE_cmd_bgcolor(uint32_t color); void EVE_cmd_bgcolor_burst(uint32_t color); -void EVE_cmd_button(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); +void EVE_cmd_button(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_button_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); void EVE_cmd_calibrate(void); -void EVE_cmd_clock(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); -void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); -void EVE_cmd_dial(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val); -void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t val); +void EVE_cmd_clock(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); +void EVE_cmd_clock_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t hours, uint16_t mins, uint16_t secs, uint16_t msecs); +void EVE_cmd_dial(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val); +void EVE_cmd_dial_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t val); void EVE_cmd_fgcolor(uint32_t color); void EVE_cmd_fgcolor_burst(uint32_t color); -void EVE_cmd_gauge(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); -void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, int16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); +void EVE_cmd_gauge(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); +void EVE_cmd_gauge_burst(int16_t xc0, int16_t yc0, uint16_t rad, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); void EVE_cmd_getmatrix(int32_t *p_a, int32_t *p_b, int32_t *p_c, int32_t *p_d, int32_t *p_e, int32_t *p_f); void EVE_cmd_gradcolor(uint32_t color); void EVE_cmd_gradcolor_burst(uint32_t color); void EVE_cmd_gradient(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1); void EVE_cmd_gradient_burst(int16_t xc0, int16_t yc0, uint32_t rgb0, int16_t xc1, int16_t yc1, uint32_t rgb1); -void EVE_cmd_keys(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_number(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, int32_t number); -void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, int32_t number); -void EVE_cmd_progress(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); -void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_keys(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_keys_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_number(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number); +void EVE_cmd_number_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, int32_t number); +void EVE_cmd_progress(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_progress_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); void EVE_cmd_romfont(uint32_t font, uint32_t romslot); void EVE_cmd_romfont_burst(uint32_t font, uint32_t romslot); -void EVE_cmd_rotate(int32_t angle); -void EVE_cmd_rotate_burst(int32_t angle); +void EVE_cmd_rotate(uint32_t angle); +void EVE_cmd_rotate_burst(uint32_t angle); void EVE_cmd_scale(int32_t scx, int32_t scy); void EVE_cmd_scale_burst(int32_t scx, int32_t scy); -void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); -void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); +void EVE_cmd_scrollbar(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); +void EVE_cmd_scrollbar_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t size, uint16_t range); void EVE_cmd_setbase(uint32_t base); void EVE_cmd_setbase_burst(uint32_t base); void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t height); @@ -311,14 +314,14 @@ void EVE_cmd_setscratch(uint32_t handle); void EVE_cmd_setscratch_burst(uint32_t handle); void EVE_cmd_sketch(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format); void EVE_cmd_sketch_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint32_t ptr, uint16_t format); -void EVE_cmd_slider(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); -void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_slider(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); +void EVE_cmd_slider_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t hgt, uint16_t options, uint16_t val, uint16_t range); void EVE_cmd_spinner(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale); void EVE_cmd_spinner_burst(int16_t xc0, int16_t yc0, uint16_t style, uint16_t scale); -void EVE_cmd_text(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, int16_t font, uint16_t options, const char *p_text); -void EVE_cmd_toggle(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text); -void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, int16_t wid, int16_t font, uint16_t options, uint16_t state, const char *p_text); +void EVE_cmd_text(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_text_burst(int16_t xc0, int16_t yc0, uint16_t font, uint16_t options, const char *p_text); +void EVE_cmd_toggle(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text); +void EVE_cmd_toggle_burst(int16_t xc0, int16_t yc0, uint16_t wid, uint16_t font, uint16_t options, uint16_t state, const char *p_text); void EVE_cmd_translate(int32_t tr_x, int32_t tr_y); void EVE_cmd_translate_burst(int32_t tr_x, int32_t tr_y); diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target.h b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target.h index 8891c85..e926cfd 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target.h +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target.h @@ -2,7 +2,7 @@ @file EVE_target.h @brief target specific includes, definitions and functions @version 5.0 -@date 2023-09-01 +@date 2023-09-30 @author Rudolph Riedel @section LICENSE @@ -87,6 +87,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - fix: while working, the check for multiple different targets was not implemented correctly - added ARDUINO_HLK_w80x target for W801, W806 and Air103 boards - modified the RISC-V entry as there are ESP32 now with RISC-V core +- added detection of the Tasking compiler and added tc38x and tc39xb targets +- removed the unfortunately defunct WIZIOPICO */ @@ -285,8 +287,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif /* __GNUC__ */ -#endif /* !Arduino */ - /* ################################################################## */ /* ################################################################## */ @@ -312,6 +312,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* ################################################################## */ /* ################################################################## */ +#if defined(__TASKING__) + +#if (__CPU__ == tc38x) || (__CPU__ == tc39xb) + +#include "EVE_target/EVE_target_Tricore_Tasking.h" + +#endif +#endif + +/* ################################################################## */ +/* ################################################################## */ + +#endif /* !Arduino */ + #if defined (ARDUINO) #if defined (__AVR__) @@ -340,7 +354,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "EVE_target/EVE_target_Arduino_Nucleo_F446RE.h" -#elif defined (WIZIOPICO) || defined (PICOPI) +#elif defined (ARDUINO_RASPBERRY_PI_PICO) #include "EVE_target/EVE_target_Arduino_RP2040.h" diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target/EVE_target_XMEGA.h b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target/EVE_target_XMEGA.h index 88cb35e..d6aa97f 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target/EVE_target_XMEGA.h +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/EVE_target/EVE_target_XMEGA.h @@ -100,7 +100,7 @@ static inline uint8_t spi_receive(uint8_t data) { EVE_SPI.DATA = data; while (!(EVE_SPI.STATUS & 0x80)) {} // wait for transmit complete - return EVE_SPI.DATA; + return (EVE_SPI.DATA); } static inline uint8_t fetch_flash_byte(const uint8_t *p_data) diff --git a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/LICENSE b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/LICENSE index e454a70..a6ab28b 100644 --- a/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/LICENSE +++ b/examples/EVE_Test_XMEGA128A1_GEN4-FT813-50CTP/Display_Test1/EmbeddedVideoEngine/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2023 Rudolph Riedel +Copyright (c) 2016-2024 Rudolph Riedel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -18,4 +18,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -