cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with capturing sensor Data from si115x with an L432KC

sasi
Associate

Hey there,

currently I am struggeling with capturing the sensor value from an si115x (Proximity & ambient light) Sensor.
So far, this would be my code:


void ReadSensorData(void)

{

uint8_t sensorAddress = 0x53 << 1; // shift left to account for R/W bit

uint8_t readProximity = 0x11;

HAL_I2C_Master_Transmit(&hi2c1, sensorAddress, &readProximity , 1, HAL_MAX_DELAY);
HAL_Delay(20);

uint8_t rawData[2]; // raw data is unreadable by itself, needs 16 bits see below
HAL_I2C_Master_Receive(&hi2c1, sensorAddress , rawData, 2, HAL_MAX_DELAY);

uint16_t rh = (rawData[0] * 256 + rawData[1])/3;

proximity=rh;

}

 

Instead of data captured by the sensor, I only get 4010. --> The Funciton void ReadSensorData(void) is called by a separate Task.

In another Task, the captured value is output via UART.

The value does not change, whatever I do...

I hope, that you could give me some advice. 

Thanks in advance!!!

0 REPLIES 0