Add board (WIP), fix firmware
This commit is contained in:
1 parent
32b08bf8ca
commit
1c7df22778
12 files changed
+118957
No files matched your search
@@ -0,0 +1,141 @@
|
||||
|
||||
// include libraries
|
||||
#include <Adafruit_MCP23X17.h>
|
||||
#include <MIDI.h>
|
||||
|
||||
// Instantiate libraries
|
||||
Adafruit_MCP23X17 mcp1; // First MCP23017
|
||||
Adafruit_MCP23X17 mcp2; // Second MCP23017
|
||||
// Default hardware MIDI. SoftwareSerial is too slow...
|
||||
MIDI_CREATE_DEFAULT_INSTANCE();
|
||||
// A7 A6 A5 A4 A3 A2 A1 A0 <-- GPIO A
|
||||
// MCP pins 28 27 26 25 24 23 22 21 20 19 18 17 16 15
|
||||
// 8 = pin 1 ╔══════════════════════════════════════════╗
|
||||
// 9 = pin 2 ╠ MCP23017 ║
|
||||
// 10 = pin 3 ╚══════════════════════════════════════════╝
|
||||
// 01 02 03 04 05 06 07 08 9 10 11 12 13 14
|
||||
// B0 B1 B2 B3 B4 B5 B6 B7 <-- GPIO B
|
||||
|
||||
// Default MIDI channel
|
||||
byte currentMidiChannel = 8; // Default MIDI channel
|
||||
|
||||
// Struct for 2 MCP chips.
|
||||
struct MCPOutput {
|
||||
uint8_t chip; // 0 = mcp1, 1 = mcp2
|
||||
uint8_t pin; // 0–15
|
||||
};
|
||||
|
||||
// LED shows MIDI activity
|
||||
unsigned long ledOnTime = 0;
|
||||
bool ledActive = false;
|
||||
const unsigned long ledDuration = 50; // flash for 50ms
|
||||
|
||||
// Note to pin mapping. {chip, pin}
|
||||
// One would be able to add up to 8 MCPs, but 2 is plenty for a Meowsic.
|
||||
MCPOutput noteToMCP[32] = {
|
||||
// MCP1 – MIDI 57 to 72
|
||||
{0, 0}, // 57 A3
|
||||
{0, 1}, // 58 A#3
|
||||
{0, 2}, // 59 B3
|
||||
{0, 3}, // 60 C4
|
||||
{0, 4}, // 61 C#4
|
||||
{0, 5}, // 62 D4
|
||||
{0, 6}, // 63 D#4
|
||||
{0, 7}, // 64 E4
|
||||
{0, 8}, // 65 F4
|
||||
{0, 9}, // 66 F#4
|
||||
{0, 10}, // 67 G4
|
||||
{0, 11}, // 68 G#4
|
||||
{0, 12}, // 69 A4
|
||||
{0, 13}, // 70 A#4
|
||||
{0, 14}, // 71 B4
|
||||
{0, 15}, // 72 C5
|
||||
|
||||
// MCP2 – MIDI 73 to 88
|
||||
{1, 0}, // 73 C#5
|
||||
{1, 1}, // 74 D5
|
||||
{1, 2}, // 75 D#5
|
||||
{1, 3}, // 76 E5
|
||||
{1, 4}, // 77 F5
|
||||
{1, 5}, // 78 F#5
|
||||
{1, 6}, // 79 G5
|
||||
{1, 7}, // 80 G#5
|
||||
{1, 8}, // 81 A5
|
||||
{1, 9}, // 82 A#5
|
||||
{1, 10}, // 83 B5
|
||||
{1, 11}, // 84 C6
|
||||
{1, 12}, // 85 C#6
|
||||
{1, 13}, // 86 D6
|
||||
{1, 14}, // 87 D#6
|
||||
{1, 15} // 88 E6
|
||||
};
|
||||
|
||||
|
||||
void setup() {
|
||||
// LED debug
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
// Initialize MCP23017s
|
||||
mcp1.begin_I2C(0x20);
|
||||
mcp2.begin_I2C(0x21);
|
||||
// Initialize MIDI
|
||||
MIDI.begin(MIDI_CHANNEL_OMNI);
|
||||
MIDI.setHandleNoteOn(handleNoteOn);
|
||||
MIDI.setHandleNoteOff(handleNoteOff);
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
mcp1.pinMode(i, OUTPUT);
|
||||
mcp1.digitalWrite(i, LOW);
|
||||
|
||||
mcp2.pinMode(i, OUTPUT);
|
||||
mcp2.digitalWrite(i, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
MIDI.read();
|
||||
|
||||
// LED feedback
|
||||
if (ledActive && millis() - ledOnTime >= ledDuration) {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
ledActive = false;
|
||||
}
|
||||
// if (MIDI.read()) {
|
||||
// digitalWrite(LED_BUILTIN, HIGH);
|
||||
// delay(50);
|
||||
// digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
void handleNoteOn(byte channel, byte pitch, byte velocity) {
|
||||
if (channel == currentMidiChannel) {
|
||||
|
||||
if (pitch >= 57 && pitch <= 88) {
|
||||
MCPOutput out = noteToMCP[pitch - 57];
|
||||
if (out.chip == 0) {
|
||||
mcp1.digitalWrite(out.pin, HIGH);
|
||||
} else if (out.chip == 1) {
|
||||
mcp2.digitalWrite(out.pin, HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flash LED on any valid Note On
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
ledOnTime = millis();
|
||||
ledActive = true;
|
||||
}
|
||||
|
||||
void handleNoteOff(byte channel, byte pitch, byte velocity) {
|
||||
if (channel == currentMidiChannel) {
|
||||
if (pitch >= 57 && pitch <= 88) {
|
||||
MCPOutput out = noteToMCP[pitch - 57];
|
||||
if (out.chip == 0) {
|
||||
mcp1.digitalWrite(out.pin, LOW);
|
||||
} else if (out.chip == 1) {
|
||||
mcp2.digitalWrite(out.pin, LOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
(kicad_pcb (version 20240108) (generator "pcbnew") (generator_version "8.0")
|
||||
)
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"board": {
|
||||
"active_layer": 0,
|
||||
"active_layer_preset": "",
|
||||
"auto_track_width": true,
|
||||
"hidden_netclasses": [],
|
||||
"hidden_nets": [],
|
||||
"high_contrast_mode": 0,
|
||||
"net_color_mode": 1,
|
||||
"opacity": {
|
||||
"images": 0.6,
|
||||
"pads": 1.0,
|
||||
"tracks": 1.0,
|
||||
"vias": 1.0,
|
||||
"zones": 0.6
|
||||
},
|
||||
"selection_filter": {
|
||||
"dimensions": true,
|
||||
"footprints": true,
|
||||
"graphics": true,
|
||||
"keepouts": true,
|
||||
"lockedItems": false,
|
||||
"otherItems": true,
|
||||
"pads": true,
|
||||
"text": true,
|
||||
"tracks": true,
|
||||
"vias": true,
|
||||
"zones": true
|
||||
},
|
||||
"visible_items": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
32,
|
||||
33,
|
||||
34,
|
||||
35,
|
||||
36,
|
||||
39,
|
||||
40
|
||||
],
|
||||
"visible_layers": "fffffff_ffffffff",
|
||||
"zone_display_mode": 0
|
||||
},
|
||||
"git": {
|
||||
"repo_password": "",
|
||||
"repo_type": "",
|
||||
"repo_username": "",
|
||||
"ssh_key": ""
|
||||
},
|
||||
"meta": {
|
||||
"filename": "purrChestrion-board.kicad_prl",
|
||||
"version": 3
|
||||
},
|
||||
"project": {
|
||||
"files": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
{
|
||||
"board": {
|
||||
"3dviewports": [],
|
||||
"design_settings": {
|
||||
"defaults": {},
|
||||
"diff_pair_dimensions": [],
|
||||
"drc_exclusions": [],
|
||||
"rules": {},
|
||||
"track_widths": [],
|
||||
"via_dimensions": []
|
||||
},
|
||||
"ipc2581": {
|
||||
"dist": "",
|
||||
"distpn": "",
|
||||
"internal_id": "",
|
||||
"mfg": "",
|
||||
"mpn": ""
|
||||
},
|
||||
"layer_presets": [],
|
||||
"viewports": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
"equivalence_files": []
|
||||
},
|
||||
"erc": {
|
||||
"erc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"pin_map": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
]
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
"conflicting_netclasses": "error",
|
||||
"different_unit_footprint": "error",
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"endpoint_off_grid": "warning",
|
||||
"extra_units": "error",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"lib_symbol_issues": "warning",
|
||||
"missing_bidi_pin": "warning",
|
||||
"missing_input_pin": "warning",
|
||||
"missing_power_pin": "error",
|
||||
"missing_unit": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
"no_connect_dangling": "warning",
|
||||
"pin_not_connected": "error",
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"similar_labels": "warning",
|
||||
"simulation_model_issue": "ignore",
|
||||
"unannotated": "error",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"pinned_footprint_libs": [],
|
||||
"pinned_symbol_libs": []
|
||||
},
|
||||
"meta": {
|
||||
"filename": "purrChestrion-board.kicad_pro",
|
||||
"version": 1
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
"diff_pair_width": 0.2,
|
||||
"line_style": 0,
|
||||
"microvia_diameter": 0.3,
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.2,
|
||||
"via_diameter": 0.6,
|
||||
"via_drill": 0.3,
|
||||
"wire_width": 6
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 3
|
||||
},
|
||||
"net_colors": null,
|
||||
"netclass_assignments": null,
|
||||
"netclass_patterns": []
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "",
|
||||
"plot": "",
|
||||
"pos_files": "",
|
||||
"specctra_dsn": "",
|
||||
"step": "",
|
||||
"svg": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"bom_export_filename": "",
|
||||
"bom_fmt_presets": [],
|
||||
"bom_fmt_settings": {
|
||||
"field_delimiter": ",",
|
||||
"keep_line_breaks": false,
|
||||
"keep_tabs": false,
|
||||
"name": "CSV",
|
||||
"ref_delimiter": ",",
|
||||
"ref_range_delimiter": "",
|
||||
"string_delimiter": "\""
|
||||
},
|
||||
"bom_presets": [],
|
||||
"bom_settings": {
|
||||
"exclude_dnp": false,
|
||||
"fields_ordered": [
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Reference",
|
||||
"name": "Reference",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "Value",
|
||||
"name": "Value",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Datasheet",
|
||||
"name": "Datasheet",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Footprint",
|
||||
"name": "Footprint",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Qty",
|
||||
"name": "${QUANTITY}",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "DNP",
|
||||
"name": "${DNP}",
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"filter_string": "",
|
||||
"group_symbols": true,
|
||||
"name": "Grouped By Value",
|
||||
"sort_asc": true,
|
||||
"sort_field": "Reference"
|
||||
},
|
||||
"connection_grid_size": 50.0,
|
||||
"drawing": {
|
||||
"dashed_lines_dash_length_ratio": 12.0,
|
||||
"dashed_lines_gap_length_ratio": 3.0,
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
"intersheets_ref_own_page": false,
|
||||
"intersheets_ref_prefix": "",
|
||||
"intersheets_ref_short": false,
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.375,
|
||||
"operating_point_overlay_i_precision": 3,
|
||||
"operating_point_overlay_i_range": "~A",
|
||||
"operating_point_overlay_v_precision": 3,
|
||||
"operating_point_overlay_v_range": "~V",
|
||||
"overbar_offset_ratio": 1.23,
|
||||
"pin_symbol_size": 25.0,
|
||||
"text_offset_ratio": 0.15
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "",
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"spice_current_sheet_as_root": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"spice_model_current_sheet_as_root": true,
|
||||
"spice_save_all_currents": false,
|
||||
"spice_save_all_dissipations": false,
|
||||
"spice_save_all_voltages": false,
|
||||
"subpart_first_id": 65,
|
||||
"subpart_id_separator": 0
|
||||
},
|
||||
"sheets": [
|
||||
[
|
||||
"184d94a8-07bc-4a5a-bbef-7f194f1f83e7",
|
||||
"Root"
|
||||
]
|
||||
],
|
||||
"text_variables": {}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user