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

Update protocol definitions #229

Closed
wants to merge 1 commit into from
Closed
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
59 changes: 14 additions & 45 deletions pslab/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,51 +179,20 @@

# /*---------- BAUDRATE for main comm channel----*/
SETBAUD = Byte.pack(12)
BAUD9600 = Byte.pack(1)
BAUD14400 = Byte.pack(2)
BAUD19200 = Byte.pack(3)
BAUD28800 = Byte.pack(4)
BAUD38400 = Byte.pack(5)
BAUD57600 = Byte.pack(6)
BAUD115200 = Byte.pack(7)
BAUD230400 = Byte.pack(8)
BAUD1000000 = Byte.pack(9)

# /*-----------NRFL01 radio module----------*/
NRFL01 = Byte.pack(13)
NRF_SETUP = Byte.pack(1)
NRF_RXMODE = Byte.pack(2)
NRF_TXMODE = Byte.pack(3)
NRF_POWER_DOWN = Byte.pack(4)
NRF_RXCHAR = Byte.pack(5)
NRF_TXCHAR = Byte.pack(6)
NRF_HASDATA = Byte.pack(7)
NRF_FLUSH = Byte.pack(8)
NRF_WRITEREG = Byte.pack(9)
NRF_READREG = Byte.pack(10)
NRF_GETSTATUS = Byte.pack(11)
NRF_WRITECOMMAND = Byte.pack(12)
NRF_WRITEPAYLOAD = Byte.pack(13)
NRF_READPAYLOAD = Byte.pack(14)
NRF_WRITEADDRESS = Byte.pack(15)
NRF_TRANSACTION = Byte.pack(16)
NRF_START_TOKEN_MANAGER = Byte.pack(17)
NRF_STOP_TOKEN_MANAGER = Byte.pack(18)
NRF_TOTAL_TOKENS = Byte.pack(19)
NRF_REPORTS = Byte.pack(20)
NRF_WRITE_REPORT = Byte.pack(21)
NRF_DELETE_REPORT_ROW = Byte.pack(22)

NRF_WRITEADDRESSES = Byte.pack(23)

# ---------Non standard IO protocols--------

NONSTANDARD_IO = Byte.pack(14)
# HX711_HEADER = Byte.pack(1)
HCSR04_HEADER = Byte.pack(2)
# AM2302_HEADER = Byte.pack(3)
# TCD1304_HEADER = Byte.pack(4)
# STEPPER_MOTOR = Byte.pack(5)
UART_PASSTHROUGH = Byte.pack(1)
Comment on lines 181 to +182
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider explaining the purpose and usage of UART_PASSTHROUGH

Adding a brief comment about how UART_PASSTHROUGH is used would improve code clarity and maintainability.

Suggested change
SETBAUD = Byte.pack(12)
BAUD9600 = Byte.pack(1)
BAUD14400 = Byte.pack(2)
BAUD19200 = Byte.pack(3)
BAUD28800 = Byte.pack(4)
BAUD38400 = Byte.pack(5)
BAUD57600 = Byte.pack(6)
BAUD115200 = Byte.pack(7)
BAUD230400 = Byte.pack(8)
BAUD1000000 = Byte.pack(9)
# /*-----------NRFL01 radio module----------*/
NRFL01 = Byte.pack(13)
NRF_SETUP = Byte.pack(1)
NRF_RXMODE = Byte.pack(2)
NRF_TXMODE = Byte.pack(3)
NRF_POWER_DOWN = Byte.pack(4)
NRF_RXCHAR = Byte.pack(5)
NRF_TXCHAR = Byte.pack(6)
NRF_HASDATA = Byte.pack(7)
NRF_FLUSH = Byte.pack(8)
NRF_WRITEREG = Byte.pack(9)
NRF_READREG = Byte.pack(10)
NRF_GETSTATUS = Byte.pack(11)
NRF_WRITECOMMAND = Byte.pack(12)
NRF_WRITEPAYLOAD = Byte.pack(13)
NRF_READPAYLOAD = Byte.pack(14)
NRF_WRITEADDRESS = Byte.pack(15)
NRF_TRANSACTION = Byte.pack(16)
NRF_START_TOKEN_MANAGER = Byte.pack(17)
NRF_STOP_TOKEN_MANAGER = Byte.pack(18)
NRF_TOTAL_TOKENS = Byte.pack(19)
NRF_REPORTS = Byte.pack(20)
NRF_WRITE_REPORT = Byte.pack(21)
NRF_DELETE_REPORT_ROW = Byte.pack(22)
NRF_WRITEADDRESSES = Byte.pack(23)
# ---------Non standard IO protocols--------
NONSTANDARD_IO = Byte.pack(14)
# HX711_HEADER = Byte.pack(1)
HCSR04_HEADER = Byte.pack(2)
# AM2302_HEADER = Byte.pack(3)
# TCD1304_HEADER = Byte.pack(4)
# STEPPER_MOTOR = Byte.pack(5)
UART_PASSTHROUGH = Byte.pack(1)
# SETBAUD is used to set the baud rate for serial communication
SETBAUD = Byte.pack(12)
# UART_PASSTHROUGH enables UART passthrough mode
UART_PASSTHROUGH = Byte.pack(1)


# /*----------- Sensors ----------*/
SENSORS = Byte.pack(13)
RTC_SETTIME = Byte.pack(1)
RTC_SETDIGIT = Byte.pack(2)
RTC_GETTIME = Byte.pack(3)
RTC_GETDIGIT = Byte.pack(4)
HCSR04 = Byte.pack(5)
AM2302 = Byte.pack(6)
BMP180 = Byte.pack(7)
TSL2591 = Byte.pack(8)
TCD1304 = Byte.pack(9)


# --------COMMUNICATION PASSTHROUGHS--------
# Data sent to the device is directly routed to output ports such as (SCL, SDA for UART)
Expand Down
Loading