I am writing the driver for the MMA6827 and am currently in the driver code for the MMA6800 in the reference TWR_SENSOR_PAK_AUTO_PROJECT
void MMA6800_Read_Acceleration(word cfgX,word cfgY)
{
word tmpx,tmpy;
(void)MMA6800_RegRead(MMA6800_DEVSTAT); //READING DEVSTAT
MMA6800_Delay(10);
(void)MMA6800_AccRead(cfgX); // AccXCfg7 X-Axis Raw, Unsigned Data, Disabled/PCM 0b0011000000000100
MMA6800_Delay(10);
xy_digits.x_dgt = MMA6800_AccRead(cfgY); //SENDING ACCELERATION READ COMMAND 2
MMA6800_Delay(10);
xy_digits.y_dgt = MMA6800_RegRead(MMA6800_DEVSTAT); //READING ACCELERATION 2
MMA6800_Delay(10);
in the previous code,xy_digits.x_dgt = MMA6800_AccRead(cfgY); Is the configured Y-axis data assigned to the X-axis? How to understand this code? Thank you so much!
Hi Zhang,
SPI transfers are completed through a sequence of two phases. During the first phase, the type of transfer and associated control information is transmitted from the SPI master to MMA68xx. Data from MMA68xx is transmitted during the second phase.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------