create CCRX library with "PORTE.PIDR" undefined

Hi everybody,

I would like to create library to be included in different projects. I currently use:

-CC-RX V3.01.00

-e2studio version 22.7.0.

-MCU RX140

I created a new project with "Renesas CC-RX C/C++ Library Project" and I wrote my .c file. I report a very short example:

#include "stdint.h"
#include "machine.h"
#include "limits.h"

//Variables
uint8_t Input_state = 0U;


void readInput(void)
{
    if (0U == PORTE.PIDR.BIT.B5)
        Input_state = 1U;
    else
        Input_state = 0U;
}

As you can see I read an input pin "PE5". When I compile it gives an error "Identifier PORTE is undefined".

I know that definition is included in "iodefine.h" file which is created by "SmartConfigurator" when I create my projects, but in this case I'm creating a library so I don't know how to include it.

How can I "extern" the "PORTE.PIDR.BIT.B5" so compiler doesn't complain about that?

Thank you and regards

Parents
  • Libraries are typically not device dependent to that level of detail, if you want to make the lib dependent on such exact peripheral or I/O you will need to add that "iodefine.h" manually to the code.

    A better approach might be to use a call-back function to the application to provide such device dependent functionality, or leave the "readInput" function to be defined by the application rather that library.

Reply
  • Libraries are typically not device dependent to that level of detail, if you want to make the lib dependent on such exact peripheral or I/O you will need to add that "iodefine.h" manually to the code.

    A better approach might be to use a call-back function to the application to provide such device dependent functionality, or leave the "readInput" function to be defined by the application rather that library.

Children
No Data