nvs

package
v0.0.0-...-dbfeb7d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package nvs generates ESP-IDF NVS partition images in pure Go — a replacement for nvs_partition_gen.py. See FORMAT.md for the byte-exact spec it implements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Partition

type Partition struct {
	// contains filtered or unexported fields
}

Partition accumulates entries and renders a fixed-size NVS image.

func New

func New(size int) (*Partition, error)

New creates an empty partition of the given byte size (multiple of 4096, min 0x3000).

func (*Partition) Bytes

func (p *Partition) Bytes() ([]byte, error)

Bytes renders the partition image: data pages followed by erased (0xFF) pages, with one trailing page reserved (as the generator does).

func (*Partition) SetBlob

func (p *Partition) SetBlob(ns, key string, data []byte) error

SetBlob stores a binary blob. The blob must fit within a single page (no cross-page chunking yet) — ample for keys/certs; large blobs return an error.

func (*Partition) SetI8

func (p *Partition) SetI8(ns, key string, v int8) error

func (*Partition) SetI16

func (p *Partition) SetI16(ns, key string, v int16) error

func (*Partition) SetI32

func (p *Partition) SetI32(ns, key string, v int32) error

func (*Partition) SetI64

func (p *Partition) SetI64(ns, key string, v int64) error

func (*Partition) SetString

func (p *Partition) SetString(ns, key, val string) error

SetString stores a NUL-terminated string (NVS appends the NUL).

func (*Partition) SetU8

func (p *Partition) SetU8(ns, key string, v uint8) error

Typed setters.

func (*Partition) SetU16

func (p *Partition) SetU16(ns, key string, v uint16) error

func (*Partition) SetU32

func (p *Partition) SetU32(ns, key string, v uint32) error

func (*Partition) SetU64

func (p *Partition) SetU64(ns, key string, v uint64) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL