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
SPIClass.h
- Committer:
- dotnfc
- Date:
- 2016-09-13
- Revision:
- 0:db8030e71f55
File content as of revision 0:db8030e71f55:
/* * 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