make attiny85 a I2C slave which control NeoPixel strips up to 32 LEDs
Freqency: 8MHz, Pins: 0 - SDA, 3 - LED data, 2 - SCL, 4 - strip Power
I2C on Raspi 3.3V is working well even if the attiny85 is powered from 5V
Address is initial 0x20, but can be changed by command
I2C register 0 is command
I2C register 1 - n are mapped direct to NeoPixel LED buffer which is in case of SK9812 g/r/b/w * num_led structure
I2C register 80 - Reset
I2C register 82 - get Timonel Version
I2C register 86 - jump to Timonel
a command consists of one or more bytes written to I2C register 0
Commands:
- 1: show_pixels, write to strip
- 2: clear all pixels
- 3 idx: copy color from one led to all other
- 4 num_led: set number of leds in strip and save to eeprom
- 5 type_h type_l: set led type save to eeprom
- 6 addr: set I2C addess and save to eeprom
- 7 idx: set poweron start color for all leds to led with index idx
- 8 idx r g b w: set the led on idx to color
- 9 r g b w: set all leds to color
- 10 r g b w: set poweron start color for all leds to color
- 11 on: control powerport (pin 3) 0->off else on (port is inverted to direct control FET)
- 12: restart
example usage:
i2ctransfer -y 1 w6@0x20 0 9 22 3 4 1
write 6 bytes to I2C device 0x20, register 0 (command reg), command 9 to set all led, (22,3,4,1) some color
result is only shown after issuing show command:
i2ctransfer -y 1 w2@0x20 0 1
get led buffer starting at position 5 (second led)
i2ctransfer -y 1 w2@0x20 0 1