Skip to content

Partly solves Issue #39 (Extended Configuration Proposal) #40

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Firmata.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#define ANALOG_MAPPING_RESPONSE 0x6A // reply with mapping info
#define REPORT_FIRMWARE 0x79 // report name and version of the firmware
#define SAMPLING_INTERVAL 0x7A // set the poll rate of the main loop
#define CONFIG_EXT 0x7C // further arduino configuration not covered by pin_mode
#define SYSEX_NON_REALTIME 0x7E // MIDI Reserved for non-realtime messages
#define SYSEX_REALTIME 0x7F // MIDI Reserved for realtime messages
// these are DEPRECATED to make the naming more consistent
Expand Down
39 changes: 39 additions & 0 deletions examples/StandardFirmata/StandardFirmata.ino
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,45 @@ void sysexCallback(byte command, byte argc, byte *argv)
//Firmata.sendString("Not enough data");
}
break;
case CONFIG_EXT:
if (argc > 1) {
switch (argv[0]) {
case 0: // analogReference request
switch (argv[0]) {
case 0: // analogReference request
switch (argv[1]) {
case 0:
analogReference(DEFAULT);
Copy link
Member

Choose a reason for hiding this comment

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

we'll need a way to query the set reference voltage

break;
case 1:
analogReference(INTERNAL);
break;
#ifdef INTERNAL1V1
case 2:
analogReference(INTERNAL1V1);
break;
#endif
#ifdef INTERNAL2V56
case 3:
analogReference(INTERNAL2V56);
break;
#endif
case 4:
analogReference(EXTERNAL);
break;
}
break;
#if ARDUINO >= 150
case 1: // analogWriteResolution request
analogReadResolution(arg[1]);
Copy link
Member

Choose a reason for hiding this comment

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

the value should stored and reported via the capability query

break;
case 2: // analogWriteResolution request
analogWriteResolution(arg[1]);
break;
#endif
}
}
}
case EXTENDED_ANALOG:
if (argc > 1) {
int val = argv[1];
Expand Down