Use the hardware random number generator

This commit is contained in:
Philip Gladstone 2021-10-21 01:32:46 +00:00
parent 96993eff16
commit d204d33d3d
3 changed files with 5 additions and 4 deletions

View File

@ -74,6 +74,11 @@
# define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
#endif
#define L_RANDMAX 2147483647
extern uint32_t esp_random(void);
#define l_rand() (esp_random() & L_RANDMAX)
#define l_srand(x)
/*
** Configuration for Paths.
**

View File

@ -928,13 +928,10 @@ static int lble_init(lua_State *L) {
}
if (!seen1800) {
printf("about to call gap_init\n");
ble_svc_gap_init();
}
printf("about to call gatt_init\n");
ble_svc_gatt_init();
printf("about to call gatts_start\n");
ble_gatts_start();
inited = RUNNING;

View File

@ -543,7 +543,6 @@ static int file_putfile( lua_State* L )
// Warning this code C calls other file_* routines to avoid duplication code. These
// use Lua stack addressing of arguments, so this does Lua stack maniplation to
// align these
int ret_cnt = 0;
lua_settop(L, 2);
lua_pushvalue(L, 2); //dup contents onto the ToS [3]
lua_pushliteral(L, "w+");