TJA1145 Example Code :PortSupervisor() ---Which input GPIO is it?
How to implement Byte ScanPort(void) function?
/// Port monitoring
/** This function reads an input port of the microcontroller. Depending on the result 3 different
* mode changes are possible:
* - Enter Sleep Operation Mode
* - Enter Standby Operation Mode
* - Enter Normal Operation Mode
*
* \author jh
* \version 1.0
* \date 2013/06/05
* \return <b>StdReturn_t</b> Function executed successfully or not
* possible values: E_OK, E_NOT_OK
*/
void PortSupervisor (void){
Byte portData = 0;
portData = ScanPort();
if((portData & PORTMASK_NORMAL) == 0){
// Normal
AddTaskToScheduler(CHANGE_TO_NORMAL);
}
else if((portData & PORTMASK_STANDBY) == 0){
// Standby
AddTaskToScheduler(CHANGE_TO_STANDBY);
}
else if((portData & PORTMASK_SLEEP) == 0){
// Sleep
AddTaskToScheduler(CHANGE_TO_SLEEP);
}
}
/**
* \brief Read GPIO port configured as input port
* \todo implement this function with your microcontroller specific code
* - Read GPIO port
* \return Port input value
*/
Byte ScanPort(void){
// Insert your microcontroller specific code here
// e.g. Read GPIO port and return value
return 1;
}
Hi,
it's RXD signal.
Depending on the microcontroller you have, it's necessary to read the state of RXD pin. For example, if you have MPC5xxx or S32K3 device, read corresponding GPDI register in SIUL module.
Regards,
Lukas