Translator

You inherited bridge firmware that reads a 2-byte value from an I2C sensor and relays it to an SPI companion chip. The I2C sensor sits on I2C1 at address 0x48, and the data register (0x00) returns 2 bytes in big-endian order. The SPI companion on SPI1 expects the same value in little-endian (byte-swapped) order.

The code compiles clean but the SPI companion never receives data. The I2C bus log and SPI transaction log in submission artifacts should help you trace the data flow. Find and fix all the bugs.

Expected output format: BRIDGE:<hex16> followed by a newline, where <hex16> is the 16-bit value as sent to SPI (little-endian). The byte-swap works the same regardless of the data: if the sensor returns a high byte then a low byte, the companion receives the low byte first, and BRIDGE:<hex16> prints the swapped 16-bit value.

Loading the interactive arena.