Browse Source

init platformio

master
adb 8 months ago
parent
commit
a3b635aade
  1. 27
      CMakeListsPrivate.txt
  2. 2
      lib/UIPArtnet
  3. 53
      platformio.ini
  4. 79
      src/main.cpp

27
CMakeListsPrivate.txt

@ -28,9 +28,16 @@ if (CMAKE_BUILD_TYPE MATCHES "Upload_UART")
include_directories("${CMAKE_CURRENT_LIST_DIR}/include")
include_directories("${CMAKE_CURRENT_LIST_DIR}/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/lib/UIPArtnet")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_UART/UIPEthernet")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_UART/UIPEthernet/utility")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_UART/ArduinoDMX/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_UART/ArduinoRS485/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_UART/RF24")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_UART/RF24/utility")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/SPI/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/cores/MightyCore")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/variants/standard")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/variants/bobuino")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/AVR_examples/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/EEPROM/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/Optiboot_flasher/src")
@ -60,9 +67,16 @@ if (CMAKE_BUILD_TYPE MATCHES "Upload_ISP")
include_directories("${CMAKE_CURRENT_LIST_DIR}/include")
include_directories("${CMAKE_CURRENT_LIST_DIR}/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/lib/UIPArtnet")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_ISP/UIPEthernet")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_ISP/UIPEthernet/utility")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_ISP/ArduinoDMX/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_ISP/ArduinoRS485/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_ISP/RF24")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/Upload_ISP/RF24/utility")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/SPI/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/cores/MightyCore")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/variants/standard")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/variants/bobuino")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/AVR_examples/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/EEPROM/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/Optiboot_flasher/src")
@ -91,9 +105,16 @@ if (CMAKE_BUILD_TYPE MATCHES "fuses_bootloader")
include_directories("${CMAKE_CURRENT_LIST_DIR}/include")
include_directories("${CMAKE_CURRENT_LIST_DIR}/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/lib/UIPArtnet")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/fuses_bootloader/UIPEthernet")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/fuses_bootloader/UIPEthernet/utility")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/fuses_bootloader/ArduinoDMX/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/fuses_bootloader/ArduinoRS485/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/fuses_bootloader/RF24")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/fuses_bootloader/RF24/utility")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/SPI/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/cores/MightyCore")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/variants/standard")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/variants/bobuino")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/AVR_examples/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/EEPROM/src")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduino-avr-mightycore/libraries/Optiboot_flasher/src")

2
lib/UIPArtnet

@ -1 +1 @@
Subproject commit 324d69798662c7986c147294dc31713fb438618b
Subproject commit b8820de9cbc2854023ca103960424cc78cfb3052

53
platformio.ini

@ -16,35 +16,36 @@ platform = atmelavr
framework = arduino
board = ATmega644P
board_build.f_cpu = 16000000L
board_build.variant = standard
board_build.variant = bobuino
build_unflags = -flto
build_flags =
build_flags =
monitor_port = ${env:Upload_UART.upload_port}
monitor_speed = 9600
lib_deps = arduino-libraries/ArduinoRS485@^1.0.0
[env:Upload_UART]
upload_protocol = arduino
upload_port = /dev/cu.usbserial*
upload_port = /dev/ttyACM0
board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed}
lib_deps =
tmrh20/RF24@^1.3.11
arduino-libraries/ArduinoDMX@^1.0.1
arduino-libraries/ArduinoRS485@^1.0.0
uipethernet/UIPEthernet@^2.0.8
lib_deps =
tmrh20/RF24@^1.3.11
arduino-libraries/ArduinoDMX@^1.0.1
uipethernet/UIPEthernet@^2.0.8
arduino-libraries/ArduinoRS485@^1.0.0
[env:Upload_ISP]
upload_protocol = custom
upload_flags =
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p$BOARD_MCU
-PUSB
-cusbasp
upload_flags =
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p$BOARD_MCU
-PUSB
-cusbasp
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
lib_deps =
tmrh20/RF24@^1.3.11
arduino-libraries/ArduinoDMX@^1.0.1
arduino-libraries/ArduinoRS485@^1.0.0
uipethernet/UIPEthernet@^2.0.8
lib_deps =
tmrh20/RF24@^1.3.11
arduino-libraries/ArduinoDMX@^1.0.1
uipethernet/UIPEthernet@^2.0.8
arduino-libraries/ArduinoRS485@^1.0.0
[env:fuses_bootloader]
board_hardware.oscillator = external
@ -53,11 +54,11 @@ board_bootloader.speed = 115200
board_hardware.bod = 2.7v
board_hardware.eesave = yes
upload_protocol = usbasp
upload_flags =
-PUSB
-B8
lib_deps =
tmrh20/RF24@^1.3.11
arduino-libraries/ArduinoDMX@^1.0.1
arduino-libraries/ArduinoRS485@^1.0.0
uipethernet/UIPEthernet@^2.0.8
upload_flags =
-PUSB
-B8
lib_deps =
tmrh20/RF24@^1.3.11
arduino-libraries/ArduinoDMX@^1.0.1
uipethernet/UIPEthernet@^2.0.8
arduino-libraries/ArduinoRS485@^1.0.0

