Hilscher Gesellschaft fuer Systemautomation mbH
Hey folks,
some people would like to use the different drivers like SPI or UART or any other dynamically instead of static.
This is made in your task, when you define the configuration structure of the used peripheral and the DrvXXXInit function.
:!: Please Note: :!:
In this cases it is necessary to keep the DrvXXXInit function in the config.c file.
The reason is, that the drivers use some global variables, which will be initialized by the OS it self, but only when the driver is called from the config.c file.
Please use the driver init in the config file as follows:
/****************************************************************************
* Peripheral Driver Configuration loaded after the Kernel has been started
****************************************************************************/
STATIC CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost[] =
{
{DrvPioInit, RX_PERIPHERAL_TYPE_PIO,atrXPio,MAX_CNT(atrXPio)},
{DrvHifPioInit, RX_PERIPHERAL_TYPE_HIFPIO,atrXHifPio,MAX_CNT(atrXHifPio)},
{DrvSpiInit, RX_PERIPHERAL_TYPE_XC, NULL, 0},
{DrvUrtInit, RX_PERIPHERAL_TYPE_UART, NULL, 0}
};
Greets