OpenXsensor Configurator

Development & General Chat for the superb openxvario project.

Moderator: rainer

mstrens
Posts: 1066
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor Configurator

Post by mstrens » Sat Oct 15, 2016 6:47 am

oXs take care of 2 types of Arduino : 5V 16Mhz and 3.3V 8 Mhz.
The selection is done in the Arduino IDE as Kalle123 said.

RightRudder
Posts: 241
Joined: Tue Jan 15, 2013 9:41 pm
Country: -

Re: OpenXsensor Configurator

Post by RightRudder » Sun Oct 16, 2016 6:35 pm

so the compiler gets the information about the target board from the IDE and sets the right timer load values based on compile time switches set somewhere in the code?

mstrens
Posts: 1066
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXsensor Configurator

Post by mstrens » Mon Oct 17, 2016 8:28 am

In fact, based on your selected hardware, IDE defines some parameters that can be used/tested in the code.
E.g. in file oXs_out_frsky.h you have this code :

Code: Select all

  #if F_CPU == 20000000L   // 20MHz clock 
    // Sinan: Not tested                                                     
    #define TICKS2COUNTSPORT         348  // Ticks between two bits.
    #define TICKS2WAITONESPORT       348  // Wait one bit period.
    #define TICKS2WAITONE_HALFSPORT  520    // Wait one and a half bit period.
  #elif F_CPU == 16000000L  // 16MHz clock                                                  
    #define TICKS2COUNTSPORT         278  // Ticks between two bits.
    #define TICKS2WAITONESPORT       278  // Wait one bit period.
    #define TICKS2WAITONE_HALFSPORT  416    // Wait one and a half bit period.
  #elif F_CPU == 8000000L   // 8MHz clock
    // Assumes a 8MHz clock                                                   
    #define TICKS2COUNTSPORT         139  // Ticks between two bits.
    #define TICKS2WAITONESPORT       139  // Wait one bit period.
    #define TICKS2WAITONE_HALFSPORT  208    // Wait one and a half bit period.
  #else
    #error Unsupported clock speed
  #endif

RightRudder
Posts: 241
Joined: Tue Jan 15, 2013 9:41 pm
Country: -

Re: OpenXsensor Configurator

Post by RightRudder » Mon Oct 17, 2016 1:56 pm

Ahhh yes this is exactly what I was concerned about. This makes life so easy for us with limited knowledge. I was afraid I would have to go digging in the code for those definitions and change the timer load values to use a different clock speed. I see that even 20MHz is a possibility. Thanks for helping me learn more about how the arduino IDE works!

Joe

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”

Who is online

Users browsing this forum: No registered users and 3 guests