ardublockly icon indicating copy to clipboard operation
ardublockly copied to clipboard

volatile number type for interruption

Open SebCanet opened this issue 8 years ago • 2 comments

Missing in types.js, only for interruption https://www.arduino.cc/en/Reference/AttachInterrupt

/** Volatile integer number. */
Blockly.Types.VOLATIL_NUMBER = new Blockly.Type({
  typeId: 'Volatil Number',
  typeMsgName: 'ARD_TYPE_VOLATILE',
  compatibleTypes: []    // Circular dependencies, add after all declarations
});

In generaor arduino.js

    case Blockly.Types.VOLATIL_NUMBER.typeId:
      return 'volatile int';

SebCanet avatar Aug 19 '16 23:08 SebCanet

Thanks for the report @SebCanet. Boy that's an interesting one! One of the concepts I would love to maintain in Ardublockly is to reduce or hide, or automatically implement, as much as possible the features that might require careful explanation.

I haven't implemented interrupts yet, so I didn't come across this requirement so far. How do you use volatile in your implementation? as a selectable variable type and then instruct users that they should use it on any variable accessed by interrupts?

carlosperate avatar Aug 24 '16 22:08 carlosperate

Because it's a real specific functionnality, it's only a selectable variable. And I'm totally agree with you about "automatically implement, as much as possible the features that might require careful explanation". That will be a big part of our job, but you already did a lot with typing variable.

SebCanet avatar Aug 25 '16 10:08 SebCanet