1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

* added get_interval function to ltc4150

* fixed date command (problem with leading zeros)
This commit is contained in:
Oliver Hahm 2010-11-09 18:48:45 +01:00
parent 21fef20ccc
commit 75c0962363
4 changed files with 11 additions and 6 deletions

View File

@ -10,5 +10,6 @@ void ltc4150_stop();
double ltc4150_get_current_mA();
double ltc4150_get_total_mAh();
double ltc4150_get_avg_mA();
int ltc4150_get_interval();
#endif /* __LTC4150_H */

View File

@ -70,6 +70,10 @@ double ltc4150_get_avg_mA() {
return (int_to_coulomb(int_count)*1000000000)/HWTIMER_TICKS_TO_US(last_int_time - start_time);
}
int ltc4150_get_interval() {
return HWTIMER_TICKS_TO_US(last_int_time - start_time);
}
unsigned long ltc4150_get_intcount() {
return int_count;
}

View File

@ -2,7 +2,7 @@
#include <ltc4150.h>
void _get_current_handler(char* unused) {
printf("Power usage: %.4f mA (%.4f mA avg/ %.4f mAh total)\n", ltc4150_get_current_mA(), ltc4150_get_avg_mA(), ltc4150_get_total_mAh());
printf("Power usage: %.4f mA (%.4f mA avg/ %.4f mAh total / %i sec)\n", ltc4150_get_current_mA(), ltc4150_get_avg_mA(), ltc4150_get_total_mAh(), ltc4150_get_interval());
}
void _reset_current_handler(char* unused) {

View File

@ -16,13 +16,13 @@ void _settime_handler(char* c) {
int res;
uint16_t month, epoch_year;
res = sscanf(c, "date %hu-%hu-%i %i:%i:%i",
res = sscanf(c, "date %hu-%hu-%u %u:%u:%u",
&epoch_year,
&month,
&(now.tm_mday),
&(now.tm_hour),
&(now.tm_min),
&(now.tm_sec));
(unsigned int*) &(now.tm_mday),
(unsigned int*) &(now.tm_hour),
(unsigned int*) &(now.tm_min),
(unsigned int*) &(now.tm_sec));
if (res < 6) {
printf("Usage: date YYYY-MM-DD hh:mm:ss\n");