Zephyr API 3.6.99
Loading...
Searching...
No Matches

Enumerations

enum  mfd_npm1300_event_t {
  NPM1300_EVENT_CHG_COMPLETED , NPM1300_EVENT_CHG_ERROR , NPM1300_EVENT_BATTERY_DETECTED , NPM1300_EVENT_BATTERY_REMOVED ,
  NPM1300_EVENT_SHIPHOLD_PRESS , NPM1300_EVENT_SHIPHOLD_RELEASE , NPM1300_EVENT_WATCHDOG_WARN , NPM1300_EVENT_VBUS_DETECTED ,
  NPM1300_EVENT_VBUS_REMOVED , NPM1300_EVENT_GPIO0_EDGE , NPM1300_EVENT_GPIO1_EDGE , NPM1300_EVENT_GPIO2_EDGE ,
  NPM1300_EVENT_GPIO3_EDGE , NPM1300_EVENT_GPIO4_EDGE , NPM1300_EVENT_MAX
}
 

Functions

int mfd_npm1300_reg_read_burst (const struct device *dev, uint8_t base, uint8_t offset, void *data, size_t len)
 Read multiple registers from npm1300.
 
int mfd_npm1300_reg_read (const struct device *dev, uint8_t base, uint8_t offset, uint8_t *data)
 Read single register from npm1300.
 
int mfd_npm1300_reg_write (const struct device *dev, uint8_t base, uint8_t offset, uint8_t data)
 Write single register to npm1300.
 
int mfd_npm1300_reg_write2 (const struct device *dev, uint8_t base, uint8_t offset, uint8_t data1, uint8_t data2)
 Write two registers to npm1300.
 
int mfd_npm1300_reg_update (const struct device *dev, uint8_t base, uint8_t offset, uint8_t data, uint8_t mask)
 Update selected bits in npm1300 register.
 
int mfd_npm1300_set_timer (const struct device *dev, uint32_t time_ms)
 Write npm1300 timer register.
 
int mfd_npm1300_reset (const struct device *dev)
 npm1300 full power reset
 
int mfd_npm1300_hibernate (const struct device *dev, uint32_t time_ms)
 npm1300 hibernate
 
int mfd_npm1300_add_callback (const struct device *dev, struct gpio_callback *callback)
 Add npm1300 event callback.
 
int mfd_npm1300_remove_callback (const struct device *dev, struct gpio_callback *callback)
 Remove npm1300 event callback.
 

Detailed Description

Enumeration Type Documentation

◆ mfd_npm1300_event_t

#include <zephyr/drivers/mfd/npm1300.h>

Enumerator
NPM1300_EVENT_CHG_COMPLETED 
NPM1300_EVENT_CHG_ERROR 
NPM1300_EVENT_BATTERY_DETECTED 
NPM1300_EVENT_BATTERY_REMOVED 
NPM1300_EVENT_SHIPHOLD_PRESS 
NPM1300_EVENT_SHIPHOLD_RELEASE 
NPM1300_EVENT_WATCHDOG_WARN 
NPM1300_EVENT_VBUS_DETECTED 
NPM1300_EVENT_VBUS_REMOVED 
NPM1300_EVENT_GPIO0_EDGE 
NPM1300_EVENT_GPIO1_EDGE 
NPM1300_EVENT_GPIO2_EDGE 
NPM1300_EVENT_GPIO3_EDGE 
NPM1300_EVENT_GPIO4_EDGE 
NPM1300_EVENT_MAX 

Function Documentation

◆ mfd_npm1300_add_callback()

int mfd_npm1300_add_callback ( const struct device * dev,
struct gpio_callback * callback )

#include <zephyr/drivers/mfd/npm1300.h>

Add npm1300 event callback.

Parameters
devnpm1300 mfd device
callbackcallback
Returns
0 on success, -errno on failure

◆ mfd_npm1300_hibernate()

int mfd_npm1300_hibernate ( const struct device * dev,
uint32_t time_ms )

#include <zephyr/drivers/mfd/npm1300.h>

npm1300 hibernate

Enters low power state, and wakes after specified time

