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_IKS01A1-f255a2c75ecb mbed-rtos mbed
Diff: sensor.cpp
- Revision:
- 24:c924342f7c76
- Parent:
- 21:849e5636076e
- Child:
- 25:2197b8bb930c
- Child:
- 26:3aad7d411eb0
--- a/sensor.cpp Tue May 17 21:19:57 2016 +0000
+++ b/sensor.cpp Tue May 17 21:38:21 2016 +0000
@@ -12,25 +12,17 @@
//This is the producer
void ExpansionBoard::sampleData()
{
- if(flag) {
- printf("\nAbout to alloc\n");
- }
+ if(flag) printf("\nAbout to alloc\n");
log_data* log_d = (log_data*)mail_box.alloc();
if (log_d == NULL) {
mail_box.get();
- if(flag) {
- printf("Out of memory, last sample deleted\n");
- }
+ if(flag) printf("Out of memory, last sample deleted\n");
log_data* log_d = (log_data*)mail_box.alloc();
- if(flag) {
- printf("Allocated after out of memory\n");
- }
+ if(flag) printf("Allocated after out of memory\n");
}
- if(flag) {
- printf("Not null, reading values\n");
- }
+ if(flag) printf("Not null, reading values\n");
//Store read data in a sample
float value;
log_d->date = time(NULL);
@@ -40,25 +32,21 @@
log_d->humidity = value;
pressure_sensor->GetPressure(&value);
log_d->pressure = value;
- if(flag) {
- printf("All values STORED\n");
- }
+ if(flag) printf("All values STORED\n");
//Send pointer to sample to the queue
osStatus stat = mail_box.put(log_d);
+ //v->push_back(*log_d);
- if(flag) {
- printf("MAIL_BOX.PUT run\n");
- }
+ if(flag) printf("MAIL_BOX.PUT run\n");
// Check for resource error
if (stat == osErrorResource) {
- if(flag) {
- printf("mail_box->put() Error %4Xh\n", stat);
- }
+ if(flag) printf("mail_box->put() Error %4Xh\n", stat);
//Error, free up memory block taken
mail_box.free(log_d);
}
}
+/*
void ExpansionBoard::getData(const void*)
{
@@ -80,6 +68,7 @@
}
}
}
+*/
// Helper function for printing floats & doubles
char *ExpansionBoard::printDouble(char* str, double v, int decimalDigits)
