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