Cleaned up Schematics

This commit is contained in:
2026-03-18 11:01:39 +01:00
parent f0c2168e2b
commit a24b15c27b
493 changed files with 3025728 additions and 3024156 deletions

View File

@@ -1,161 +1,161 @@
/*
@file: FIRMARE.h
@author: Erik Tóth
@contact: etoth@tsn.at
@date: 2025-10-26
@updated: 2025-12-06
@brief: Header for FIRMWARE.cpp (FIXED VERSION)
*/
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_MCP4728.h>
#ifndef FIRMWARE_H
#define FIRMWARE_H
#define N_MAX_QUEUE 10
#define N_MAX_ROWS 8
#define N_MAX_COLS 8
#define MS_DEBOUNCE 20
#define N_MAX_DAC_CH 4
struct Key
{
int row;
int col;
};
struct DualVoltageDurationPair
{
uint16_t voltage_ch1;
uint16_t voltage_ch2;
uint16_t duration;
bool active; // NEU: true wenn Step aktive Noten hat, false für Pausen
};
const Key NOT_A_KEY = {-1, -1};
bool isNotKey(Key k);
bool isEqualKey(Key k1, Key k2);
class Keyboard
{
public:
Keyboard(uint8_t nRows, uint8_t nCols, uint8_t *pinsRow, uint8_t *pinsCol);
void begin();
void update();
int getQueueLength();
Key getQueue(uint8_t index);
private:
uint8_t _nRows;
uint8_t _nCols;
uint8_t *_pinsRow;
uint8_t *_pinsCol;
bool _keyState[N_MAX_COLS][N_MAX_ROWS];
bool _keyStateLatest[N_MAX_COLS][N_MAX_ROWS];
unsigned long _lastChangeTime[N_MAX_COLS][N_MAX_ROWS];
Key _activeKeys[N_MAX_QUEUE];
uint8_t _nActiveKeys;
uint8_t _nSticky;
void _addActiveKey(uint8_t row, uint8_t col);
void _removeActiveKey(uint8_t row, uint8_t col);
bool _inQueue(uint8_t row, uint8_t col);
bool _inQueue(Key k);
bool _isNotKey(Key k);
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);
};
class SequencerBlock
{
public:
SequencerBlock(uint16_t maxDurationMS, uint16_t maxStepCount);
// Aufnahme-Funktionen
void startRecord();
void stopRecord();
void addStep(uint16_t voltage_ch1, uint16_t voltage_ch2);
bool isRecording();
// Wiedergabe-Funktionen
void startPlay();
void stopPlay();
void update();
bool isPlaying();
// Sequenz-Verwaltung
void clear();
void setLoop(bool loop);
// Status-Abfragen
bool timeLimitReached();
bool stepLimitReached();
uint16_t getStepCount();
uint16_t getCurrentVoltageCh1();
uint16_t getCurrentVoltageCh2();
bool isCurrentStepActive(); // NEU: Prüft ob aktueller Step aktive Noten hat
uint16_t getTotalDuration();
private:
/*!
* @brief Memory limiting
* @return (uint16_t) 1024
* @attention Increasing the value might lead to an overflow
* @note sizeOf(DualVoltageDurationPair) = 8 Byte ==> 8 Byte * 1024 = 8192 Byte
*/
const static uint16_t _MAX_SEQUENCE_STEPS = 1024;
// Sequenz memory
DualVoltageDurationPair _sequence[_MAX_SEQUENCE_STEPS];
uint16_t _stepCount;
uint16_t _currentStep;
// Time management
uint16_t _maxDurationMS;
uint16_t _maxStepCount;
unsigned long _recordStartTime;
unsigned long _lastStepTime;
unsigned long _playStartTime;
unsigned long _stepStartTime;
unsigned long _lastAddStepTime; // NEU: Rate-Limiting
// Status flags
bool _isRecording;
bool _isPlaying;
bool _loop;
// Last recorded Voltage: at n-th step minus one
uint16_t _lastVoltageCh1;
uint16_t _lastVoltageCh2;
// helper functions
void _finishCurrentStep();
bool _canAddStep();
};
/*
@file: FIRMARE.h
@author: Erik Tóth
@contact: etoth@tsn.at
@date: 2025-10-26
@updated: 2025-12-06
@brief: Header for FIRMWARE.cpp (FIXED VERSION)
*/
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_MCP4728.h>
#ifndef FIRMWARE_H
#define FIRMWARE_H
#define N_MAX_QUEUE 10
#define N_MAX_ROWS 8
#define N_MAX_COLS 8
#define MS_DEBOUNCE 20
#define N_MAX_DAC_CH 4
struct Key
{
int row;
int col;
};
struct DualVoltageDurationPair
{
uint16_t voltage_ch1;
uint16_t voltage_ch2;
uint16_t duration;
bool active; // NEU: true wenn Step aktive Noten hat, false für Pausen
};
const Key NOT_A_KEY = {-1, -1};
bool isNotKey(Key k);
bool isEqualKey(Key k1, Key k2);
class Keyboard
{
public:
Keyboard(uint8_t nRows, uint8_t nCols, uint8_t *pinsRow, uint8_t *pinsCol);
void begin();
void update();
int getQueueLength();
Key getQueue(uint8_t index);
private:
uint8_t _nRows;
uint8_t _nCols;
uint8_t *_pinsRow;
uint8_t *_pinsCol;
bool _keyState[N_MAX_COLS][N_MAX_ROWS];
bool _keyStateLatest[N_MAX_COLS][N_MAX_ROWS];
unsigned long _lastChangeTime[N_MAX_COLS][N_MAX_ROWS];
Key _activeKeys[N_MAX_QUEUE];
uint8_t _nActiveKeys;
uint8_t _nSticky;
void _addActiveKey(uint8_t row, uint8_t col);
void _removeActiveKey(uint8_t row, uint8_t col);
bool _inQueue(uint8_t row, uint8_t col);
bool _inQueue(Key k);
bool _isNotKey(Key k);
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);
};
class SequencerBlock
{
public:
SequencerBlock(uint16_t maxDurationMS, uint16_t maxStepCount);
// Aufnahme-Funktionen
void startRecord();
void stopRecord();
void addStep(uint16_t voltage_ch1, uint16_t voltage_ch2);
bool isRecording();
// Wiedergabe-Funktionen
void startPlay();
void stopPlay();
void update();
bool isPlaying();
// Sequenz-Verwaltung
void clear();
void setLoop(bool loop);
// Status-Abfragen
bool timeLimitReached();
bool stepLimitReached();
uint16_t getStepCount();
uint16_t getCurrentVoltageCh1();
uint16_t getCurrentVoltageCh2();
bool isCurrentStepActive(); // NEU: Prüft ob aktueller Step aktive Noten hat
uint16_t getTotalDuration();
private:
/*!
* @brief Memory limiting
* @return (uint16_t) 1024
* @attention Increasing the value might lead to an overflow
* @note sizeOf(DualVoltageDurationPair) = 8 Byte ==> 8 Byte * 1024 = 8192 Byte
*/
const static uint16_t _MAX_SEQUENCE_STEPS = 1024;
// Sequenz memory
DualVoltageDurationPair _sequence[_MAX_SEQUENCE_STEPS];
uint16_t _stepCount;
uint16_t _currentStep;
// Time management
uint16_t _maxDurationMS;
uint16_t _maxStepCount;
unsigned long _recordStartTime;
unsigned long _lastStepTime;
unsigned long _playStartTime;
unsigned long _stepStartTime;
unsigned long _lastAddStepTime; // NEU: Rate-Limiting
// Status flags
bool _isRecording;
bool _isPlaying;
bool _loop;
// Last recorded Voltage: at n-th step minus one
uint16_t _lastVoltageCh1;
uint16_t _lastVoltageCh2;
// helper functions
void _finishCurrentStep();
bool _canAddStep();
};
#endif

