Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a469023

Browse filesBrowse files
authored
Merge pull request #7 from WestfW/master
Remove unnecessary Atomicity code and extra sanity check.
2 parents 746de7f + 295f988 commit a469023
Copy full SHA for a469023

File tree

Expand file treeCollapse file tree

1 file changed

+0
-16
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+0
-16
lines changed

‎cores/arduino/wiring_digital.c

Copy file name to clipboardExpand all lines: cores/arduino/wiring_digital.c
-16Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,9 @@ void pinMode(uint8_t pin, PinMode mode)
4141

4242
if(mode == OUTPUT){
4343

44-
/* Save state */
45-
uint8_t status = SREG;
46-
cli();
47-
4844
/* Configure direction as output */
4945
port->DIRSET = bit_mask;
5046

51-
/* Restore state */
52-
SREG = status;
53-
5447
} else { /* mode == INPUT or INPUT_PULLUP */
5548

5649
uint8_t bit_pos = digitalPinToBitPosition(pin);
@@ -151,15 +144,10 @@ void digitalWrite(uint8_t pin, PinStatus val)
151144

152145
/* Get port */
153146
PORT_t *port = digitalPinToPortStruct(pin);
154-
if(port == NULL) return;
155147

156148
/* Output direction */
157149
if(port->DIR & bit_mask){
158150

159-
/* Save system status and disable interrupts */
160-
uint8_t status = SREG;
161-
cli();
162-
163151
/* Set output to value */
164152
if (val == LOW) { /* If LOW */
165153
port->OUTCLR = bit_mask;
@@ -171,9 +159,6 @@ void digitalWrite(uint8_t pin, PinStatus val)
171159
port->OUTSET = bit_mask;
172160
}
173161

174-
/* Restore system status */
175-
SREG = status;
176-
177162
/* Input direction */
178163
} else {
179164
/* Old implementation has side effect when pin set as input -
@@ -218,7 +203,6 @@ PinStatus digitalRead(uint8_t pin)
218203

219204
/* Get port and check valid port */
220205
PORT_t *port = digitalPinToPortStruct(pin);
221-
if(port == NULL) return LOW;
222206

223207
/* Read pin value from PORTx.IN register */
224208
if(port->IN & bit_mask){

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.