Hello,
I'm trying to refactor an existing Arduino CPP library for ChibiOS. The library is for the MCP2515. I've created a new folder under the project called mcp_can, and the main .cpp file is called ./mcp_can/mcp_can.cpp. I've added it the makefile with CPPSRC. I've also added in CHCPPSRC and CHCPPINC, following suit with the 'RT-STM32F407-DISCOVERY-G++' sample project (which compiles fine, I've even tried adding the library to this and it still produces this result). I'm getting many errors like the following:
./mcp_can/mcp_can.cpp:210:19: note: in expansion of macro 'spi_read'
values[i] = spi_read();
^~~~~~~~
In file included from C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:129:0,
from C:\ChibiStudio\chibios176/os/hal/include/hal.h:124,
from ./mcp_can/mcp_can_dfs.h:53,
from ./mcp_can/mcp_can.h:50,
from ./mcp_can/mcp_can.cpp:48:
C:\ChibiStudio\chibios176/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h:289:44: error: base operand of '->' is not a pointer
#define pal_lld_setport(port, bits) ((port)->BSRR = (bits))
^
C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:286:32: note: in expansion of macro 'pal_lld_setport'
#define palSetPort(port, bits) pal_lld_setport(port, bits)
^~~~~~~~~~~~~~~
C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:454:30: note: in expansion of macro 'palSetPort'
#define palSetPad(port, pad) palSetPort(port, PAL_PORT_BIT(pad))
^~~~~~~~~~
./mcp_can/mcp_can_dfs.h:396:28: note: in expansion of macro 'palSetPad'
#define MCP2515_UNSELECT() palSetPad(SPIGPIO, SPICS)
^~~~~~~~~
Hopefully this is enough information. I'm used to working with high level languages, and also with Arduino, so this is new to me. Sorry!
Thanks a ton in advance!
Include CPP Library Issue
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Include CPP Library Issue
Hi,
Just my 2 cents.
Unless your application need additional CAN ports, STM32f407 has already two built-in CAN devices, supported by Chibios.
Simply add MCP2551 transceiver.
Angelo
Just my 2 cents.
Unless your application need additional CAN ports, STM32f407 has already two built-in CAN devices, supported by Chibios.
Simply add MCP2551 transceiver.
Angelo
Re: Include CPP Library Issue
Giovanni wrote:It probably depends on how is defined SPIGPIO.
Giovanni
Thank you very much for your reply! I didn't have a clear understanding of how macros worked, so I researched them and found my error. Also, thanks for your many posts on this site. I've referenced them quite a few times in the past, and they've always helped me.
Polux wrote:Hi,
Just my 2 cents.
Unless your application need additional CAN ports, STM32f407 has already two built-in CAN devices, supported by Chibios.
Simply add MCP2551 transceiver.
Angelo
I intend to do this, though the chips I ordered are on their way from China. They're going to take a long time to arrive here, and I have a spare breakout board for the MCP2515 from Arduino tinkering. Many thanks for your suggestion!
Who is online
Users browsing this forum: No registered users and 18 guests