Skip to content

Commit 612d901

Browse files
committed
add Enc28J60.powerOff(), Enc28J60.powerOn() and Enc28J60.getrev()
2 parents 0ff16ea + e26876b commit 612d901

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

utility/Enc28J60Network.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,3 +556,23 @@ Enc28J60Network::chksum(uint16_t sum, memhandle handle, memaddress pos, uint16_t
556556
return sum;
557557
}
558558

559+
void
560+
Enc28J60Network::powerOff()
561+
{
562+
writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_RXEN);
563+
delay(50);
564+
writeOp(ENC28J60_BIT_FIELD_SET, ECON2, ECON2_VRPS);
565+
delay(50);
566+
writeOp(ENC28J60_BIT_FIELD_SET, ECON2, ECON2_PWRSV);
567+
}
568+
569+
void
570+
Enc28J60Network::powerOn()
571+
{
572+
writeOp(ENC28J60_BIT_FIELD_CLR, ECON2, ECON2_PWRSV);
573+
delay(50);
574+
writeOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_RXEN);
575+
delay(50);
576+
}
577+
578+
Enc28J60Network Enc28J60;

utility/Enc28J60Network.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ class Enc28J60Network : public MemoryPool
7070

7171
public:
7272

73-
static uint8_t getrev(void);
73+
uint8_t getrev(void);
74+
void powerOn();
75+
void powerOff();
7476

7577
static void init(uint8_t* macaddr);
7678
static memhandle receivePacket();
@@ -83,4 +85,5 @@ class Enc28J60Network : public MemoryPool
8385
static uint16_t chksum(uint16_t sum, memhandle handle, memaddress pos, uint16_t len);
8486
};
8587

88+
extern Enc28J60Network Enc28J60;
8689
#endif /* Enc28J60NetworkClass_H_ */

0 commit comments

Comments
 (0)