AnsweredAssumed Answered

trouble with stm32f4 and 16x2 lcd after moving from C to C++

Question asked by anton.bogdan on Jun 17, 2014
Hi
after moving a whole project from C to a c++ project, had trouble with the lcd librarry.
On the C project, the library works fine. But in C++ i get the following error


Error[Pe513]: a value of type "int" cannot be assigned to an entity of type "TLCD_NAME_t" 
Error[Pe511]: this operation on an enumerated type requires an applicable user-defined operator function

This is the initial declaration of TLCD_NAME

typedef enum
{
  TLCD_RS = 0,  // RS-Pin
  TLCD_E  = 1,  // E-Pin
  TLCD_D4 = 2,  // DB4-Pin
  TLCD_D5 = 3,  // DB5-Pin
  TLCD_D6 = 4,  // DB6-Pin
  TLCD_D7 = 5   // DB7-Pin
}TLCD_NAME_t;


This is the code where it points the error
 GPIO_InitTypeDef  GPIO_InitStructure;
  TLCD_NAME_t lcd_pin;
   for(lcd_pin=0;lcd_pin<TLCD_ANZ;lcd_pin++) {
    // Clock Enable
    RCC_AHB1PeriphClockCmd(LCD_2X16[lcd_pin].TLCD_CLK, ENABLE);
GPIO_InitStructure.GPIO_Pin = LCD_2X16[lcd_pin].TLCD_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  

Ok, from what i mannaged to understand is that it wont let me assign numbers to its structure positions, why? How can i increment each position of it?

Outcomes