Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

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