|
@@ -20,6 +20,7 @@ int main()
|
|
bus_t bus;
|
|
bus_t bus;
|
|
pthread_t thread;
|
|
pthread_t thread;
|
|
FILE* file = NULL;
|
|
FILE* file = NULL;
|
|
|
|
+ struct timeval tv;
|
|
setup_io();
|
|
setup_io();
|
|
bus_init_recv(&bus, PIN_DATA, PIN_CLK, PIN_ACK);
|
|
bus_init_recv(&bus, PIN_DATA, PIN_CLK, PIN_ACK);
|
|
init_read_pin(PIN_DATA, PIN_CLK, PIN_ACK);
|
|
init_read_pin(PIN_DATA, PIN_CLK, PIN_ACK);
|
|
@@ -27,10 +28,14 @@ int main()
|
|
while(1)
|
|
while(1)
|
|
{
|
|
{
|
|
uint32_t c;
|
|
uint32_t c;
|
|
|
|
+ double w;
|
|
char buffer[16];
|
|
char buffer[16];
|
|
bus_read(&bus, &c, 4);
|
|
bus_read(&bus, &c, 4);
|
|
|
|
+
|
|
|
|
+ gettimeofday(&tv, NULL);
|
|
printf("%ld' s %ld ms %'d us \n", c/1000000, c%1000000/1000, c%1000);
|
|
printf("%ld' s %ld ms %'d us \n", c/1000000, c%1000000/1000, c%1000);
|
|
-
|
|
|
|
|
|
+ w=3600.0/(((double)c)/1000000.0);
|
|
|
|
+ printf("%ld : %.2lf W %.2lf\n\n", tv.tv_sec, w, w/220);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|