1 parent
bc65391f50
commit
ebea46c98d
6 files changed
+19
-22
No files matched your search
@@ -49,8 +49,10 @@ static void __initialize()
|
||||
/*
|
||||
* \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs.
|
||||
* Replaces any previous function that was attached to the interrupt.
|
||||
*
|
||||
* \return Interrupt Mask
|
||||
*/
|
||||
void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
||||
int attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
||||
{
|
||||
if (!enabled) {
|
||||
__initialize();
|
||||
@@ -58,7 +60,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
||||
}
|
||||
|
||||
if (pin >= PINS_COUNT) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pin = g_ADigitalPinMap[pin];
|
||||
@@ -95,9 +97,11 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
|
||||
|
||||
NRF_GPIOTE->INTENSET = (1 << ch);
|
||||
|
||||
break;
|
||||
return (1 << ch);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -39,8 +39,10 @@ typedef void (*voidFuncPtr)(void);
|
||||
/*
|
||||
* \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs.
|
||||
* Replaces any previous function that was attached to the interrupt.
|
||||
*
|
||||
* \return Interrupt Mask
|
||||
*/
|
||||
void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode);
|
||||
int attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode);
|
||||
|
||||
/*
|
||||
* \brief Turns off the given interrupt.
|
||||
|
||||
+4
-4
@@ -66,10 +66,10 @@ extern void delay( uint32_t dwMs );
|
||||
static __inline__ void delayMicroseconds( uint32_t ) __attribute__((always_inline, unused)) ;
|
||||
static __inline__ void delayMicroseconds( uint32_t usec )
|
||||
{
|
||||
if ( usec == 0 )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
// if ( usec == 0 )
|
||||
// {
|
||||
// return ;
|
||||
// }
|
||||
|
||||
nrf_delay_us(usec);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ bool SoftwareSerial::stopListening()
|
||||
|
||||
void SoftwareSerial::end()
|
||||
{
|
||||
stopListening();
|
||||
stopListening();
|
||||
}
|
||||
|
||||
int SoftwareSerial::read()
|
||||
@@ -326,4 +326,4 @@ void SoftwareSerial::setRX(uint8_t rx)
|
||||
_receiveBitMask = digitalPinToBitMask(rx);
|
||||
NRF_GPIO_Type * port = digitalPinToPort(rx);
|
||||
_receivePortRegister = portInputRegister(port);
|
||||
}
|
||||
}
|
||||
@@ -91,13 +91,4 @@ public:
|
||||
static inline void handle_interrupt() __attribute__((__always_inline__));
|
||||
};
|
||||
|
||||
// Arduino 0012 workaround
|
||||
#undef int
|
||||
#undef char
|
||||
#undef long
|
||||
#undef byte
|
||||
#undef float
|
||||
#undef abs
|
||||
#undef round
|
||||
|
||||
#endif
|
||||
@@ -5,8 +5,8 @@
|
||||
Receives from software serial, sends to hardware serial.
|
||||
|
||||
The circuit:
|
||||
* RX is digital pin 9 (connect to TX of other device)
|
||||
* TX is digital pin 10 (connect to RX of other device)
|
||||
* RX is digital pin A0 (connect to TX of other device)
|
||||
* TX is digital pin A1 (connect to RX of other device)
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
SoftwareSerial mySerial(9, 10); // RX, TX
|
||||
SoftwareSerial mySerial(A0, A1); // RX, TX
|
||||
|
||||
|
||||
void setup()
|
||||
|
||||
Reference in new issue
Block a user