forked from njh/EtherCard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enc28j60.h
executable file
·46 lines (35 loc) · 1.26 KB
/
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
// Microchip ENC28J60 Ethernet Interface Driver
// Author: Pascal Stang
// Modified by: Guido Socher
// Copyright: GPL V2
//
// This driver provides initialization and transmit/receive
// functions for the Microchip ENC28J60 10Mb Ethernet Controller and PHY.
// This chip is novel in that it is a full MAC+PHY interface all in a 28-pin
// chip, using an SPI interface to the host processor.
//
// 2010-05-20 <jc@wippler.nl>
#ifndef ENC28J60_H
#define ENC28J60_H
class ENC28J60 {
public:
static uint8_t buffer[];
static uint16_t bufferSize;
static uint8_t* tcpOffset () { return buffer + 0x36; }
static void initSPI ();
static uint8_t initialize (const uint16_t size, const uint8_t* macaddr,
uint8_t csPin =8);
static bool isLinkUp ();
static void packetSend (uint16_t len);
static uint16_t packetReceive ();
static void copyout (uint8_t page, const uint8_t* data);
static void copyin (uint8_t page, uint8_t* data);
static uint8_t peekin (uint8_t page, uint8_t off);
static void powerDown(); // contrib by Alex M.
static void powerUp(); // contrib by Alex M.
static void enableBroadcast();
static void disableBroadcast();
static uint8_t doBIST(uint8_t csPin =8);
};
typedef ENC28J60 Ethernet;
#endif