Reads external values

79 views
asked Mar 20 in Embedded Wizard Studio by Tonny

Hello Team,

     Now, I can use valuedisplay to show new value on screen.  

 int control = 0;
int DeviceDriver_ProcessData( void )
{
  double value;
  static double PEQ_KNOK_GAIN_SRC[31] = {-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0.0,1.0,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
   if ( ValueDisplay != control )
  {
    ApplicationDeviceClass device = EwGetAutoObject( &ApplicationDevice,
                                                      ApplicationDeviceClass );
     value = PEQ_KNOK_GAIN_SRC[ValueDisplay];
    ApplicationDeviceClass__UpdateValueDisplay( device, (XInt32)value);
    control++;
    return 1;
  }
  return 0;
}

If I want to read this array on the embedded wizard stdio.You may know I  use text view as a value to make line before,and use text view to read the current value .

var float g = (float)Application::Device.PEQ_GAIN1[PEQ_GAIN.Sider.CurrentValue];
var float q = (float)Application::Device.PEQ_Q1[PEQ_Q.Sider.CurrentValue];
var float f = (float)Application::Device.PEQ_FREQ1[PEQ_FREQ.Sider.CurrentValue];

Question:Can I use ValueDisplay to read external arrays(PEQ_KNOK_GAIN_SRC) and operate on embedded wizard stdio to calculate?If so, how can I get?

Best regards,

Tonny

1 Answer

0 votes
answered Mar 20 by Paul Banach

Hello Tonny,

I'm sorry, but I do not understand what you mean. If you want to exchange data via arrays then the section Exchange array contents provides you hints how to do this.

Best regards

Paul Banach

commented Mar 23 by Tonny
Hello Paul,

       Thank you very much,I think I should know

Best regards,

Tonny
commented Mar 24 by Tonny

Hello Paul,

       According to what you mean .

var int32 noOfEntries = SomeDataArray.length;
var int32 i;

// Iterate through all entries of the array. Here the variable 'noOfEntries'
// limits the loop.
for ( i = 0; i < noOfEntries; i = i + 1 )
{
  var uint32 val;

  // Within 'native' code read the value 'i' of the array in your main software
  // or middleware. Store the value in the local variable 'val'.
  native ( i, val )
  {
    /* Declaration of an externally available array. In this manner the
       C compiler can access the array without warnings. */
    extern unsigned int PEQ_KNOK_GAIN_SRC[ 31];
    
    val = PEQ_KNOK_GAIN_SRC[ i ];
  }

  // Again in Chora, copy the value from the variable 'val' to an array
  // member existing in 'this' object
  SomeDataArray[ i ] = val;
}

But I still don't know the SomeDataArray define,for example:Is it like this ?

If i want to use peq_try array instead of PEQ_KNOK_GAIN_SRC[31] value,What should i do?Could you give me some details ?Thanks!

Best regards

Tonny

commented Mar 24 by Paul Banach

Hello Tonny,

yes, in this approach SomeDataArray stands for an array member, e.g. peq_try. The array PEQ_KNOK_GAIN_SRC (or in the original example the array YourDeviceArray) represents some C array in the device. The example shows how to transfer data from the C array to an array existing in Chora.

Does it help you?

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...