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

View File

@@ -11,19 +11,20 @@
#include <Arduino.h>
#include <Wire.h>
// CONSTANTS DEFINITONS
#define N_KEYBOARD_ROW 4
#define N_KEYBOARD_COL 3
#define BAUDRATE 115200
#define N_KEYBOARD_ROW 4
#define N_KEYBOARD_COL 3
#define N_CV_GATES 2
#define BAUDRATE 115200
// PIN DEFENTITIONS
// I2C PINS
#define PIN_SDA 15
#define PIN_SCL 16
#define PIN_SDA 15
#define PIN_SCL 16
// KEYBOARD PINS
#define PIN_K_R0 7
#define PIN_K_R1 8
#define PIN_K_R2 9
#define PIN_K_R3 10
#define PIN_K_C0 1
#define PIN_K_C1 2
#define PIN_K_C2 4
#define PIN_K_R0 7
#define PIN_K_R1 8
#define PIN_K_R2 9
#define PIN_K_R3 10
#define PIN_K_C0 1
#define PIN_K_C1 2
#define PIN_K_C2 4
#endif