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