BBIO2 binary mode

The main modes struct now has a function to query the number of configuration bytes required. Those bytes are then gathered by whatever protocol and handed to binmode_config by reference.

SPI is the only mode with a prototype config length query and binmode_config function at the moment. No sanity checking yet either.

(0x3b9aca0) (4-8 bits) (CPOL=0) (CPHA=0) (CS=1)

The SPI config is 8 bytes long. The first four bytes are the SPI speed in Hz, maximum 62500000 (realistically 12-20MHz). New byte is the number of bits in each SPI frame (usually 8). Clock polarity & clock phase. Finally CS idle state.

Read and write functions need to be updated to not consume data directly. This, I believe, is key to using a protocol buffer as the library hands us actual populated structs to work with. Maybe this is a good use of creating/destroying temp variables with the new bigbuf API.

  • Sanity check if functions are available in the current mode
  • Read and Write not consume own data
1 Like