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
sensor.cpp
- Committer:
- Jacinta
- Date:
- 2016-05-18
- Revision:
- 35:34bbca276f99
- Parent:
- 33:2ee6fbdad7b4
File content as of revision 35:34bbca276f99:
#include "mbed.h"
#include "x_nucleo_iks01a1.h"
#include <vector>
#include "sensor.h"
#include "userMethods.h"
// Queue
//std::vector<log_data> ExpansionBoard::v;
int * ExpansionBoard::n;
bool ExpansionBoard::flag;
// This is the consumer
void ExpansionBoard::getData(const void*)
{/*
while(true) {
//Block on queue if no data is available
osEvent event = queue.get(2000);
if(flag) {
printf("MAIL_BOX.GET\n");
}
if (event.status == osEventMail) {
// Successful, store log_data
log_data* temp = (log_data*) event.value.p;
v.push_back(*temp);
if(flag) {
printf("GET value stored and freed up mail_box\n");
}
}
}*/
}
// Helper function for printing floats & doubles
char *ExpansionBoard::printDouble(char* str, double v, int decimalDigits)
{
int intPart, fractPart, len, i=1;
char *ptr;
for (; decimalDigits!=0; i*=10, decimalDigits--);
intPart = (int)v;
fractPart = (int)((v-(double)(int)v)*i);
sprintf(str, "%i.", intPart);
len = strlen(str);
ptr = &str[len];
for (i/=10; i>1; i/=10, ptr++) {
if(fractPart >= i) break;
*ptr = '0';
}
sprintf(ptr, "%i", fractPart);
return str;
}
// Constructor for the class
ExpansionBoard::ExpansionBoard(int num, bool lFlag): T(15.0f)
{
n = #
flag = &lFlag;
/* Retrieve the composing elements of the expansion board */
printf("Initialising expansion board...\n\r");
}
