mbed-os-examples / Mbed OS mbed-os-example-nfc-EEPROM
Committer:
mbed_official
Date:
Mon Sep 24 17:09:39 2018 +0100
Revision:
0:86f202e07059
Add mbed deploy into the SmartPoster instructions.
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-nfc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:86f202e07059 1 /* mbed Microcontroller Library
mbed_official 0:86f202e07059 2 * Copyright (c) 2018-2018 ARM Limited
mbed_official 0:86f202e07059 3 *
mbed_official 0:86f202e07059 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 0:86f202e07059 5 * you may not use this file except in compliance with the License.
mbed_official 0:86f202e07059 6 * You may obtain a copy of the License at
mbed_official 0:86f202e07059 7 *
mbed_official 0:86f202e07059 8 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 0:86f202e07059 9 *
mbed_official 0:86f202e07059 10 * Unless required by applicable law or agreed to in writing, software
mbed_official 0:86f202e07059 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 0:86f202e07059 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 0:86f202e07059 13 * See the License for the specific language governing permissions and
mbed_official 0:86f202e07059 14 * limitations under the License.
mbed_official 0:86f202e07059 15 */
mbed_official 0:86f202e07059 16
mbed_official 0:86f202e07059 17 #include "EEPROMDriver.h"
mbed_official 0:86f202e07059 18
mbed_official 0:86f202e07059 19 #include "nfc/NFCController.h"
mbed_official 0:86f202e07059 20 #include "NfcControllerToEEPROMAdapter.h"
mbed_official 0:86f202e07059 21 #include "nfc/controllers/PN512Driver.h"
mbed_official 0:86f202e07059 22 #include "nfc/controllers/PN512SPITransportDriver.h"
mbed_official 0:86f202e07059 23 #include "target/NfcControllerToEEPROMAdapter.h"
mbed_official 0:86f202e07059 24
mbed_official 0:86f202e07059 25 using mbed::nfc::NFCController;
mbed_official 0:86f202e07059 26 using mbed::nfc::PN512SPITransportDriver;
mbed_official 0:86f202e07059 27 using mbed::nfc::PN512Driver;
mbed_official 0:86f202e07059 28 using mbed::nfc::ControllerToEEPROMDriverAdapter;
mbed_official 0:86f202e07059 29 using mbed::nfc::NFCEEPROMDriver;
mbed_official 0:86f202e07059 30
mbed_official 0:86f202e07059 31 NFCEEPROMDriver& get_eeprom_driver(events::EventQueue& queue)
mbed_official 0:86f202e07059 32 {
mbed_official 0:86f202e07059 33 static uint8_t ndef_controller_buffer[1024] = { 0 };
mbed_official 0:86f202e07059 34 static uint8_t eeprom_buffer[1024] = { 0 };
mbed_official 0:86f202e07059 35
mbed_official 0:86f202e07059 36 static PN512SPITransportDriver pn512_transport(D11, D12, D13, D10, A1, A0);
mbed_official 0:86f202e07059 37 static PN512Driver pn512_driver(&pn512_transport);
mbed_official 0:86f202e07059 38
mbed_official 0:86f202e07059 39 static NFCController nfc_controller(
mbed_official 0:86f202e07059 40 &pn512_driver,
mbed_official 0:86f202e07059 41 &queue,
mbed_official 0:86f202e07059 42 ndef_controller_buffer
mbed_official 0:86f202e07059 43 );
mbed_official 0:86f202e07059 44
mbed_official 0:86f202e07059 45 static ControllerToEEPROMDriverAdapter eeprom_driver(
mbed_official 0:86f202e07059 46 nfc_controller,
mbed_official 0:86f202e07059 47 eeprom_buffer
mbed_official 0:86f202e07059 48 );
mbed_official 0:86f202e07059 49 return eeprom_driver;
mbed_official 0:86f202e07059 50 }
mbed_official 0:86f202e07059 51