Skip to content

File desktop_devkit.h

File List > external-docs > libDaisy > src > desktop_devkit.h

Go to the documentation of this file

Source Code

#pragma once
#include "daisy_seed.h"

namespace daisy::desktop_devkit
{
constexpr size_t kNumPots = 8;
constexpr size_t kNumCVs = 2;
constexpr size_t kNumGateIns = 2;
constexpr size_t kNumButtons = 16;
constexpr size_t kNumLeds = 16;

class Hardware
{
  public:
    Hardware() {}

    using LedDriver = LedDriverPca9685<1, true>;
    using ButtonSr  = ShiftRegister4021<2, 1>;

    DaisySeed       seed;
    Switch          tog_sw17;
    Switch3         tog_sw18;
    ButtonSr        button_sr;
    GateIn          gate_in[kNumGateIns];
    AnalogControl   pot[kNumPots], cv[kNumCVs];
    DigitalControl  button[kNumButtons];
    MidiUartHandler midi;
    LedDriver       led_driver;
    TimerHandle     tim5_handle;
    // Plug Detection
    Switch sd_detect, left_detect, right_detect;

    void Init();

    void UpdateAllControls();

    void SetDacOut(DacHandle::Channel channel, uint16_t code);

    void ClearLeds();

    void UpdateLeds();

    void SetLed(int idx, float brightness);

    void StartLowPriorityCallback(TimerHandle::PeriodElapsedCallback cb,
                                  uint32_t target_freq,
                                  void*    data = nullptr);

    void StopLowPriorityCallback();
};

} // namespace daisy::desktop_devkit