Skip to content

Commit

Permalink
Added SetHighDriveStrength
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed May 29, 2022
1 parent 1133532 commit 4fbbe16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/CoreIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ void DisablePullup(Pin pin) noexcept
#endif
}

#if SAME5x || SAMC21

// Set high driver strength on an output pin
void SetHighDriveStrength(Pin p) noexcept
{
PORT->Group[GpioPortNumber(p)].PINCFG[GpioPinNumber(p)].reg |= PORT_PINCFG_DRVSTR;
}

#endif

// IoPort::SetPinMode calls this
// Warning! Changing pin mode will reset the output drive strength to normal.
void SetPinMode(Pin pin, enum PinMode mode, uint32_t debounceCutoff = 0) noexcept
Expand Down
4 changes: 4 additions & 0 deletions src/CoreIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ enum class GpioPinFunction : uint8_t
*/
void SetPinFunction(Pin p, GpioPinFunction f) noexcept;

#if SAME5x || SAMC21
void SetHighDriveStrength(Pin p) noexcept;
#endif

/**
* @brief Set a pin back to ordinary digital I/O
*
Expand Down

0 comments on commit 4fbbe16

Please sign in to comment.