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.
at24mac.h
00001 /* 00002 * Copyright (c) 2014-2015 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * 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, WITHOUT 00012 * 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 #ifndef AT24MAC_H 00017 #define AT24MAC_H 00018 00019 #include "PinNames.h" 00020 #include "I2C.h" 00021 00022 /* 00023 * AT24MAC drivers. 00024 * 00025 * This is a EEPROM chip designed to contain factory programmed read-only EUI-64 or EUI-48, 00026 * a 128bit serial number and some user programmable EEPROM. 00027 * 00028 * AT24MAC602 contains EUI-64, use read_eui64() 00029 * AT24MAC402 contains EUI-64, use read_eui48() 00030 * 00031 * NOTE: You cannot use both EUI-64 and EUI-48. Chip contains only one of those. 00032 */ 00033 00034 class AT24Mac { 00035 public: 00036 AT24Mac(PinName sda, PinName scl); 00037 00038 /** 00039 * Read unique serial number from chip. 00040 * \param buf pointer to write serial number to. Must have space for 16 bytes. 00041 * \return zero on success, negative number on failure 00042 */ 00043 int read_serial(void *buf); 00044 00045 /** 00046 * Read EUI-64 from chip. 00047 * \param buf pointer to write EUI-64 to. Must have space for 8 bytes. 00048 * \return zero on success, negative number on failure 00049 */ 00050 int read_eui64(void *buf); 00051 00052 /** 00053 * Read EUI-48 from chip. 00054 * \param buf pointer to write EUI-48 to. Must have space for 6 bytes. 00055 * \return zero on success, negative number on failure 00056 */ 00057 int read_eui48(void *buf); 00058 00059 private: 00060 mbed::I2C _i2c; 00061 }; 00062 00063 #endif /* AT24MAC_H */
Generated on Tue Jul 12 2022 19:14:50 by
