Mistake on this page?
Report an issue in GitHub or email us
NFCControllerDriver.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_NFC_CONTROLLER_DRIVER_H
18 #define MBED_NFC_CONTROLLER_DRIVER_H
19 
20 #include <stdint.h>
21 #include "events/EventQueue.h"
22 
23 #include "stack/nfc_errors.h"
24 #include "stack/transceiver/transceiver.h"
25 #include "stack/platform/nfc_scheduler.h"
26 
27 namespace mbed {
28 namespace nfc {
29 
30 /**
31  * @addtogroup nfc
32  * @{
33  */
34 
35 /**
36  * The abstraction for a NFC controller driver.
37  * Implementers need to derive from this class and implement its methods.
38  */
40 public:
41  /**
42  * Instantiate a NFCControllerDriver
43  */
45 
46  /**
47  * NFCControllerDriver destructor
48  */
49  virtual ~NFCControllerDriver();
50 
51  /**
52  * The NFCControllerDriver delegate
53  */
54  struct Delegate {
55  /**
56  * Called when the controller asserts the interrupt line
57  */
58  virtual void on_hw_interrupt() {}
59 
60  protected:
61  ~Delegate() {}
62  };
63 
64  /**
65  * Initialize the driver and retrieve the interface to the controller.
66  *
67  * @param[in] scheduler_timer a timer to initialize the controller's scheduler instance with
68  * @return an initialized MicroNFC nfc_transceiver_t instance
69  */
70  virtual nfc_transceiver_t *initialize(nfc_scheduler_timer_t *scheduler_timer) = 0;
71 
72  /**
73  * Retrieve list of technologies supported by the controller
74  * @param[out] initiator bitmask of technologies supported when the controller is in initiator mode
75  * @param[out] target bitmask of technologies supported when the controller is in target mode
76  */
77  virtual void get_supported_nfc_techs(nfc_tech_t *initiator, nfc_tech_t *target) const = 0;
78 
79  /**
80  * Set this instance's delegate
81  *
82  * @param[in] delegate the delegate instance to use
83  */
84  void set_delegate(Delegate *delegate);
85 
86 protected:
87  /**
88  * An implementation must call this function (can be called from interrupt context)
89  * when the controller asserts its interrupt line
90  */
91  void hw_interrupt();
92 
93 private:
94  Delegate *_delegate;
95 };
96 
97 /**
98  * @}
99  */
100 
101 } // namespace nfc
102 } // namespace mbed
103 
104 #endif
virtual ~NFCControllerDriver()
NFCControllerDriver destructor.
The abstraction for a NFC controller driver.
virtual void on_hw_interrupt()
Called when the controller asserts the interrupt line.
void hw_interrupt()
An implementation must call this function (can be called from interrupt context) when the controller ...
virtual nfc_transceiver_t * initialize(nfc_scheduler_timer_t *scheduler_timer)=0
Initialize the driver and retrieve the interface to the controller.
void set_delegate(Delegate *delegate)
Set this instance&#39;s delegate.
virtual void get_supported_nfc_techs(nfc_tech_t *initiator, nfc_tech_t *target) const =0
Retrieve list of technologies supported by the controller.
NFCControllerDriver()
Instantiate a NFCControllerDriver.
The NFCControllerDriver delegate.
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.