Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-generated Bonsai interface #1

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

bruno-f-cruz
Copy link
Member

@bruno-f-cruz bruno-f-cruz commented Aug 10, 2023

This PR adds the first draft of the MultiPwm device metadata file, together with the corresponding auto-generated Bonsai high-level interface. The metadata YML file makes use of merge operators to avoid repeating declarations as much as possible, and currently relies on bitmask values to represent PWM and trigger input channels.

device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated Show resolved Hide resolved
device.yml Outdated
Start: 0
StartAndStop: 1
NoTrigger: 8 #TODO Is this correct?
TriggerAllConfig: #TODO UNCLEAR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any time a trigger is received, all the channels are operated according to these groupmask options.

Firmware/MultiPwm/registers.xls Outdated Show resolved Hide resolved
@bruno-f-cruz bruno-f-cruz requested review from artursilva0, glopesdev and filcarv and removed request for artursilva0 and glopesdev August 20, 2023 14:10
device.yml Outdated Show resolved Hide resolved
@bruno-f-cruz bruno-f-cruz requested a review from glopesdev August 23, 2023 21:44
@bruno-f-cruz
Copy link
Member Author

@glopesdev Can we merge this one?

@artursilva0
Copy link
Contributor

@glopesdev Can we proceed with this merge?

Copy link

@glopesdev glopesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one minor change to a bitmask name and a minor update to launchSettings.json.

device.yml Outdated Show resolved Hide resolved
Interface/Harp.MultiPwm/Properties/launchSettings.json Outdated Show resolved Hide resolved
Copy link

@glopesdev glopesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more things I noticed in the meantime.

Comment on lines +267 to +273
TriggerAllModeConfig:
description: Available operation modes for "All" trigger input channel.
values:
Start: 0
StartAndStop: 1
Enable: 2
EnableAndStop: 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this enum different from TriggerModeConfig? It feels strange to have more options when configuring all channels at the same time versus one at a time, but maybe I am missing something here since I don't know the device.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional options for TriggerModeConfig are not directly related to the Trigger Channels. The additional Enable options allow to enable the PWM channels and not the Trigger Channels. If I remember it was added here for convenience, since we could use this "All" channel to enable by an external signal all the PWM Channels.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In that case probably the name TriggerAllModeConfig is misleading since it provides no indication that different channel types other than trigger may also be configured. I can see two options to improve the situation:

  1. Keep the register name but remove the convenience functionality and make this register work only with the TriggerModeConfig group mask (would require firmware changes);
  2. Change the register name to encompass both trigger and PWM channels, e.g. TriggerAndPwmMode or AllChannelMode. Also rename the group mask to match the register name with a Config suffix and rename the values in this group mask to include information about which channels are affected, e.g. TriggerStart, TriggerStartAndStop, PwmEnable, PwmEnableAndStop.

I would be happy with either choice, depending on how this register is meant to be used.

One last thing which is still not clear to me in this combined register is how the register can work with multiple channel types and be a group mask at the same time.

What happens if you write TriggerStart and then PwmEnable? Are these options mutually exclusive? Or will it leave the trigger mode at whatever value was set previously? In the latter case, what happens when you read the register?

Depending on the answers we could also consider the following options:

  1. Convert the register type into a bitmask;
  2. Make a separate register for all PWM channel config.

Both would also likely require firmware changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to improve the naming than making any changes to the firmware at this point. So I will modify the register, group masks name and values according to 2. and regenerate the interface if you have no additional suggestions.

These options are mutually exclusive.

device.yml Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants