Pi HAT ID EEPROM library

The Raspberry Pi HAT specification defines the existence of an ID EEPROM that is connected to pins 27 and 28 of the 40-way connector. This ID EEPROM contains a machine-readable description of the HAT hardware in a form that allows the Pi to automatically configure the GPIOs and load appropriate device drivers.

The pihat library provides a mechanism for easily extracting and manipulating the contents of the ID EEPROM. For example:

from pihat.eeprom import EepromDevice

with EepromDevice() as eeprom:
    print("Board UUID is %s" % eeprom.uuid)
    print("Board uses %d GPIOs" %
          sum(x.used for x in eeprom.pins))

Indices and tables