Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Purpose:

The pedal board reads the ADCs for the throttle and brake pedals and broadcasts the data to the MCI.

...

General idea - The MAX11600 has four analog IN channels, AIN0 is throttle, AIN1 is steering angle, and AIN2 is brake, and AIN3 is used as a reference voltage (hardware’s problem). The MAX will scan from AIN0 up to AIN2 and send each of these channels' readings in sequence. We can discard the reading from AIN1 (unless we need it in the future), and use the other two channels we’re reading and return those values to whichever function is requesting themunused. We’ll send a configuration byte to select a channel and then simply read in the data from that channel. Taken from Figure 11 on the datasheet:

...

The driver should send the slave address with a read byte (11001001), after which the MAX will begin sending AIN0-2 the data from the selected channel until the master transmits a STOP condition (for us this will be done will just two function calls).

max11600_init:

Send a setup and configuration byte to the IC (address 11001000) and set up any necessary storage/struct pointers needed for the driver.

Byte

Bits

Setup

101x100x

Configuration000x0101

011xx001

These are channel select bits which need to be changed depending on the data we’re reading - they can be anything on initialization

View Tables 1 and 2 on the datasheet for more information on Setup and Configuration bytes.

max11600_read_raw:

Send the slave Slave address 11001000 - write a config byte to select channel.

Slave address 11001001, - read in three values in binary, discard the steering value, transmit STOP condition.the data

This function should be passed a pointer to a storage variable/struct which will hold the three values read from the MAX.

...