AnsweredAssumed Answered

Cosmic CXSTM8 Comiler Error - Invalid Constant Expression

Question asked by richards.jeremy on Jul 3, 2011
Latest reply on Jul 4, 2011 by Andrew Neil
I'm porting some code designed to run on a Nordic nRF8200 to an STM8L152C6. The code was orginally compiled using Keil C5. I am using the Cosmic CXSTM8 compiler.

I am getting a compiler error 'Invalid Constant Expression' in the CASE: line of a switch statement that I cannot understand.

code snippet is included below.

switch (pipe_num)
      alert_handle_on_link_loss = (alert_level_t)buffer[0];

pipe_num is a locally defined uint8_t, and
 #define PIPE_LINK_LOSS_ALERT_ALERT_LEVEL_RX  6 is declared in an included header file.

I cannot understand what the compiler is taking exception to in this case. If anyone could help I'd really appreciate it.