add digitalToggle() for convenience
This commit is contained in:
1 parent
bee98fd16b
commit
30c735a68f
2 files changed
+10
No files matched your search
@@ -111,6 +111,14 @@ int digitalRead( uint32_t ulPin )
|
||||
return ((NRF_GPIO->IN >> ulPin) & 1UL) ? HIGH : LOW ;
|
||||
}
|
||||
|
||||
// TODO toggle not work !!!
|
||||
int digitalToggle( uint32_t pin )
|
||||
{
|
||||
int state = 1 - (((NRF_GPIO->OUT >> pin) & 1UL) ? HIGH : LOW);
|
||||
digitalWrite(pin, state);
|
||||
return state;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -64,6 +64,8 @@ extern void digitalWrite( uint32_t dwPin, uint32_t dwVal ) ;
|
||||
*/
|
||||
extern int digitalRead( uint32_t ulPin ) ;
|
||||
|
||||
extern int digitalToggle( uint32_t pin );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user