diff --git a/components/lua_modules/lua_module_adc/lua_scripts/basic_adc.lua b/components/lua_modules/lua_module_adc/lua_scripts/basic_adc.lua index ae1596e..c3ea8a6 100644 --- a/components/lua_modules/lua_module_adc/lua_scripts/basic_adc.lua +++ b/components/lua_modules/lua_module_adc/lua_scripts/basic_adc.lua @@ -9,7 +9,7 @@ local ch = adc.new(ADC_GPIO) print(string.format( "[adc_demo] reading gpio=%d for %d samples...", - ch:gpio(), + ch:get_gpio(), SAMPLE_COUNT )) diff --git a/components/lua_modules/lua_module_adc/skills/lua_module_adc.md b/components/lua_modules/lua_module_adc/skills/lua_module_adc.md index c7aef54..dd40d38 100644 --- a/components/lua_modules/lua_module_adc/skills/lua_module_adc.md +++ b/components/lua_modules/lua_module_adc/skills/lua_module_adc.md @@ -15,7 +15,7 @@ raw ADC codes. `pcall` if you want to handle that gracefully. - `ch:read()` → current voltage in millivolts (integer). Blocking, returns within microseconds. -- `ch:gpio()` → the GPIO number this channel is bound to. +- `ch:get_gpio()` → the GPIO number this channel is bound to. - `ch:close()` when you're done. Handles are also cleaned up on garbage collection, but explicit `close()` is preferred for determinism. diff --git a/components/lua_modules/lua_module_adc/src/lua_module_adc.c b/components/lua_modules/lua_module_adc/src/lua_module_adc.c index f6efd0a..966e1ca 100644 --- a/components/lua_modules/lua_module_adc/src/lua_module_adc.c +++ b/components/lua_modules/lua_module_adc/src/lua_module_adc.c @@ -216,7 +216,7 @@ static int lua_module_adc_read(lua_State *L) return 1; } -static int lua_module_adc_gpio(lua_State *L) +static int lua_module_adc_get_gpio(lua_State *L) { lua_module_adc_ud_t *ud = lua_module_adc_get_ud(L, 1); lua_pushinteger(L, ud->gpio_num); @@ -258,8 +258,8 @@ int luaopen_adc(lua_State *L) lua_setfield(L, -2, "__index"); lua_pushcfunction(L, lua_module_adc_read); lua_setfield(L, -2, "read"); - lua_pushcfunction(L, lua_module_adc_gpio); - lua_setfield(L, -2, "gpio"); + lua_pushcfunction(L, lua_module_adc_get_gpio); + lua_setfield(L, -2, "get_gpio"); lua_pushcfunction(L, lua_module_adc_close); lua_setfield(L, -2, "close"); }