git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1020 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
4fc5b696fa
commit
e1ce260439
|
@ -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.
|
||||
|
|
|
@ -31,6 +31,16 @@
|
|||
#include "pal_lld.h"
|
||||
#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
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue