Refactored for teensy 4.0, xEvi hardware

- Switched to platformio, ino -> cpp
- MPRLS for pressure sensor
- Added basic ICM support
- Removed widi, battery, other features not supported in xEvi
- Removed legacy options/processing
- Added LED strip support
- Added encoder support
- Reworked menu code to use encoders/be more flexible
This commit is contained in:
Brian Hrebec 2023-08-27 11:52:08 -05:00
parent c58c3f9e46
commit 01d193c9b3
92 changed files with 69119 additions and 73272 deletions

96
NuEVI/src/hardware.h Normal file
View file

@ -0,0 +1,96 @@
#ifndef __HARDWARE_H
#define __HARDWARE_H
#include <Adafruit_MPR121.h>
#include <Adafruit_MPRLS.h>
#include <Adafruit_ICM20X.h>
#include <WS2812Serial.h>
#include <Adafruit_ICM20948.h>
#include <stdint.h>
// Hardware sensor definitions
// TODO: remove these
extern WS2812Serial ledStrip;
extern Adafruit_Sensor *accelSensor;
extern Adafruit_ICM20948 icmSensor;
void initHardware();
bool checkButtonState(uint8_t mask); // return true if the given buttons are pressed
uint8_t buttonState(); // return true if the given buttons are pressed
int readKnob(uint8_t n);
int readTouchKey(uint8_t n);
int readTouchUtil(uint8_t n);
uint16_t keysTouched();
uint16_t utilTouched();
int readPressure();
int readAltPressure();
// xEVI hardware setup
// I2C
#define MainI2CBus Wire1
#define AuxI2CBus Wire
#define KeysI2CAddr 0x5B
#define UtilI2CAddr 0x5A
// Digital pins for encoder buttons
#define b1Pin 0
#define b2Pin 2
#define b3Pin 3
#define b4Pin 4
// Digital pins for encoder quadrature
#define e1aPin 5
#define e2aPin 6
#define e3aPin 7
#define e4aPin 8
#define e1bPin 20
#define e2bPin 21
#define e3bPin 22
#define e4bPin 23
// CV pins
#define cvGatePin 9
#define cvPitchPin 10
#define cvBreathPin 11
#define cvBitePin 12
//Output pins for LEDs
#define statusLedPin 13
#define ledStripPin 1
#define numLeds 8
// Key pins
// RH keys
#define K1Pin 0
#define K2Pin 1
#define K3Pin 2
#define K4Pin 3
#define K5Pin 4
#define K6Pin 5
#define K7Pin 6
#define K8Pin 7
// LH keys
#define K9Pin 8
#define K10Pin 9
#define K11Pin 10
#define K12Pin 11
// Octave roller pins
#define R1Pin 0
#define R2Pin 1
#define R3Pin 2
#define R4Pin 3
#define R5Pin 4
#define R6Pin 5
// Additional pins
#define bitePin 6
#define pbUpPin 7
#define pbDnPin 8
#define vibratoPin 9
#endif