Bergsonne Labs

Drive.P

Piezoelectric haptic driver for the Drive.P tile (rev a).

Tile Details

Embeds the Boréas Technologies BOS1921, a piezoelectric driver with integrated high-voltage boost (190 Vpp differential), waveform synthesizer, 1024-sample FIFO, and piezo sensing.

Key specifications:
  - Output:      190 Vpp differential, up to 820 nF capacitive load
  - Sensing:     7.6 mV resolution (fine), 54.5 mV (coarse)
  - Play modes:  Direct, FIFO, RAM, RAM Synth
  - Sample rate:  8 ksps – 1024 ksps (configurable)
0x44

Quick Start

Quick start

tiles_hal_core_cfg_t cfg = { .i2c = &hi2c1, .buses = TILES_BUS_I2C };
tiles_hal_t hal;
tiles_hal_core_init(&hal, &cfg);

tile_t piezo;
tile_drive_p_init(&hal, 0, &piezo);
if (tile_is_ready(&piezo)) {
    tile_drive_p_set_mode(&piezo, DRIVE_P_MODE_PLAY_FIFO);
    tile_drive_p_write_fifo(&piezo, 0x7FFF);
}

Types & Enums

drive_p_mode_t

Drive.P operating mode.

Each mode configures the CONFIG register for a specific use case. After init, the device is in IDLE mode.

ValueHexDescription
DRIVE_P_MODE_IDLE0Output disabled, status readback
DRIVE_P_MODE_SENSE_FINE1Piezo sensing, 7.6 mV/LSB resolution
DRIVE_P_MODE_SENSE_COARSE2Piezo sensing, 54.5 mV/LSB resolution
DRIVE_P_MODE_PLAY_DIRECT3Direct waveform output
DRIVE_P_MODE_PLAY_FIFO4FIFO-buffered playback, 8 ksps
DRIVE_P_MODE_PLAY_RAM_SYNTH5RAM Synthesis waveform playback

Initialization

uint8_t tile_drive_p_find(tiles_hal_t* hal, uint8_t instance);

Check whether a BOS1921 is present on the I2C bus.

Parameters
hal
Platform HAL handle
instance
Instance index (0 = default, see mapping table)
Returns

1 if device ACKs, 0 otherwise

void tile_drive_p_init(tiles_hal_t* hal, uint8_t instance, tile_t* tile);

Initialize the BOS1921 piezoelectric driver.

Wakes the device, performs a software reset, verifies the chip ID, and configures parasitic capacitance and supply parameters for a 260nF piezo on a 3.7V LiPo supply.

Parameters
hal
Platform HAL handle
instance
Instance index (0 = default, see mapping table)
tile
Pointer to tile handle (populated by this function)

Configuration

void tile_drive_p_reset(tile_t* tile);

Perform a software reset.

Parameters
tile
Pointer to tile handle
void tile_drive_p_set_mode(tile_t* tile, drive_p_mode_t mode);

Set the operating mode.

Parameters
tile
Pointer to tile handle
mode
One of the drive_p_mode_t values

Data

uint16_t tile_drive_p_read(tile_t* tile);

Read the current return register value.

Parameters
tile
Pointer to tile handle
Returns

16-bit value from the currently selected return register

int16_t tile_drive_p_read_sense(tile_t* tile);

Read the sensed piezo voltage.

Must be in SENSE_FINE or SENSE_COARSE mode.

Parameters
tile
Pointer to tile handle
Returns

Signed 16-bit sense value (−2048 to +2047)

uint16_t tile_drive_p_read_status(tile_t* tile);

Read the IC status register.

Parameters
tile
Pointer to tile handle
Returns

16-bit IC_STATUS value

void tile_drive_p_write_fifo(tile_t* tile, int16_t sample);

Write a sample to the FIFO.

Parameters
tile
Pointer to tile handle
sample
Signed 16-bit waveform sample
void tile_drive_p_write_reg(tile_t* tile, uint8_t reg, uint16_t value);

Write a raw 16-bit value to any BOS1921 register.

Parameters
tile
Pointer to tile handle
reg
8-bit register address
value
16-bit value (sent big-endian on the wire)
void tile_drive_p_wfs_write(tile_t* tile, const uint16_t* words, uint16_t count);

Write a multi-word WFS command to the BOS1921.

Parameters
tile
Pointer to tile handle
words
Array of 16-bit words (big-endian on wire)
count
Number of words (max 8)

Power Management

void tile_drive_p_sleep(tile_t* tile);

Enter low-power sleep mode.

Parameters
tile
Pointer to tile handle

Other

uint8_t tile_drive_p_check_and_recover(tile_t* tile, drive_p_mode_t restore_mode);

Check status and recover from error/fault states.

Parameters
tile
Pointer to tile handle
restore_mode
Mode to re-enter after recovery
Returns

1 if recovery was performed, 0 if device was healthy

Auto-generated from tile_drive_p.h v2.0.0 — last synced 3/26/2026