SPI: added set_frequency() API

this allows the bus speed to be changed on the fly by device
drivers. This is needed for the MPU6000
This commit is contained in:
Andrew Tridgell 2013-10-30 09:45:58 +11:00 committed by Lorenz Meier
parent 415417196b
commit 8df4d636ab
2 changed files with 17 additions and 0 deletions

View File

@ -181,4 +181,10 @@ SPI::transfer(uint8_t *send, uint8_t *recv, unsigned len)
return OK;
}
void
SPI::set_frequency(uint32_t frequency)
{
_frequency = frequency;
}
} // namespace device

View File

@ -101,6 +101,17 @@ protected:
*/
int transfer(uint8_t *send, uint8_t *recv, unsigned len);
/**
* Set the SPI bus frequency
* This is used to change frequency on the fly. Some sensors
* (such as the MPU6000) need a lower frequency for setup
* registers and can handle higher frequency for sensor
* value registers
*
* @param frequency Frequency to set (Hz)
*/
void set_frequency(uint32_t frequency);
/**
* Locking modes supported by the driver.
*/