Datasheet
CANSPISetOperationMode
CANSPIGetOperationMode
236
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
void CANSPISetOperationMode(char mode, char WAIT);
Returns Nothing.
Description
Sets the CANSPI module to requested mode.
Parameters :
- mode: CANSPI module operation mode. Valid values: CANSPI_OP_MODE con-
stants (see CANSPI constants).
- WAIT: CANSPI mode switching verification request. If WAIT == 0, the call is
non-blocking. The function does not verify if the CANSPI module is switched to
requested mode or not. Caller must use CANSPIGetOperationMode to verify cor-
rect operation mode before performing mode specific operation. If
WAIT != 0,
the call is blocking – the function won’t “return” until the requested mode is set.
Requires
The CANSPI routines are supported only by MCUs with the SPI module.
MCU has to be properly connected to mikroElektronika's CANSPI Extra Board
or similar hardware. See connection example at the bottom of this page.
Example
// set the CANSPI module into configuration mode (wait inside
CANSPISetOperationMode until this mode is set)
CANSPISetOperationMode(CANSPI_MODE_CONFIG, 0xFF);
Prototype
char CANSPIGetOperationMode();
Returns Current operation mode.
Description
The function returns current operation mode of the CANSPI module. Check
CANSPI_OP_MODE constants (see CANSPI constants) or device datasheet for
operation mode codes.
Requires
The CANSPI routines are supported only by MCUs with the SPI module.
MCU has to be properly connected to mikroElektronika's CANSPI Extra Board
or similar hardware. See connection example at the bottom of this page.
Example
// check whether the CANSPI module is in Normal mode and if it is
do something.
if (CANSPIGetOperationMode() == CANSPI_MODE_NORMAL) {
...
}