mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-07 07:12:34 +00:00
feat(core/prodtest): add RGB LED test
[no changelog]
This commit is contained in:
parent
cbfbd48e3a
commit
43721ab396
@ -9,7 +9,7 @@ PRODUCTION = ARGUMENTS.get('PRODUCTION', '0') == '1'
|
|||||||
BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1'
|
BOOTLOADER_DEVEL = ARGUMENTS.get('BOOTLOADER_DEVEL', '0') == '1'
|
||||||
HW_REVISION = ARGUMENTS.get('HW_REVISION', None)
|
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 = ''
|
CCFLAGS_MOD = ''
|
||||||
CPPPATH_MOD = []
|
CPPPATH_MOD = []
|
||||||
|
@ -243,6 +243,19 @@ HAPTIC 3000
|
|||||||
OK
|
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
|
### OTP READ
|
||||||
The `OTP READ` command is utilized to retrieve a string parameter from the device's OTP memory.
|
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.
|
This string typically contains information identifying the model and production batch of the device.
|
||||||
|
@ -71,6 +71,10 @@
|
|||||||
#include <io/haptic.h>
|
#include <io/haptic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_RGB_LED
|
||||||
|
#include <io/rgb_led.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_HASH_PROCESSOR
|
#ifdef USE_HASH_PROCESSOR
|
||||||
#include <sec/hash_processor.h>
|
#include <sec/hash_processor.h>
|
||||||
#endif
|
#endif
|
||||||
@ -731,6 +735,33 @@ static void test_haptic(const char *args) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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) {
|
static void test_otp_read(void) {
|
||||||
uint8_t data[FLASH_OTP_BLOCK_SIZE + 1];
|
uint8_t data[FLASH_OTP_BLOCK_SIZE + 1];
|
||||||
memzero(data, sizeof(data));
|
memzero(data, sizeof(data));
|
||||||
@ -1130,6 +1161,10 @@ int main(void) {
|
|||||||
#ifdef USE_HAPTIC
|
#ifdef USE_HAPTIC
|
||||||
haptic_init();
|
haptic_init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_RGB_LED
|
||||||
|
rgb_led_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
usb_init_all();
|
usb_init_all();
|
||||||
|
|
||||||
uint32_t bootloader_version = read_bootloader_version();
|
uint32_t bootloader_version = read_bootloader_version();
|
||||||
@ -1216,6 +1251,10 @@ int main(void) {
|
|||||||
} else if (startswith(line, "HAPTIC ")) {
|
} else if (startswith(line, "HAPTIC ")) {
|
||||||
test_haptic(line + 7);
|
test_haptic(line + 7);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_RGB_LED
|
||||||
|
} else if (startswith(line, "RGB_LED ")) {
|
||||||
|
test_rgb_led(line + 8);
|
||||||
|
#endif
|
||||||
#ifdef USE_OPTIGA
|
#ifdef USE_OPTIGA
|
||||||
} else if (startswith(line, "OPTIGAID READ")) {
|
} else if (startswith(line, "OPTIGAID READ")) {
|
||||||
optigaid_read();
|
optigaid_read();
|
||||||
|
Loading…
Reference in New Issue
Block a user