-
-
Notifications
You must be signed in to change notification settings - Fork 34
Backport patches from arduino/ArduinoCore-mbed #81
Conversation
A Nordic specific ADC configuration is implemented in 'variant.cpp'. It can be modified using 'analogReference' function, all the reference options are defined in 'pins_arduino.h'. Once the configuration is changed: - the already active ADC objects are reconfigured. - new ADC objects will be set to the most recent configuration.
Implement a Nordic specific function able to change the acquisition time of ADCs.
- PinMode is redefined to be compatible with both Arduino and Mbed contexts - DigitalInOut is employed to handle gpio, it now exploits the reconfigure PinMode symbol
Implements checks on DigitalRead and DigitalWrite functions. If the requested pin is not initialized, it is assigned to a new DigitalInOut object configured as: - if INPUT: no pull and 0 as default value - if OUTPUT: no pull and the argument value as init value
… PPI_CHANNEL and GPIOTE events
Excited! One note - interrupts.cpp still doesn't cover all possible interrupt types (HIGH, LOW) - is it better to have the irq setting as a |
|
@facchinm ah, if they're not supported then no worries. Thanks! |
@facchinm this implementation in // Give a default pullup for the pin, since calling InterruptIn with PinMode is impossible
if (digitalPinToGpio(interruptNum) == NULL) {
pinMode(interruptNum, mode == FALLING ? INPUT_PULLUP : INPUT_PULLDOWN);
} Perhaps the following? if (digitalPinToGpio(interruptNum) == NULL) {
switch(mode){
case FALLING:
pinMode(interruptNum, INPUT_PULLUP);
break;
case RISING:
pinMode(interruptNum, INPUT_PULLDOWN);
break;
case CHANGE:
pinMode(interruptNum, INPUT);
break;
default:
pinMode(interruptNum, INPUT);
break;
}
} |
@rmlearney-digicatapult the snippet you are linking only applies is the pin has not been configured as INPUT before calling |
What will be the default pin state if somebody doesn't configure the pin as INPUT but calls an Won't it be pulled down according to this code, which means it won't trigger properly? |
Yep, you are right! Would you mind sending a PR over |
Works in sync with upcoming arduino-builder for precompiled libraries
Borrow implementation for samd core Should fix #85
This should be the last maintenance release of this core; since this core is based on mbed 5.x branch all functions marked for deprecation are still there; arduino/ArduinoCore-mbed, on the other hand, contains all the new stuff and should replace this core as soon as considered stable.
Reworks and includes #31 and #72