Skip to content

Commit

Permalink
Feature/daisy midi (#76)
Browse files Browse the repository at this point in the history
* start midi work for daisy

* semi-working usb and uart midi

* set delayMs to 0; enable other midi input events

* try SendMessage

* midi out

* make midi optional in the template based on board_info

* remove print

* disable usb-midi when debug printing in enabled

* separate usb and uart midi with extra meta.json flag

* use FixedCapStr as the FIFO type

* separate midi (usb and uart) and improved debug printing (#117)

* disable usb-midi when debug printing in enabled

* separate usb and uart midi with extra meta.json flag

* use FixedCapStr as the FIFO type

* update changelog and docs

* use temp wstd2daisy package

* update changelog
  • Loading branch information
dromer authored Sep 1, 2023
1 parent 0cd0660 commit d33f50e
Show file tree
Hide file tree
Showing 5 changed files with 325 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CHANGELOG
Next Release
-----

* Daisy: allow for debug printing (off by default, increases program size due to formatting)
* Daisy: set bootloader type in Makefile
* Daisy: MIDI i/o for NoteOn/Off, ControlChange, ProgramChange, ChannelPressure, and PitchBend
* Daisy: USB MIDI toggle (disabled by debug printing)
* Daisy: allow for debug printing (off by default, increases program size due to formatting)
* DPF bugfixes: broken midi template include; MIDI_RT_CLOCK fails under certain conditions

0.8.0
Expand Down
42 changes: 41 additions & 1 deletion docs/03.gen.daisy.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,44 @@ Which can be configured using the `-m` metadata.json `daisy.board` setting:
}
```

However one can also create custom board layouts. See the pd2dsy documentation for more information.
However one can also create custom board layouts. See [the Electro-Smith documentation](https://github.com/electro-smith/DaisyWiki/wiki/Pd2dsy-Guide) for more information.

The custom layout can be passed on via the meta.json as such:

```json
{
"daisy": {
"board_file": <path to board.json>
}
}
```

## MIDI

Board files that have `OOPSY_TARGET_HAS_MIDI_INPUT` configured will automatically set up UART MIDI on the default USART1 Rx and Tx pins of the Daisy (D13/14).

Additionally `usb_midi`, running on the onboard micro-usb, can be enabled separately via the meta.json

```json
{
"daisy": {
"usb_midi": true
}
}
```

At the moment all midi messages will be merged between USB and UART MIDI interfaces. In the future it will likely be possible to assign additional UART pins and group them under a specific PD midi "port".

## [print] object

Printing to serial console can be enabled using the `debug_printing` flag in the meta.json:

```json
{
"daisy": {
"debug_printing": true
}
}
```

This will increase the program size with a few kb and will disable `usb_midi` as we currently do not have composite USB device yet.
16 changes: 16 additions & 0 deletions hvcc/generators/c2daisy/c2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
from . import parameters


hv_midi_messages = {
"__hv_noteout",
"__hv_ctlout",
"__hv_pgmout",
"__hv_touchout",
"__hv_bendout",
"__hv_midiout"
}


class c2daisy:
""" Generates a Daisy wrapper for a given patch.
"""
Expand Down Expand Up @@ -63,6 +73,10 @@ def compile(
else:
header, board_info = json2daisy.generate_header_from_name(board)

# remove heavy out params from externs
externs['parameters']['out'] = [
t for t in externs['parameters']['out'] if not any(x == y for x in hv_midi_messages for y in t)]

component_glue = parameters.parse_parameters(
externs['parameters'], board_info['components'], board_info['aliases'], 'hardware')
component_glue['class_name'] = board_info['name']
Expand All @@ -71,6 +85,8 @@ def compile(
component_glue['max_channels'] = board_info['channels']
component_glue['num_output_channels'] = num_output_channels
component_glue['debug_printing'] = daisy_meta.get('debug_printing', False)
component_glue['usb_midi'] = daisy_meta.get('usb_midi', False)
component_glue['has_midi'] = board_info['has_midi']

component_glue['copyright'] = copyright_c

Expand Down
Loading

0 comments on commit d33f50e

Please sign in to comment.