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