예제 #1
0
func dealExtremeSetColor(d hid.Device, c color.Color) error {
	palette := color.Palette{
		color.RGBA{0x00, 0x00, 0x00, 0x00},
		color.RGBA{0x00, 0xff, 0x00, 0xff},
		color.RGBA{0xff, 0x00, 0x00, 0xff},
		color.RGBA{0x00, 0x00, 0xff, 0xff},
		color.RGBA{0x00, 0xff, 0xff, 0xff},
		color.RGBA{0x00, 0xff, 0xff, 0xff},
		color.RGBA{0xff, 0xff, 0x00, 0xff},
		color.RGBA{0xff, 0x00, 0xff, 0xff},
		color.RGBA{0xff, 0xff, 0xff, 0xff},
	}
	return d.Write([]byte{0x00, byte(palette.Index(c))})
}
예제 #2
0
파일: blync.go 프로젝트: ingen-fakir/led
func blyncDevSetColor(d hid.Device, c color.Color) error {
	palette := color.Palette{
		color.RGBA{0x00, 0x00, 0x00, 0x00}, // black
		color.RGBA{0xff, 0xff, 0xff, 0xff}, // white
		color.RGBA{0x00, 0xff, 0xff, 0xff}, // cyan
		color.RGBA{0xff, 0x00, 0xff, 0xff}, // magenta
		color.RGBA{0x00, 0x00, 0xff, 0xff}, // blue
		color.RGBA{0xff, 0xff, 0x00, 0xff}, // yellow
		color.RGBA{0x00, 0xff, 0x00, 0xff}, // lime
		color.RGBA{0xff, 0x00, 0x00, 0xff}, // red
	}

	value := byte((palette.Index(c) * 16) + 127)
	return d.Write([]byte{0x00, 0x55, 0x53, 0x42, 0x43, 0x00, 0x40, 0x02, value})
}
예제 #3
0
func dreamCheekyDevSetColor(d hid.Device, c color.Color) error {
	r, g, b, _ := c.RGBA()
	return d.Write([]byte{0x00, byte(r >> 10), byte(g >> 10), byte(b >> 10), 0x00, 0x00, 0x54, 0x2C, 0x05})
}