Commit 69c12fa8 authored by Vidisha Srivastav's avatar Vidisha Srivastav
Browse files

Reverted init structure to fix SPI init hang bug

parent 7df49194
......@@ -173,13 +173,13 @@ void i2c_accel_init(i2c_accel_sensor_t* sensor, i2c_sensor_t i2c_sensor) {
}
void init_accels(void) {
center_sensor = spi_sensor_create();
spi_init(&center_sensor);
i2c_sensor_t left_i2c_sensor = i2c_sensor_create(LEFT_WING_I2CADDR);
i2c_sensor_t right_i2c_sensor = i2c_sensor_create(RIGHT_WING_I2CADDR);
//i2c_sensor_t right_i2c_sensor = i2c_sensor_create(RIGHT_WING_I2CADDR);
spi_accel_init(&center_sensor);
i2c_accel_init(&left_wing, left_i2c_sensor);
i2c_accel_init(&right_wing, right_i2c_sensor);
//i2c_accel_init(&right_wing, right_i2c_sensor);
}
......
......@@ -7,7 +7,7 @@
#define SCK &pin_PA17 //SCK
#define MOSI &pin_PB23 //MOSI
#define MISO &pin_PB22 //MISO
#define CS_CENTER &pin_PA19 //Pin D9 on feather m4
#define CS_CENTER &pin_PA18 //Pin D9 on feather m4
#define SPI_BAUD 100000
#define SPI_POLARITY 0
#define SPI_PHASE 0
......@@ -37,12 +37,6 @@ void spi_init(spi_sensor_t* device){
initted = true;
}
spi_sensor_t spi_sensor_create(){
spi_sensor_t sensor;
spi_init(&sensor);
return sensor;
}
//Writes to SPI bus, make sure the device has been "entered" into
static void write(spi_sensor_t *device, uint8_t *buffer, size_t length)
{
......
......@@ -21,7 +21,7 @@ typedef struct {
digitalio_digitalinout_obj_t cs;
} spi_sensor_t;
spi_sensor_t spi_sensor_create(void);
void spi_init(spi_sensor_t*);
uint8_t spi_read_register_byte(spi_sensor_t*, uint8_t);
void spi_write_register_byte(spi_sensor_t*, uint8_t, uint8_t);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment