Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command constants closes #11 #13

Merged
merged 1 commit into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pico_lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def __init__(self, I2Ccontroller: I2C, address: int = 0x41) -> None:
self.led_groups = {}
self.set_light_bits = 0b01000000
self.group_bit = 0b00100000
self.reset_bit = 0b00010000
self.reset_bit = 0b00010000
self.module_id_byte = 0b10000001
self.version_byte = 0b10000010
self.get_groups_byte = 0b10000011

def send_data(self, data: list):

Expand All @@ -40,7 +43,7 @@ def send_data(self, data: list):
self.i2c1.writeto(self.I2C_address, sendData)

def get_module_id(self) -> int:
command_byte = 0b10000001
command_byte = self.module_id_byte
data = []
data.append(command_byte)
self.send_data(data)
Expand All @@ -50,7 +53,7 @@ def get_module_id(self) -> int:
return returnData

def get_version(self) -> str:
command_byte = 0b10000010
command_byte = self.version_byte
data = []
data.append(command_byte)
self.send_data(data)
Expand All @@ -72,7 +75,7 @@ def check_bus(self) -> bool:
return False

def get_groups(self) -> dict:
command_byte = 0b10000011
command_byte = self.get_groups_byte
data = []
data.append(command_byte)
self.send_data(data)
Expand Down