[rtems commit] bsp/atsam: Allow setting the drive strength.
Christian Mauderer
christianm at rtems.org
Tue Mar 13 14:05:47 UTC 2018
Module: rtems
Branch: master
Commit: 71c5552f9a7c2fbe27b860fafc295427955f25a1
Changeset: http://git.rtems.org/rtems/commit/?id=71c5552f9a7c2fbe27b860fafc295427955f25a1
Author: Christian Mauderer <christian.mauderer at embedded-brains.de>
Date: Mon Mar 12 16:43:28 2018 +0100
bsp/atsam: Allow setting the drive strength.
This adds a simple function for setting the PIO drive strength.
---
bsps/arm/atsam/include/libchip/include/pio.h | 2 ++
.../lib/libbsp/arm/atsam/libraries/libchip/source/pio.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/bsps/arm/atsam/include/libchip/include/pio.h b/bsps/arm/atsam/include/libchip/include/pio.h
index 6cf463d..1e24b73 100644
--- a/bsps/arm/atsam/include/libchip/include/pio.h
+++ b/bsps/arm/atsam/include/libchip/include/pio.h
@@ -209,6 +209,8 @@ extern void PIO_DisableWriteProtect(const Pin *pin);
extern void PIO_SetPinType(Pin *pin, uint8_t pinType);
extern uint32_t PIO_GetWriteProtectViolationInfo(const Pin *pin);
+
+extern void PIO_SetDriveStrength(const Pin *pin, uint8_t strength);
#ifdef __cplusplus
}
#endif
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c
index e39825d..d6df587 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/pio.c
@@ -481,3 +481,19 @@ void PIO_SetPinType(Pin *pin, uint8_t pinType)
pin->type = pinType;
}
+/**
+ * \brief Set the drive strength of the pin.
+ *
+ * \param pin Pointer to a Pin instance describing one or more pins.
+ * \param strength 0 for low drive strength or 1 for high drive strength.
+ */
+void PIO_SetDriveStrength(const Pin *pin, uint8_t strength)
+{
+ Pio *pio = pin->pio;
+
+ if (strength) {
+ pio->PIO_DRIVER |= pin->mask;
+ } else {
+ pio->PIO_DRIVER &= ~(pin->mask);
+ }
+}
More information about the vc
mailing list