Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PN512SPITransportDriver.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2018 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef MBED_PN512_SPI_TRANSPORT_DRIVER_H 00018 #define MBED_PN512_SPI_TRANSPORT_DRIVER_H 00019 00020 #include <stdint.h> 00021 00022 #include "platform/platform.h" 00023 #include "platform/nfc_transport.h" 00024 #include "PN512TransportDriver.h" 00025 00026 #include "drivers/SPI.h" 00027 #include "drivers/DigitalOut.h" 00028 #include "drivers/InterruptIn.h" 00029 00030 namespace mbed { 00031 namespace nfc { 00032 00033 class PN512SPITransportDriver : public PN512TransportDriver { 00034 public: 00035 PN512SPITransportDriver(PinName mosi, PinName miso, PinName sclk, PinName ssel, PinName irq, PinName rst); 00036 00037 private: 00038 virtual void initialize(); 00039 virtual nfc_transport_t *get_transport(); 00040 00041 void transport_write(uint8_t address, const uint8_t *outBuf, size_t outLen); 00042 void transport_read(uint8_t address, uint8_t *inBuf, size_t inLen); 00043 00044 // Callbacks from munfc 00045 static void s_transport_write(uint8_t address, const uint8_t *outBuf, size_t outLen, void *pUser); 00046 static void s_transport_read(uint8_t address, uint8_t *inBuf, size_t inLen, void *pUser); 00047 00048 nfc_transport_t _nfc_transport; 00049 mbed::SPI _spi; 00050 mbed::DigitalOut _ssel; 00051 mbed::InterruptIn _irq; 00052 mbed::DigitalOut _rst; 00053 }; 00054 00055 } // namespace nfc 00056 } // namespace mbed 00057 00058 #endif
Generated on Tue Aug 9 2022 00:37:17 by
1.7.2