18c2ecf20Sopenharmony_ci* Pattern format for LED pattern trigger 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ciThe pattern is given by a series of tuples, of brightness and duration (ms). 48c2ecf20Sopenharmony_ciThe LED is expected to traverse the series and each brightness value for the 58c2ecf20Sopenharmony_cispecified duration. Duration of 0 means brightness should immediately change to 68c2ecf20Sopenharmony_cinew value, and writing malformed pattern deactivates any active one. 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci1. For gradual dimming, the dimming interval now is set as 50 milliseconds. So 98c2ecf20Sopenharmony_cithe tuple with duration less than dimming interval (50ms) is treated as a step 108c2ecf20Sopenharmony_cichange of brightness, i.e. the subsequent brightness will be applied without 118c2ecf20Sopenharmony_ciadding intervening dimming intervals. 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciThe gradual dimming format of the software pattern values should be: 148c2ecf20Sopenharmony_ci"brightness_1 duration_1 brightness_2 duration_2 brightness_3 duration_3 ...". 158c2ecf20Sopenharmony_ciFor example (using sysfs interface): 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciecho 0 1000 255 2000 > pattern 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciIt will make the LED go gradually from zero-intensity to max (255) intensity in 208c2ecf20Sopenharmony_ci1000 milliseconds, then back to zero intensity in 2000 milliseconds: 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciLED brightness 238c2ecf20Sopenharmony_ci ^ 248c2ecf20Sopenharmony_ci255-| / \ / \ / 258c2ecf20Sopenharmony_ci | / \ / \ / 268c2ecf20Sopenharmony_ci | / \ / \ / 278c2ecf20Sopenharmony_ci | / \ / \ / 288c2ecf20Sopenharmony_ci 0-| / \/ \/ 298c2ecf20Sopenharmony_ci +---0----1----2----3----4----5----6------------> time (s) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci2. To make the LED go instantly from one brightness value to another, we should 328c2ecf20Sopenharmony_ciuse zero-time lengths (the brightness must be same as the previous tuple's). So 338c2ecf20Sopenharmony_cithe format should be: "brightness_1 duration_1 brightness_1 0 brightness_2 348c2ecf20Sopenharmony_ciduration_2 brightness_2 0 ...". 358c2ecf20Sopenharmony_ciFor example (using sysfs interface): 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciecho 0 1000 0 0 255 2000 255 0 > pattern 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciIt will make the LED stay off for one second, then stay at max brightness for 408c2ecf20Sopenharmony_citwo seconds: 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciLED brightness 438c2ecf20Sopenharmony_ci ^ 448c2ecf20Sopenharmony_ci255-| +---------+ +---------+ 458c2ecf20Sopenharmony_ci | | | | | 468c2ecf20Sopenharmony_ci | | | | | 478c2ecf20Sopenharmony_ci | | | | | 488c2ecf20Sopenharmony_ci 0-| -----+ +----+ +---- 498c2ecf20Sopenharmony_ci +---0----1----2----3----4----5----6------------> time (s) 50