This commit is contained in:
Wolfgang Hottgenroth
2019-10-04 09:48:04 +01:00
parent 690f2aa2d6
commit 56b89f66b7
3 changed files with 25 additions and 3 deletions

View File

@ -131,6 +131,8 @@ void initCounter() {
}
int main (void) {
static uint32_t lastDiff = 0;
init();
initCounter();
@ -139,8 +141,10 @@ int main (void) {
pthread_cond_wait(&eventSignal, &eventMutex);
pthread_mutex_unlock(&eventMutex);
double f = 1.0 / (((double) diff) / 1000000.0);
printf("%d %d %d %f\n", ec, counter, diff, f);
if (diff != lastDiff) {
lastDiff = diff;
double f = 1.0 / (((double) diff) / 1000000.0);
printf("%d %d %d %f\n", ec, counter, diff, f);
}
}
}

1
snippets/test2/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
test2

17
snippets/test2/test2.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdint.h>
#include <stdio.h>
void main() {
uint8_t s = 25;
uint8_t c = 0;
uint8_t l = 0;
uint8_t d = 0;
for (uint8_t i = 0; i < 30; i++) {
c += 25;
d = c - l;
printf("%d %d %d %d\n", i, c, l, d);
l = c;
}
}