#include <Arduino.h>
#include <wiring_private.h> // cbi/sbi definition
#if defined(UCSRB) && defined(UBRRL)
volatile byte * const _ucsrb = &UCSRB;
#else
volatile byte * const _ucsrb = &UCSR0B;
#endif
// Definitions for the hardware Serial port, used for Nexstar auxBus
#define AUXBUS_RX_PIN 0
#define AUXBUS_TX_PIN 1
#define AUXBUS_BUSY_PIN 4 // The RTS (aka. "Busy") line for Nexstar auxBus
#define auxBus Serial
static inline void auxBus_enable_tx() { sbi(*_ucsrb, TXEN0); }
static inline void auxBus_disable_tx() { cbi(*_ucsrb, TXEN0); }
#define MINUS_PIN 9
#define PLUS_PIN 8
#define LED_PIN 13
Again, without any changes it compiles on Arduino processors but fails on ESP8266 processors with the following error:
Arduino: 1.8.13 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
celestron_motor_focuser_hand_controller:7:35: error: 'UCSR0B' was not declared in this scope
volatile byte * const _ucsrb = &UCSR0B;
<deleted>\celestron_motor_focuser_hand_controller\celestron_motor_focuser_hand_controller.ino: In function 'void auxBus_enable_tx()':
celestron_motor_focuser_hand_controller:16:64: error: 'TXEN0' was not declared in this scope
static inline void auxBus_enable_tx() { sbi(*_ucsrb, TXEN0); }
^
celestron_motor_focuser_hand_controller:16:69: error: 'sbi' was not declared in this scope
static inline void auxBus_enable_tx() { sbi(*_ucsrb, TXEN0); }
^
<deleted>\celestron_motor_focuser_hand_controller\celestron_motor_focuser_hand_controller.ino: In function 'void auxBus_disable_tx()':
celestron_motor_focuser_hand_controller:17:64: error: 'TXEN0' was not declared in this scope
static inline void auxBus_disable_tx() { cbi(*_ucsrb, TXEN0); }
^
celestron_motor_focuser_hand_controller:17:69: error: 'cbi' was not declared in this scope
static inline void auxBus_disable_tx() { cbi(*_ucsrb, TXEN0); }
^
exit status 1
'UCSR0B' was not declared in this scope
Any help or suggestions would be appreciated!