at24mac.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Benjamin Valentin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef AT24MAC_H
21 #define AT24MAC_H
22 
23 #include <stdint.h>
24 #include "net/eui48.h"
25 #include "net/eui64.h"
26 #include "periph/i2c.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 typedef uint_fast8_t at24mac_t;
36 
37 #define AT24MAC_ID_LEN (16)
42 typedef enum {
46 
50 typedef struct {
52  uint8_t i2c_addr;
55 
65 int at24mac_get_eui48(at24mac_t dev, eui48_t *addr);
66 
76 int at24mac_get_eui64(at24mac_t dev, eui64_t *addr);
77 
88 int at24mac_get_id128(at24mac_t dev, void *dst);
89 
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* AT24MAC_H */
105 
at24mac_get_eui64
int at24mac_get_eui64(at24mac_t dev, eui64_t *addr)
Get the unique EUI64 address from a AT24MAC6xx chip.
AT24MAC4XX
@ AT24MAC4XX
provides EUI-48
Definition: at24mac.h:43
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
eui48_t
Data type to represent an EUI-48.
Definition: eui48.h:35
at24mac_type_t
at24mac_type_t
Type of the AT24Mac device.
Definition: at24mac.h:42
at24mac_params_t::i2c_dev
i2c_t i2c_dev
I2C device
Definition: at24mac.h:51
at24mac_get_type
at24mac_type_t at24mac_get_type(at24mac_t dev)
Get the type of a AT24MACxxx chip.
at24mac_get_id128
int at24mac_get_id128(at24mac_t dev, void *dst)
Get the unique ID from a AT24MACxxx chip.
at24mac_params_t::type
at24mac_type_t type
Device type
Definition: at24mac.h:53
at24mac_t
uint_fast8_t at24mac_t
Device handle type for AT24Mac devices.
Definition: at24mac.h:35
at24mac_get_eui48
int at24mac_get_eui48(at24mac_t dev, eui48_t *addr)
Get the unique EUI48 address from a AT24MAC4xx chip.
eui64_t
Data type to represent an EUI-64.
Definition: eui64.h:55
AT24MAC6XX
@ AT24MAC6XX
provides EUI-64
Definition: at24mac.h:44
eui64.h
EUI-64 data type definition.
i2c.h
Low-level I2C peripheral driver interface definition.
at24mac_params_t
struct holding all params needed for device communication
Definition: at24mac.h:50
eui48.h
Definition and IPv6 IID conversion for IEEE EUI-48 identifiers.
at24mac_params_t::i2c_addr
uint8_t i2c_addr
I2C address
Definition: at24mac.h:52