make spi.send() transparent for 32 bit data

accept negative values as u32
This commit is contained in:
devsaurus 2015-10-19 23:01:59 +02:00
parent 20881d27a1
commit 75488639eb
1 changed files with 0 additions and 4 deletions

View File

@ -71,8 +71,6 @@ static int spi_send( lua_State *L )
if( lua_type( L, argn ) == LUA_TNUMBER ) if( lua_type( L, argn ) == LUA_TNUMBER )
{ {
numdata = ( int )luaL_checkinteger( L, argn ); numdata = ( int )luaL_checkinteger( L, argn );
if( numdata < 0 )
return luaL_error( L, "wrong arg range" );
platform_spi_send( id, spi_databits[id], numdata ); platform_spi_send( id, spi_databits[id], numdata );
wrote ++; wrote ++;
} }
@ -84,8 +82,6 @@ static int spi_send( lua_State *L )
lua_rawgeti( L, argn, i + 1 ); lua_rawgeti( L, argn, i + 1 );
numdata = ( int )luaL_checkinteger( L, -1 ); numdata = ( int )luaL_checkinteger( L, -1 );
lua_pop( L, 1 ); lua_pop( L, 1 );
if( numdata < 0 )
return luaL_error( L, "wrong arg range" );
platform_spi_send( id, spi_databits[id], numdata ); platform_spi_send( id, spi_databits[id], numdata );
} }
wrote += i; wrote += i;