79
src/main.cpp

@ -5,16 +5,17 @@
#include <ArduinoDMX.h>
const int universeSize = 512;
// ethernet stuff
#include <UIPEthernet.h>
const IPAddress ip(10, 255, 255, 255);
uint8_t mac[] = {0xAA, 0xDD, 0xBB, 0xAA, 0xDD, 0xBB};
//ArtNet stuff
#include <UIPArtnet.h>
ArtnetReceiver artnet;
uint32_t universe0 = 0;
uint32_t universe1 = 1;
// ethernet stuff
const IPAddress ip(10, 255, 255, 255);
uint8_t mac[] = {0xAA, 0xDD, 0xBB, 0xAA, 0xDD, 0xBB};
//NRF stuff
#include <SPI.h>
#include <RF24.h>
@ -35,11 +36,43 @@ unsigned long previousTime = 0;
const long waitTime = 100;
const long errorTime = 5000;
//ArtNet universe0 callback
void callback(byte* artnetdata, uint16_t size) {
digitalWrite(10, HIGH);
//RGB PWM
//setRGB(artnetdata[0], artnetdata[1], artnetdata[2]);
//DMX output
DMX.beginTransmission();
for (int i = 0; i < universeSize; ++i) {
DMX.write(i, artnetdata[i]);
}
DMX.endTransmission();
//send NRF
for (int i = 0; i < 20; i++) {
datasend = i; //package ID
for (int j = 0; j < 7; j++) {
datasend = (datasend << 8) + artnetdata[7 * i + j];
}
radio.writeFast(&datasend, sizeof(datasend));
}
digitalWrite(10, LOW);
}
void setRGB(int r, int g, int b){
if (r != statusLEDstat[0]) analogWrite(statusLED[0], r);
if (g != statusLEDstat[1]) analogWrite(statusLED[1], g);
if (b != statusLEDstat[2]) analogWrite(statusLED[2], b);
statusLEDstat[0] = r;
statusLEDstat[1] = g;
statusLEDstat[2] = b;
}
//setup
void setup() {
for (int i=0; i < statusLEDlength; i++){
pinMode(statusLED[i], OUTPUT);
digitalWrite(statusLED[i], LOW);
for (int i : statusLED){
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
pinMode(10, OUTPUT);
digitalWrite(10, LOW);
@ -79,35 +112,3 @@ void loop() {
setRGB(0,0,255);
}
}
//ArtNet universe0 callback
void callback(byte* artnetdata, uint16_t size) {
digitalWrite(10, HIGH);
//RGB PWM
//setRGB(artnetdata[0], artnetdata[1], artnetdata[2]);
//DMX output
DMX.beginTransmission();
for (int i = 0; i < universeSize; ++i) {
DMX.write(i, artnetdata[i]);
}
DMX.endTransmission();
//send NRF
for (int i = 0; i < 20; i++) {
datasend = i; //package ID
for (int j = 0; j < 7; j++) {
datasend = (datasend << 8) + artnetdata[7 * i + j];
}
radio.writeFast(&datasend, sizeof(datasend));
}
digitalWrite(10, LOW);
}
void setRGB(int r, int g, int b){
if (r != statusLEDstat[0]) analogWrite(statusLED[0], r);
if (g != statusLEDstat[1]) analogWrite(statusLED[1], g);
if (b != statusLEDstat[2]) analogWrite(statusLED[2], b);
statusLEDstat[0] = r;
statusLEDstat[1] = g;
statusLEDstat[2] = b;
}
Loading…
Cancel
Save