Select one of the symbols to view example projects that use it.
 
Outline
#include "esp_eth_phy.h"
#include "esp_eth_mac.h"
#include "driver/spi_master.h"
#define CS_HOLD_TIME_MIN_NS
eth_enc28j60_config_t
eth_enc28j60_rev_t
enc28j60_cal_spi_cs_hold_time(int)
esp_eth_mac_new_enc28j60(const eth_enc28j60_config_t *, const eth_mac_config_t *);
esp_eth_phy_new_enc28j60(const eth_phy_config_t *);
emac_enc28j60_get_chip_info(esp_eth_mac_t *);
Files
loading...
SourceVuESP-IDF Framework and Examplesstatic_ip samplemanaged_components/espressif__enc28j60/include/esp_eth_enc28j60.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #ifdef __cplusplus extern "C" { #endif #include "esp_eth_phy.h" #include "esp_eth_mac.h" #include "driver/spi_master.h" #define CS_HOLD_TIME_MIN_NS 210 /** * @brief ENC28J60 specific configuration * *//* ... */ typedef struct { spi_host_device_t spi_host_id; /*!< SPI peripheral */ spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */ int int_gpio_num; /*!< Interrupt GPIO number */ }{ ... } eth_enc28j60_config_t; /** * @brief ENC28J60 Supported Revisions * *//* ... */ typedef enum { ENC28J60_REV_B1 = 0b00000010, ENC28J60_REV_B4 = 0b00000100, ENC28J60_REV_B5 = 0b00000101, ENC28J60_REV_B7 = 0b00000110 }{ ... } eth_enc28j60_rev_t; /** * @brief Default ENC28J60 specific configuration * *//* ... */ #define ETH_ENC28J60_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \ { \ .spi_host_id = spi_host, \ .spi_devcfg = spi_devcfg_p, \ .int_gpio_num = 4, \ }{...} ... /** * @brief Compute amount of SPI bit-cycles the CS should stay active after the transmission * to meet ENC28J60 CS Hold Time specification. * * @param clock_speed_mhz SPI Clock frequency in MHz (valid range is <1, 20>) * @return uint8_t *//* ... */ static inline uint8_t enc28j60_cal_spi_cs_hold_time(int clock_speed_mhz) { if (clock_speed_mhz <= 0 || clock_speed_mhz > 20) { return 0; }{...} int temp = clock_speed_mhz * CS_HOLD_TIME_MIN_NS; uint8_t cs_posttrans = temp / 1000; if (temp % 1000) { cs_posttrans += 1; }{...} return cs_posttrans; }{ ... } /** * @brief Create ENC28J60 Ethernet MAC instance * * @param[in] enc28j60_config: ENC28J60 specific configuration * @param[in] mac_config: Ethernet MAC configuration * * @return * - instance: create MAC instance successfully * - NULL: create MAC instance failed because some error occurred *//* ... */ esp_eth_mac_t *esp_eth_mac_new_enc28j60(const eth_enc28j60_config_t *enc28j60_config, const eth_mac_config_t *mac_config); /** * @brief Create a PHY instance of ENC28J60 * * @param[in] config: configuration of PHY * * @return * - instance: create PHY instance successfully * - NULL: create PHY instance failed because some error occurred *//* ... */ esp_eth_phy_t *esp_eth_phy_new_enc28j60(const eth_phy_config_t *config); /** * @brief Get ENC28J60 silicon revision ID * * @param mac ENC28J60 MAC Handle * @return eth_enc28j60_rev_t * - returns silicon revision ID read during initialization *//* ... */ eth_enc28j60_rev_t emac_enc28j60_get_chip_info(esp_eth_mac_t *mac); #ifdef __cplusplus }{...} #endif
Details