PN532 Driver library This library provides an abstract API to drive the pn532 nfc chip, with I2C/HSU/SPI interface. Its based on the Seeed Studio's Arduino version.

Dependents:   PN532_ReadUid Nfctest2

Revision:
0:db8030e71f55
diff -r 000000000000 -r db8030e71f55 SPIClass.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SPIClass.h	Tue Sep 13 06:01:19 2016 +0000
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010 by Cristian Maglie <c.maglie@bug.st>
+ * SPI Master library for arduino.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either the GNU General Public License version 2
+ * or the GNU Lesser General Public License version 2.1, both as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _SPI_H_INCLUDED
+#define _SPI_H_INCLUDED
+
+#include <stdio.h>
+#include <Arduino.h>
+
+
+#define SPI_CLOCK_DIV2     SPI_BaudRatePrescaler_2  
+#define SPI_CLOCK_DIV4     SPI_BaudRatePrescaler_4  
+#define SPI_CLOCK_DIV8     SPI_BaudRatePrescaler_8  
+#define SPI_CLOCK_DIV16    SPI_BaudRatePrescaler_16 
+#define SPI_CLOCK_DIV32    SPI_BaudRatePrescaler_32 
+#define SPI_CLOCK_DIV64    SPI_BaudRatePrescaler_64 
+#define SPI_CLOCK_DIV128   SPI_BaudRatePrescaler_128
+#define SPI_CLOCK_DIV256   SPI_BaudRatePrescaler_256
+
+#define SPI_MODE0 0x00
+#define SPI_MODE1 0x04
+#define SPI_MODE2 0x08
+#define SPI_MODE3 0x0C
+
+
+class SPIClass {
+public:
+  uint8_t transfer(uint8_t _data);
+
+  // SPI Configuration methods
+
+  inline static void attachInterrupt();
+  inline static void detachInterrupt(); // Default
+
+  void begin(); // Default
+  void end();
+
+  void setBitOrder(uint8_t);
+  void setDataMode(uint8_t);
+  void setClockDivider(uint8_t);
+private:
+  SPI_TypeDef *spi;
+  SPI_InitTypeDef SPI_InitStructure;
+  uint16_t bitOrder;
+};
+
+extern SPIClass SPI;
+
+
+
+#endif