main
John Lauer software/ 1.2.1 for board 1.2.1: Pico firmware runs the board's controller contract (head DAC121C085 written and read b… 2e755c9
// SPDX-License-Identifier: MIT
// Lets the dashboard's simulator run the firmware's own control core
// (firmware/src/smi_ctl.c) with the same generated control table.
#include "smi_ctl.h"
#include "smi_controls_gen.h"

size_t smi_shim_size(void) { return sizeof(smi_ctl_t); }
uint32_t smi_shim_hash(void) { return SMI_MAP_HASH; }

void smi_shim_init(smi_ctl_t *c, void *ctx, bool (*dac)(void *, uint8_t, uint8_t, uint16_t),
                   bool (*gp)(void *, uint8_t, bool), void (*wait)(void *, uint32_t),
                   bool (*rd)(void *, uint8_t, uint16_t *), uint8_t reason, uint32_t now_us) {
    smi_hal_t hal = { .ctx = ctx, .dac_write = dac, .wait_us = wait, .dac_read = rd, .gpio_put = gp };
    smi_ctl_init(c, smi_controls, SMI_NUM_CONTROLS, &smi_isense, SMI_MAP_HASH, SMI_MAP_VERSION,
                 SMI_LASER_EN_GPIO, SMI_LASER_EN_ACTIVE_HIGH, &hal, reason, now_us);
}