Mbed OS Reference
Loading...
Searching...
No Matches
PN512TransportDriver.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_TRANSPORT_DRIVER_H
19#define MBED_PN512_TRANSPORT_DRIVER_H
20
21#include <stdint.h>
23
24
25namespace mbed {
26namespace nfc {
27/**
28 * The PN512 supports multiple transport mechanisms (SPI, I2C, UART): this class provides a unified API across these transports
29 */
31public:
32 /**
33 * The PN512TransportDriver delegate
34 */
35 struct Delegate {
36 /**
37 * Called when the PN512 asserts the interrupt line
38 */
39 virtual void on_hw_interrupt() {}
40
41 protected:
42 ~Delegate() {}
43 };
44
45 /**
46 * Create a PN512TransportDriver instance
47 */
49
50 /**
51 * PN512TransportDriver destructor.
52 */
54
55 /**
56 * Initialize transport driver and perform a chip reset
57 */
58 virtual void initialize() = 0;
59
60 /**
61 * Retrieve the nfc_transport_t struct for the stack to use
62 *
63 * @return a pointer to a nfc_transport_t struct
64 */
66
67 /**
68 * Set this instance's delegate
69 *
70 * @param[in] delegate the delegate instance to use
71 */
72 void set_delegate(Delegate *delegate);
73protected:
74
75 /**
76 * An implementation must call this function (can be called from interrupt context)
77 * when the PN512 asserts its interrupt line
78 */
80private:
81 Delegate *_delegate;
82};
83
84} // namespace nfc
85} // namespace mbed
86
87#endif
The PN512 supports multiple transport mechanisms (SPI, I2C, UART): this class provides a unified API ...
PN512TransportDriver()
Create a PN512TransportDriver instance.
virtual nfc_transport_t * get_transport()=0
Retrieve the nfc_transport_t struct for the stack to use.
virtual ~PN512TransportDriver()
PN512TransportDriver destructor.
virtual void initialize()=0
Initialize transport driver and perform a chip reset.
void hw_interrupt()
An implementation must call this function (can be called from interrupt context) when the PN512 asser...
void set_delegate(Delegate *delegate)
Set this instance's delegate.
The PN512TransportDriver delegate.
virtual void on_hw_interrupt()
Called when the PN512 asserts the interrupt line.