Update NFC EEPROM Driver and add implementation

pull/7822/head
Donatien Garnier 2018-08-16 14:07:46 +01:00
parent 8c4e4d855c
commit a4a8ee1b49
3 changed files with 58 additions and 16 deletions

View File

@ -68,12 +68,14 @@ namespace nfc {
private:
// Implementation of NFCEEPROMDriver::Delegate
virtual void has_started_session(bool success);
virtual void has_read_bytes(bool success);
virtual void has_written_bytes(bool success);
virtual void has_set_size(bool success);
virtual void has_gotten_size(bool success, size_t size);
virtual void has_erased_bytes(bool success);
virtual void on_session_started(bool success);
virtual void on_session_ended(bool success);
virtual void on_bytes_read(size_t count);
virtual void on_bytes_written(size_t count);
virtual void on_size_set(bool success);
virtual void on_size_gotten(bool success, size_t size);
virtual void on_bytes_erased(size_t count);
virtual void on_event();
};
/**

View File

@ -52,35 +52,35 @@ namespace nfc {
*
* @param[in] success whether this operation succeeded
*/
virtual void has_started_session(bool success) = 0;
virtual void on_session_started(bool success) = 0;
/**
* Completion of session end operation.
*
* @param[in] success whether this operation succeeded
*/
virtual void has_ended_session(bool success) = 0;
virtual void on_session_ended(bool success) = 0;
/**
* Completion of read operation.
*
* @param[in] success whether this operation succeeded
* @param[in] count number of bytes actually read
*/
virtual void has_read_bytes(bool success) = 0;
virtual void on_bytes_read(size_t count) = 0;
/**
* Completion of write operation.
*
* @param[in] success whether this operation succeeded
* @param[in] count number of bytes actually written
*/
virtual void has_written_bytes(bool success) = 0;
virtual void on_bytes_written(size_t count) = 0;
/**
* Completion of size setting operation.
*
* @param[in] success whether this operation succeeded
*/
virtual void has_set_size(bool success) = 0;
virtual void on_size_set(bool success) = 0;
/**
* Completion of size retrieval operation.
@ -88,14 +88,21 @@ namespace nfc {
* @param[in] success whether this operation succeeded
* @param[out] the current addressable memory size
*/
virtual void has_gotten_size(bool success, size_t size) = 0;
virtual void on_size_gotten(bool success, size_t size) = 0;
/**
* Completion of erasing operation.
*
* @param[in] success whether this operation succeeded
* @param[in] count number of bytes actually erased
*/
virtual void has_erased_bytes(bool success) = 0;
virtual void on_bytes_erased(size_t count) = 0;
/**
* Signal the user that the process_events() need to be called
*
* @note this function can be called in interrupt context
*/
virtual void on_event();
};
/**
@ -111,6 +118,11 @@ namespace nfc {
*/
virtual void reset() = 0;
/**
* Process events raised by the driver in interrupt context.
*/
virtual void process_events();
/**
* Get the maximum memory size addressable by the EEPROM.
*/

View File

@ -0,0 +1,28 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "NFCEEPROMDriver.h"
using namespace mbed;
using namespace mbed::nfc;
NFCEEPROMDriver::NFCEEPROMDriver() : _delegate(NULL) {
}
void NFCEEPROMDriver::set_delegate(Delegate* delegate) {
_delegate = delegate;
}