Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tim4431 committed Nov 27, 2023
1 parent e1e0db8 commit 7370c0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion 231124_Instatune/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DJ133_LUT_0v0.csv
DJ133_LUT_0v0.csv
/__pycache__
17 changes: 9 additions & 8 deletions 231124_Instatune/insta_LUT.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

import struct

def create_command_packet(register_address, write_value):
byte0 = 1 << 31 | register_address << 25

def write_command_packet(register_address, write_value):
byte0 = 0x80 | register_address # 0x80 for Write operation
byte1 = (write_value >> 8) & 0xFF # MSB
byte2 = write_value & 0xFF # LSB
byte3 = 0 # Checksum placeholder
print(byte0, byte1, byte2, byte3)

return struct.pack(">BBBB", byte0, byte1, byte2, byte3)
byte3 = 0 # Checksum placeholder (not implemented)
return bytes([byte0, byte1, byte2, byte3])


def write_to_register(ser, register_address, write_value):
command_packet = create_command_packet(register_address, write_value)
command_packet = write_command_packet(register_address, write_value)
print(command_packet)
ser.write(command_packet)
# Optionally, read the response here

Expand Down Expand Up @@ -49,7 +49,8 @@ def write_LUT(ser, lut):

if __name__ == "__main__":
# Open serial communication
ser = serial.Serial("COM14", 9600) # Replace 'COM_PORT' with the actual COM port
# ser = serial.Serial("COM14", 9600) # Replace 'COM_PORT' with the actual COM port
ser = None
from read_LUT import read_LUT

lut = read_LUT([1325, 1326, 1327])
Expand Down

0 comments on commit 7370c0a

Please sign in to comment.