hardware_manager module

Hardware Abstraction Layer for Circuit Playground Bluefruit.

This module provides a simplified interface to Circuit Playground hardware, abstracting NeoPixel control, audio output, and sensor access for UFO routines.

The hardware manager handles:
  • NeoPixel LED ring control and brightness management

  • Tone generation via piezo speaker

  • Hardware abstraction to simplify routine implementations

  • Battery-conscious default brightness settings

Classes:

HardwareManager: Hardware abstraction for Circuit Playground

Example

>>> hardware = HardwareManager()
>>> hardware.update_pixels_with_data(data, color_function)
>>> hardware.play_tone_if_enabled(440, 0.2, volume=1)
Author:

Charles Doebler at Feral Cat AI

Dependencies:
  • adafruit_circuitplayground

  • simpleio

class hardware_manager.HardwareManager

Bases: object

clear_pixels()

Clear all pixels.

static get_accelerometer()

Get accelerometer data from the Circuit Playground.

property light

Get the current light sensor reading.

static map_deltas_to_pixels(deltas)

Map audio deltas to pixel positions.

static play_tone_if_enabled(freq, duration, volume)

Play tone if volume is enabled.

static shake_detected(threshold=11)

Check if a shake has been detected.

static tap_detected()

Check if a tap has been detected.

property temperature

Get the current temperature reading.

update_pixels_with_data(pixel_data, color_func)

Update pixels based on data array and color function.