We help IT Professionals succeed at work.
Get Started

TypeDef Struct Variable to different #define statement  during variable init.

Richard Payne
on
185 Views
Last Modified: 2015-03-27
the TI demo code provided the statement (without error). I need help to understand and fix this error.

RFFT32  fft=RFFT32_512P_DEFAULTS;  (There are 6 different default setting).

I wish to implement switch statement which setup the fft to different setting

RFFT32  fft;

case 0:
    fft = RFFT32_512P_DEFAULTS;
   break;
case 1:
    fft = RFFT32_256P_DEFAULTS;
   break;
case 2:
    fft = RFFT32_128P_DEFAULTS;
   break;

However the compiler report error "Error expected a expression".

I have tried fft = (RFFT32 ) RFFT32_128P_DEFAULTS; but no luck as it report error (RFFT32) is not allowed

The compiler is Code Composer V6 (from TI) which is based on Eclipse.

There are 6 different default based on RFFT32_512P_DEFAULTS
RFFT32_512P_DEFAULTS
RFFT32_256P_DEFAULTS
RFFT32_128P_DEFAULTS, etc

where RFFT32_512P_DEFAULTS has the following code provided by TI example code.
//------------------------------------------------------------------------------------
#define RFFT32_512P_DEFAULTS    { (long *)NULL,\
        (long *)NULL,\
        512,\
        9,\
        (long *)NULL,\
        (long *)NULL,\
        0,\
        0,\
        8,\
        (void (*)(void *))FFT32_init,\
        (void (*)(void *))FFT32_calc,\
        (void (*)(void *))FFT32_mag,\
        (void (*)(void *))FFT32_win
}
//-------------------------------------------------------------------------
The RFFT32  typedef struct has the following statement

typedef struct {  
        long *ipcbptr;
        long *tfptr;              
        int size;
        int nrstage;            
        long *magptr;
        long *winptr;
        long peakmag;
        int peakfrq;
            int ratio;
        void (*init)(void *);
        void (*calc)(void *);
        void (*mag)(void *);
        void (*win)(void *);
        }RFFT32;
typedef RFFT32 *RFFT32_handle;
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2016
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE