[ell-i-developers] Re: PWM working for TIM2

  • From: Ivan Raul <supra.material@xxxxxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Fri, 31 Jan 2014 12:05:02 +0200

And you're completely right. A very important mental note written today :)

Thank you very much

I'll keep you posted

With Warm Regards, Ivan Raul


On Fri, Jan 31, 2014 at 11:45 AM, Pekka Nikander <pekka.nikander@xxxxxx>wrote:

> > What would be your initial guess about it, why it is not considering
> > __GPIO ## port ## _PIN0_MODE
> > to be  a constant, even when they are declared as static const.
>
> Looking at your code, the expression is essentially defined as
>
> static const uint32_t __GPIO ## port ## _PIN ## pin ## _MODE =
> GPIO_MODER_MODER0_ ## mode << (pin * 2);
>
> Now, while that is a compile-time constant, IIRC it is not a constant
> expression by C89/C99 or even C11 rules:
>
>
> http://bytes.com/topic/c/answers/663536-c99-does-const-int-x-5-make-x-constant-expression
>
> http://stackoverflow.com/questions/12343027/const-keyword-and-constant-expressions-in-c99-and-c11
>
> Most probably the easiest way is to rename ellduino_gpio.c to
> ellduino_gpio.cpp and try again.  IIRC C++11 should compile it just fine,
> but I may be wrong.
>
> --Pekka
>
>
>

Other related posts: