Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sstaub committed Oct 5, 2021
1 parent eee0a6b commit 43052a1
Show file tree
Hide file tree
Showing 415 changed files with 5,737 additions and 141,034 deletions.
460 changes: 439 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

426 changes: 271 additions & 155 deletions README.md

Large diffs are not rendered by default.

50 changes: 39 additions & 11 deletions examples/gma3_Arduino/gma3_Arduino.ino
Original file line number Diff line number Diff line change
@@ -1,37 +1,53 @@
#include <Ethernet3.h>
#include <EthernetUdp3.h>
#include "OSCMessage.h"
#include "gma3.h"

#define BTN_KEY 2
#define ENC_1_A 3
#define ENC_1_B 4
#define BTN_CMD 5
#define FADER A0

// network data
uint8_t mac[] = {0x90, 0xA2, 0xDA, 0x10, 0x14, 0x48};
#define GMA3_UDP_PORT 8000 // UDP Port configured in gma3
#define GMA3_TCP_PORT 9000 // UDP Port configured in gma3

IPAddress localIP(10, 101, 1, 201); // IP address of the microcontroller board
IPAddress subnet(255, 255, 0, 0); // subnet range
uint16_t localUdpPort = GMA3_UDP_PORT;
IPAddress gma3IP(10, 101, 1, 100); // IP address of the gma3 console
uint16_t gma3UdpPort = GMA3_UDP_PORT;
uint16_t gma3TcpPort = GMA3_TCP_PORT;

EthernetUDP udp;
EthernetUDP udpQLab;
EthernetClient tcp;
EthernetClient tcpQLab;

// hardware definitions
Key key201(A1, 1, 201);
Fader fader201(A0, 1, 201);
ExecutorKnob enc301(A3, A4, 1, 301, REVERSE);
CmdButton macro1(A2, "GO+ Macro 1");
Fader fader201(FADER, 1, 201);
Key key201(BTN_KEY, 1, 201, TCP);
ExecutorKnob enc301(ENC_1_A, ENC_1_B, 1, 301);
CmdButton macro1(BTN_CMD, "GO+ Macro 1", TCP);

// use of generic OSC button
#define QLAB_GO_PIN 2
#define QLAB_GO_PIN 6
IPAddress qlabIP(10, 101, 1, 100); // IP of QLab
uint16_t qlabPort = 53000; // QLab receive port
OscButton qlabGo(QLAB_GO_PIN , "/go", qlabIP, qlabPort);
OscButton qlabGo(QLAB_GO_PIN , "/go", TCPSLIP);

void setup() {
Serial.begin(9600);
/* for USR-ES1 module
Ethernet.setRstPin(9);
Ethernet.hardreset();
*/
Ethernet.begin(mac, localIP, subnet);
udp.begin(localUdpPort);
interface(udp, gma3IP, gma3UdpPort);
setPrefix("gma3");
interfaceGMA3(gma3IP);
interfaceUDP(udp, gma3UdpPort);
interfaceTCP(tcp, gma3TcpPort);
interfaceExternUDP(udpQLab, qlabIP, qlabPort);
interfaceExternTCP(tcpQLab, qlabIP, qlabPort);
}

