Librairie adaptée au laboratoire 2
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_6180XA1 by
Revision 32:ef97c377d27b, committed 2015-11-10
- Comitter:
- mapellil
- Date:
- Tue Nov 10 10:46:15 2015 +0000
- Parent:
- 31:f99c53a51917
- Child:
- 33:1573db91352c
- Commit message:
- Extended Doxy doc
Changed in this revision
| Components/VL6180X/vl6180x_class.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Components/VL6180X/vl6180x_class.h Mon Nov 09 15:37:48 2015 +0000
+++ b/Components/VL6180X/vl6180x_class.h Tue Nov 10 10:46:15 2015 +0000
@@ -102,7 +102,7 @@
* @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
* @param[in] DevAddr device address, 0x29 by default
*/
- VL6180X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), gpio0(&pin), interrupt_measure(pin_gpio1)
+ VL6180X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), gpio0(&pin), gpio1Int(pin_gpio1)
{
MyDevice.I2cAddr=DevAddr;
MyDevice.Present=0;
@@ -116,7 +116,7 @@
* @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
* @param[in] device address, 0x29 by default
*/
- VL6180X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), expgpio0(&pin), interrupt_measure(pin_gpio1)
+ VL6180X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), expgpio0(&pin), gpio1Int(pin_gpio1)
{
MyDevice.I2cAddr=DevAddr;
MyDevice.Present=0;
@@ -132,6 +132,7 @@
The warning should request to introduce a virtual destructor to make sure to delete the object */
/*** Interface Methods ***/
+ /*** High level API ***/
/**
* @brief PowerOn the sensor
* @return void
@@ -167,9 +168,9 @@
/**
* @brief Start the measure indicated by operating mode
* @param[in] operating_mode specifies requested measure
- * @param[in] fptr specifies call back function in case of interrupt measure
- * @param[in] low specifies measure low threashold
- * @param[in] high specifies measure high threashold
+ * @param[in] fptr specifies call back function must be !NULL in case of interrupt measure
+ * @param[in] low specifies measure low threashold in Lux or in mm according to measure
+ * @param[in] high specifies measure high threashold in Lux or in mm according to measure
* @return 0 on Success
*/
int StartMeasurement(OperatingMode operating_mode, void (*fptr)(void), uint16_t low, uint16_t high);
@@ -189,15 +190,13 @@
*/
int StopMeasurement(OperatingMode operating_mode);
- /**
- * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready
- * @param[in] fptr pointer to call back function to be called whenever an interrupt occours
+ /**
+ * @brief Interrupt handling func to be called by user after an INT is occourred
+ * @param[in] opeating_mode indicating the in progress measure
+ * @param[out] Data pointer to the MeasureData_t structure to read data in to
* @return 0 on Success
- */
- void AttachInterruptMeasureDetectionIRQ(void (*fptr)(void))
- {
- interrupt_measure.rise(fptr);
- }
+ */
+ int HandleIRQ(OperatingMode operating_mode, MeasureData_t *Data);
/**
* @brief Enable interrupt measure IRQ
@@ -205,7 +204,7 @@
*/
void EnableInterruptMeasureDetectionIRQ(void)
{
- interrupt_measure.enable_irq();
+ gpio1Int.enable_irq();
}
/**
@@ -214,18 +213,21 @@
*/
void DisableInterruptMeasureDetectionIRQ(void)
{
- interrupt_measure.disable_irq();
+ gpio1Int.disable_irq();
+ }
+ /*** End High level API ***/
+
+ /**
+ * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready
+ * @param[in] fptr pointer to call back function to be called whenever an interrupt occours
+ * @return 0 on Success
+ */
+ void AttachInterruptMeasureDetectionIRQ(void (*fptr)(void))
+ {
+ gpio1Int.rise(fptr);
}
/**
- * @brief Interrupt handling func to be called by user after an INT is occourred
- * @param[in] opeating_mode indicating the in progress measure
- * @param[out] Data pointer to the MeasureData_t structure to read data in to
- * @return 0 on Success
- */
- int HandleIRQ(OperatingMode operating_mode, MeasureData_t *Data);
-
- /**
* @brief Check the sensor presence
* @return 1 when device is present
*/
@@ -234,7 +236,12 @@
return Device->Present;
}
- /* Wrapper functions */
+ /** Wrapper functions */
+
+ /**
+ * @brief Wait sensor to boot
+ * @return 0 when device is booted
+ */
int WaitDeviceBooted()
{
return VL6180x_WaitDeviceBooted(Device);
@@ -623,7 +630,7 @@
/* GPIO expander */
STMPE1600DigiOut *expgpio0;
/* Measure detection IRQ */
- InterruptIn interrupt_measure;
+ InterruptIn gpio1Int;
/* Device data */
MyVL6180Dev_t MyDevice;
VL6180xDev_t Device;
