/* Reads new measurement data and processes a new sample. This function should be called every time an interrupt for a new sample is received.  */
gesture_t Si1147_NewSample(I2C_TypeDef *i2c, uint8_t addr, uint32_t timestamp)
/* Reads new measurement data and processes a new sample. This function should be called every time an interrupt for a new sample is received.  */
gesture_t Si1147_NewSample(I2C_TypeDef *i2c, uint8_t addr, uint32_t timestamp)
{
  Si114x_Sample_TypeDef sample;
  si114x_handle->addr = addr;
  si114x_handle->i2c  = i2c;
  sample.timestamp    = timestamp;
  readPSData(si114x_handle, &sample);
  Si114xWriteToRegister(si114x_handle, REG_IRQ_STATUS, Si114xReadFromRegister(si114x_handle, REG_IRQ_STATUS));
  return ProcessSi1147Samples(&sample);
}