void loop() {
Expand All @@ -40,4 +56,16 @@ void loop() {
enc301.update();
macro1.update();
qlabGo.update();
if (receiveUDP()) {
Serial.print("OSC Pattern: ");
Serial.print(patternOSC());
Serial.print(" String: ");
Serial.print(stringOSC());
Serial.print(" Integer 1: ");
Serial.print(int1OSC());
Serial.print(" Integer 2: ");
Serial.print(int2OSC());
Serial.print(" Float: ");
Serial.println(floatOSC());
}
}
File renamed without changes.
7 changes: 7 additions & 0 deletions examples/gma3_Arduino_PIO/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
227 changes: 227 additions & 0 deletions examples/gma3_Arduino_PIO/lib/Ethernet3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
# Ethernet3 v1.5
Ethernet library for Arduino and Ethernetshield2 / WIZ550io / WIZ850io / USR-ES1 with Wiznet W5500 chip
based on the Ethernet2 library of arduino.org

I added many new functionalities.

## new in 1.5
- custom hostname for DHCP
- the PHY is configurable
- Wake on LAN
- added new example for webclient "WebClientReadResponse.ino"

You need to include

#include <Ethernet3.h> // instead Ethernet.h
#include <EthernetUdp3.h> // instead EthernetUdp.h for UDP functionality

## Custom Hostname

For use with DHCP you can set a custom hostname, this must be done before Ethernet.begin(mac).

Ethernet.setHostname(char* hostname);

## PHY Configuration

The PHY is now configurable, this must done after Ethernet.begin()
Following modes are possible:
HALF_DUPLEX_10,
FULL_DUPLEX_10,
HALF_DUPLEX_100,
FULL_DUPLEX_100,
FULL_DUPLEX_100_AUTONEG,
POWER_DOWN,
ALL_AUTONEG (default)

Ethernet.phyMode(phyMode_t mode);

## Wake on LAN

You can set the Wake on LAN functionality

Ethernet.WoL(bool wol);

## what's next

In version 2 there will mDNS and a large code cleanup

A new NTP library is published https://github.com/sstaub/NTP

## New init procedure **!!!**

The init of the Ethernetinterface changed, the ordner is now:

Ethernet.begin(mac, ip, subnet, gateway, dns);

This is more logical.


## Multicast support

Multicast for udp added. You need to set the Multicast IP address and port to listen.

***example***

EthernetUdp udp
upd.beginMulticast(multicastIP, port);

An Unicast blocking function is added to set and get the flag in a UDP socket.

void setUnicastBlock(bool block);
bool getUnicastBlock();

***example***

EthernetUDP udp;
udp.setUnicastBlock(true);

// to restore the value to standard

udp.setUnicastBlock(false);
udp.setUnicastBlock();

## PHY support

Added some function to read the PHYCFGR in Ethernet3.

uint8_t phyState(); // returns the PHYCFGR
uint8_t link(); // returns the linkstate, 1 = linked, 0 = no link
const char* linkReport(); // returns the linkstate as a string
uint8_t speed(); // returns speed in MB/s
const char* speedReport(); // returns speed as a string
uint8_t duplex(); // returns duplex mode 0 = no link, 1 = Half Duplex, 2 = Full Duplex
const char* duplexReport(); // returns duplex mode as a string

***example***

Serial.println(Ethernet.linkReport());

## MAC address

Added some function to read the MAC address in Ethernet3, this is helpfull when you use Wiznet boards like WIZ550io with build in MAC address.

void macAddress(uint8_t mac[]); // get the MAC Address
const char* macAddressReport(); // returns the the MAC Address as a string

***example***

uint8_t mac[6]; // array for mac address
Ethernet.macAddress(mac);

## Socket RAM-Size

You can de- or increase the RAM-Size for the sockets, this must be done before Ethernet.begin(...)

The possible socketnumbers are:

Ethernet.init(1); -> 1 Socket with 16k RX/TX buffer
Ethernet.init(2); -> 2 Socket with 8k RX/TX buffer
Ethernet.init(4); -> 4 Socket with 4k RX/TX buffer
Ethernet.init(); -> 8 Socket with 2k RX/TX buffer

Be carefull with the MAX_SOCK_NUM in w5500.h , it cannot changed dynamicly.

***example***

Ethernet.init(4); // reduce to 4 Socket, each with 4k RX/TX buffer
Ethernet.begin();

## RST and CS pin settings

You can set the CS and (Hardware) RST (e.g. WIZ550io or USR-ES1), this must be done before Ethernet.begin(...)

Standard is Pin 10 for CS and Pin 9 for RST

Ethernet.setCsPin(3); // set Pin 3 for CS
Ethernet.setRstPin(4); // set Pin 4 for RST

***example***

Ethernet.setRstPin(); // set Pin 9 for RST
Ethernet.begin();

## Hard- and Software Reset

Two new functions to make resets, Softreset can done only after Ethernet.begin(...)

For Hardware Reset you need to set the Pin number.

Ethernet.softreset(); // performs a software reset
Ethernet.hardreset(); // performs a hardware reset

***example***

Ethernet.setRstPin(); // set Pin 9 for RST
Ethernet.begin();
Ethernet.hardreset();

## Additional TCP settings in Ethernet

There are two function to set and get the retransmission timeout and retry count, this helps to solve problem with TCP connections with unexpected very long timeouts. Beware the the timeout value multiplier is 100us!

void Ethernet.setRtTimeOut(uint16_t timeout);
uint16_t Ethernet.getRtTimeOut();
void Ethernet.setRtCount(uint8_t count);
uint8_t Ethernet.getRtCount();

***example***

Ethernet.setRtTimeOut(500); // timeout 50ms
Ethernet.setRtCount(2);

// to restore the value to standard

Ethernet.setRtTimeOut();
Ethernet.setRtCount();

## Additional settings in EthernetClient

### ACK feature

A 'No Delayed ACK' function is added to set and get the flag in a TCP socket.

void setNoDelayedACK(bool ack);
bool getNoDelayedACK();

***example***

EthernetClient tcp;
tcp.setNoDelayedACK(true);

// to restore the value to standard

tcp.setNoDelayedACK(false);
tcp.setNoDelayedACK();

### remoteIP and remoteMAC adresses

Two new functions for getting the IP and MAC address of a remote host.

void remoteIP(uint8_t *ip);
void remoteMAC(uint8_t *mac);

## Additional settings in EthernetUDP

### Broadcast feature in EthernetUDP

A Broadcast blocking function is added to set and get the flag in a UDP socket.

void setBroadcastBlock(bool block);
bool getBroadcastBlock();

***example***

EthernetUDP udp;
udp.setBroadcastBlock(true);

// to restore the value to standard

udp.setBroadcastBlock(false);
udp.setBroadcastBlock();

### remoteIP and remoteMAC adresses

Two new functions for getting the IP and MAC address of a remote host.

void remoteIP(uint8_t *ip);
void remoteMAC(uint8_t *mac);
Loading

0 comments on commit 43052a1

Please sign in to comment.