mirror of https://github.com/ARMmbed/mbed-os.git
Update NFC EEPROM Driver and add implementation
parent
8c4e4d855c
commit
a4a8ee1b49
|
@ -68,12 +68,14 @@ namespace nfc {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Implementation of NFCEEPROMDriver::Delegate
|
// Implementation of NFCEEPROMDriver::Delegate
|
||||||
virtual void has_started_session(bool success);
|
virtual void on_session_started(bool success);
|
||||||
virtual void has_read_bytes(bool success);
|
virtual void on_session_ended(bool success);
|
||||||
virtual void has_written_bytes(bool success);
|
virtual void on_bytes_read(size_t count);
|
||||||
virtual void has_set_size(bool success);
|
virtual void on_bytes_written(size_t count);
|
||||||
virtual void has_gotten_size(bool success, size_t size);
|
virtual void on_size_set(bool success);
|
||||||
virtual void has_erased_bytes(bool success);
|
virtual void on_size_gotten(bool success, size_t size);
|
||||||
|
virtual void on_bytes_erased(size_t count);
|
||||||
|
virtual void on_event();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,35 +52,35 @@ namespace nfc {
|
||||||
*
|
*
|
||||||
* @param[in] success whether this operation succeeded
|
* @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.
|
* Completion of session end operation.
|
||||||
*
|
*
|
||||||
* @param[in] success whether this operation succeeded
|
* @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.
|
* 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.
|
* 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.
|
* Completion of size setting operation.
|
||||||
*
|
*
|
||||||
* @param[in] success whether this operation succeeded
|
* @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.
|
* Completion of size retrieval operation.
|
||||||
|
@ -88,14 +88,21 @@ namespace nfc {
|
||||||
* @param[in] success whether this operation succeeded
|
* @param[in] success whether this operation succeeded
|
||||||
* @param[out] the current addressable memory size
|
* @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.
|
* 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;
|
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.
|
* Get the maximum memory size addressable by the EEPROM.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue