mirror of https://github.com/ARMmbed/mbed-os.git
overload InterruptIn constructor to allow PinMode control
parent
3d1174a215
commit
35308c1937
|
|
@ -24,11 +24,20 @@ InterruptIn::InterruptIn(PinName pin) : gpio(),
|
|||
_rise(NULL),
|
||||
_fall(NULL) {
|
||||
// No lock needed in the constructor
|
||||
|
||||
gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
|
||||
gpio_init_in(&gpio, pin);
|
||||
}
|
||||
|
||||
InterruptIn::InterruptIn(PinName pin, PinMode mode) :
|
||||
gpio(),
|
||||
gpio_irq(),
|
||||
_rise(NULL),
|
||||
_fall(NULL) {
|
||||
// No lock needed in the constructor
|
||||
gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
|
||||
gpio_init_in_ex(&gpio, pin, mode);
|
||||
}
|
||||
|
||||
InterruptIn::~InterruptIn() {
|
||||
// No lock needed in the destructor
|
||||
gpio_irq_free(&gpio_irq);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ public:
|
|||
* @param pin InterruptIn pin to connect to
|
||||
*/
|
||||
InterruptIn(PinName pin);
|
||||
/** Create an InterruptIn connected to the specified pin,
|
||||
* and the pin configured to the specified mode.
|
||||
*
|
||||
* @param pin InterruptIn pin to connect to
|
||||
*/
|
||||
InterruptIn(PinName pin, PinMode mode);
|
||||
virtual ~InterruptIn();
|
||||
|
||||
/** Read the input, represented as 0 or 1 (int)
|
||||
|
|
|
|||
Loading…
Reference in New Issue