• AVR Freaks

AnsweredHot!Harmony 3 GPIO PLIB Invalid Conversion Error with C++

Author
jdeguire
Super Member
  • Total Posts : 597
  • Reward points : 0
  • Joined: 2012/01/13 07:48:44
  • Location: United States
  • Status: offline
2020/07/31 11:31:06 (permalink)
0

Harmony 3 GPIO PLIB Invalid Conversion Error with C++

This issues affects the three GPIO peripheral variants located at "csp/peripheral/gpio_nnnnn".
 
The "templates/plib_gpio.h.ftl" header files in those peripheral directories all cause "invalid conversion from 'int' to 'GPIO_PORT'" errors with XC32 whenever "peripheral/gpio/plib_gpio.h" is included when building in C++ mode. The cause is functions defined in the header that look like
 

static inline void GPIO_PinWrite(GPIO_PIN pin, bool value)
{
    GPIO_PortWrite(pin>>4, (uint32_t)(0x1) << (pin & 0xF), (uint32_t)(value) << (pin & 0xF));
}

 
when they should actually look like
 

static inline void GPIO_PinWrite(GPIO_PIN pin, bool value)
{
    GPIO_PortWrite((GPIO_PORT)(pin>>4), (uint32_t)(0x1) << (pin & 0xF), (uint32_t)(value) << (pin & 0xF));
}

 
Notice the extra explicit cast on the first parameter. There are multiple functions like this that need to be modified.
 
I assume that there are other peripheral libraries that have similar issues, but I haven't seen them yet. The PIO and PORT libraries for the Atmel devices do seem to have proper casts.
#1
JigneshM
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2020/05/06 01:13:14
  • Location: 0
  • Status: offline
Re: Harmony 3 GPIO PLIB Invalid Conversion Error with C++ 2020/08/01 07:43:24 (permalink) ☼ Best Answerby jdeguire 2020/08/03 09:43:52
5 (2)
@jdeguire, Thank you for reporting the issue. It will be fixed in the next release.
#2
jdeguire
Super Member
  • Total Posts : 597
  • Reward points : 0
  • Joined: 2012/01/13 07:48:44
  • Location: United States
  • Status: offline
Re: Harmony 3 GPIO PLIB Invalid Conversion Error with C++ 2020/08/03 09:44:01 (permalink)
0
Good to hear, thanks!
#3
Jump to:
© 2020 APG vNext Commercial Version 4.5