Software Upload 2

Firmware-Header ist fertig und kann nun zur Implementation zur DA verwendet werden. Anbei ist ein Beispiel der Verwendung!
This commit is contained in:
Erik Tóth
2025-10-31 15:37:57 +01:00
parent 64c6bfd271
commit 54d8f104f4
4 changed files with 129 additions and 28 deletions

View File

@@ -17,6 +17,8 @@
#define N_MAX_COLS 8
#define MS_DEBOUNCE 20
#define N_MAX_DAC_CH 4
struct Key
{
int row;
@@ -59,4 +61,26 @@ class Keyboard
bool _isEqualKey(Key k1, Key k2);
};
class CV
{
public:
CV(Adafruit_MCP4728 *dac, TwoWire *wire, uint8_t nCV, MCP4728_channel_t *cvChannelMap, uint16_t *keyToVoltage, uint8_t row, uint8_t col);
bool begin(uint8_t pinSDA, uint8_t pinSCL);
void setVoltage(uint8_t cvIndex, Key k);
void setVoltage(uint8_t cvIndex, uint16_t mV);
void clearAll();
private:
Adafruit_MCP4728 *_dac;
TwoWire *_wire;
uint8_t _nCV;
uint8_t _row;
uint8_t _col;
MCP4728_channel_t _cvChannelMap[N_MAX_DAC_CH];
uint16_t *_keyToVoltage;
uint8_t _getKeyToVoltageIndex(uint8_t row, uint8_t col);
uint8_t _getKeyToVoltageIndex(Key k);
};
#endif