Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_6180XA1 mbed
Fork of HelloWorld_6180XA1 by
X-Nucleo-6180XA1 Hello World Application
This application provides a simple example of usage of X_NUCLEO_6180XA1 library. It provides a measurement of:
- Ambient Light (Lux),
- Distance (millimeters) of an object in front of the on-board sensor.
The values are displayed on the Hyperterminal connected through COM port over USB.
Diff: main.cpp
- Revision:
- 33:b903a0ec8803
- Parent:
- 32:724d2afb0ca2
- Child:
- 35:8b4a5cc0fb1f
--- a/main.cpp Thu Nov 12 11:55:28 2015 +0100
+++ b/main.cpp Tue Nov 17 17:08:33 2015 +0100
@@ -84,11 +84,11 @@
/* On board red slider position check */
enum OpModeIntPoll_t{ PollMeasure, IntMeasure };
-OperatingMode CheckSlider(STMPE1600DigiIn measure_type, enum OpModeIntPoll_t OpMode)
-{
-int measure=measure_type;
+OperatingMode CheckSlider(enum OpModeIntPoll_t OpMode) {
+
+OperatingMode ret;
+int measure= board->RdSwitch();
-OperatingMode ret;
switch (OpMode) {
case PollMeasure:
if(measure==RANGE)
@@ -104,7 +104,7 @@
ret = als_continuous_interrupt;
break;
}
- return ret;
+ return ret;
}
/* Print on USB Serial the started OperatingMode */
@@ -157,7 +157,7 @@
printf("Failed to init board!\n\r");
- operating_mode=CheckSlider(measure_type, IntMeasure);
+ operating_mode=CheckSlider(IntMeasure);
status=board->sensor_top->StartMeasurement(operating_mode, SensorTopIRQ, NULL, NULL);
if(!status)
{
@@ -180,7 +180,7 @@
printf("\nProgram stopped!\n\n\r");
break;
}
- operating_mode=CheckSlider(measure_type, IntMeasure);
+ operating_mode=CheckSlider(IntMeasure);
if(operating_mode!=prev_operating_mode)
{
DisplayRefresh(prev_operating_mode);
@@ -195,7 +195,6 @@
DisplayRefresh(operating_mode);
}
}
- DisplayMsg("BYE");
delete board;
}
@@ -210,7 +209,7 @@
status=board->InitBoard();
if(status)
printf("Failed to init board!\n\r");
- operating_mode=CheckSlider(measure_type, PollMeasure);
+ operating_mode=CheckSlider(PollMeasure);
status=board->sensor_top->StartMeasurement(operating_mode, NULL, NULL, NULL);
if(!status)
{
@@ -234,7 +233,7 @@
break;
}
- operating_mode=CheckSlider(measure_type, PollMeasure);
+ operating_mode=CheckSlider(PollMeasure);
if(operating_mode!=prev_operating_mode)
{
DisplayRefresh(prev_operating_mode);

X-NUCLEO-6180XA1 Proximity and Ambient Light Sensor