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