Merge branch 'master' of github.com:adafruit/ArduinoCore-samd

This commit is contained in:
ladyada 2022-01-04 13:50:18 -05:00
commit a8c4b4d8e3
2 changed files with 41 additions and 16 deletions

View file

@ -39,39 +39,39 @@ void pinMode( uint32_t ulPin, uint32_t ulMode )
{
case INPUT:
// Set pin to input mode
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN) ;
PORT->Group[port].DIRCLR.reg = pinMask ;
break ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN);
PORT->Group[port].DIRCLR.reg = pinMask;
break;
case INPUT_PULLUP:
// Set pin to input mode with pull-up resistor enabled
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ;
PORT->Group[port].DIRCLR.reg = pinMask ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);
PORT->Group[port].DIRCLR.reg = pinMask;
// Enable pull level (cf '22.6.3.2 Input Configuration' and '22.8.7 Data Output Value Set')
PORT->Group[port].OUTSET.reg = pinMask ;
break ;
PORT->Group[port].OUTSET.reg = pinMask;
break;
case INPUT_PULLDOWN:
// Set pin to input mode with pull-down resistor enabled
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ;
PORT->Group[port].DIRCLR.reg = pinMask ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);
PORT->Group[port].DIRCLR.reg = pinMask;
// Enable pull level (cf '22.6.3.2 Input Configuration' and '22.8.6 Data Output Value Clear')
PORT->Group[port].OUTCLR.reg = pinMask ;
break ;
PORT->Group[port].OUTCLR.reg = pinMask;
break;
case OUTPUT:
// enable input, to support reading back values, with pullups disabled
PORT->Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN) ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_DRVSTR);
// Set pin to output mode
PORT->Group[port].DIRSET.reg = pinMask ;
break ;
PORT->Group[port].DIRSET.reg = pinMask;
break;
default:
// do nothing
break ;
break;
}
}

View file

@ -66,12 +66,37 @@
// #define digitalPinToTimer(P)
// Digital pins
// ----
#define PIN_D4 (4u)
#define PIN_D5 (5u)
#define PIN_D7 (7u)
#define PIN_D8 (8u)
#define PIN_D11 (25u)
#define PIN_D12 (26u)
#define PIN_D13 (13u)
#define D4 PIN_D4
#define D5 PIN_D5
#define D7 PIN_D7
#define D8 PIN_D8
#define D11 PIN_D11
#define D12 PIN_D12
#define D13 PIN_D13
// LEDs
// ----
#define PIN_LED_13 (13u)
#define PIN_LED_13 (D13)
#define PIN_LED PIN_LED_13
#define LED_BUILTIN PIN_LED
// Neopixel
#define PIN_NEOPIXEL D8
#define NEOPIXEL_NUM 10
#define PIN_BUTTON1 D4 // Left Button
#define PIN_BUTTON2 D5 // Right Button
//#define PIN_LED_RXL (25u)
//#define PIN_LED_TXL (26u)