kx122: Allow faster SPI bus frequency

The hardcoded frequency of 10kHz was much slower than the capacity of the device

Signed-off-by: Antoine W. Campagna <AntoineW@Campagna.org>
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Antoine W. Campagna
2018-03-25 22:02:02 -04:00
committed by Noel Eck
parent 83f541a5db
commit 54c6d294af
5 changed files with 16 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ extern "C"{
*/
//Frequency of the SPI connection
#define SPI_FREQUENCY 10000
#define DEFAULT_SPI_FREQUENCY 10000
//Default slave addresses for the sensor
#define KX122_DEFAULT_SLAVE_ADDR_1 0x1F
@@ -170,9 +170,10 @@ If no errors occur, the device gets initialized with default values and gets set
@param bus I2C or SPI bus to use.
@param addr I2C address of the sensor.
@param chip_select Chip select pin for SPI.
@param spi_bus_frequency Speed of the SPI communication bus in Hz (ignored when using I2C).
@return The device context, or NULL if an error occurs.
*/
kx122_context kx122_init(int bus, int addr, int chip_select_pin);
kx122_context kx122_init(int bus, int addr, int chip_select_pin, int spi_bus_frequency);
/**
KX122 destructor