ejleiss
Junior Member level 2
- Joined
- Jul 2, 2009
- Messages
- 22
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,446
Hello,
I'm having some trouble with the ADXL345 communicating via 3 wire SPI on my XMEGA256. I am using Atmel Software Framework with the XMEGA. If anyone has done this before I would appreciate some direction initiating the accelerometer to stream data. Here is what I have.
Then can I just do an spi_read_single(&SPIC, data); and do what I wish with the values stored in data?
I'm having some trouble with the ADXL345 communicating via 3 wire SPI on my XMEGA256. I am using Atmel Software Framework with the XMEGA. If anyone has done this before I would appreciate some direction initiating the accelerometer to stream data. Here is what I have.
Code:
spi_select_device(&SPIC, &spi_device_conf);
delay_ms(1);
spi_write_single(&SPIC, DATA_FORMAT); // Write to Data_Format Register
spi_write_single(&SPIC,0x4B); // 16g full resolution
spi_write_single(&SPIC, POWER_CTL); // Write to Power_CTL Register
spi_write_single(&SPIC, 0x2D); // Start Measurement
spi_write_single(&SPIC, INT_ENABLE); // Write to INT_ENABLE
spi_write_single(&SPIC, 0x80); // Enable Data_Ready Interrupt
spi_deselect_device(&SPIC, &spi_device_conf);
Then can I just do an spi_read_single(&SPIC, data); and do what I wish with the values stored in data?