123r
Dependencies: WNC14A2AInterface
atmel-rf-driver/source/at24mac.h@7:c8e4e62c5fa7, 2019-05-02 (annotated)
- Committer:
- m_ahsan
- Date:
- Thu May 02 13:15:26 2019 +0000
- Revision:
- 7:c8e4e62c5fa7
- Parent:
- 0:2563b0415d1f
123
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 0:2563b0415d1f | 1 | /* |
JMF | 0:2563b0415d1f | 2 | * Copyright (c) 2014-2015 ARM Limited. All rights reserved. |
JMF | 0:2563b0415d1f | 3 | * SPDX-License-Identifier: Apache-2.0 |
JMF | 0:2563b0415d1f | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
JMF | 0:2563b0415d1f | 5 | * not use this file except in compliance with the License. |
JMF | 0:2563b0415d1f | 6 | * You may obtain a copy of the License at |
JMF | 0:2563b0415d1f | 7 | * |
JMF | 0:2563b0415d1f | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
JMF | 0:2563b0415d1f | 9 | * |
JMF | 0:2563b0415d1f | 10 | * Unless required by applicable law or agreed to in writing, software |
JMF | 0:2563b0415d1f | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
JMF | 0:2563b0415d1f | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
JMF | 0:2563b0415d1f | 13 | * See the License for the specific language governing permissions and |
JMF | 0:2563b0415d1f | 14 | * limitations under the License. |
JMF | 0:2563b0415d1f | 15 | */ |
JMF | 0:2563b0415d1f | 16 | #ifndef AT24MAC_H |
JMF | 0:2563b0415d1f | 17 | #define AT24MAC_H |
JMF | 0:2563b0415d1f | 18 | |
JMF | 0:2563b0415d1f | 19 | #include "PinNames.h" |
JMF | 0:2563b0415d1f | 20 | #include "I2C.h" |
JMF | 0:2563b0415d1f | 21 | |
JMF | 0:2563b0415d1f | 22 | /* |
JMF | 0:2563b0415d1f | 23 | * AT24MAC drivers. |
JMF | 0:2563b0415d1f | 24 | * |
JMF | 0:2563b0415d1f | 25 | * This is a EEPROM chip designed to contain factory programmed read-only EUI-64 or EUI-48, |
JMF | 0:2563b0415d1f | 26 | * a 128bit serial number and some user programmable EEPROM. |
JMF | 0:2563b0415d1f | 27 | * |
JMF | 0:2563b0415d1f | 28 | * AT24MAC602 contains EUI-64, use read_eui64() |
JMF | 0:2563b0415d1f | 29 | * AT24MAC402 contains EUI-64, use read_eui48() |
JMF | 0:2563b0415d1f | 30 | * |
JMF | 0:2563b0415d1f | 31 | * NOTE: You cannot use both EUI-64 and EUI-48. Chip contains only one of those. |
JMF | 0:2563b0415d1f | 32 | */ |
JMF | 0:2563b0415d1f | 33 | |
JMF | 0:2563b0415d1f | 34 | class AT24Mac { |
JMF | 0:2563b0415d1f | 35 | public: |
JMF | 0:2563b0415d1f | 36 | AT24Mac(PinName sda, PinName scl); |
JMF | 0:2563b0415d1f | 37 | |
JMF | 0:2563b0415d1f | 38 | /** |
JMF | 0:2563b0415d1f | 39 | * Read unique serial number from chip. |
JMF | 0:2563b0415d1f | 40 | * \param buf pointer to write serial number to. Must have space for 16 bytes. |
JMF | 0:2563b0415d1f | 41 | * \return zero on success, negative number on failure |
JMF | 0:2563b0415d1f | 42 | */ |
JMF | 0:2563b0415d1f | 43 | int read_serial(void *buf); |
JMF | 0:2563b0415d1f | 44 | |
JMF | 0:2563b0415d1f | 45 | /** |
JMF | 0:2563b0415d1f | 46 | * Read EUI-64 from chip. |
JMF | 0:2563b0415d1f | 47 | * \param buf pointer to write EUI-64 to. Must have space for 8 bytes. |
JMF | 0:2563b0415d1f | 48 | * \return zero on success, negative number on failure |
JMF | 0:2563b0415d1f | 49 | */ |
JMF | 0:2563b0415d1f | 50 | int read_eui64(void *buf); |
JMF | 0:2563b0415d1f | 51 | |
JMF | 0:2563b0415d1f | 52 | /** |
JMF | 0:2563b0415d1f | 53 | * Read EUI-48 from chip. |
JMF | 0:2563b0415d1f | 54 | * \param buf pointer to write EUI-48 to. Must have space for 6 bytes. |
JMF | 0:2563b0415d1f | 55 | * \return zero on success, negative number on failure |
JMF | 0:2563b0415d1f | 56 | */ |
JMF | 0:2563b0415d1f | 57 | int read_eui48(void *buf); |
JMF | 0:2563b0415d1f | 58 | |
JMF | 0:2563b0415d1f | 59 | private: |
JMF | 0:2563b0415d1f | 60 | mbed::I2C _i2c; |
JMF | 0:2563b0415d1f | 61 | }; |
JMF | 0:2563b0415d1f | 62 | |
JMF | 0:2563b0415d1f | 63 | #endif /* AT24MAC_H */ |