1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-18 11:00:09 +02:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/LEDColors.java
cpfeiffer edcf54e55d WIP: support for different kind of LED notifications
Difficulty is: LED and "normal" notifications interfere, i.e. a normal
vibration buzz will stop an LED notification. So when we want to combine
them, we have to let them finish.
2015-08-07 21:36:32 +02:00

28 lines
1019 B
Java

package nodomain.freeyourgadget.gadgetbridge.miband;
public class LEDColors {
public static final int toInt(byte r, byte g, byte b) {
int result = ((int) r << 16);
result |= ((int) g << 8);
result |= ((int) b);
return result;
}
public static final byte[] toBytes(int rgb) {
byte r = (byte) ((rgb >> 16) & 0x0000ff);
byte g = (byte) ((rgb >> 8) & 0x0000ff);
byte b = (byte) (rgb & 0x0000ff);
return new byte[] { r, g, b };
}
public static final int RED = toInt((byte) 6, (byte) 0, (byte) 0);
public static final int GREEN = toInt((byte) 0, (byte) 6, (byte) 6);
public static final int BLUE = toInt((byte) 0, (byte) 0, (byte) 6);
public static final int CYAN = toInt((byte) 0, (byte) 6, (byte) 6);
public static final int YELLOW = toInt((byte) 6, (byte) 6, (byte) 0);
public static final int MAGENTA = toInt((byte) 6, (byte) 0, (byte) 6);
public static final int OFF = toInt((byte) 0, (byte) 0, (byte) 0);
}