diff --git a/core/SConscript.prodtest b/core/SConscript.prodtest index 88a593d999..0541d8178c 100644 --- a/core/SConscript.prodtest +++ b/core/SConscript.prodtest @@ -9,7 +9,7 @@ PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1' BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1' HW_REVISION = ARGUMENTS.get('HW_REVISION', None) -FEATURES_WANTED = ["input", "sbu", "sd_card", "rdb_led", "usb", "consumption_mask", "optiga", "haptic"] +FEATURES_WANTED = ["input", "sbu", "sd_card", "rgb_led", "usb", "consumption_mask", "optiga", "haptic"] CCFLAGS_MOD = '' CPPPATH_MOD = [] diff --git a/core/embed/projects/prodtest/README.md b/core/embed/projects/prodtest/README.md index a46c2ba932..18c6532d6c 100644 --- a/core/embed/projects/prodtest/README.md +++ b/core/embed/projects/prodtest/README.md @@ -243,6 +243,19 @@ HAPTIC 3000 OK ``` +### RGB_LED +The `RGB_LED` command allows you to test the functionality of the device's RGB LED. +It takes three input parameters, representing the intensity of the red, green, and blue color components. +Each component is a decimal value between 0 and 255. + +Example: +``` +// sets the RGB LED to red + +RGB_LED 255 0 0 +OK +``` + ### OTP READ The `OTP READ` command is utilized to retrieve a string parameter from the device's OTP memory. This string typically contains information identifying the model and production batch of the device. diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c index b7ff7c3906..55e5bacb9a 100644 --- a/core/embed/projects/prodtest/main.c +++ b/core/embed/projects/prodtest/main.c @@ -71,6 +71,10 @@ #include #endif +#ifdef USE_RGB_LED +#include +#endif + #ifdef USE_HASH_PROCESSOR #include #endif @@ -731,6 +735,33 @@ static void test_haptic(const char *args) { } #endif +#ifdef USE_RGB_LED +static void test_rgb_led(const char *args) { + static const int expected_params = 3; + + int params[expected_params]; + int num_params = 0; + + extract_params(args, params, &num_params, expected_params); + + if (num_params != expected_params) { + vcp_println("ERROR PARAM"); + return; + } + + if (params[0] > 255 || params[1] > 255 || params[2] > 255) { + vcp_println("ERROR RGB VALUE"); + return; + } + + uint32_t color = params[0] << 16 | params[1] << 8 | params[2]; + + rgb_led_set_color(color); + + vcp_println("OK"); +} +#endif + static void test_otp_read(void) { uint8_t data[FLASH_OTP_BLOCK_SIZE + 1]; memzero(data, sizeof(data)); @@ -1130,6 +1161,10 @@ int main(void) { #ifdef USE_HAPTIC haptic_init(); #endif +#ifdef USE_RGB_LED + rgb_led_init(); +#endif + usb_init_all(); uint32_t bootloader_version = read_bootloader_version(); @@ -1216,6 +1251,10 @@ int main(void) { } else if (startswith(line, "HAPTIC ")) { test_haptic(line + 7); #endif +#ifdef USE_RGB_LED + } else if (startswith(line, "RGB_LED ")) { + test_rgb_led(line + 8); +#endif #ifdef USE_OPTIGA } else if (startswith(line, "OPTIGAID READ")) { optigaid_read();