Skip to content
Rodeo

io_plan.h

Generated from the header

This page is rodeo-sdk/common/io_plan.h — its comments and declarations. To change it, change the header.

An app says what each of the ten connectors is for; PlanIo() checks it against what the hardware can do (analog only where there is an ADC channel, CV out only on the two DAC pins) and works out the order the ADC scans in. A wrong configuration fails here, by silkscreen name, instead of as a pin that reads nothing. Pure logic: host-tested in common/tests/io_plan_gtest.cpp, used by io.h on the Seed.

IoMode

enum class IoMode : uint8_t
  • kUnused
  • kDigitalIn
  • kDigitalInPullUp
  • kDigitalInPullDown
  • kDigitalOut
  • kAnalogIn — through the Seed’s ADC: A1-A7, CV1, CV2
  • kCvOut — the Seed’s DAC, 0-3.3 V: CV1, CV2

IoConfig

struct IoConfig

What each connector is for, indexed by board::Io.

Members

  • IoMode mode[board::kNumIo] = {}

IoConfig::Set

IoConfig& Set(board::Io c, IoMode m);

IoPlan

struct IoPlan

A checked configuration, ready for the hardware.

Members

  • bool ok
  • int8_t bad — the connector that failed (board::Io), or -1
  • const char* why — what’s wrong with it
  • uint8_t n_adc — analog inputs, in scan order
  • uint8_t adc_conn[board::kNumIo] — connector for each scan position
  • int8_t adc_index[board::kNumIo] — scan position for each connector, or -1
  • bool dac1 — DAC channels in use
  • bool dac1, dac2 — DAC channels in use

PlanIo

inline IoPlan PlanIo(const IoConfig& cfg);

DacCode

inline uint16_t DacCode(float v);

0..1 to the DAC’s 12-bit code, clamped and rounded.