Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

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