DCS-Skunkworks / dcs-bios-arduino-library

A library designed to run on Arduinos and similar microcontrollers and communicate with DCS-BIOS.
MIT License
60 stars 22 forks source link

DCS BIOS FOR STM32 #66

Open nerwerr opened 5 months ago

nerwerr commented 5 months ago

Hello I'm new here and trying to figure out how to code in DCS BIOS using the STM32 extension for an f-16 cockpit, I'm currently using the dcs-bios-arduino-library-0.3.9.

After I compile the code a sequence of error relating directly to the DCSBIOS.h appears on the arduino ide console, even when just a small part of the code is used the error report is the same. When changed for the arduino board it compile without problems. normally was used the STM32F4 board but even when other boards are used the error is the same.

the code is bellow: /* Tell DCS-BIOS to use a serial connection and use interrupt-driven communication. The main program will be interrupted to prioritize processing incoming data.

This should work on any Arduino that has an ATMega328 controller (Uno, Pro Mini, many others). */

define DCSBIOS_IRQ_SERIAL

define DCSBIOS_FOR_STM32

include "DcsBios.h"

// TEST PANEL

int FLCS_MAINT = PE_2 ; // flcs maint int FLCS_TEST = PE_3 ; // flcs test int PROBE_HEAT = PE_4 ; // probe heat int PROBE_TEST= PE_5 ; // probe test int FIRE_OVHT = PE_6 ; // overhear - fire

/ paste code snippets from the reference documentation here /

void setup() { DcsBios::setup(); }

void loop() { DcsBios::loop(); }

here is the error that returns

In file included from C:\Users\leosa\AppData\Local\Temp.arduinoIDE-unsaved2024113-18876-1rtbjia.9jz6\IRQSerial\IRQSerial.ino:21: d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:55:20: error: expected constructor, destructor, or type conversion before '(' token 55 | ISR(USART0_RX_vect) { | ^ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h: In function 'void DcsBios::setup()': d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:27:14: error: 'PRR' was not declared in this scope; did you mean 'PWR'? 27 | #define PRR0 PRR | ^~~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:61:25: note: in expansion of macro 'PRR0' 61 | PRR0 &= ~(1<<PRUSART0); | ^~~~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:61:38: error: 'PRUSART0' was not declared in this scope; did you mean 'USART1'? 61 | PRR0 &= ~(1<<PRUSART0); | ^~~~ | USART1 d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:62:25: error: 'UBRR0H' was not declared in this scope 62 | UBRR0H = 0; | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:63:25: error: 'UBRR0L' was not declared in this scope 63 | UBRR0L = 3; // 250000 bps | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:64:25: error: 'UCSR0A' was not declared in this scope 64 | UCSR0A = 0; | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:65:25: error: 'UCSR0C' was not declared in this scope 65 | UCSR0C = (1<<UCSZ00) | (1<<UCSZ01); | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:65:38: error: 'UCSZ00' was not declared in this scope 65 | UCSR0C = (1<<UCSZ00) | (1<<UCSZ01); | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:65:52: error: 'UCSZ01' was not declared in this scope 65 | UCSR0C = (1<<UCSZ00) | (1<<UCSZ01); | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:25: error: 'UCSR0B' was not declared in this scope 67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0); | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:38: error: 'RXEN0' was not declared in this scope 67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0); | ^~~~~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:51: error: 'TXEN0' was not declared in this scope 67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0); | ^~~~~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:67:64: error: 'RXCIE0' was not declared in this scope 67 | UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0); | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h: In function 'void DcsBios::usart_tx(const char)': d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:82:41: error: 'UCSR0A' was not declared in this scope 82 | while(!(UCSR0A & (1<<UDRE0))); // wait until TX buffer is empty | ^~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:82:54: error: 'UDRE0' was not declared in this scope 82 | while(!(UCSR0A & (1<<UDRE0))); // wait until TX buffer is empty | ^~~~~ d:\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:83:33: error: 'UDR0' was not declared in this scope 83 | UDR0 = c++; // write byte to TX buffer | ^~~~ Multiple libraries were found for "Servo.h" Used: C:\Users\leosa\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1\libraries\Servo Not used: C:\Users\leosa\AppData\Local\Arduino15\libraries\Servo exit status 1

Compilation error: exit status 1

someone has any clue what is happening?

wiggles5289 commented 2 months ago

Eliminate the #define DCSBIOS_IRQ_SERIAL line from your code. That is specifically for the Atmel based Arduino and not the STM32 based one. The #define DCSBIOS_FOR_STM32 is all you need, also make sure that you have serial enabled in the board menu dropdown.