Skip to content

Commit 281eae7

Browse files
authored
Merge pull request #141 from hideakitai/feature/enable-multiple-interfaces-in-one-sketch
Feature: enable multiple interfaces in one sketch
2 parents 3cd5bba + 03e9506 commit 281eae7

22 files changed

Lines changed: 62 additions & 119 deletions

File tree

Artnet.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

ArtnetETH.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "Artnet/Manager.h"
1313

1414
// ETH.h is a library for Ethernet PHY, but we should use WiFi library's apis for sever/client
15-
using Artnet = art_net::Manager<WiFiUDP>;
16-
using ArtnetSender = art_net::Sender<WiFiUDP>;
17-
using ArtnetReceiver = art_net::Receiver<WiFiUDP>;
15+
using ArtnetETH = art_net::Manager<WiFiUDP>;
16+
using ArtnetETHSender = art_net::Sender<WiFiUDP>;
17+
using ArtnetETHReceiver = art_net::Receiver<WiFiUDP>;
1818

1919
#endif // ARTNET_ETH_H

ArtnetEther.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "Artnet/util/TeensyDirtySTLErrorSolution/TeensyDirtySTLErrorSolution.h"
1313
#include "Artnet/Manager.h"
1414

15-
using Artnet = art_net::Manager<EthernetUDP>;
16-
using ArtnetSender = art_net::Sender<EthernetUDP>;
17-
using ArtnetReceiver = art_net::Receiver<EthernetUDP>;
15+
using ArtnetEther = art_net::Manager<EthernetUDP>;
16+
using ArtnetEtherSender = art_net::Sender<EthernetUDP>;
17+
using ArtnetEtherReceiver = art_net::Receiver<EthernetUDP>;
1818

1919
#endif // ARTNET_ETHER_H

ArtnetEtherENC.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "Artnet/util/TeensyDirtySTLErrorSolution/TeensyDirtySTLErrorSolution.h"
1313
#include "Artnet/Manager.h"
1414

15-
using Artnet = art_net::Manager<EthernetUDP>;
16-
using ArtnetSender = art_net::Sender<EthernetUDP>;
17-
using ArtnetReceiver = art_net::Receiver<EthernetUDP>;
15+
using ArtnetEtherENC = art_net::Manager<EthernetUDP>;
16+
using ArtnetEtherENCSender = art_net::Sender<EthernetUDP>;
17+
using ArtnetEtherENCReceiver = art_net::Receiver<EthernetUDP>;
1818

1919
#endif // ARTNET_ETHER_H

ArtnetNativeEther.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "Artnet/util/TeensyDirtySTLErrorSolution/TeensyDirtySTLErrorSolution.h"
1313
#include "Artnet/Manager.h"
1414

15-
using Artnet = art_net::Manager<EthernetUDP>;
16-
using ArtnetSender = art_net::Sender<EthernetUDP>;
17-
using ArtnetReceiver = art_net::Receiver<EthernetUDP>;
15+
using ArtnetNativeEther = art_net::Manager<EthernetUDP>;
16+
using ArtnetNativeEtherSender = art_net::Sender<EthernetUDP>;
17+
using ArtnetNativeEtherReceiver = art_net::Receiver<EthernetUDP>;
1818

1919
#endif // ARTNET_NATIVE_ETHER_H

