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
| Parameter | Value |
|---|---|
| Device address (7-bit) | 0x3D |
| Shifted address (used in HAL) | 0x7A |
| Bus speed | 100 kbit/s |
| Timeout default | 1300 ms |
Quick Navigation
| Section | Contents |
|---|---|
| Getting Started | Initialisation flow and first configuration |
| Platform Porting | Adapting npz_hal.c to your MCU |
| API — Register Map | Full IC register address table |
| API — HAL | npz_hal_init, npz_hal_read, npz_hal_write |
| API — Device Control | npz_device_configure, npz_device_go_to_idle, etc. |
| API — Register Access | All low-level npz_read_* / npz_write_* functions |
| API — Logging | npz_log_configurations |
| Data Structures | All _s config and register structs |
| Enumerations | All _e enumerations |