Skip to content

Port modules to uart. - #119

Closed
kareltucek wants to merge 1 commit into
masterfrom
uart_modules
Closed

kareltucek wants to merge 1 commit into
masterfrom
uart_modules

Conversation

@kareltucek

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR ports module communication from I2C to UART protocol, enabling modules (particularly the trackpoint module) to communicate with the keyboard base via UART instead of I2C. This is a significant architectural change that involves creating new UART parser/link infrastructure, refactoring the existing UART code into separate bridge and module components, and updating module drivers to support both communication protocols.

Key changes:

  • New UART parser and link layer implementation for packet framing, escaping, and CRC validation
  • Split of existing UART implementation into uart_bridge (for keyboard-to-keyboard communication) and uart_modules (for module communication)
  • Updated module protocol handlers to support both I2C and UART modes
  • Configuration changes to enable UART on modules and adjust buffer sizes

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
shared/uart_parser.h/c New UART packet parser with escape sequences and CRC validation
shared/uart_defs.h Common UART protocol definitions and buffer size calculations
shared/module/uart.h/c Module-side UART implementation for KL03 microcontroller
device/src/keyboard/uart_bridge.h/c Renamed from uart.h/c, handles keyboard-to-keyboard UART
device/src/keyboard/uart_modules.h/c New module UART handler on keyboard side
device/src/keyboard/uart_link.h/c Common UART link layer for Zephyr-based devices
right/src/slave_drivers/uhk_module_driver.c Updated to support UART communication alongside I2C
right/src/slave_scheduler.c Refactored to extract common transfer logic
shared/module/slave_protocol_handler.c Updated function signatures to accept data pointer parameter
trackpoint/src/module.h/c Configuration updates for UART mode and debug functionality
shared/crc16.h Made data pointer const for compatibility
boards/ugl/uhk-80/uhk-80-right.dts Swapped UART TX/RX pin assignments
Various files Updated includes from uart.h to uart_bridge.h
Comments suppressed due to low confidence (2)

right/src/slave_drivers/uhk_module_driver.c:247

  • The message length for SlaveCommand_JumpToBootloader has been changed from 1 to 2, but no additional data is being added to the message. This appears to be incorrect and may cause the bootloader jump to fail or behave unexpectedly.
            res.status = tx(i2cAddress);

trackpoint/src/module.c:606

  • Commented-out code should be removed instead of left in the codebase. If this debugging code is needed, consider using a debug flag or removing it entirely.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shared/module/uart.c Resolved
Comment thread shared/module/uart.c Resolved
Comment thread device/src/keyboard/uart_modules.c Resolved
Comment thread device/src/keyboard/uart_modules.c Resolved
Comment thread trackpoint/src/module.c Resolved
Comment thread shared/slave_protocol.h Resolved
Comment thread device/src/keyboard/uart_link.c Resolved
Comment thread shared/module/CMakeLists.txt Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants