aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/include
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-03 02:48:57 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-03 22:40:39 -0400
commit4a53794f1afbb9951bd87f413c64614d1006294c (patch)
tree210c6472de86c8a95061a1ee81780021bbf32ba1 /wirish/include
parentccd1ca1403490db05cf02696e1b5430147fc2805 (diff)
downloadlibrambutan-4a53794f1afbb9951bd87f413c64614d1006294c.tar.gz
librambutan-4a53794f1afbb9951bd87f413c64614d1006294c.zip
<wirish/boards.h>: Add feature test macros for SPI.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'wirish/include')
-rw-r--r--wirish/include/wirish/boards.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/wirish/include/wirish/boards.h b/wirish/include/wirish/boards.h
index 2da252d..69e8882 100644
--- a/wirish/include/wirish/boards.h
+++ b/wirish/include/wirish/boards.h
@@ -117,8 +117,9 @@ bool boardUsesPin(uint8 pin);
/**
* @brief Does the board break out a USART/UART's RX and TX pins?
*
- * BOARD_HAVE_USART(n) is nonzero iff USARTn is available. Also see
- * BOARD_HAVE_USART1, ..., BOARD_HAVE_UART4 (sic), etc.
+ * BOARD_HAVE_USART(n) is nonzero iff USARTn is available (n must be
+ * an integer literal, 1 through 6). Also see BOARD_HAVE_USART1, ...,
+ * BOARD_HAVE_UART4 (sic), etc.
*/
#define BOARD_HAVE_USART(n) (defined(BOARD_USART##n##_TX_PIN) && \
defined(BOARD_USART##n##_RX_PIN))
@@ -135,4 +136,21 @@ bool boardUsesPin(uint8 pin);
/** Feature test: nonzero iff the board has USART6, 0 otherwise. */
#define BOARD_HAVE_USART6 BOARD_HAVE_USART(6)
+/**
+ * @brief Does the board break out a SPI peripheral's pins?
+ *
+ * BOARD_HAVE_SPI(n) is nonzero iff SPIn is available (n must be an
+ * integer literal: 1, 2, or 3). Also see BOARD_HAVE_SPI1,
+ * BOARD_HAVE_SPI2, BOARD_HAVE_SPI3. */
+#define BOARD_HAVE_SPI(n) (defined(BOARD_SPI##n##_NSS_PIN) && \
+ defined(BOARD_SPI##n##_SCK_PIN) && \
+ defined(BOARD_SPI##n##_MISO_PIN) && \
+ defined(BOARD_SPI##n##_MOSI_PIN))
+/** Feature test: nonzero iff the board has SPI1. */
+#define BOARD_HAVE_SPI1 BOARD_HAVE_SPI(1)
+/** Feature test: nonzero iff the board has SPI2. */
+#define BOARD_HAVE_SPI2 BOARD_HAVE_SPI(2)
+/** Feature test: nonzero iff the board has SPI3. */
+#define BOARD_HAVE_SPI3 BOARD_HAVE_SPI(3)
+
#endif