Parameters
devnpm1300 mfd device
time_mstimer value in ms
Return values
0If successful
-EINVALif time value is too large
-errnoIn case of any bus error (see i2c_write_dt())

◆ mfd_npm1300_reg_read()

int mfd_npm1300_reg_read ( const struct device * dev,
uint8_t base,
uint8_t offset,
uint8_t * data )

#include <zephyr/drivers/mfd/npm1300.h>

Read single register from npm1300.

Parameters
devnpm1300 mfd device
baseRegister base address (bits 15..8 of 16-bit address)
offsetRegister offset address (bits 7..0 of 16-bit address)
dataPointer to buffer for received data
Return values
0If successful
-errnoIn case of any bus error (see i2c_write_read_dt())

◆ mfd_npm1300_reg_read_burst()

int mfd_npm1300_reg_read_burst ( const struct device * dev,
uint8_t base,
uint8_t offset,
void * data,
size_t len )

#include <zephyr/drivers/mfd/npm1300.h>

Read multiple registers from npm1300.

Parameters
devnpm1300 mfd device
baseRegister base address (bits 15..8 of 16-bit address)
offsetRegister offset address (bits 7..0 of 16-bit address)
dataPointer to buffer for received data
lenNumber of bytes to read
Return values
0If successful
-errnoIn case of any bus error (see i2c_write_read_dt())

◆ mfd_npm1300_reg_update()

int mfd_npm1300_reg_update ( const struct device * dev,
uint8_t base,
uint8_t offset,
uint8_t data,
uint8_t mask )

#include <zephyr/drivers/mfd/npm1300.h>

Update selected bits in npm1300 register.

Parameters
devnpm1300 mfd device
baseRegister base address (bits 15..8 of 16-bit address)
offsetRegister offset address (bits 7..0 of 16-bit address)
datadata to write
maskmask of bits to be modified
Return values
0If successful
-errnoIn case of any bus error (see i2c_write_read_dt(), i2c_write_dt())

◆ mfd_npm1300_reg_write()

int mfd_npm1300_reg_write ( const struct device * dev,
uint8_t base,
uint8_t offset,
uint8_t data )

#include <zephyr/drivers/mfd/npm1300.h>

Write single register to npm1300.

Parameters
devnpm1300 mfd device
baseRegister base address (bits 15..8 of 16-bit address)
offsetRegister offset address (bits 7..0 of 16-bit address)
datadata to write
Return values
0If successful
-errnoIn case of any bus error (see i2c_write_dt())

◆ mfd_npm1300_reg_write2()

int mfd_npm1300_reg_write2 ( const struct device * dev,
uint8_t base,
uint8_t offset,
uint8_t data1,
uint8_t data2 )

#include <zephyr/drivers/mfd/npm1300.h>

Write two registers to npm1300.

Parameters
devnpm1300 mfd device
baseRegister base address (bits 15..8 of 16-bit address)
offsetRegister offset address (bits 7..0 of 16-bit address)
data1first byte of data to write
data2second byte of data to write
Return values
0If successful
-errnoIn case of any bus error (see i2c_write_dt())

◆ mfd_npm1300_remove_callback()

int mfd_npm1300_remove_callback ( const struct device * dev,
struct gpio_callback * callback )

#include <zephyr/drivers/mfd/npm1300.h>

Remove npm1300 event callback.

Parameters
devnpm1300 mfd device
callbackcallback
Returns
0 on success, -errno on failure

◆ mfd_npm1300_reset()

int mfd_npm1300_reset ( const struct device * dev)

#include <zephyr/drivers/mfd/npm1300.h>

npm1300 full power reset

Parameters
devnpm1300 mfd device
Return values
0If successful
-errnoIn case of any bus error (see i2c_write_dt())

◆ mfd_npm1300_set_timer()

int mfd_npm1300_set_timer ( const struct device * dev,
uint32_t time_ms )

#include <zephyr/drivers/mfd/npm1300.h>

Write npm1300 timer register.

Parameters
devnpm1300 mfd device
time_mstimer value in ms
Return values
0If successful
-EINVALif time value is too large
-errnoIn case of any bus error (see i2c_write_dt())