mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +03:00
ARDUINO_ARCH_AVR
This commit is contained in:
@@ -23,7 +23,7 @@ e-mail anklimov@gmail.com
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
#ifdef _dmxin
|
#ifdef _dmxin
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
#include <DMXSerial.h>
|
#include <DMXSerial.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -207,7 +207,7 @@ void DMXinSetup(int channels)
|
|||||||
|
|
||||||
#if defined(_dmxin)
|
#if defined(_dmxin)
|
||||||
DMXin = new uint8_t [channels];
|
DMXin = new uint8_t [channels];
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
DMXSerial.init(DMXReceiver,0,channels);
|
DMXSerial.init(DMXReceiver,0,channels);
|
||||||
if (DMXSerial.getBuffer()) {Serial.print(F("Init in ch:"));Serial.println(channels);} else Serial.println(F("DMXin Buffer alloc err"));
|
if (DMXSerial.getBuffer()) {Serial.print(F("Init in ch:"));Serial.println(channels);} else Serial.println(F("DMXin Buffer alloc err"));
|
||||||
//DMXSerial.maxChannel(channels);
|
//DMXSerial.maxChannel(channels);
|
||||||
@@ -230,7 +230,7 @@ dmxin.begin();
|
|||||||
void DMXoutSetup(int channels)
|
void DMXoutSetup(int channels)
|
||||||
{
|
{
|
||||||
#ifdef _dmxout
|
#ifdef _dmxout
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
DmxSimple.usePin(AVR_DMXOUT_PIN);
|
DmxSimple.usePin(AVR_DMXOUT_PIN);
|
||||||
DmxSimple.maxChannel(channels);
|
DmxSimple.maxChannel(channels);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ e-mail anklimov@gmail.com
|
|||||||
|
|
||||||
#if defined(_dmxout)
|
#if defined(_dmxout)
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
#include <DmxSimple.h>
|
#include <DmxSimple.h>
|
||||||
#define DmxWrite DmxSimple.write
|
#define DmxWrite DmxSimple.write
|
||||||
#endif
|
#endif
|
||||||
@@ -56,7 +56,7 @@ extern Artnet *artnet;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _dmxin
|
#ifdef _dmxin
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
#include <DMXSerial.h>
|
#include <DMXSerial.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ extern PubSubClient mqttClient;
|
|||||||
#ifndef DHT_COUNTER_DISABLE
|
#ifndef DHT_COUNTER_DISABLE
|
||||||
static volatile unsigned long nextPollMillisValue[5];
|
static volatile unsigned long nextPollMillisValue[5];
|
||||||
static volatile int nextPollMillisPin[5] = {0,0,0,0,0};
|
static volatile int nextPollMillisPin[5] = {0,0,0,0,0};
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
static volatile long counter_value[6];
|
static volatile long counter_value[6];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ void Input::counterPoll() {
|
|||||||
if(nextPollTime()>millis())
|
if(nextPollTime()>millis())
|
||||||
return;
|
return;
|
||||||
if (store->logicState == 0) {
|
if (store->logicState == 0) {
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
#define interrupt_number pin
|
#define interrupt_number pin
|
||||||
if (interrupt_number >= 0 && interrupt_number < 6) {
|
if (interrupt_number >= 0 && interrupt_number < 6) {
|
||||||
const short mega_interrupt_array[6] = {2, 3, 21, 20, 19, 18};
|
const short mega_interrupt_array[6] = {2, 3, 21, 20, 19, 18};
|
||||||
@@ -171,7 +171,7 @@ void Input::counterPoll() {
|
|||||||
void Input::attachInterruptPinIrq(int realPin, int irq) {
|
void Input::attachInterruptPinIrq(int realPin, int irq) {
|
||||||
pinMode(realPin, INPUT);
|
pinMode(realPin, INPUT);
|
||||||
int real_irq;
|
int real_irq;
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
real_irq = irq;
|
real_irq = irq;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
@@ -293,7 +293,7 @@ void Input::onCounterChanged(int i) {
|
|||||||
counter_value[counter_irq_map[i]]++;
|
counter_value[counter_irq_map[i]]++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
counter_value[i]++;
|
counter_value[i]++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ void Input::contactPoll() {
|
|||||||
#if defined(ARDUINO_ARCH_STM32F1)
|
#if defined(ARDUINO_ARCH_STM32F1)
|
||||||
WiringPinMode inputPinMode;
|
WiringPinMode inputPinMode;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SAM3X8E__)||defined(__AVR__)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
||||||
uint32_t inputPinMode;
|
uint32_t inputPinMode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ DueFlashStorage EEPROM;
|
|||||||
EthernetClient ethClient;
|
EthernetClient ethClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
EthernetClient ethClient;
|
EthernetClient ethClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ lan_status lanLoop() {
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
#if defined(__AVR__) || defined(__SAM3X8E__)
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__)
|
||||||
wdt_dis();
|
wdt_dis();
|
||||||
if (lanStatus > 0)
|
if (lanStatus > 0)
|
||||||
switch (Ethernet.maintain()) {
|
switch (Ethernet.maintain()) {
|
||||||
@@ -456,7 +456,7 @@ void onInitialStateInitLAN() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__) || defined(__SAM3X8E__)||defined(ARDUINO_ARCH_STM32F1)
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__)||defined(ARDUINO_ARCH_STM32F1)
|
||||||
#ifdef W5500_CS_PIN
|
#ifdef W5500_CS_PIN
|
||||||
Ethernet.w5500_cspin = W5500_CS_PIN;
|
Ethernet.w5500_cspin = W5500_CS_PIN;
|
||||||
debugSerial<<F("Use W5500 pin: "));
|
debugSerial<<F("Use W5500 pin: "));
|
||||||
@@ -487,7 +487,7 @@ void onInitialStateInitLAN() {
|
|||||||
else {
|
else {
|
||||||
debugSerial<<"\nNo IP data found in flash\n";
|
debugSerial<<"\nNo IP data found in flash\n";
|
||||||
wdt_dis();
|
wdt_dis();
|
||||||
#if defined(__AVR__) || defined(__SAM3X8E__)
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__)
|
||||||
res = Ethernet.begin(mac, 12000);
|
res = Ethernet.begin(mac, 12000);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ARDUINO_ARCH_STM32F1)
|
#if defined(ARDUINO_ARCH_STM32F1)
|
||||||
@@ -519,7 +519,7 @@ void softRebootFunc() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__) || defined(__SAM3X8E__)
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__)
|
||||||
void (*softRebootFunc)(void) = 0;
|
void (*softRebootFunc)(void) = 0;
|
||||||
|
|
||||||
void printCurentLanConfig();
|
void printCurentLanConfig();
|
||||||
@@ -908,7 +908,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
|||||||
#endif
|
#endif
|
||||||
debugSerial<<F("Config URI: http://")<<configServer<<URI<<eol;
|
debugSerial<<F("Config URI: http://")<<configServer<<URI<<eol;
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
FILE *configStream;
|
FILE *configStream;
|
||||||
//byte hserver[] = { 192,168,88,2 };
|
//byte hserver[] = { 192,168,88,2 };
|
||||||
wdt_dis();
|
wdt_dis();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
//#define wdt_en()
|
//#define wdt_en()
|
||||||
//#define wdt_dis()
|
//#define wdt_dis()
|
||||||
//#endif
|
//#endif
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
#if defined(WATCH_DOG_TICKER_DISABLE)
|
#if defined(WATCH_DOG_TICKER_DISABLE)
|
||||||
#define wdt_en() wdt_disable()
|
#define wdt_en() wdt_disable()
|
||||||
#define wdt_dis() wdt_disable()
|
#define wdt_dis() wdt_disable()
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
#include <ArduinoHttpClient.h>
|
#include <ArduinoHttpClient.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
#include "HTTPClient.h"
|
#include "HTTPClient.h"
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <avr/wdt.h>
|
#include <avr/wdt.h>
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__) || defined(__SAM3X8E__) || defined(ESP8266)
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(ESP8266)
|
||||||
#ifdef Wiz5500
|
#ifdef Wiz5500
|
||||||
#include <Ethernet2.h>
|
#include <Ethernet2.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
#define LAN_INIT_DELAY 500
|
#define LAN_INIT_DELAY 500
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
//All options available
|
//All options available
|
||||||
#ifdef CONTROLLINO
|
#ifdef CONTROLLINO
|
||||||
#define modbusSerial Serial3
|
#define modbusSerial Serial3
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ unsigned long freeRam ()
|
|||||||
{return system_get_free_heap_size();}
|
{return system_get_free_heap_size();}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
unsigned long freeRam ()
|
unsigned long freeRam ()
|
||||||
{
|
{
|
||||||
extern int __heap_start, *__brkval;
|
extern int __heap_start, *__brkval;
|
||||||
@@ -141,7 +141,7 @@ void printFloatValueToStr(float value, char *valstr) {
|
|||||||
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
sprintf(valstr, "%2.1f", value);
|
sprintf(valstr, "%2.1f", value);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__AVR__)
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
sprintf(valstr, "%d", (int)value);
|
sprintf(valstr, "%d", (int)value);
|
||||||
int fractional = 10.0*((float)abs(value)-(float)abs((int)value));
|
int fractional = 10.0*((float)abs(value)-(float)abs((int)value));
|
||||||
int val_len =strlen(valstr);
|
int val_len =strlen(valstr);
|
||||||
|
|||||||
Reference in New Issue
Block a user