AppNearMe µNFC stack for the NXP PN532 chip License: You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!

Dependents:   IOT_sensor_nfc AppNearMe_MuNFC_PN532_Test p2p_nfc_test NFCMoodLamp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers spi.h Source File

spi.h

00001 /*
00002     spi.h 
00003   Copyright (c) Donatien Garnier 2012
00004   donatien.garnier@appnearme.com
00005   http://www.appnearme.com/
00006 */
00007 
00008 #ifndef SPI_H_
00009 #define SPI_H_
00010 
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014 
00015 #include "core/fwk.h"
00016 
00017 //These functions must be implemented for each platform
00018 
00019 /*
00020  * After skipping outSkip bytes, write outLen bytes
00021  * After skipping inSkip bytes, read inLen bytes
00022  * This will generate MAX(outSkip + outLen, inSkip + inLen) transfers on the SPI bus
00023  */
00024 int spi_transfer( uint8_t* outBuf, size_t outLen, size_t outSkip, uint8_t* inBuf, size_t inLen, size_t inSkip );
00025 
00026 /*
00027  * Write outLen bytes
00028  */
00029 int spi_write( uint8_t* outBuf, size_t outLen );
00030 
00031 /*
00032  * Read inLen bytes
00033  */
00034 int spi_read( uint8_t* inBuf, size_t inLen );
00035 
00036 /*
00037  * Skip len bytes
00038  */
00039 int spi_skip( size_t len );
00040 
00041 #ifdef __cplusplus
00042 }
00043 #endif
00044 
00045 #endif /* SPI_H_ */