Skip to content

Commit

Permalink
Merge pull request #13 from Wasted-Audio/feature/midi
Browse files Browse the repository at this point in the history
Feature/midi
  • Loading branch information
CorvusPrudens authored Sep 1, 2023
2 parents 8e84248 + e6e817e commit f77c6b4
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/json2daisy/json2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ def generate_header(board_description_dict: dict) -> 'tuple[str, dict]':
else:
replacements['display'] = ''

if 'defines' in target:
if target['defines'].get('OOPSY_TARGET_HAS_MIDI_INPUT'):
target['has_midi'] = True
replacements['midi'] = """daisy::MidiUartHandler midi;"""

replacements['process'] = filter_map_template(
components, 'process', key_exclude='default', match_exclude=True)
replacements['loopprocess'] = filter_map_template(
Expand Down Expand Up @@ -316,7 +321,8 @@ def generate_header(board_description_dict: dict) -> 'tuple[str, dict]':
'name': target['name'],
'components': components,
'aliases': target['aliases'],
'channels': audio_channels
'channels': audio_channels,
'has_midi': target.get('has_midi', False)
}

return rendered_header, board_info
Expand Down
1 change: 1 addition & 0 deletions src/json2daisy/templates/daisy.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ struct Daisy{{ name|capitalize }} {
// I/O Components
{{comps}}
{{dispdec}}
{{midi}}

};

Expand Down
1 change: 1 addition & 0 deletions tests/data/integration/expected_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ struct DaisyField {
daisy::Switch sw2;
daisy::I2CHandle i2c;
daisy::OledDisplay<daisy::SSD130x4WireSpi128x64Driver> display;
daisy::MidiUartHandler midi;

};

Expand Down
1 change: 1 addition & 0 deletions tests/data/integration/expected_patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ struct DaisyPatch {
daisy::GateIn gatein2;
dsy_gpio gateout;
daisy::OledDisplay<daisy::SSD130x4WireSpi128x64Driver> display;
daisy::MidiUartHandler midi;

};

Expand Down
1 change: 1 addition & 0 deletions tests/data/integration/expected_patch_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ struct DaisyPatch_init {
daisy::Switch sw1;
daisy::Switch sw2;



};

Expand Down
1 change: 1 addition & 0 deletions tests/data/integration/expected_petal.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ struct DaisyPetal {
daisy::Switch sw7;
daisy::I2CHandle i2c;



};

Expand Down
1 change: 1 addition & 0 deletions tests/data/integration/expected_petal_125b_sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ struct DaisyPetal_125b_sm {
// I/O Components




};

Expand Down
1 change: 1 addition & 0 deletions tests/data/integration/expected_pod.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ struct DaisyPod {
daisy::Switch sw1;
daisy::Switch sw2;
daisy::OledDisplay<daisy::SSD130x4WireSpi128x64Driver> display;
daisy::MidiUartHandler midi;

};

Expand Down

0 comments on commit f77c6b4

Please sign in to comment.