apds9930: enable sensor before read out sensor data

Changes in library:
- enableProximity() function is to enable or disable proximity sensor
- enableIlluminance() function is to enable or disable illuminance sensor
- run clang-format

Changes in example:
- proximity and illuminance kernel IIO-based driver init state is power off,
  require enable before read out sensor data. Sleep time is needed after
  enable, the sleep time may vary on different platform.
- run clang-format

Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Lay, Kuan Loon
2016-06-20 15:42:19 +08:00
committed by Mihai Tudor Panu
parent 40fe6654eb
commit e64f192fb7
3 changed files with 47 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
/*
* Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
* Copyright (c) 2015 Intel Corporation.
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -75,6 +75,16 @@ class APDS9930
* @return Proximity value
*/
int getProximity();
/**
* Enable proximity
* @param enable state
*/
bool enableProximity(bool enable);
/**
* Enable illuminance
* @param enable state
*/
bool enableIlluminance(bool enable);
private:
mraa_iio_context m_iio;