Skip to content

Instantly share code, notes, and snippets.

@tcdowney
Last active December 12, 2015 00:39
Show Gist options
  • Select an option

  • Save tcdowney/4685580 to your computer and use it in GitHub Desktop.

Select an option

Save tcdowney/4685580 to your computer and use it in GitHub Desktop.
void ds_gyro_read(uint8_t* pBuffer, uint8_t ReadAddr, volatile uint16_t NumByteToRead) {
if (NumByteToRead > 0x01) {
ReadAddr |= (uint8_t)(0x80 | 0x40); // If sending more that one byte set multibyte commands
}
else {
ReadAddr |= (uint8_t) (0x80); // Else just set the read mode
}
GYRO_CS_LOW();
//GPIO_ResetBits(GPIOE, GPIO_Pin_3);
ds_gyro_sendbyte(ReadAddr);
while(NumByteToRead > 0x00) {
*pBuffer = ds_gyro_sendbyte(((uint8_t)0x00));
NumByteToRead--;
pBuffer++;
}
GYRO_CS_HIGH();
//GPIO_SetBits(GPIOE, GPIO_Pin_3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment