Mistake on this page?
Report an issue in GitHub or email us
PN512SPITransportDriver.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MBED_PN512_SPI_TRANSPORT_DRIVER_H
18 #define MBED_PN512_SPI_TRANSPORT_DRIVER_H
19 
20 #include <stdint.h>
21 
22 #include "platform/platform.h"
23 #include "platform/nfc_transport.h"
24 #include "PN512TransportDriver.h"
25 
26 #include "drivers/SPI.h"
27 #include "drivers/DigitalOut.h"
28 #include "drivers/InterruptIn.h"
29 
30 namespace mbed {
31 namespace nfc {
32 
34 public:
35  PN512SPITransportDriver(PinName mosi, PinName miso, PinName sclk, PinName ssel, PinName irq, PinName rst);
36 
37 private:
38  virtual void initialize();
39  virtual nfc_transport_t *get_transport();
40 
41  void transport_write(uint8_t address, const uint8_t *outBuf, size_t outLen);
42  void transport_read(uint8_t address, uint8_t *inBuf, size_t inLen);
43 
44  // Callbacks from munfc
45  static void s_transport_write(uint8_t address, const uint8_t *outBuf, size_t outLen, void *pUser);
46  static void s_transport_read(uint8_t address, uint8_t *inBuf, size_t inLen, void *pUser);
47 
48  nfc_transport_t _nfc_transport;
49  mbed::SPI _spi;
50  mbed::DigitalOut _ssel;
51  mbed::InterruptIn _irq;
52  mbed::DigitalOut _rst;
53 };
54 
55 } // namespace nfc
56 } // namespace mbed
57 
58 #endif
A digital interrupt input, used to call a function on a rising or falling edge.
Definition: InterruptIn.h:65
A digital output, used for setting the state of a pin.
Definition: DigitalOut.h:49
A SPI Master, used for communicating with SPI slave devices.
Definition: SPI.h:98
The PN512 supports multiple transport mechanisms (SPI, I2C, UART): this class provides a unified API ...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.