diff --git a/nifs/atomvm_m5.cc b/nifs/atomvm_m5.cc index fcd4b44..feeea17 100644 --- a/nifs/atomvm_m5.cc +++ b/nifs/atomvm_m5.cc @@ -33,7 +33,7 @@ #define MAKE_ATOM(ctx, len, str) globalcontext_make_atom(ctx->global, ATOM_STR(len, str)) //#define MAKE_ATOM(ctx, len, str) context_make_atom(ctx, ATOM_STR(len, str)) -static term nif_begin(Context *ctx, int argc, term argv[]) +static term nif_begin(Context* ctx, int argc, term argv[]) { UNUSED(argc); VALIDATE_VALUE(argv[0], term_is_list); @@ -59,50 +59,50 @@ static term nif_begin(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_get_board(Context *ctx, int argc, term argv[]) +static term nif_get_board(Context* ctx, int argc, term argv[]) { UNUSED(argc); switch (M5.getBoard()) { #if defined(CONFIG_IDF_TARGET_ESP32C3) - case m5::board_t::board_M5StampC3: - return MAKE_ATOM(ctx, "\x8", "stamp_c3"); - case m5::board_t::board_M5StampC3U: - return MAKE_ATOM(ctx, "\x9", "stamp_c3u"); + case m5::board_t::board_M5StampC3: + return MAKE_ATOM(ctx, "\x8", "stamp_c3"); + case m5::board_t::board_M5StampC3U: + return MAKE_ATOM(ctx, "\x9", "stamp_c3u"); #else - case m5::board_t::board_M5Stack: - return MAKE_ATOM(ctx, "\x5", "stack"); - case m5::board_t::board_M5StackCore2: - return MAKE_ATOM(ctx, "\xB", "stack_core2"); - case m5::board_t::board_M5StickC: - return MAKE_ATOM(ctx, "\x7", "stick_c"); - case m5::board_t::board_M5StickCPlus: - return MAKE_ATOM(ctx, "\xB", "stick_cplus"); - case m5::board_t::board_M5StackCoreInk: - return MAKE_ATOM(ctx, "\x8", "core_ink"); - case m5::board_t::board_M5Paper: - return MAKE_ATOM(ctx, "\x5", "paper"); - case m5::board_t::board_M5Tough: - return MAKE_ATOM(ctx, "\x5", "tough"); - case m5::board_t::board_M5Station: - return MAKE_ATOM(ctx, "\x7", "station"); - case m5::board_t::board_M5Atom: - return MAKE_ATOM(ctx, "\x4", "atom"); - case m5::board_t::board_M5AtomPsram: - return MAKE_ATOM(ctx, "\xA", "atom_psram"); - case m5::board_t::board_M5AtomU: - return MAKE_ATOM(ctx, "\x6", "atom_u"); - case m5::board_t::board_M5TimerCam: - return MAKE_ATOM(ctx, "\xC", "timer_camera"); - case m5::board_t::board_M5StampPico: - return MAKE_ATOM(ctx, "\xA", "stamp_pico"); + case m5::board_t::board_M5Stack: + return MAKE_ATOM(ctx, "\x5", "stack"); + case m5::board_t::board_M5StackCore2: + return MAKE_ATOM(ctx, "\xB", "stack_core2"); + case m5::board_t::board_M5StickC: + return MAKE_ATOM(ctx, "\x7", "stick_c"); + case m5::board_t::board_M5StickCPlus: + return MAKE_ATOM(ctx, "\xB", "stick_cplus"); + case m5::board_t::board_M5StackCoreInk: + return MAKE_ATOM(ctx, "\x8", "core_ink"); + case m5::board_t::board_M5Paper: + return MAKE_ATOM(ctx, "\x5", "paper"); + case m5::board_t::board_M5Tough: + return MAKE_ATOM(ctx, "\x5", "tough"); + case m5::board_t::board_M5Station: + return MAKE_ATOM(ctx, "\x7", "station"); + case m5::board_t::board_M5Atom: + return MAKE_ATOM(ctx, "\x4", "atom"); + case m5::board_t::board_M5AtomPsram: + return MAKE_ATOM(ctx, "\xA", "atom_psram"); + case m5::board_t::board_M5AtomU: + return MAKE_ATOM(ctx, "\x6", "atom_u"); + case m5::board_t::board_M5TimerCam: + return MAKE_ATOM(ctx, "\xC", "timer_camera"); + case m5::board_t::board_M5StampPico: + return MAKE_ATOM(ctx, "\xA", "stamp_pico"); #endif - default: - return UNDEFINED_ATOM; + default: + return UNDEFINED_ATOM; } } -static term nif_update(Context *ctx, int argc, term argv[]) +static term nif_update(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -111,7 +111,7 @@ static term nif_update(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static constexpr std::array, 3> NIFS = { { +static constexpr std::array, 3> NIFS = { { { "begin_/1", { { NIFFunctionType }, nif_begin } }, { "get_board/0", { { NIFFunctionType }, nif_get_board } }, { "update/0", { { NIFFunctionType }, nif_update } }, @@ -121,12 +121,12 @@ static constexpr std::array, 3> NIFS = // Component Nif Entrypoints // -static const struct Nif *get_nif(const char *nifname) +static const struct Nif* get_nif(const char* nifname) { if (memcmp(nifname, MODULE_PREFIX, strlen(MODULE_PREFIX))) { return NULL; } - for (const auto &nif : NIFS) { + for (const auto& nif : NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_PREFIX)) == 0) { return &nif.second; } diff --git a/nifs/atomvm_m5_i2c.cc b/nifs/atomvm_m5_i2c.cc index 3d22b03..6015ec9 100644 --- a/nifs/atomvm_m5_i2c.cc +++ b/nifs/atomvm_m5_i2c.cc @@ -33,40 +33,40 @@ #define MAKE_ATOM(ctx, len, str) globalcontext_make_atom(ctx->global, ATOM_STR(len, str)) -static term nif_in_i2c_set_port(Context *ctx, int argc, term argv[]) +static term nif_in_i2c_set_port(Context* ctx, int argc, term argv[]) { UNUSED(argc); M5.In_I2C.setPort(term_to_int32(argv[0]), term_to_int32(argv[1]), term_to_int32(argv[2])); return OK_ATOM; } -static term nif_ex_i2c_set_port(Context *ctx, int argc, term argv[]) +static term nif_ex_i2c_set_port(Context* ctx, int argc, term argv[]) { UNUSED(argc); M5.Ex_I2C.setPort(term_to_int32(argv[0]), term_to_int32(argv[1]), term_to_int32(argv[2])); return OK_ATOM; } -static term nif_in_i2c_begin(Context *ctx, int argc, term argv[]) +static term nif_in_i2c_begin(Context* ctx, int argc, term argv[]) { UNUSED(argc); bool result = M5.In_I2C.begin(term_to_int32(argv[0]), term_to_int32(argv[1]), term_to_int32(argv[2])); return result ? TRUE_ATOM : FALSE_ATOM; } -static term nif_ex_i2c_begin(Context *ctx, int argc, term argv[]) +static term nif_ex_i2c_begin(Context* ctx, int argc, term argv[]) { UNUSED(argc); bool result = M5.Ex_I2C.begin(term_to_int32(argv[0]), term_to_int32(argv[1]), term_to_int32(argv[2])); return result ? TRUE_ATOM : FALSE_ATOM; } -static constexpr std::array, 2> IN_NIFS = { { +static constexpr std::array, 2> IN_NIFS = { { { "set_port/3", { { NIFFunctionType }, nif_in_i2c_set_port } }, { "begin_/3", { { NIFFunctionType }, nif_in_i2c_begin } }, } }; -static constexpr std::array, 2> EX_NIFS = { { +static constexpr std::array, 2> EX_NIFS = { { { "set_port/3", { { NIFFunctionType }, nif_ex_i2c_set_port } }, { "begin_/3", { { NIFFunctionType }, nif_ex_i2c_begin } }, } }; @@ -75,16 +75,16 @@ static constexpr std::array, 2> EX_NIF // Component Nif Entrypoints // -static const struct Nif *get_nif(const char *nifname) +static const struct Nif* get_nif(const char* nifname) { if (memcmp(nifname, MODULE_IN_PREFIX, strlen(MODULE_IN_PREFIX)) == 0) { - for (const auto &nif : IN_NIFS) { + for (const auto& nif : IN_NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_IN_PREFIX)) == 0) { return &nif.second; } } } else if (memcmp(nifname, MODULE_EX_PREFIX, strlen(MODULE_EX_PREFIX)) == 0) { - for (const auto &nif : EX_NIFS) { + for (const auto& nif : EX_NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_EX_PREFIX)) == 0) { return &nif.second; } diff --git a/nifs/atomvm_m5_nifs.h b/nifs/atomvm_m5_nifs.h index 405df9d..8f3dfeb 100644 --- a/nifs/atomvm_m5_nifs.h +++ b/nifs/atomvm_m5_nifs.h @@ -2,7 +2,7 @@ // Common macros to simplify glue #define M5_NIF_v_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ UNUSED(argv); \ @@ -11,14 +11,14 @@ } #define M5_NIF_v_i(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ return term_from_int(M5.module.api_func()); \ } #define M5_NIF_i_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ VALIDATE_VALUE(argv[0], term_is_integer); \ @@ -28,7 +28,7 @@ } #define M5_NIF_i2_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ VALIDATE_VALUE(argv[0], term_is_integer); \ @@ -39,8 +39,8 @@ return OK_ATOM; \ } -#define M5_NIF_i3_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ +#define M5_NIF_i3_v(name, module, api_func) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ VALIDATE_VALUE(argv[0], term_is_integer); \ @@ -53,8 +53,8 @@ return OK_ATOM; \ } -#define M5_NIF_i2_i3_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ +#define M5_NIF_i2_i3_v(name, module, api_func) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ for (int i = 0; i < argc; i++) { \ VALIDATE_VALUE(argv[i], term_is_integer); \ @@ -71,8 +71,8 @@ } \ return OK_ATOM; \ } -#define M5_NIF_i3_i4_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ +#define M5_NIF_i3_i4_v(name, module, api_func) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ for (int i = 0; i < argc; i++) { \ VALIDATE_VALUE(argv[i], term_is_integer); \ @@ -92,8 +92,8 @@ return OK_ATOM; \ } -#define M5_NIF_i4_i5_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ +#define M5_NIF_i4_i5_v(name, module, api_func) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ for (int i = 0; i < argc; i++) { \ VALIDATE_VALUE(argv[i], term_is_integer); \ @@ -115,8 +115,8 @@ return OK_ATOM; \ } -#define M5_NIF_i5_i6_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ +#define M5_NIF_i5_i6_v(name, module, api_func) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ for (int i = 0; i < argc; i++) { \ VALIDATE_VALUE(argv[i], term_is_integer); \ @@ -140,8 +140,8 @@ return OK_ATOM; \ } -#define M5_NIF_i6_i7_v(name, module, api_func) \ - static term name(Context *ctx, int argc, term argv[]) \ +#define M5_NIF_i6_i7_v(name, module, api_func) \ + static term name(Context* ctx, int argc, term argv[]) \ { \ for (int i = 0; i < argc; i++) { \ VALIDATE_VALUE(argv[i], term_is_integer); \ diff --git a/nifs/atomvm_m5_power.cc b/nifs/atomvm_m5_power.cc index 221825d..c78dbcc 100644 --- a/nifs/atomvm_m5_power.cc +++ b/nifs/atomvm_m5_power.cc @@ -32,7 +32,7 @@ #define MAKE_ATOM(ctx, len, str) globalcontext_make_atom(ctx->global, ATOM_STR(len, str)) -static term nif_power_deep_sleep(Context *ctx, int argc, term argv[]) +static term nif_power_deep_sleep(Context* ctx, int argc, term argv[]) { avm_int64_t usec = 0; bool touch_wakeup = true; @@ -48,7 +48,7 @@ static term nif_power_deep_sleep(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_power_timer_sleep(Context *ctx, int argc, term argv[]) +static term nif_power_timer_sleep(Context* ctx, int argc, term argv[]) { UNUSED(argc); VALIDATE_VALUE(argv[0], term_is_any_integer); @@ -56,14 +56,14 @@ static term nif_power_timer_sleep(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_power_get_battery_level(Context *ctx, int argc, term argv[]) +static term nif_power_get_battery_level(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); return term_from_int(M5.Power.getBatteryLevel()); } -static term nif_power_set_battery_charge(Context *ctx, int argc, term argv[]) +static term nif_power_set_battery_charge(Context* ctx, int argc, term argv[]) { UNUSED(argc); VALIDATE_VALUE(argv[0], term_is_atom); @@ -71,7 +71,7 @@ static term nif_power_set_battery_charge(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_power_set_charge_current(Context *ctx, int argc, term argv[]) +static term nif_power_set_charge_current(Context* ctx, int argc, term argv[]) { UNUSED(argc); VALIDATE_VALUE(argv[0], term_is_number); @@ -79,7 +79,7 @@ static term nif_power_set_charge_current(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_power_set_charge_voltage(Context *ctx, int argc, term argv[]) +static term nif_power_set_charge_voltage(Context* ctx, int argc, term argv[]) { UNUSED(argc); VALIDATE_VALUE(argv[0], term_is_number); @@ -87,7 +87,7 @@ static term nif_power_set_charge_voltage(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_power_is_charging(Context *ctx, int argc, term argv[]) +static term nif_power_is_charging(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -95,21 +95,21 @@ static term nif_power_is_charging(Context *ctx, int argc, term argv[]) term result = term_nil(); switch (M5.Power.isCharging()) { - case m5::Power_Class::is_discharging: - result = FALSE_ATOM; - break; - case m5::Power_Class::is_charging: - result = TRUE_ATOM; - break; - case m5::Power_Class::charge_unknown: - result = UNDEFINED_ATOM; - break; + case m5::Power_Class::is_discharging: + result = FALSE_ATOM; + break; + case m5::Power_Class::is_charging: + result = TRUE_ATOM; + break; + case m5::Power_Class::charge_unknown: + result = UNDEFINED_ATOM; + break; } return result; } -static term nif_power_get_type(Context *ctx, int argc, term argv[]) +static term nif_power_get_type(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -117,27 +117,27 @@ static term nif_power_get_type(Context *ctx, int argc, term argv[]) term result = term_nil(); switch (M5.Power.getType()) { - case m5::Power_Class::pmic_unknown: - result = MAKE_ATOM(ctx, "\x7", "unknown"); - break; - case m5::Power_Class::pmic_adc: - result = MAKE_ATOM(ctx, "\x3", "adc"); - break; - case m5::Power_Class::pmic_axp192: - result = MAKE_ATOM(ctx, "\x6", "axp192"); - break; - case m5::Power_Class::pmic_axp2101: - result = MAKE_ATOM(ctx, "\x7", "axp2101"); - break; - case m5::Power_Class::pmic_ip5306: - result = MAKE_ATOM(ctx, "\x6", "ip5306"); - break; + case m5::Power_Class::pmic_unknown: + result = MAKE_ATOM(ctx, "\x7", "unknown"); + break; + case m5::Power_Class::pmic_adc: + result = MAKE_ATOM(ctx, "\x3", "adc"); + break; + case m5::Power_Class::pmic_axp192: + result = MAKE_ATOM(ctx, "\x6", "axp192"); + break; + case m5::Power_Class::pmic_axp2101: + result = MAKE_ATOM(ctx, "\x7", "axp2101"); + break; + case m5::Power_Class::pmic_ip5306: + result = MAKE_ATOM(ctx, "\x6", "ip5306"); + break; } return result; } -static constexpr std::array, 10> NIFS = { { +static constexpr std::array, 10> NIFS = { { { "deep_sleep/0", { { NIFFunctionType }, nif_power_deep_sleep } }, { "deep_sleep/1", { { NIFFunctionType }, nif_power_deep_sleep } }, { "deep_sleep/2", { { NIFFunctionType }, nif_power_deep_sleep } }, @@ -154,12 +154,12 @@ static constexpr std::array, 10> NIFS // Component Nif Entrypoints // -static const struct Nif *get_nif(const char *nifname) +static const struct Nif* get_nif(const char* nifname) { if (memcmp(nifname, MODULE_PREFIX, strlen(MODULE_PREFIX))) { return NULL; } - for (const auto &nif : NIFS) { + for (const auto& nif : NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_PREFIX)) == 0) { return &nif.second; } diff --git a/nifs/atomvm_m5_power_axp192.cc b/nifs/atomvm_m5_power_axp192.cc index a4cb4ae..230e8b7 100644 --- a/nifs/atomvm_m5_power_axp192.cc +++ b/nifs/atomvm_m5_power_axp192.cc @@ -33,14 +33,14 @@ #define MAKE_ATOM(ctx, len, str) globalcontext_make_atom(ctx->global, ATOM_STR(len, str)) #define NIF_IMPL_GETTER_INT(name, expr) \ - static term nif_power_axp192_##name(Context *ctx, int argc, term argv[]) \ + static term nif_power_axp192_##name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ UNUSED(argv); \ return term_from_int(M5.Power.Axp192.expr); \ } #define NIF_IMPL_GETTER_FLOAT(name, expr) \ - static term nif_power_axp192_##name(Context *ctx, int argc, term argv[]) \ + static term nif_power_axp192_##name(Context* ctx, int argc, term argv[]) \ { \ UNUSED(argc); \ UNUSED(argv); \ @@ -59,7 +59,7 @@ NIF_IMPL_GETTER_FLOAT(get_vbus_current, getVBUSCurrent()) NIF_IMPL_GETTER_FLOAT(get_aps_voltage, getAPSVoltage()) NIF_IMPL_GETTER_FLOAT(get_internal_temperature, getInternalTemperature()) -static constexpr std::array, 11> NIFS = { { +static constexpr std::array, 11> NIFS = { { { "get_battery_level/0", { { NIFFunctionType }, nif_power_axp192_get_battery_level } }, { "get_battery_voltage/0", { { NIFFunctionType }, nif_power_axp192_get_battery_voltage } }, { "get_battery_discharge_current/0", { { NIFFunctionType }, nif_power_axp192_get_battery_discharge_current } }, @@ -77,12 +77,12 @@ static constexpr std::array, 11> NIFS // Component Nif Entrypoints // -static const struct Nif *get_nif(const char *nifname) +static const struct Nif* get_nif(const char* nifname) { if (memcmp(nifname, MODULE_PREFIX, strlen(MODULE_PREFIX))) { return NULL; } - for (const auto &nif : NIFS) { + for (const auto& nif : NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_PREFIX)) == 0) { return &nif.second; } diff --git a/nifs/atomvm_m5_rtc.cc b/nifs/atomvm_m5_rtc.cc index 1b56446..31706e1 100644 --- a/nifs/atomvm_m5_rtc.cc +++ b/nifs/atomvm_m5_rtc.cc @@ -32,7 +32,7 @@ #define MAKE_ATOM(ctx, len, str) globalcontext_make_atom(ctx->global, ATOM_STR(len, str)) -static term nif_rtc_is_enabled(Context *ctx, int argc, term argv[]) +static term nif_rtc_is_enabled(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -40,7 +40,7 @@ static term nif_rtc_is_enabled(Context *ctx, int argc, term argv[]) return M5.Rtc.isEnabled() ? TRUE_ATOM : FALSE_ATOM; } -static term nif_rtc_get_time(Context *ctx, int argc, term argv[]) +static term nif_rtc_get_time(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -58,7 +58,7 @@ static term nif_rtc_get_time(Context *ctx, int argc, term argv[]) return result; } -static term nif_rtc_get_date(Context *ctx, int argc, term argv[]) +static term nif_rtc_get_date(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -76,7 +76,7 @@ static term nif_rtc_get_date(Context *ctx, int argc, term argv[]) return result; } -static term nif_rtc_get_datetime(Context *ctx, int argc, term argv[]) +static term nif_rtc_get_datetime(Context* ctx, int argc, term argv[]) { UNUSED(argc); UNUSED(argv); @@ -101,7 +101,7 @@ static term nif_rtc_get_datetime(Context *ctx, int argc, term argv[]) return result; } -static term nif_rtc_set_time(Context *ctx, int argc, term argv[]) +static term nif_rtc_set_time(Context* ctx, int argc, term argv[]) { UNUSED(argc); @@ -119,7 +119,7 @@ static term nif_rtc_set_time(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_rtc_set_date(Context *ctx, int argc, term argv[]) +static term nif_rtc_set_date(Context* ctx, int argc, term argv[]) { UNUSED(argc); @@ -138,7 +138,7 @@ static term nif_rtc_set_date(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static term nif_rtc_set_datetime(Context *ctx, int argc, term argv[]) +static term nif_rtc_set_datetime(Context* ctx, int argc, term argv[]) { UNUSED(argc); @@ -170,7 +170,7 @@ static term nif_rtc_set_datetime(Context *ctx, int argc, term argv[]) return OK_ATOM; } -static constexpr std::array, 7> NIFS = { { { "is_enabled/0", { { NIFFunctionType }, nif_rtc_is_enabled } }, +static constexpr std::array, 7> NIFS = { { { "is_enabled/0", { { NIFFunctionType }, nif_rtc_is_enabled } }, { "get_time/0", { { NIFFunctionType }, nif_rtc_get_time } }, { "get_date/0", { { NIFFunctionType }, nif_rtc_get_date } }, { "get_datetime/0", { { NIFFunctionType }, nif_rtc_get_datetime } }, @@ -182,10 +182,10 @@ static constexpr std::array, 7> NIFS = // Component Nif Entrypoints // -static const struct Nif *get_nif(const char *nifname) +static const struct Nif* get_nif(const char* nifname) { if (memcmp(nifname, MODULE_PREFIX, strlen(MODULE_PREFIX)) == 0) { - for (const auto &nif : NIFS) { + for (const auto& nif : NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_PREFIX)) == 0) { return &nif.second; } diff --git a/nifs/atomvm_m5_speaker.cc b/nifs/atomvm_m5_speaker.cc index ac30325..7d24224 100644 --- a/nifs/atomvm_m5_speaker.cc +++ b/nifs/atomvm_m5_speaker.cc @@ -30,7 +30,7 @@ #define MODULE_PREFIX "m5_speaker:" -static term nif_speaker_tone(Context *ctx, int argc, term argv[]) +static term nif_speaker_tone(Context* ctx, int argc, term argv[]) { VALIDATE_VALUE(argv[0], term_is_number); VALIDATE_VALUE(argv[1], term_is_integer); @@ -54,7 +54,7 @@ static term nif_speaker_tone(Context *ctx, int argc, term argv[]) return r ? TRUE_ATOM : FALSE_ATOM; } -static constexpr std::array, 3> NIFS = { { +static constexpr std::array, 3> NIFS = { { { "tone/2", { { NIFFunctionType }, nif_speaker_tone } }, { "tone/3", { { NIFFunctionType }, nif_speaker_tone } }, { "tone/4", { { NIFFunctionType }, nif_speaker_tone } }, @@ -65,12 +65,12 @@ static constexpr std::array, 3> NIFS = // Component Nif Entrypoints // -static const struct Nif *get_nif(const char *nifname) +static const struct Nif* get_nif(const char* nifname) { if (memcmp(nifname, MODULE_PREFIX, strlen(MODULE_PREFIX))) { return NULL; } - for (const auto &nif : NIFS) { + for (const auto& nif : NIFS) { if (strcmp(nif.first, nifname + strlen(MODULE_PREFIX)) == 0) { return &nif.second; }