/* Set the SFH7770 execution mode. 
SENSOR_STATE_NORMAL: Setting the sleep mode puts the specific sensor unit (light or proximity) in continuous measurement mode. */
static bool sfh7770_set_state(sensor_hal_t *hal, sensor_type_t type, sensor_state_t state)
/* Set the SFH7770 execution mode. 
SENSOR_STATE_NORMAL: Setting the sleep mode puts the specific sensor unit (light or proximity) in continuous measurement mode. */
static bool sfh7770_set_state(sensor_hal_t *hal, sensor_type_t type, sensor_state_t state)
{
	switch (state) {
	case SENSOR_STATE_SLEEP:
		if (type == SENSOR_TYPE_LIGHT) {
			sensor_bus_put(hal, SFH7770_ALS_CONTROL,
					ALS_MODE_STANDBY);
		} else {
			sensor_bus_put(hal, SFH7770_PS_CONTROL,
					PS_MODE_STANDBY);
		}
		break;
	case SENSOR_STATE_NORMAL:
		if (type == SENSOR_TYPE_LIGHT) {
			sensor_bus_put(hal, SFH7770_ALS_CONTROL,
					ALS_MODE_FREE_RUNNING);
		} else {
			sensor_bus_put(hal, SFH7770_PS_CONTROL,
					PS_MODE_FREE_RUNNING);
		}
		break;
	default:
		return false;
	}
	return true;
}