... pressure sensor isn't linear over it's domain. It is only linear over .2V to 4.9V.
Okay, I get it now.
On Maple (ARM) an int is 32-bits, but people traditionally use specific types to force the size to be what they need, so int32 would be unambiguous.
I don't use floating point arithmetic much, but it works. I just did a quick check, and the sizeof(float) is 4 bytes, and the sizeof(double) is 8. It's just slower than int's.
... If I store it as a double, can I get decimals?
Not sure what you mean. A double is only a decimal part, it is represented in (the binary form of) scientific notation, e.g. 1.275 is stored as 0.1275 * 10^1 (but in binary)*.
So yes, with some example numbers, and assuming timeNew and timeOld are unsigned long ...
double delta_t = 1.275*((timeNew-timeOld)/2);
= 1.275 * ((300-199)/2);
= 1.275 * (101/2);
= 1.275 * (50); // it is integer arithmetic
= 63.75;
I wouldn't worry about how fast the code goes until you get it giving the correct answers.
(I'd also suggest looking at Amdahl's Law.)
That calculation can be recast as:
double delta_t = 1.275*((timeNew-timeOld)/2);
double delta_t = 0.6375*((timeNew-timeOld));
double delta_t = 6375*((timeNew-timeOld))/10000;
int delta_t = 6375*((timeNew-timeOld)); // and remember it is 10000 times too big
Please try to avoid focusing on how fast it will go until it gives the correct answers because:
1. It is likely that it will be fast enough anyway,
2. It is always difficult to really know which part will be the slow part before it works
3. It might be impossible to make it fast enough, and that is hard to tell until it works
As far as I can see, there isn't anything you have described which the Maple can't do easily, if approached in the right way. So get it working with the least amount of effort, and leave plenty of time to improve it if there are any problems.
* actually it is sneakier than this, but this is a pretty good way to understand it.