From 2143082aa43f8b9bcf36f39fc6a3bf60789dba84 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:33:47 +0100 Subject: [PATCH] Berry rename axp drivers (#22718) * Berry rename axp drivers * fix compilation --- lib/libesp32/berry_tasmota/solidify_all.be | 8 +- ...b.c => be_i2c_axp192_axp202_axp2102_lib.c} | 4 +- .../src/embedded/{i2c_axp192.be => AXP192.be} | 7 +- .../src/embedded/{i2c_axp202.be => AXP202.be} | 9 +- ...ified_i2c_axp192.h => solidified_AXP192.h} | 104 ++--- ...ified_i2c_axp202.h => solidified_AXP202.h} | 360 +++++++++--------- 6 files changed, 254 insertions(+), 238 deletions(-) rename lib/libesp32/berry_tasmota/src/{be_i2c_axp192_axp202_lib.c => be_i2c_axp192_axp202_axp2102_lib.c} (68%) rename lib/libesp32/berry_tasmota/src/embedded/{i2c_axp192.be => AXP192.be} (97%) rename lib/libesp32/berry_tasmota/src/embedded/{i2c_axp202.be => AXP202.be} (97%) rename lib/libesp32/berry_tasmota/src/solidify/{solidified_i2c_axp192.h => solidified_AXP192.h} (96%) rename lib/libesp32/berry_tasmota/src/solidify/{solidified_i2c_axp202.h => solidified_AXP202.h} (90%) diff --git a/lib/libesp32/berry_tasmota/solidify_all.be b/lib/libesp32/berry_tasmota/solidify_all.be index 84794af13e61..18c86be7e384 100755 --- a/lib/libesp32/berry_tasmota/solidify_all.be +++ b/lib/libesp32/berry_tasmota/solidify_all.be @@ -13,16 +13,22 @@ import sys sys.path().push('src/embedded') # allow to import from src/embedded # globals that need to exist to make compilation succeed -var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,MD5,lv,light_state,udp,I2C_Driver,tcpserver,log," +var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,MD5,lv,light_state,udp,tcpserver,log," "lv_clock,lv_clock_icon,lv_signal_arcs,lv_signal_bars,lv_wifi_arcs_icon,lv_wifi_arcs," "lv_wifi_bars_icon,lv_wifi_bars," "_lvgl," "int64" +var glob_classes = "I2C_Driver" + for g:string2.split(globs, ",") global.(g) = nil end +for g:string2.split(glob_classes, ",") + compile(f"class {g} end")() +end + var prefix_dir = "src/embedded/" var prefix_out = "src/solidify/" diff --git a/lib/libesp32/berry_tasmota/src/be_i2c_axp192_axp202_lib.c b/lib/libesp32/berry_tasmota/src/be_i2c_axp192_axp202_axp2102_lib.c similarity index 68% rename from lib/libesp32/berry_tasmota/src/be_i2c_axp192_axp202_lib.c rename to lib/libesp32/berry_tasmota/src/be_i2c_axp192_axp202_axp2102_lib.c index f121b1708d6f..7c05c205a3b2 100644 --- a/lib/libesp32/berry_tasmota/src/be_i2c_axp192_axp202_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_i2c_axp192_axp202_axp2102_lib.c @@ -1,5 +1,5 @@ /******************************************************************** * Drivers for AXP192 and AXP202 I2C Solidified *******************************************************************/ -#include "solidify/solidified_i2c_axp192.h" -#include "solidify/solidified_i2c_axp202.h" +#include "solidify/solidified_AXP192.h" +#include "solidify/solidified_AXP202.h" diff --git a/lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be b/lib/libesp32/berry_tasmota/src/embedded/AXP192.be similarity index 97% rename from lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be rename to lib/libesp32/berry_tasmota/src/embedded/AXP192.be index b9254af1d041..5bb26c0174ec 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/i2c_axp192.be +++ b/lib/libesp32/berry_tasmota/src/embedded/AXP192.be @@ -1,11 +1,11 @@ #------------------------------------------------------------- - Generic driver for AXP192 - solidified -------------------------------------------------------------# -class I2C_Driver end # for solidification #@ solidify:AXP192 class AXP192 : I2C_Driver - def init() + def init(addr) + if (addr == nil) addr = 0x34 end # default address is 0x34 super(self, I2C_Driver).init("AXP192", 0x34) end @@ -27,7 +27,7 @@ class AXP192 : I2C_Driver end # Battery Charging Status - def get_battery_chargin_status() + def get_battery_charging_status() return self.wire.read(self.addr, 0x01, 1) end @@ -187,3 +187,4 @@ class AXP192 : I2C_Driver tasmota.response_append(msg) end end +return AXP192 diff --git a/lib/libesp32/berry_tasmota/src/embedded/i2c_axp202.be b/lib/libesp32/berry_tasmota/src/embedded/AXP202.be similarity index 97% rename from lib/libesp32/berry_tasmota/src/embedded/i2c_axp202.be rename to lib/libesp32/berry_tasmota/src/embedded/AXP202.be index e6b6f6d80a5f..a9b5f55a31ef 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/i2c_axp202.be +++ b/lib/libesp32/berry_tasmota/src/embedded/AXP202.be @@ -1,11 +1,11 @@ #------------------------------------------------------------- - Generic driver for AXP202 - solidified -------------------------------------------------------------# -class I2C_Driver end # for solidification - #@ solidify:AXP202 +#@ solidify:AXP202 class AXP202 : I2C_Driver - def init() + def init(addr) + if (addr == nil) addr = 0x35 end # default address is 0x35 super(self, I2C_Driver).init("AXP202", 0x35) end @@ -22,7 +22,7 @@ class AXP202 : I2C_Driver end # Battery Charging Status - def get_battery_chargin_status() + def get_battery_charging_status() return self.wire.read(self.addr, 0x01, 1) end @@ -189,3 +189,4 @@ class AXP202 : I2C_Driver # # tasmota.response_append(msg) # end end +return AXP202 diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_axp192.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_AXP192.h similarity index 96% rename from lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_axp192.h rename to lib/libesp32/berry_tasmota/src/solidify/solidified_AXP192.h index 003818560353..d28d969aa927 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_axp192.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_AXP192.h @@ -1,4 +1,4 @@ -/* Solidification of i2c_axp192.h */ +/* Solidification of AXP192.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -11,7 +11,7 @@ static const bvalue be_ktab_class_AXP192[37] = { /* K3 */ be_const_int(2), /* K4 */ be_const_int(3), /* K5 */ be_nested_str(read24), - /* K6 */ be_const_real_hex(0x3A102DE0), + /* K6 */ be_const_real_hex(0x3A102DE1), /* K7 */ be_nested_str(read12), /* K8 */ be_const_real_hex(0x3A902DE0), /* K9 */ be_const_real_hex(0x3EC00000), @@ -551,8 +551,8 @@ be_local_closure(class_AXP192_json_append, /* name */ ********************************************************************/ be_local_closure(class_AXP192_init, /* name */ be_nested_proto( - 5, /* nstack */ - 1, /* argc */ + 6, /* nstack */ + 2, /* argc */ 10, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -562,16 +562,20 @@ be_local_closure(class_AXP192_init, /* name */ &be_ktab_class_AXP192, /* shared constants */ &be_const_str_init, &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x60040003, // 0000 GETGBL R1 G3 - 0x5C080000, // 0001 MOVE R2 R0 - 0xB80E3000, // 0002 GETNGBL R3 K24 - 0x7C040400, // 0003 CALL R1 2 - 0x8C040319, // 0004 GETMET R1 R1 K25 - 0x580C001A, // 0005 LDCONST R3 K26 - 0x54120033, // 0006 LDINT R4 52 - 0x7C040600, // 0007 CALL R1 3 - 0x80000000, // 0008 RET 0 + ( &(const binstruction[13]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x780A0000, // 0002 JMPF R2 #0004 + 0x54060033, // 0003 LDINT R1 52 + 0x60080003, // 0004 GETGBL R2 G3 + 0x5C0C0000, // 0005 MOVE R3 R0 + 0xB8123000, // 0006 GETNGBL R4 K24 + 0x7C080400, // 0007 CALL R2 2 + 0x8C080519, // 0008 GETMET R2 R2 K25 + 0x5810001A, // 0009 LDCONST R4 K26 + 0x54160033, // 000A LDINT R5 52 + 0x7C080600, // 000B CALL R2 3 + 0x80000000, // 000C RET 0 }) ) ); @@ -659,12 +663,12 @@ be_local_closure(class_AXP192_web_sensor, /* name */ /******************************************************************** -** Solidified function: set_chg_current +** Solidified function: get_battery_charging_status ********************************************************************/ -be_local_closure(class_AXP192_set_chg_current, /* name */ +be_local_closure(class_AXP192_get_battery_charging_status, /* name */ be_nested_proto( - 8, /* nstack */ - 2, /* argc */ + 6, /* nstack */ + 1, /* argc */ 10, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -672,21 +676,16 @@ be_local_closure(class_AXP192_set_chg_current, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP192, /* shared constants */ - &be_const_str_set_chg_current, + &be_const_str_get_battery_charging_status, &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x8C08010F, // 0000 GETMET R2 R0 K15 - 0x54120032, // 0001 LDINT R4 51 - 0x8C140110, // 0002 GETMET R5 R0 K16 - 0x541E0032, // 0003 LDINT R7 51 - 0x7C140400, // 0004 CALL R5 2 - 0x541A00EF, // 0005 LDINT R6 240 - 0x2C140A06, // 0006 AND R5 R5 R6 - 0x541A000E, // 0007 LDINT R6 15 - 0x2C180206, // 0008 AND R6 R1 R6 - 0x30140A06, // 0009 OR R5 R5 R6 - 0x7C080600, // 000A CALL R2 3 - 0x80000000, // 000B RET 0 + ( &(const binstruction[ 7]) { /* code */ + 0x8804010A, // 0000 GETMBR R1 R0 K10 + 0x8C04030B, // 0001 GETMET R1 R1 K11 + 0x880C010C, // 0002 GETMBR R3 R0 K12 + 0x58100000, // 0003 LDCONST R4 K0 + 0x58140000, // 0004 LDCONST R5 K0 + 0x7C040800, // 0005 CALL R1 4 + 0x80040200, // 0006 RET 1 R1 }) ) ); @@ -823,12 +822,12 @@ be_local_closure(class_AXP192_power_off, /* name */ /******************************************************************** -** Solidified function: get_battery_chargin_status +** Solidified function: set_chg_current ********************************************************************/ -be_local_closure(class_AXP192_get_battery_chargin_status, /* name */ +be_local_closure(class_AXP192_set_chg_current, /* name */ be_nested_proto( - 6, /* nstack */ - 1, /* argc */ + 8, /* nstack */ + 2, /* argc */ 10, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -836,16 +835,21 @@ be_local_closure(class_AXP192_get_battery_chargin_status, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP192, /* shared constants */ - &be_const_str_get_battery_chargin_status, + &be_const_str_set_chg_current, &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x8804010A, // 0000 GETMBR R1 R0 K10 - 0x8C04030B, // 0001 GETMET R1 R1 K11 - 0x880C010C, // 0002 GETMBR R3 R0 K12 - 0x58100000, // 0003 LDCONST R4 K0 - 0x58140000, // 0004 LDCONST R5 K0 - 0x7C040800, // 0005 CALL R1 4 - 0x80040200, // 0006 RET 1 R1 + ( &(const binstruction[12]) { /* code */ + 0x8C08010F, // 0000 GETMET R2 R0 K15 + 0x54120032, // 0001 LDINT R4 51 + 0x8C140110, // 0002 GETMET R5 R0 K16 + 0x541E0032, // 0003 LDINT R7 51 + 0x7C140400, // 0004 CALL R5 2 + 0x541A00EF, // 0005 LDINT R6 240 + 0x2C140A06, // 0006 AND R5 R5 R6 + 0x541A000E, // 0007 LDINT R6 15 + 0x2C180206, // 0008 AND R6 R1 R6 + 0x30140A06, // 0009 OR R5 R5 R6 + 0x7C080600, // 000A CALL R2 3 + 0x80000000, // 000B RET 0 }) ) ); @@ -891,12 +895,12 @@ be_local_class(AXP192, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key(set_dcdc_enable, -1), be_const_closure(class_AXP192_set_dcdc_enable_closure) }, { be_const_key(get_bat_power, -1), be_const_closure(class_AXP192_get_bat_power_closure) }, - { be_const_key(get_bat_charge_current, 3), be_const_closure(class_AXP192_get_bat_charge_current_closure) }, - { be_const_key(get_battery_chargin_status, -1), be_const_closure(class_AXP192_get_battery_chargin_status_closure) }, + { be_const_key(get_bat_charge_current, -1), be_const_closure(class_AXP192_get_bat_charge_current_closure) }, + { be_const_key(set_chg_current, -1), be_const_closure(class_AXP192_set_chg_current_closure) }, { be_const_key(get_warning_level, -1), be_const_closure(class_AXP192_get_warning_level_closure) }, { be_const_key(power_off, -1), be_const_closure(class_AXP192_power_off_closure) }, { be_const_key(get_vbus_current, 22), be_const_closure(class_AXP192_get_vbus_current_closure) }, - { be_const_key(get_aps_voltage, -1), be_const_closure(class_AXP192_get_aps_voltage_closure) }, + { be_const_key(get_aps_voltage, 17), be_const_closure(class_AXP192_get_aps_voltage_closure) }, { be_const_key(set_exten, -1), be_const_closure(class_AXP192_set_exten_closure) }, { be_const_key(battery_present, -1), be_const_closure(class_AXP192_battery_present_closure) }, { be_const_key(get_vbus_voltage, -1), be_const_closure(class_AXP192_get_vbus_voltage_closure) }, @@ -906,9 +910,9 @@ be_local_class(AXP192, { be_const_key(init, 2), be_const_closure(class_AXP192_init_closure) }, { be_const_key(get_bat_current, -1), be_const_closure(class_AXP192_get_bat_current_closure) }, { be_const_key(web_sensor, -1), be_const_closure(class_AXP192_web_sensor_closure) }, - { be_const_key(set_dc_voltage, -1), be_const_closure(class_AXP192_set_dc_voltage_closure) }, + { be_const_key(get_battery_charging_status, -1), be_const_closure(class_AXP192_get_battery_charging_status_closure) }, { be_const_key(get_temp, -1), be_const_closure(class_AXP192_get_temp_closure) }, - { be_const_key(set_chg_current, 17), be_const_closure(class_AXP192_set_chg_current_closure) }, + { be_const_key(set_dc_voltage, 3), be_const_closure(class_AXP192_set_dc_voltage_closure) }, { be_const_key(get_bat_voltage, 5), be_const_closure(class_AXP192_get_bat_voltage_closure) }, { be_const_key(json_append, -1), be_const_closure(class_AXP192_json_append_closure) }, { be_const_key(get_input_power_status, -1), be_const_closure(class_AXP192_get_input_power_status_closure) }, diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_axp202.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_AXP202.h similarity index 90% rename from lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_axp202.h rename to lib/libesp32/berry_tasmota/src/solidify/solidified_AXP202.h index c15ccbf69710..cee68ff63771 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_axp202.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_AXP202.h @@ -1,4 +1,4 @@ -/* Solidification of i2c_axp202.h */ +/* Solidification of AXP202.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -13,20 +13,20 @@ static const bvalue be_ktab_class_AXP202[24] = { /* K5 */ be_nested_str(read8), /* K6 */ be_nested_str(read12), /* K7 */ be_const_real_hex(0x3EC00000), - /* K8 */ be_const_real_hex(0x3A902DE0), - /* K9 */ be_nested_str(read13), - /* K10 */ be_const_real_hex(0x3F000000), - /* K11 */ be_nested_str(read24), - /* K12 */ be_const_real_hex(0x3A102DE0), - /* K13 */ be_const_real_hex(0x3AB78035), - /* K14 */ be_const_real_hex(0x3ADED28A), - /* K15 */ be_nested_str(write_bit), - /* K16 */ be_nested_str(wire), - /* K17 */ be_nested_str(read), - /* K18 */ be_nested_str(addr), - /* K19 */ be_nested_str(I2C_Driver), - /* K20 */ be_nested_str(init), - /* K21 */ be_nested_str(AXP202), + /* K8 */ be_nested_str(read13), + /* K9 */ be_const_real_hex(0x3F000000), + /* K10 */ be_nested_str(read24), + /* K11 */ be_const_real_hex(0x3A102DE1), + /* K12 */ be_nested_str(wire), + /* K13 */ be_nested_str(read), + /* K14 */ be_nested_str(addr), + /* K15 */ be_const_real_hex(0x3ADED28A), + /* K16 */ be_const_real_hex(0x3AB78035), + /* K17 */ be_nested_str(write_bit), + /* K18 */ be_nested_str(I2C_Driver), + /* K19 */ be_nested_str(init), + /* K20 */ be_nested_str(AXP202), + /* K21 */ be_const_real_hex(0x3A902DE0), /* K22 */ be_const_real_hex(0x3DCCCCCD), /* K23 */ be_const_real_hex(0x4310B333), }; @@ -110,9 +110,9 @@ be_local_closure(class_AXP202_get_vbus_current, /* name */ /******************************************************************** -** Solidified function: get_bat_voltage +** Solidified function: get_bat_charge_current ********************************************************************/ -be_local_closure(class_AXP202_get_bat_voltage, /* name */ +be_local_closure(class_AXP202_get_bat_charge_current, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -123,13 +123,13 @@ be_local_closure(class_AXP202_get_bat_voltage, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP202, /* shared constants */ - &be_const_str_get_bat_voltage, + &be_const_str_get_bat_charge_current, &be_const_str_solidified, ( &(const binstruction[ 5]) { /* code */ - 0x8C040106, // 0000 GETMET R1 R0 K6 - 0x540E0077, // 0001 LDINT R3 120 + 0x8C040108, // 0000 GETMET R1 R0 K8 + 0x540E0079, // 0001 LDINT R3 122 0x7C040400, // 0002 CALL R1 2 - 0x08040308, // 0003 MUL R1 R1 K8 + 0x08040309, // 0003 MUL R1 R1 K9 0x80040200, // 0004 RET 1 R1 }) ) @@ -154,14 +154,14 @@ be_local_closure(class_AXP202_get_bat_current, /* name */ &be_const_str_get_bat_current, &be_const_str_solidified, ( &(const binstruction[ 9]) { /* code */ - 0x8C040109, // 0000 GETMET R1 R0 K9 + 0x8C040108, // 0000 GETMET R1 R0 K8 0x540E0079, // 0001 LDINT R3 122 0x7C040400, // 0002 CALL R1 2 - 0x8C080109, // 0003 GETMET R2 R0 K9 + 0x8C080108, // 0003 GETMET R2 R0 K8 0x5412007B, // 0004 LDINT R4 124 0x7C080400, // 0005 CALL R2 2 0x04040202, // 0006 SUB R1 R1 R2 - 0x0804030A, // 0007 MUL R1 R1 K10 + 0x08040309, // 0007 MUL R1 R1 K9 0x80040200, // 0008 RET 1 R1 }) ) @@ -186,10 +186,10 @@ be_local_closure(class_AXP202_get_bat_power, /* name */ &be_const_str_get_bat_power, &be_const_str_solidified, ( &(const binstruction[ 5]) { /* code */ - 0x8C04010B, // 0000 GETMET R1 R0 K11 + 0x8C04010A, // 0000 GETMET R1 R0 K10 0x540E006F, // 0001 LDINT R3 112 0x7C040400, // 0002 CALL R1 2 - 0x0804030C, // 0003 MUL R1 R1 K12 + 0x0804030B, // 0003 MUL R1 R1 K11 0x80040200, // 0004 RET 1 R1 }) ) @@ -198,11 +198,11 @@ be_local_closure(class_AXP202_get_bat_power, /* name */ /******************************************************************** -** Solidified function: get_aps_voltage +** Solidified function: get_battery_charging_status ********************************************************************/ -be_local_closure(class_AXP202_get_aps_voltage, /* name */ +be_local_closure(class_AXP202_get_battery_charging_status, /* name */ be_nested_proto( - 4, /* nstack */ + 6, /* nstack */ 1, /* argc */ 10, /* varg */ 0, /* has upvals */ @@ -211,14 +211,16 @@ be_local_closure(class_AXP202_get_aps_voltage, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP202, /* shared constants */ - &be_const_str_get_aps_voltage, + &be_const_str_get_battery_charging_status, &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040106, // 0000 GETMET R1 R0 K6 - 0x540E007D, // 0001 LDINT R3 126 - 0x7C040400, // 0002 CALL R1 2 - 0x0804030D, // 0003 MUL R1 R1 K13 - 0x80040200, // 0004 RET 1 R1 + ( &(const binstruction[ 7]) { /* code */ + 0x8804010C, // 0000 GETMBR R1 R0 K12 + 0x8C04030D, // 0001 GETMET R1 R1 K13 + 0x880C010E, // 0002 GETMBR R3 R0 K14 + 0x58100001, // 0003 LDCONST R4 K1 + 0x58140001, // 0004 LDCONST R5 K1 + 0x7C040800, // 0005 CALL R1 4 + 0x80040200, // 0006 RET 1 R1 }) ) ); @@ -245,7 +247,7 @@ be_local_closure(class_AXP202_get_vbus_voltage, /* name */ 0x8C040106, // 0000 GETMET R1 R0 K6 0x540E0059, // 0001 LDINT R3 90 0x7C040400, // 0002 CALL R1 2 - 0x0804030E, // 0003 MUL R1 R1 K14 + 0x0804030F, // 0003 MUL R1 R1 K15 0x80040200, // 0004 RET 1 R1 }) ) @@ -254,12 +256,12 @@ be_local_closure(class_AXP202_get_vbus_voltage, /* name */ /******************************************************************** -** Solidified function: set_ldo_enable +** Solidified function: get_aps_voltage ********************************************************************/ -be_local_closure(class_AXP202_set_ldo_enable, /* name */ +be_local_closure(class_AXP202_get_aps_voltage, /* name */ be_nested_proto( - 8, /* nstack */ - 3, /* argc */ + 4, /* nstack */ + 1, /* argc */ 10, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -267,32 +269,14 @@ be_local_closure(class_AXP202_set_ldo_enable, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP202, /* shared constants */ - &be_const_str_set_ldo_enable, + &be_const_str_get_aps_voltage, &be_const_str_solidified, - ( &(const binstruction[23]) { /* code */ - 0x1C0C0302, // 0000 EQ R3 R1 K2 - 0x780E0004, // 0001 JMPF R3 #0007 - 0x8C0C010F, // 0002 GETMET R3 R0 K15 - 0x54160011, // 0003 LDINT R5 18 - 0x58180002, // 0004 LDCONST R6 K2 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x7C0C0800, // 0006 CALL R3 4 - 0x1C0C0303, // 0007 EQ R3 R1 K3 - 0x780E0004, // 0008 JMPF R3 #000E - 0x8C0C010F, // 0009 GETMET R3 R0 K15 - 0x54160011, // 000A LDINT R5 18 - 0x541A0005, // 000B LDINT R6 6 - 0x5C1C0400, // 000C MOVE R7 R2 - 0x7C0C0800, // 000D CALL R3 4 - 0x540E0003, // 000E LDINT R3 4 - 0x1C0C0203, // 000F EQ R3 R1 R3 - 0x780E0004, // 0010 JMPF R3 #0016 - 0x8C0C010F, // 0011 GETMET R3 R0 K15 - 0x54160011, // 0012 LDINT R5 18 - 0x58180003, // 0013 LDCONST R6 K3 - 0x5C1C0400, // 0014 MOVE R7 R2 - 0x7C0C0800, // 0015 CALL R3 4 - 0x80000000, // 0016 RET 0 + ( &(const binstruction[ 5]) { /* code */ + 0x8C040106, // 0000 GETMET R1 R0 K6 + 0x540E007D, // 0001 LDINT R3 126 + 0x7C040400, // 0002 CALL R1 2 + 0x08040310, // 0003 MUL R1 R1 K16 + 0x80040200, // 0004 RET 1 R1 }) ) ); @@ -316,9 +300,9 @@ be_local_closure(class_AXP202_battery_present, /* name */ &be_const_str_battery_present, &be_const_str_solidified, ( &(const binstruction[15]) { /* code */ - 0x88040110, // 0000 GETMBR R1 R0 K16 - 0x8C040311, // 0001 GETMET R1 R1 K17 - 0x880C0112, // 0002 GETMBR R3 R0 K18 + 0x8804010C, // 0000 GETMBR R1 R0 K12 + 0x8C04030D, // 0001 GETMET R1 R1 K13 + 0x880C010E, // 0002 GETMBR R3 R0 K14 0x58100001, // 0003 LDCONST R4 K1 0x58140001, // 0004 LDCONST R5 K1 0x7C040800, // 0005 CALL R1 4 @@ -395,14 +379,14 @@ be_local_closure(class_AXP202_set_dcdc_enable, /* name */ ( &(const binstruction[15]) { /* code */ 0x1C0C0302, // 0000 EQ R3 R1 K2 0x780E0004, // 0001 JMPF R3 #0007 - 0x8C0C010F, // 0002 GETMET R3 R0 K15 + 0x8C0C0111, // 0002 GETMET R3 R0 K17 0x54160011, // 0003 LDINT R5 18 0x541A0003, // 0004 LDINT R6 4 0x5C1C0400, // 0005 MOVE R7 R2 0x7C0C0800, // 0006 CALL R3 4 0x1C0C0303, // 0007 EQ R3 R1 K3 0x780E0004, // 0008 JMPF R3 #000E - 0x8C0C010F, // 0009 GETMET R3 R0 K15 + 0x8C0C0111, // 0009 GETMET R3 R0 K17 0x54160011, // 000A LDINT R5 18 0x58180001, // 000B LDCONST R6 K1 0x5C1C0400, // 000C MOVE R7 R2 @@ -459,8 +443,8 @@ be_local_closure(class_AXP202_set_chg_led_mode, /* name */ ********************************************************************/ be_local_closure(class_AXP202_init, /* name */ be_nested_proto( - 5, /* nstack */ - 1, /* argc */ + 6, /* nstack */ + 2, /* argc */ 10, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -470,16 +454,20 @@ be_local_closure(class_AXP202_init, /* name */ &be_ktab_class_AXP202, /* shared constants */ &be_const_str_init, &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x60040003, // 0000 GETGBL R1 G3 - 0x5C080000, // 0001 MOVE R2 R0 - 0xB80E2600, // 0002 GETNGBL R3 K19 - 0x7C040400, // 0003 CALL R1 2 - 0x8C040314, // 0004 GETMET R1 R1 K20 - 0x580C0015, // 0005 LDCONST R3 K21 - 0x54120034, // 0006 LDINT R4 53 - 0x7C040600, // 0007 CALL R1 3 - 0x80000000, // 0008 RET 0 + ( &(const binstruction[13]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x780A0000, // 0002 JMPF R2 #0004 + 0x54060034, // 0003 LDINT R1 53 + 0x60080003, // 0004 GETGBL R2 G3 + 0x5C0C0000, // 0005 MOVE R3 R0 + 0xB8122400, // 0006 GETNGBL R4 K18 + 0x7C080400, // 0007 CALL R2 2 + 0x8C080513, // 0008 GETMET R2 R2 K19 + 0x58100014, // 0009 LDCONST R4 K20 + 0x54160034, // 000A LDINT R5 53 + 0x7C080600, // 000B CALL R2 3 + 0x80000000, // 000C RET 0 }) ) ); @@ -503,7 +491,7 @@ be_local_closure(class_AXP202_set_exten, /* name */ &be_const_str_set_exten, &be_const_str_solidified, ( &(const binstruction[ 6]) { /* code */ - 0x8C08010F, // 0000 GETMET R2 R0 K15 + 0x8C080111, // 0000 GETMET R2 R0 K17 0x54120011, // 0001 LDINT R4 18 0x58140000, // 0002 LDCONST R5 K0 0x5C180200, // 0003 MOVE R6 R1 @@ -516,12 +504,12 @@ be_local_closure(class_AXP202_set_exten, /* name */ /******************************************************************** -** Solidified function: get_battery_chargin_status +** Solidified function: set_ldo_voltage ********************************************************************/ -be_local_closure(class_AXP202_get_battery_chargin_status, /* name */ +be_local_closure(class_AXP202_set_ldo_voltage, /* name */ be_nested_proto( - 6, /* nstack */ - 1, /* argc */ + 9, /* nstack */ + 3, /* argc */ 10, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -529,16 +517,68 @@ be_local_closure(class_AXP202_get_battery_chargin_status, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP202, /* shared constants */ - &be_const_str_get_battery_chargin_status, + &be_const_str_set_ldo_voltage, &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x88040110, // 0000 GETMBR R1 R0 K16 - 0x8C040311, // 0001 GETMET R1 R1 K17 - 0x880C0112, // 0002 GETMBR R3 R0 K18 - 0x58100001, // 0003 LDCONST R4 K1 - 0x58140001, // 0004 LDCONST R5 K1 - 0x7C040800, // 0005 CALL R1 4 - 0x80040200, // 0006 RET 1 R1 + ( &(const binstruction[59]) { /* code */ + 0x540E0CE3, // 0000 LDINT R3 3300 + 0x240C0403, // 0001 GT R3 R2 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x540A000E, // 0003 LDINT R2 15 + 0x1C0C0302, // 0004 EQ R3 R1 K2 + 0x740E0002, // 0005 JMPT R3 #0009 + 0x540E0003, // 0006 LDINT R3 4 + 0x1C0C0203, // 0007 EQ R3 R1 R3 + 0x780E0020, // 0008 JMPF R3 #002A + 0x540E0063, // 0009 LDINT R3 100 + 0x0C0C0403, // 000A DIV R3 R2 R3 + 0x54120011, // 000B LDINT R4 18 + 0x040C0604, // 000C SUB R3 R3 R4 + 0x5C080600, // 000D MOVE R2 R3 + 0x1C0C0302, // 000E EQ R3 R1 K2 + 0x780E000D, // 000F JMPF R3 #001E + 0x8C0C0104, // 0010 GETMET R3 R0 K4 + 0x54160027, // 0011 LDINT R5 40 + 0x8C180105, // 0012 GETMET R6 R0 K5 + 0x54220027, // 0013 LDINT R8 40 + 0x7C180400, // 0014 CALL R6 2 + 0x541E000E, // 0015 LDINT R7 15 + 0x2C180C07, // 0016 AND R6 R6 R7 + 0x541E000E, // 0017 LDINT R7 15 + 0x2C1C0407, // 0018 AND R7 R2 R7 + 0x54220003, // 0019 LDINT R8 4 + 0x381C0E08, // 001A SHL R7 R7 R8 + 0x30180C07, // 001B OR R6 R6 R7 + 0x7C0C0600, // 001C CALL R3 3 + 0x7002000A, // 001D JMP #0029 + 0x8C0C0104, // 001E GETMET R3 R0 K4 + 0x54160027, // 001F LDINT R5 40 + 0x8C180105, // 0020 GETMET R6 R0 K5 + 0x54220027, // 0021 LDINT R8 40 + 0x7C180400, // 0022 CALL R6 2 + 0x541E00EF, // 0023 LDINT R7 240 + 0x2C180C07, // 0024 AND R6 R6 R7 + 0x541E000E, // 0025 LDINT R7 15 + 0x2C1C0407, // 0026 AND R7 R2 R7 + 0x30180C07, // 0027 OR R6 R6 R7 + 0x7C0C0600, // 0028 CALL R3 3 + 0x7002000F, // 0029 JMP #003A + 0x540E0018, // 002A LDINT R3 25 + 0x0C0C0403, // 002B DIV R3 R2 R3 + 0x5412001B, // 002C LDINT R4 28 + 0x040C0604, // 002D SUB R3 R3 R4 + 0x5C080600, // 002E MOVE R2 R3 + 0x8C0C0104, // 002F GETMET R3 R0 K4 + 0x54160027, // 0030 LDINT R5 40 + 0x8C180105, // 0031 GETMET R6 R0 K5 + 0x54220028, // 0032 LDINT R8 41 + 0x7C180400, // 0033 CALL R6 2 + 0x541E007F, // 0034 LDINT R7 128 + 0x2C180C07, // 0035 AND R6 R6 R7 + 0x541E007E, // 0036 LDINT R7 127 + 0x2C1C0407, // 0037 AND R7 R2 R7 + 0x30180C07, // 0038 OR R6 R6 R7 + 0x7C0C0600, // 0039 CALL R3 3 + 0x80000000, // 003A RET 0 }) ) ); @@ -613,9 +653,9 @@ be_local_closure(class_AXP202_set_dc_voltage, /* name */ /******************************************************************** -** Solidified function: get_bat_charge_current +** Solidified function: get_bat_voltage ********************************************************************/ -be_local_closure(class_AXP202_get_bat_charge_current, /* name */ +be_local_closure(class_AXP202_get_bat_voltage, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -626,13 +666,13 @@ be_local_closure(class_AXP202_get_bat_charge_current, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP202, /* shared constants */ - &be_const_str_get_bat_charge_current, + &be_const_str_get_bat_voltage, &be_const_str_solidified, ( &(const binstruction[ 5]) { /* code */ - 0x8C040109, // 0000 GETMET R1 R0 K9 - 0x540E0079, // 0001 LDINT R3 122 + 0x8C040106, // 0000 GETMET R1 R0 K6 + 0x540E0077, // 0001 LDINT R3 120 0x7C040400, // 0002 CALL R1 2 - 0x0804030A, // 0003 MUL R1 R1 K10 + 0x08040315, // 0003 MUL R1 R1 K21 0x80040200, // 0004 RET 1 R1 }) ) @@ -670,11 +710,11 @@ be_local_closure(class_AXP202_get_temp, /* name */ /******************************************************************** -** Solidified function: set_ldo_voltage +** Solidified function: set_ldo_enable ********************************************************************/ -be_local_closure(class_AXP202_set_ldo_voltage, /* name */ +be_local_closure(class_AXP202_set_ldo_enable, /* name */ be_nested_proto( - 9, /* nstack */ + 8, /* nstack */ 3, /* argc */ 10, /* varg */ 0, /* has upvals */ @@ -683,68 +723,32 @@ be_local_closure(class_AXP202_set_ldo_voltage, /* name */ NULL, /* no sub protos */ 1, /* has constants */ &be_ktab_class_AXP202, /* shared constants */ - &be_const_str_set_ldo_voltage, + &be_const_str_set_ldo_enable, &be_const_str_solidified, - ( &(const binstruction[59]) { /* code */ - 0x540E0CE3, // 0000 LDINT R3 3300 - 0x240C0403, // 0001 GT R3 R2 R3 - 0x780E0000, // 0002 JMPF R3 #0004 - 0x540A000E, // 0003 LDINT R2 15 - 0x1C0C0302, // 0004 EQ R3 R1 K2 - 0x740E0002, // 0005 JMPT R3 #0009 - 0x540E0003, // 0006 LDINT R3 4 - 0x1C0C0203, // 0007 EQ R3 R1 R3 - 0x780E0020, // 0008 JMPF R3 #002A - 0x540E0063, // 0009 LDINT R3 100 - 0x0C0C0403, // 000A DIV R3 R2 R3 - 0x54120011, // 000B LDINT R4 18 - 0x040C0604, // 000C SUB R3 R3 R4 - 0x5C080600, // 000D MOVE R2 R3 - 0x1C0C0302, // 000E EQ R3 R1 K2 - 0x780E000D, // 000F JMPF R3 #001E - 0x8C0C0104, // 0010 GETMET R3 R0 K4 - 0x54160027, // 0011 LDINT R5 40 - 0x8C180105, // 0012 GETMET R6 R0 K5 - 0x54220027, // 0013 LDINT R8 40 - 0x7C180400, // 0014 CALL R6 2 - 0x541E000E, // 0015 LDINT R7 15 - 0x2C180C07, // 0016 AND R6 R6 R7 - 0x541E000E, // 0017 LDINT R7 15 - 0x2C1C0407, // 0018 AND R7 R2 R7 - 0x54220003, // 0019 LDINT R8 4 - 0x381C0E08, // 001A SHL R7 R7 R8 - 0x30180C07, // 001B OR R6 R6 R7 - 0x7C0C0600, // 001C CALL R3 3 - 0x7002000A, // 001D JMP #0029 - 0x8C0C0104, // 001E GETMET R3 R0 K4 - 0x54160027, // 001F LDINT R5 40 - 0x8C180105, // 0020 GETMET R6 R0 K5 - 0x54220027, // 0021 LDINT R8 40 - 0x7C180400, // 0022 CALL R6 2 - 0x541E00EF, // 0023 LDINT R7 240 - 0x2C180C07, // 0024 AND R6 R6 R7 - 0x541E000E, // 0025 LDINT R7 15 - 0x2C1C0407, // 0026 AND R7 R2 R7 - 0x30180C07, // 0027 OR R6 R6 R7 - 0x7C0C0600, // 0028 CALL R3 3 - 0x7002000F, // 0029 JMP #003A - 0x540E0018, // 002A LDINT R3 25 - 0x0C0C0403, // 002B DIV R3 R2 R3 - 0x5412001B, // 002C LDINT R4 28 - 0x040C0604, // 002D SUB R3 R3 R4 - 0x5C080600, // 002E MOVE R2 R3 - 0x8C0C0104, // 002F GETMET R3 R0 K4 - 0x54160027, // 0030 LDINT R5 40 - 0x8C180105, // 0031 GETMET R6 R0 K5 - 0x54220028, // 0032 LDINT R8 41 - 0x7C180400, // 0033 CALL R6 2 - 0x541E007F, // 0034 LDINT R7 128 - 0x2C180C07, // 0035 AND R6 R6 R7 - 0x541E007E, // 0036 LDINT R7 127 - 0x2C1C0407, // 0037 AND R7 R2 R7 - 0x30180C07, // 0038 OR R6 R6 R7 - 0x7C0C0600, // 0039 CALL R3 3 - 0x80000000, // 003A RET 0 + ( &(const binstruction[23]) { /* code */ + 0x1C0C0302, // 0000 EQ R3 R1 K2 + 0x780E0004, // 0001 JMPF R3 #0007 + 0x8C0C0111, // 0002 GETMET R3 R0 K17 + 0x54160011, // 0003 LDINT R5 18 + 0x58180002, // 0004 LDCONST R6 K2 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x7C0C0800, // 0006 CALL R3 4 + 0x1C0C0303, // 0007 EQ R3 R1 K3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x8C0C0111, // 0009 GETMET R3 R0 K17 + 0x54160011, // 000A LDINT R5 18 + 0x541A0005, // 000B LDINT R6 6 + 0x5C1C0400, // 000C MOVE R7 R2 + 0x7C0C0800, // 000D CALL R3 4 + 0x540E0003, // 000E LDINT R3 4 + 0x1C0C0203, // 000F EQ R3 R1 R3 + 0x780E0004, // 0010 JMPF R3 #0016 + 0x8C0C0111, // 0011 GETMET R3 R0 K17 + 0x54160011, // 0012 LDINT R5 18 + 0x58180003, // 0013 LDCONST R6 K3 + 0x5C1C0400, // 0014 MOVE R7 R2 + 0x7C0C0800, // 0015 CALL R3 4 + 0x80000000, // 0016 RET 0 }) ) ); @@ -799,9 +803,9 @@ be_local_closure(class_AXP202_get_input_power_status, /* name */ &be_const_str_get_input_power_status, &be_const_str_solidified, ( &(const binstruction[ 7]) { /* code */ - 0x88040110, // 0000 GETMBR R1 R0 K16 - 0x8C040311, // 0001 GETMET R1 R1 K17 - 0x880C0112, // 0002 GETMBR R3 R0 K18 + 0x8804010C, // 0000 GETMBR R1 R0 K12 + 0x8C04030D, // 0001 GETMET R1 R1 K13 + 0x880C010E, // 0002 GETMBR R3 R0 K14 0x58100000, // 0003 LDCONST R4 K0 0x58140001, // 0004 LDCONST R5 K1 0x7C040800, // 0005 CALL R1 4 @@ -826,20 +830,20 @@ be_local_class(AXP202, { be_const_key(get_aps_voltage, -1), be_const_closure(class_AXP202_get_aps_voltage_closure) }, { be_const_key(get_bat_current, -1), be_const_closure(class_AXP202_get_bat_current_closure) }, { be_const_key(get_bat_power, 2), be_const_closure(class_AXP202_get_bat_power_closure) }, - { be_const_key(init, -1), be_const_closure(class_AXP202_init_closure) }, + { be_const_key(get_battery_charging_status, -1), be_const_closure(class_AXP202_get_battery_charging_status_closure) }, { be_const_key(get_vbus_voltage, -1), be_const_closure(class_AXP202_get_vbus_voltage_closure) }, - { be_const_key(set_ldo_voltage, 14), be_const_closure(class_AXP202_set_ldo_voltage_closure) }, + { be_const_key(set_ldo_voltage, -1), be_const_closure(class_AXP202_set_ldo_voltage_closure) }, { be_const_key(battery_present, -1), be_const_closure(class_AXP202_battery_present_closure) }, { be_const_key(set_chg_current_ma, -1), be_const_closure(class_AXP202_set_chg_current_ma_closure) }, { be_const_key(set_dcdc_enable, -1), be_const_closure(class_AXP202_set_dcdc_enable_closure) }, - { be_const_key(set_chg_led_mode, 7), be_const_closure(class_AXP202_set_chg_led_mode_closure) }, - { be_const_key(set_ldo_enable, 5), be_const_closure(class_AXP202_set_ldo_enable_closure) }, + { be_const_key(set_chg_led_mode, 16), be_const_closure(class_AXP202_set_chg_led_mode_closure) }, + { be_const_key(init, 14), be_const_closure(class_AXP202_init_closure) }, { be_const_key(set_exten, -1), be_const_closure(class_AXP202_set_exten_closure) }, - { be_const_key(get_temp, -1), be_const_closure(class_AXP202_get_temp_closure) }, - { be_const_key(get_bat_voltage, 16), be_const_closure(class_AXP202_get_bat_voltage_closure) }, + { be_const_key(set_ldo_enable, -1), be_const_closure(class_AXP202_set_ldo_enable_closure) }, { be_const_key(get_bat_charge_current, 17), be_const_closure(class_AXP202_get_bat_charge_current_closure) }, - { be_const_key(set_dc_voltage, 18), be_const_closure(class_AXP202_set_dc_voltage_closure) }, - { be_const_key(get_battery_chargin_status, -1), be_const_closure(class_AXP202_get_battery_chargin_status_closure) }, + { be_const_key(get_temp, 7), be_const_closure(class_AXP202_get_temp_closure) }, + { be_const_key(get_bat_voltage, 18), be_const_closure(class_AXP202_get_bat_voltage_closure) }, + { be_const_key(set_dc_voltage, -1), be_const_closure(class_AXP202_set_dc_voltage_closure) }, { be_const_key(set_limiting_off, -1), be_const_closure(class_AXP202_set_limiting_off_closure) }, { be_const_key(get_input_power_status, -1), be_const_closure(class_AXP202_get_input_power_status_closure) }, })),