Skip to main content

Module sim

Module sim 

Source
Expand description

A PCA9685 that is not there.

part holds the power-on registers of the datasheet’s Table 4 and keeps the rules its register descriptions set out, so a driver’s mistakes show up in what the part holds:

  • a write to PRE_SCALE is blocked while MODE1’s SLEEP bit is clear, and never loads less than PRE_SCALE_MIN;
  • the register pointer moves on only while MODE1’s auto-increment bit is set, wrapping from LED15_OFF_H and from PRE_SCALE to MODE1;
  • a write to the ALL_LED registers loads that byte into every channel, and the ALL_LED registers read back as zero;
  • writing a logic 1 to RESTART clears it, sleeping with a channel still running sets it, and loading a channel clears it again; EXTCLK, once set, stays set;
  • reserved bits read zero, and reserved registers take no writes.

The general-call software reset goes to address 0x00, which no simulated part holds.

Constants§

RULES
The PCA9685’s rules for writes, reads, and its register pointer.

Functions§

part
A PCA9685 at an address, as it powers up: asleep at 200 Hz with every output off.