README.md

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
[Art-Net](https://en.wikipedia.org/wiki/Art-Net) Sender/Receiver for Arduino (Ethernet, WiFi)
44

55
> [!WARNING]
6-
> Breaking API changes from v0.4.0 and above
7-
8-
> [!WARNING]
9-
> Dependent libraries removed from v0.3.0
10-
11-
If you have already installed this library before v0.3.0, please follow:
12-
13-
- Cloned from GitHub (manually): Please install dependent libraries manually
14-
- Installed from library manager: re-install this library from library manager
15-
- Dependent libraries will be installed automatically
6+
> Breaking API changes from v0.9.0 and above. `Artnet.h` is no longer included. Please include the header file and use interface-specific classes depending on the interface you want to use.
7+
>
8+
> - WiFi: `ArtnetWiFi.h` (`ArtnetWiFi`, `ArtnetWiFiSender`, `ArtnetWiFiReceiver`)
9+
> - Ethernet: `ArtnetEther.h` (`ArtnetEther`, `ArtnetEtherSender`, `ArtnetEtherReceiver`)
10+
> - EthernetENC (ENC28J60): `ArtnetEtherENC.h` (`ArtnetEtherENC`, `ArtnetEtherENCSender`, `ArtnetEtherENCReceiver`)
11+
> - ETH (ESP32): `ArtnetETH.h` (`ArtnetETH`, `ArtnetETHSender`, `ArtnetETHReceiver`)
12+
> - NativeEthernet (Teensy 4.1): `ArtnetNativeEther.h` (`ArtnetNativeEther`, `ArtnetNativeEtherSender`, `ArtnetNativeEtherReceiver`)
1613
1714
## Feature
1815

@@ -29,6 +26,7 @@ If you have already installed this library before v0.3.0, please follow:
2926
- Ethernet
3027
- EthernetENC
3128
- ETH (ESP32)
29+
- NativeEthernet (Teensy 4.1)
3230
- Supports a lot of boards which can use Ethernet or WiFi
3331
- Multiple receiver callbacks depending on universe
3432
- Mutilple destination streaming with sender
@@ -54,6 +52,7 @@ If you have already installed this library before v0.3.0, please follow:
5452

5553
- ESP32 (Ethernet and ETH)
5654
- ESP8266
55+
- Teensy 4.1 (NativeEthernet)
5756
- Almost all platforms without WiFi
5857
- Any platform supported by ENC28J60 (please read following section)
5958

@@ -63,38 +62,35 @@ If you have already installed this library before v0.3.0, please follow:
6362
When using the ENC28J60 controller
6463

6564
- make sure to **clone** the [EthernetENC](https://github.com/JAndrassy/EthernetENC) library (version =< 2.0.4 doesn't support MAC address)
66-
- simply replace `#include <Artnet.h>` with `#include <ArtnetEtherENC.h>`
65+
- simply replace `#include <ArtnetEther.h>` with `#include <ArtnetEtherENC.h>`
66+
6767
</details>
6868

6969
## Usage
7070

71-
This library has following Art-Net controller options.
72-
Please use them depending on the situation.
71+
This library has following Art-Net controller options. Please use them depending on the situation.
7372

74-
- ArtnetReveiver
75-
- ArtnetSender
76-
- Artnet (Integrated Sender/Receiver)
73+
- `Artnet{interface}Receiver`
74+
- `Artnet{interface}Sender`
75+
- `Artnet{interface}`
7776

78-
### Include Artnet
77+
Where `{interface}` is one of the following depending on the interface you want to use.
7978

80-
Please include `#include "Artnet.h` first.
79+
| Interface | Header File | Class Name Prefix |
80+
|---------------|-----------------------|-------------------|
81+
| WiFi | ArtnetWiFi.h | ArtnetWiFi |
82+
| Ethernet | ArtnetEther.h | ArtnetEther |
83+
| EthernetENC | ArtnetEtherENC.h | ArtnetEtherENC |
84+
| ETH (ESP32) | ArtnetETH.h | ArtnetETH |
85+
| NativeEthernet| ArtnetNativeEther.h | ArtnetNativeEther |
8186

82-
If you use the board which has both `WiFi` and `Ethernet`, you can't use `#include <Artnet.h>`. Please replace it with `#include <ArtnetWiFi.h>` or `#include <ArtnetEther.h>` depending on the interface you want to use.
83-
84-
```C++
85-
// For the boards which can use ether WiFi or Ethernet
86-
#include <Artnet.h>
87-
// OR use WiFi on the board which can use both WiFi and Ethernet
88-
#include <ArtnetWiFi.h>
89-
// OR use Ethenet on the board which can use both WiFi and Ethernet
90-
#include <ArtnetEther.h>
91-
```
87+
Also, you can use multiple interfaces in the same sketch.
9288

9389
### ArtnetReceiver
9490

9591
```C++
96-
#include <Artnet.h>
97-
ArtnetReceiver artnet;
92+
#include <ArtnetWiFi.h>
93+
ArtnetWiFiReceiver artnet;
9894

9995
void callback(const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote) {
10096
// you can also use pre-defined callbacks
@@ -121,8 +117,8 @@ void loop() {
121117
### ArtnetSender
122118
123119
```C++
124-
#include <Artnet.h>
125-
ArtnetSender artnet;
120+
#include <ArtnetWiFi.h>
121+
ArtnetWiFiSender artnet;
126122
127123
void setup() {
128124
// setup Ethernet/WiFi...
@@ -149,11 +145,11 @@ void loop() {
149145

150146
### Artnet (Integrated Sender/Receiver)
151147

152-
`ArtNet` class has `ArtNetReceiver` and `ArtNetSender` features.
148+
`ArtNet` class has both `ArtNetReceiver` and `ArtNetSender` features.
153149

154150
```C++
155-
#include <Artnet.h>
156-
Artnet artnet;
151+
#include <ArtnetWiFi.h>
152+
ArtnetWiFi artnet;
157153

158154
void setup()
159155
{
@@ -184,8 +180,8 @@ void loop() {
184180
### Artnet Receiver + FastLED
185181

186182
```C++
187-
#include <Artnet.h>
188-
ArtnetReceiver artnet;
183+
#include <ArtnetWiFi.h>
184+
ArtnetWiFiReceiver artnet;
189185

190186
// FastLED
191187
#define NUM_LEDS 1
@@ -238,7 +234,7 @@ void loop() {
238234
- `ArtPoll` is automatically parsed and sends `ArtPollReply`
239235
- You can configure the following information of by `setArtPollReplyConfig()`
240236
- Other settings are set automatically based on registerd callbacks
241-
- Please refer [here](https://art-net.org.uk/downloads/art-net.pdf) for more information
237+
- Please refer the [spec](https://art-net.org.uk/downloads/art-net.pdf) for more information
242238

243239
```C++
244240
struct ArtPollReplyMetadata
@@ -284,7 +280,7 @@ void setArtPollReplyConfigSwIn(uint8_t sw_in_0, uint8_t sw_in_1, uint8_t sw_in_2
284280
285281
## ArtTrigger
286282
287-
You can send/subscribe `ArtTrigger` using the follwing APIs. Please refer [here](https://art-net.org.uk/how-it-works/time-keeping-triggering/arttrigger/) for more information.
283+
You can send/subscribe `ArtTrigger` using the following APIs. Please refer the [spec](https://art-net.org.uk/how-it-works/time-keeping-triggering/arttrigger/) for more information.
288284
289285
```C++
290286
void sendArtTrigger(const String& ip, uint16_t oem = 0, uint8_t key = 0, uint8_t subkey = 0, const uint8_t *payload = nullptr, uint16_t size = 512);
@@ -294,7 +290,7 @@ using ArtTriggerCallback = std::function<void(const ArtTriggerMetadata &metadata
294290

295291
## ArtSync
296292

297-
You can send/subscribe `ArtSync` using the follwing APIs. Please refer [here](https://art-net.org.uk/how-it-works/time-keeping-triggering/arttimesync/) for more information.
293+
You can send/subscribe `ArtSync` using the following APIs. Please refer the [spec](https://art-net.org.uk/how-it-works/time-keeping-triggering/arttimesync/) for more information.
298294

299295
```C++
300296
void sendArtSync(const String& ip);
@@ -304,7 +300,7 @@ using ArtSyncCallback = std::function<void(const ArtNetRemoteInfo &remote)>;
304300
305301
## APIs
306302
307-
### ArtnetSender
303+
### ArtnetSender APIs
308304
309305
```C++
310306
// streaming artdmx packet
@@ -332,7 +328,7 @@ void sendArtTrigger(const String& ip, uint16_t oem = 0, uint8_t key = 0, uint8_t
332328
void sendArtSync(const String& ip);
333329
```
334330

335-
### ArtnetReceiver
331+
### ArtnetReceiver APIs
336332

337333
```C++
338334
using ArtDmxCallback = std::function<void(const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote)>;

examples/ETH/receive_fastled/receive_fastled.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const IPAddress ip(192, 168, 0, 201);
66
const IPAddress gateway(192, 168, 0, 1);
77
const IPAddress subnet(255, 255, 255, 0);
88

9-
ArtnetReceiver artnet;
9+
ArtnetETHReceiver artnet;
1010
uint8_t universe = 1; // 0 - 15
1111

1212
// FastLED

examples/ETH/receiver/receiver.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const IPAddress ip(192, 168, 0, 201);
55
const IPAddress gateway(192, 168, 0, 1);
66
const IPAddress subnet_mask(255, 255, 255, 0);
77

8-
ArtnetReceiver artnet;
8+
ArtnetETHReceiver artnet;
99
uint16_t universe1 = 1; // 0 - 32767
1010
uint8_t net = 0; // 0 - 127
1111
uint8_t subnet = 0; // 0 - 15

examples/ETH/send_receive/send_receive.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const IPAddress ip(192, 168, 0, 201);
55
const IPAddress gateway(192, 168, 0, 1);
66
const IPAddress subnet(255, 255, 255, 0);
77

8-
Artnet artnet;
8+
ArtnetETH artnet;
99
const String target_ip = "192.168.0.200";
1010
uint8_t universe = 1; // 0 - 15
1111

examples/ETH/sender/sender.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const IPAddress ip(192, 168, 0, 201);
55
const IPAddress gateway(192, 168, 0, 1);
66
const IPAddress subnet(255, 255, 255, 0);
77

8-
ArtnetSender artnet;
8+
ArtnetETHSender artnet;
99
const String target_ip = "192.168.0.200";
1010
uint16_t universe = 1;
1111

0 commit comments

Comments
 (0)