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 00021 #if DEVICE_I2C 00022 00023 #include "I2C.h" 00024 #include "drivers/DigitalInOut.h" 00025 #include "platform/mbed_wait_api.h" 00026 00027 /* 00028 * AT24MAC drivers. 00029 * 00030 * This is a EEPROM chip designed to contain factory programmed read-only EUI-64 or EUI-48, 00031 * a 128bit serial number and some user programmable EEPROM. 00032 * 00033 * AT24MAC602 contains EUI-64, use read_eui64() 00034 * AT24MAC402 contains EUI-64, use read_eui48() 00035 * 00036 * NOTE: You cannot use both EUI-64 and EUI-48. Chip contains only one of those. 00037 */ 00038 00039 class AT24Mac { 00040 public: 00041 AT24Mac(PinName sda, PinName scl); 00042 00043 /** 00044 * Read unique serial number from chip. 00045 * \param buf pointer to write serial number to. Must have space for 16 bytes. 00046 * \return zero on success, negative number on failure 00047 */ 00048 int read_serial(void *buf); 00049 00050 /** 00051 * Read EUI-64 from chip. 00052 * \param buf pointer to write EUI-64 to. Must have space for 8 bytes. 00053 * \return zero on success, negative number on failure 00054 */ 00055 int read_eui64(void *buf); 00056 00057 /** 00058 * Read EUI-48 from chip. 00059 * \param buf pointer to write EUI-48 to. Must have space for 6 bytes. 00060 * \return zero on success, negative number on failure 00061 */ 00062 int read_eui48(void *buf); 00063 00064 private: 00065 mbed::I2C _i2c; 00066 }; 00067 00068 #endif /* DEVICE_I2C */ 00069 #endif /* AT24MAC_H */
Generated on Tue Aug 9 2022 00:37:02 by
1.7.2