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