diff --git a/board/msba2-common/include/msba2_common.h b/board/msba2-common/include/msba2_common.h index a9d9d3e72c..fff12f965d 100644 --- a/board/msba2-common/include/msba2_common.h +++ b/board/msba2-common/include/msba2_common.h @@ -24,8 +24,8 @@ and the mailinglist (subscription via web site) scatterweb@lists.spline.inf.fu-berlin.de *******************************************************************************/ -#ifndef __BOARD_H -#define __BOARD_H +#ifndef __MSBA2_COMMON_H +#define __MSBA2_COMMON_H /** * @ingroup msb_a2 @@ -48,4 +48,4 @@ and the mailinglist (subscription via web site) #define VICIntEnClear VICIntEnClr /** @} */ -#endif // __BOARD_H +#endif // __MSBA2_COMMON_H diff --git a/board/msba2/include/board.h b/board/msba2/include/board.h index bf596f0ee1..2b1f28fd2a 100644 --- a/board/msba2/include/board.h +++ b/board/msba2/include/board.h @@ -2,6 +2,7 @@ #define __BOARD_H #include +#include #define LED_RED_PIN (BIT25) #define LED_GREEN_PIN (BIT26) diff --git a/drivers/include/ltc4150.h b/drivers/include/ltc4150.h index 4a3c055153..fdc08573ae 100644 --- a/drivers/include/ltc4150.h +++ b/drivers/include/ltc4150.h @@ -9,6 +9,7 @@ void ltc4150_stop(); double ltc4150_get_current_mA(); double ltc4150_get_total_mAh(); +double ltc4150_get_total_Joule(void); double ltc4150_get_avg_mA(); int ltc4150_get_interval(); long ltc4150_get_intcount(void); diff --git a/drivers/include/ltc4150_arch.h b/drivers/include/ltc4150_arch.h index 1a6c5c630b..51fc9478a3 100644 --- a/drivers/include/ltc4150_arch.h +++ b/drivers/include/ltc4150_arch.h @@ -46,6 +46,7 @@ and the mailinglist (subscription via web site) #define _GFH (double)32.631375 #define _R_SENSE (double)0.330 +#define SUPPLY_VOLTAGE (5) void ltc4150_disable_int(void); void ltc4150_enable_int(void); diff --git a/drivers/ltc4150.c b/drivers/ltc4150.c index 947265f6a5..9f4134b5c9 100644 --- a/drivers/ltc4150.c +++ b/drivers/ltc4150.c @@ -54,6 +54,10 @@ static double __attribute__((__no_instrument_function__)) coulomb_to_mA(double c return (coulomb * 1000) / 3600; } +static double mAh_to_Joule(double mAh) { + return (SUPPLY_VOLTAGE * mAh * 3600); +} + uint32_t ltc4150_get_last_int_duration_us() { return HWTIMER_TICKS_TO_US(last_int_duration); } @@ -66,6 +70,10 @@ double __attribute__((__no_instrument_function__)) ltc4150_get_total_mAh() { return coulomb_to_mA(int_to_coulomb(int_count)); } +double ltc4150_get_total_Joule(void) { + return mAh_to_Joule(ltc4150_get_total_mAh()); +} + double ltc4150_get_avg_mA() { return (int_to_coulomb(int_count)*1000000000)/HWTIMER_TICKS_TO_US(last_int_time - start_time); } diff --git a/projects/default/main.c b/projects/default/main.c index 06c8a16e7e..ccc4cfd9a1 100644 --- a/projects/default/main.c +++ b/projects/default/main.c @@ -34,7 +34,6 @@ int main(void) { shell_init(&shell, NULL, shell_readc, shell_putchar); shell_run(&shell); - return 0; } diff --git a/projects/laser/main.c b/projects/laser/main.c index 902ffc3088..e3c3d4f83e 100644 --- a/projects/laser/main.c +++ b/projects/laser/main.c @@ -7,6 +7,8 @@ int main(void) { sht11_val_t sht11_val; + double mAh = 0; + uint8_t success = 0; puts(""); @@ -18,11 +20,12 @@ int main(void) while (1) { success = sht11_read_sensor(&sht11_val, HUMIDITY|TEMPERATURE); + mAh = ltc4150_get_total_mAh(); if (!success) { printf("error;error;error\n"); } else { - printf("%.2f;%.2f;%.2f\n", sht11_val.temperature, sht11_val.relhum, sht11_val.relhum_temp); + printf("%.2f;%.2f;%.2f;%.2f\n", sht11_val.temperature, sht11_val.relhum, sht11_val.relhum_temp, mAh); } LED_RED_TOGGLE; swtimer_usleep(60 * 1000*1000); diff --git a/projects/test_cc110x_ng/Jamfile b/projects/test_cc110x_ng/Jamfile index 2a13cb0892..5ef69ea238 100644 --- a/projects/test_cc110x_ng/Jamfile +++ b/projects/test_cc110x_ng/Jamfile @@ -1,5 +1,5 @@ SubDir TOP projects test_cc110x_ng ; -Module test_cc110x_ng : main.c : cc110x_ng shell shell_commands transceiver ps rtc posix_io uart0 auto_init swtimer config ; +Module test_cc110x_ng : main.c : cc110x_ng shell shell_commands transceiver ps rtc posix_io uart0 auto_init swtimer config ltc4150 ; UseModule test_cc110x_ng ;