diff --git a/microfx_src/include/microfx/microfx.h b/microfx_src/include/microfx/microfx.h index ccb4ffb..7dbb9bf 100644 --- a/microfx_src/include/microfx/microfx.h +++ b/microfx_src/include/microfx/microfx.h @@ -108,7 +108,7 @@ void tsleep_ms(int ms); Get 1/128 seconds ticks since midnight. */ -void tgetticks(void); +int tgetticks(void); /* int tiselapsed(int start, int ms); @@ -119,5 +119,14 @@ Returns 1 if ms is elapsed and 0 if it is not. int tiselapsed(int start, int ms); -#endif +/******* CPU *******/ +/* void csleep(void); + +Uses asm sleep instruction. +Can be used to reduce battery usage of some loops. +*/ + +void csleep(void); + +#endif diff --git a/microfx_src/src/microfx.c b/microfx_src/src/microfx.c index 4c3bb6e..ab21aa4 100644 --- a/microfx_src/src/microfx.c +++ b/microfx_src/src/microfx.c @@ -104,11 +104,16 @@ void tsleep_ms(int ms) { _Sleep(ms); } -void tgetticks(void) { - _RTC_GetTicks(); +int tgetticks(void) { + return _RTC_GetTicks(); } int tiselapsed(int start, int ms) { return _RTC_Elapsed_ms(start, ms); } +/******* CPU *******/ + +void csleep(void) { + __asm__("sleep"); +} diff --git a/template/lib/include/microfx/microfx.h b/template/lib/include/microfx/microfx.h index ccb4ffb..7dbb9bf 100644 --- a/template/lib/include/microfx/microfx.h +++ b/template/lib/include/microfx/microfx.h @@ -108,7 +108,7 @@ void tsleep_ms(int ms); Get 1/128 seconds ticks since midnight. */ -void tgetticks(void); +int tgetticks(void); /* int tiselapsed(int start, int ms); @@ -119,5 +119,14 @@ Returns 1 if ms is elapsed and 0 if it is not. int tiselapsed(int start, int ms); -#endif +/******* CPU *******/ +/* void csleep(void); + +Uses asm sleep instruction. +Can be used to reduce battery usage of some loops. +*/ + +void csleep(void); + +#endif diff --git a/template/lib/libMicrofx.a b/template/lib/libMicrofx.a index 48126ab..0bea3d7 100644 Binary files a/template/lib/libMicrofx.a and b/template/lib/libMicrofx.a differ