diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-06-07 13:40:36 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-06-07 13:40:36 +0000 |
commit | e1ce26043955f6354af12bafa87c62ef9328440e (patch) | |
tree | 0cb80abd418fcb6aa05085b1b874d136be523364 | |
parent | 4fc5b696fad6b10620dcd49149bf64b829e38f77 (diff) | |
download | ChibiOS-e1ce26043955f6354af12bafa87c62ef9328440e.tar.gz ChibiOS-e1ce26043955f6354af12bafa87c62ef9328440e.tar.bz2 ChibiOS-e1ce26043955f6354af12bafa87c62ef9328440e.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1020 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | ports/ARMCM3-STM32F103/pal_lld.h | 11 | ||||
-rw-r--r-- | src/lib/pal.h | 18 |
2 files changed, 18 insertions, 11 deletions
diff --git a/ports/ARMCM3-STM32F103/pal_lld.h b/ports/ARMCM3-STM32F103/pal_lld.h index 7c1bb4399..33e6f959a 100644 --- a/ports/ARMCM3-STM32F103/pal_lld.h +++ b/ports/ARMCM3-STM32F103/pal_lld.h @@ -198,8 +198,8 @@ typedef GPIO_TypeDef * ioportid_t; * code.
*/
#define pal_lld_writegroup(port, mask, offset, bits) { \
- (bus)->bus_portid->BSRR = ((~(bits) & (mask)) << (16 + (offset))) | \
- ((bits) & (mask)) << (offset); \
+ (port)->BSRR = ((~(bits) & (mask)) << (16 + (offset))) | \
+ (((bits) & (mask)) << (offset)); \
}
/**
@@ -207,15 +207,12 @@ typedef GPIO_TypeDef * ioportid_t; *
* @param[in] port the port identifier
* @param[in] pad the pad number within the port
- * @param[out] value the logical value, the value must be @p 0 or @p 1
+ * @param[out] bit the logical value, the value must be @p 0 or @p 1
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define pal_lld_writepad(port, pad, value) { \
- (bus)->bus_portid->BSRR = (((~(value) & 1) << ((pad) + 16)) | \
- ((((value) & 1) << (pad))); \
-}
+#define pal_lld_writepad(port, pad, bit) pal_lld_writegroup(port, 1, pad, bit)
/**
* @brief GPIO port setup.
diff --git a/src/lib/pal.h b/src/lib/pal.h index 11137c6cb..cac306c43 100644 --- a/src/lib/pal.h +++ b/src/lib/pal.h @@ -32,6 +32,16 @@ #endif
/**
+ * @brief Logical low state. + */
+#define PAL_LOW 0
+
+/**
+ * @brief Logical high state.
+ */
+#define PAL_HIGH 1
+
+/**
* @brief Port bit helper macro.
* @details This macro calculates the mask of a bit within a port.
*
@@ -241,7 +251,7 @@ typedef struct { *
* @param[in] port the port identifier
* @param[in] pad the pad number within the port
- * @param[out] value the logical value, the value must be @p 0 or @p 1
+ * @param[out] bit the logical value, the value must be @p 0 or @p 1
*
* @note The operation is not guaranteed to be atomic on all the architectures,
* for atomicity and/or portability reasons you may need to enclose port
@@ -253,12 +263,12 @@ typedef struct { * @p palWritePort().
*/
#if !defined(pal_lld_writepad) || defined(__DOXYGEN__)
-#define palWritePad(port, pad, value) { \
+#define palWritePad(port, pad, bit) { \
palWritePort(port, (palReadLatch(port) & ~PAL_PORT_BIT(pad)) | \
- (((value) & 1) << pad)); \
+ (((bit) & 1) << pad)); \
}
#else
-#define palWritePad(port, pad, value) pal_lld_writepad(port, pad, value)
+#define palWritePad(port, pad, bit) pal_lld_writepad(port, pad, bit)
#endif
/**
|