/* Sets the integration time and gain (controls sensitivity)  */
tsl2561Error_t tsl2561SetTiming(tsl2561IntegrationTime_t integration, tsl2561Gain_t gain)
/* Sets the integration time and gain (controls sensitivity)  */
tsl2561Error_t tsl2561SetTiming(tsl2561IntegrationTime_t integration, tsl2561Gain_t gain)
{
  if (!_tsl2561Initialised) tsl2561Init();
  tsl2561Error_t error = TSL2561_ERROR_OK;
  error = tsl2561Enable();
  if (error) return error;
  error = tsl2561Write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING, integration | gain);  
  if (error) return error;
  _tsl2561IntegrationTime = integration;
  _tsl2561Gain = gain;
  error = tsl2561Disable();
  if (error) return error;  
  return error;
}