From ba9d3af68f1e76a1e71fa9d87ae73b2258763851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Wed, 12 Oct 2016 20:12:23 +0900 Subject: [PATCH] Add generic function to print deprecation notes --- app/modules/tmr.c | 1 + app/platform/platform.c | 5 +++++ app/platform/platform.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/modules/tmr.c b/app/modules/tmr.c index b85ec80fc3..26c2cd15c5 100755 --- a/app/modules/tmr.c +++ b/app/modules/tmr.c @@ -151,6 +151,7 @@ static timer_t tmr_get( lua_State *L, int stack ) { if (lua_isuserdata(L, stack)) { return (timer_t)luaL_checkudata(L, stack, "tmr.timer"); } else { + platform_print_deprecation_note("Use the dynamic timer API rather than the static one.", "end of 2016"); uint32_t id = luaL_checkinteger(L, 1); luaL_argcheck(L, platform_tmr_exists(id), 1, "invalid timer index"); return &alarm_timers[id]; diff --git a/app/platform/platform.c b/app/platform/platform.c index 9cf283541e..db31d001f7 100755 --- a/app/platform/platform.c +++ b/app/platform/platform.c @@ -859,3 +859,8 @@ uint32_t platform_flash_mapped2phys (uint32_t mapped_addr) uint32_t meg = (b1 << 1) | b0; return mapped_addr - INTERNAL_FLASH_MAPPED_ADDRESS + meg * 0x100000; } + +void* platform_print_deprecation_note( const char *msg, const char *time_frame) +{ + c_printf( "Warning, deprecated API! %s. It will be removed %s. See documentation for details.\n", msg, time_frame ); +} diff --git a/app/platform/platform.h b/app/platform/platform.h index c1ac367714..10978472ee 100644 --- a/app/platform/platform.h +++ b/app/platform/platform.h @@ -302,6 +302,9 @@ int platform_gpio_exists( unsigned id ); int platform_tmr_exists( unsigned id ); // ***************************************************************************** + +void* platform_print_deprecation_note( const char *msg, const char *time_frame); + // Helper macros #define MOD_CHECK_ID( mod, id )\ if( !platform_ ## mod ## _exists( id ) )\