Hi.
I want to disable the restart function when the SHPHLD button is pressed for a long time (10 seconds).
If I understood correctly from the datasheet, the LPRESETCONFIG register (offset - 0x6) is responsible for this. To disable reset, write 0x01 to this register, but that doesn't work for me.
Program code:
#include <zephyr/drivers/i2c.h> #define SHIP 0xB00 // Base address #define LPRESETCONFIG 0x6 // Long press RESET (nPM1300) config register static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(DT_NODELABEL(npm1300_ek_pmic)); int main(void) { int ret; if (!device_is_ready(dev_i2c.bus)) { printk("I2C bus %s is not ready!\n\r",dev_i2c.bus->name); return -1; } uint8_t long_press_reset_config[2] = {SHIP + LPRESETCONFIG, 0x01}; // LP RESET (10s) disabled ret = i2c_write_dt(&dev_i2c, long_press_reset_config, sizeof(long_press_reset_config)); if(ret != 0){ printk("Failed to write to I2C device address %x at Reg. %x \n", dev_i2c.addr, long_press_reset_config[0]); return -1; } printk("Reset button disabled"); }
Please help me determine where I am making a mistake.
Thank you.