Skip to content

Commit

Permalink
Add generic function to print deprecation notes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelstoer committed Oct 12, 2016
1 parent 025805b commit ba9d3af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/modules/tmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
5 changes: 5 additions & 0 deletions app/platform/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
3 changes: 3 additions & 0 deletions app/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )\
Expand Down

0 comments on commit ba9d3af

Please sign in to comment.