View File

@@ -1,49 +1,49 @@
/*
@file: FIRMARE_DEF.h
@author: Erik Tóth
@contact: etoth@tsn.at
@date: 2025-10-26
@updated: 2026-03-08
@brief: Header for constant definitions
*/
#ifndef FIRMWARE_DEF_H
#define FIRMWARE_DEF_H
#include <Arduino.h>
#include <Wire.h>
// CONSTANTS DEFINITONS
#define N_KEYBOARD_ROW 5
#define N_KEYBOARD_COL 5
#define N_CV_GATES 2
#define N_SB 2
#define BAUDRATE 115200
#define N_MAX_SEQ_STEPS 512
// PIN DEFENTITIONS
// I2C PINS
#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_R4 11
#define PIN_K_C0 1
#define PIN_K_C1 2
#define PIN_K_C2 4
#define PIN_K_C3 5
#define PIN_K_C4 6
// SEQUENCER BUTTON PINS
#define PIN_SB_1_REC 33
#define PIN_SB_1_PLAY 34
#define PIN_SB_2_REC 35
#define PIN_SB_2_PLAY 36
// MISC/INFO PINS
#define PIN_VCO1_EN 38
#define PIN_VCO2_EN 39
#define PIN_REC 37
#define PIN_BPM 12
#define PIN_B_METRONOME 14
#define PIN_L_METRONOME 13
/*
@file: FIRMARE_DEF.h
@author: Erik Tóth
@contact: etoth@tsn.at
@date: 2025-10-26
@updated: 2026-03-08
@brief: Header for constant definitions
*/
#ifndef FIRMWARE_DEF_H
#define FIRMWARE_DEF_H
#include <Arduino.h>
#include <Wire.h>
// CONSTANTS DEFINITONS
#define N_KEYBOARD_ROW 5
#define N_KEYBOARD_COL 5
#define N_CV_GATES 2
#define N_SB 2
#define BAUDRATE 115200
#define N_MAX_SEQ_STEPS 512
// PIN DEFENTITIONS
// I2C PINS
#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_R4 11
#define PIN_K_C0 1
#define PIN_K_C1 2
#define PIN_K_C2 4
#define PIN_K_C3 5
#define PIN_K_C4 6
// SEQUENCER BUTTON PINS
#define PIN_SB_1_REC 33
#define PIN_SB_1_PLAY 34
#define PIN_SB_2_REC 35
#define PIN_SB_2_PLAY 36
// MISC/INFO PINS
#define PIN_VCO1_EN 38
#define PIN_VCO2_EN 39
#define PIN_REC 37
#define PIN_BPM 12
#define PIN_B_METRONOME 14
#define PIN_L_METRONOME 13
#endif

View File

@@ -1,37 +1,37 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the convention is to give header files names that end with `.h'.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the convention is to give header files names that end with `.h'.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html