Skip to content

Commit

Permalink
add samd51 support, fixes PaulStoffregen#32
Browse files Browse the repository at this point in the history
  • Loading branch information
ladyada committed Feb 20, 2020
1 parent 80a924a commit f29b89a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CapacitiveSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ void directModeOutput(IO_REG_TYPE pin)
#define DIRECT_WRITE_LOW(base, mask) ((*((base)+5)) = (mask))
#define DIRECT_WRITE_HIGH(base, mask) ((*((base)+6)) = (mask))

#elif defined(__SAMD51__)
#define PIN_TO_BASEREG(pin) portModeRegister(digitalPinToPort(pin))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) (((*((base)+8)) & (mask)) ? 1 : 0) // IN
#define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) = (mask)) // DIRCLR
#define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+2)) = (mask)) // DIRSET
#define DIRECT_WRITE_LOW(base, mask) ((*((base)+5)) = (mask)) // OUTCLR
#define DIRECT_WRITE_HIGH(base, mask) ((*((base)+6)) = (mask)) /// OUTSET

#elif defined(RBL_NRF51822)
#define PIN_TO_BASEREG(pin) (0)
#define PIN_TO_BITMASK(pin) (pin)
Expand Down

0 comments on commit f29b89a

Please sign in to comment.