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  * 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 
25 namespace mbed {
26 namespace nfc {
27 /**
28  * The PN512 supports multiple transport mechanisms (SPI, I2C, UART): this class provides a unified API across these transports
29  */
31 public:
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  */
53  virtual ~PN512TransportDriver();
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  */
65  virtual nfc_transport_t *get_transport() = 0;
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);
73 protected:
74 
75  /**
76  * An implementation must call this function (can be called from interrupt context)
77  * when the PN512 asserts its interrupt line
78  */
79  void hw_interrupt();
80 private:
81  Delegate *_delegate;
82 };
83 
84 } // namespace nfc
85 } // namespace mbed
86 
87 #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.