Skip to content
Rodeo

io.h

Generated from the header

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

rodeo::Io io;
io.Init(rodeo::IoConfig()
.Set(board::kIoA1, rodeo::IoMode::kAnalogIn)
.Set(board::kIoD1, rodeo::IoMode::kDigitalInPullUp)
.Set(board::kIoCv1, rodeo::IoMode::kCvOut));
float knob = io.Read(board::kIoA1); // 0..1, latest scan, never blocks
bool gate = io.Get(board::kIoD1);
io.Write(board::kIoCv1, 0.5f); // half of 3.3 V

The configuration is checked first (io_plan.h); Init() returns false and Plan() says why if it asks for something a connector can’t do. The ADC scans every analog input in the background on DMA. A Rev B connector has 1 kOhm in series with the pin and 3V3_A on its third pin, so a 10 k pot plugs straight into any analog one.

Not here yet: interrupt-driven gate inputs. When they come, A3/A6 and A7/CV1 share an interrupt line (board::SharesExti), and only one of each pair can use it.

Io

class Io

Io::Init

bool Init(const IoConfig& cfg);

Set up every connector the configuration uses. False if it can’t be done.

Io::Plan

const IoPlan& Plan() const;

Io::Get

bool Get(board::Io c);

A digital input’s level, or a digital output’s last setting.

Io::Set

void Set(board::Io c, bool high);

A digital output. Ignored on any other connector.

Io::Read

float Read(board::Io c) const;

An analog input, 0..1. 0 on any other connector.

Io::Write

void Write(board::Io c, float v);

CV out, 0..1 of 3.3 V. Ignored unless the connector is CV out.