Skip to main content

nPZero Driver API

The nPZero Driver API provides a comprehensive register-level C API for interfacing with the nPZero G1S power-saving IC from Nanopower Semiconductor. It is platform-agnostic and communicates with the IC over I2C.

What the Driver Does

The nPZero G1S operates as an autonomous power management hub. It takes over control of connected sensors, manages their power, collects data, and wakes the host MCU only when needed — letting the host remain off for extended periods. The driver gives your application full control over this behaviour through a clean C API.

Key Features

  • I2C HAL — A Hardware Abstraction Layer with a reference STM32 implementation, designed to be adapted to any MCU platform.
  • Peripheral control — Autonomous management of up to 4 peripherals via I2C or SPI, with configurable polling modes, init sequences written to internal SRAM, and threshold-based wake-up.
  • ADC support — Internal (VBAT) and external (ADC_IN) ADC channels with threshold triggering.
  • Power management — Full control over host and peripheral power switches, clock sources, and operation states.
  • Status registers — Read-back of STA1/STA2 to determine the exact wake-up cause.
  • Logging — Built-in npz_log_configurations() utility for debugging.

Repository Structure

nPZero_Driver/
├── Inc/
│ ├── npz.h # Main driver API — enumerations, structs, register R/W functions
│ ├── npz_hal.h # HAL interface (I²C read/write/init)
│ ├── npz_device_control.h # High-level device control (configure, idle, reset, wake)
│ ├── npz_logs.h # Configuration logging utility
│ └── npz_registers.h # Register address definitions
└── Src/
├── npz.c # Register-level read/write implementations
├── npz_device_control.c # High-level configuration orchestration
└── npz_logs.c # Logging implementation

I2C Interface

ParameterValue
Device address (7-bit)0x3D
Shifted address (used in HAL)0x7A
Bus speed100 kbit/s
Timeout default1300 ms

Quick Navigation

SectionContents
Getting StartedInitialisation flow and first configuration
Platform PortingAdapting npz_hal.c to your MCU
API — Register MapFull IC register address table
API — HALnpz_hal_init, npz_hal_read, npz_hal_write
API — Device Controlnpz_device_configure, npz_device_go_to_idle, etc.
API — Register AccessAll low-level npz_read_* / npz_write_* functions
API — Loggingnpz_log_configurations
Data StructuresAll _s config and register structs
EnumerationsAll _e enumerations