LED Pattern Trigger =================== This is a LED trigger allowing arbitrary pattern execution. It can do gradual dimming. This trigger can be configured to repeat the pattern a number of times or indefinitely. This is intended as a way of communication for embedded systems with no screen. The trigger can be activated from user space on LED class devices as shown below: echo pattern > trigger This adds the following sysfs attributes to the LED: pattern - specifies the pattern. See syntax below. repeat - number of times the pattern must be repeated. writing -1 to this file will make the pattern repeat indefinitely. The pattern will be restarted each time a new value is written to the pattern or repeat attribute. When dimming, the LED brightness is set every 50 ms. pattern syntax: The pattern is specified in the pattern attribute with an array of comma- separated "brightness/length in miliseconds" values. The two components of each value are to be separated by a space. For example, assuming the driven LED supports intensity value from 0 to 255: echo 0 1000, 255 2000 > pattern Will make the LED go gradually from zero-intensity to max (255) intensity in 1000 milliseconds, then back to zero intensity in 2000 milliseconds: LED brightness ^ 255-| / \ / \ / | / \ / \ / | / \ / \ / | / \ / \ / 0-| / \/ \/ +---0----1----2----3----4----5----6------------> time (s) To make the LED go instantly from one brigntess value to another, use zero-time lengths. For example: echo 0 1000, 0 0, 255 2000, 255 0 > pattern Will make the LED stay off for one second, then stay at max brightness for two seconds: LED brightness ^ 255-| +---------+ +---------+ | | | | | | | | | | | | | | | 0-| -----+ +----+ +---- +---0----1----2----3----4----5----6------------> time (s) Patterns with less than two values, no value with time length > 50 milliseconds, or no two values with differing brightnesses will result in the LED being set at the brightness of the first value, or zero if the pattern contains no value. Patterns with invalid syntax are silently swallowed and will result in undefined behavior of the LED brightness. Because sysfs is used to define the pattern, patterns that need more than PAGE_SIZE characters to describe aren't supported. PAGE_SIZE is system dependent. # 4 step "charging" pattern echo "0 0, 0 1000, 50 500, 50 1000, 100 500, 100 1000, 150 500, 150 1000, 200 500, 200 1000, 0 100" > pattern