Skip to content

Commit 1710c41

Browse files
authored
enable DRVSTR for output pin (arduino#313)
add neopixel and button pin define for circuitplay
1 parent 41c0a72 commit 1710c41

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

cores/arduino/wiring_digital.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,39 @@ void pinMode( uint32_t ulPin, uint32_t ulMode )
3939
{
4040
case INPUT:
4141
// Set pin to input mode
42-
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN) ;
43-
PORT->Group[port].DIRCLR.reg = pinMask ;
44-
break ;
42+
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN);
43+
PORT->Group[port].DIRCLR.reg = pinMask;
44+
break;
4545

4646
case INPUT_PULLUP:
4747
// Set pin to input mode with pull-up resistor enabled
48-
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ;
49-
PORT->Group[port].DIRCLR.reg = pinMask ;
48+
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);
49+
PORT->Group[port].DIRCLR.reg = pinMask;
5050

5151
// Enable pull level (cf '22.6.3.2 Input Configuration' and '22.8.7 Data Output Value Set')
52-
PORT->Group[port].OUTSET.reg = pinMask ;
53-
break ;
52+
PORT->Group[port].OUTSET.reg = pinMask;
53+
break;
5454

5555
case INPUT_PULLDOWN:
5656
// Set pin to input mode with pull-down resistor enabled
57-
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ;
58-
PORT->Group[port].DIRCLR.reg = pinMask ;
57+
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);
58+
PORT->Group[port].DIRCLR.reg = pinMask;
5959

6060
// Enable pull level (cf '22.6.3.2 Input Configuration' and '22.8.6 Data Output Value Clear')
61-
PORT->Group[port].OUTCLR.reg = pinMask ;
62-
break ;
61+
PORT->Group[port].OUTCLR.reg = pinMask;
62+
break;
6363

6464
case OUTPUT:
6565
// enable input, to support reading back values, with pullups disabled
66-
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN) ;
66+
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_DRVSTR);
6767

6868
// Set pin to output mode
69-
PORT->Group[port].DIRSET.reg = pinMask ;
70-
break ;
69+
PORT->Group[port].DIRSET.reg = pinMask;
70+
break;
7171

7272
default:
7373
// do nothing
74-
break ;
74+
break;
7575
}
7676
}
7777

variants/circuitplay/variant.h

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272
#define PIN_LED PIN_LED_13
7373
#define LED_BUILTIN PIN_LED
7474

75+
// Neopixel
76+
#define PIN_NEOPIXEL 8
77+
#define NEOPIXEL_NUM 10
78+
79+
#define PIN_BUTTON1 4 // Left Button
80+
#define PIN_BUTTON2 5 // Right Button
81+
7582

7683
//#define PIN_LED_RXL (25u)
7784
//#define PIN_LED_TXL (26u)

0 commit comments

Comments
 (0)