Skip to content

Commit a8c4b4d

Browse files
author
ladyada
committed
Merge branch 'master' of github.com:adafruit/ArduinoCore-samd
2 parents 3db7484 + e669a01 commit a8c4b4d

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

cores/arduino/wiring_digital.c

Lines changed: 15 additions & 15 deletions
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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,37 @@
6666
// #define digitalPinToTimer(P)
6767

6868

69+
// Digital pins
70+
// ----
71+
#define PIN_D4 (4u)
72+
#define PIN_D5 (5u)
73+
#define PIN_D7 (7u)
74+
#define PIN_D8 (8u)
75+
#define PIN_D11 (25u)
76+
#define PIN_D12 (26u)
77+
#define PIN_D13 (13u)
78+
79+
#define D4 PIN_D4
80+
#define D5 PIN_D5
81+
#define D7 PIN_D7
82+
#define D8 PIN_D8
83+
#define D11 PIN_D11
84+
#define D12 PIN_D12
85+
#define D13 PIN_D13
86+
6987
// LEDs
7088
// ----
71-
#define PIN_LED_13 (13u)
89+
#define PIN_LED_13 (D13)
7290
#define PIN_LED PIN_LED_13
7391
#define LED_BUILTIN PIN_LED
7492

93+
// Neopixel
94+
#define PIN_NEOPIXEL D8
95+
#define NEOPIXEL_NUM 10
96+
97+
#define PIN_BUTTON1 D4 // Left Button
98+
#define PIN_BUTTON2 D5 // Right Button
99+
75100

76101
//#define PIN_LED_RXL (25u)
77102
//#define PIN_LED_TXL (26u)

0 commit comments

Comments
 (0)