I'm trying to implement some kind of serial driver with use of SPI- and EXTI-driver on the STM32F4 Discovery board for RFM12. To get an idea how other drivers are used in a driver itself I've already had a look in mmc_spi.[ch]. My project is based on the demo-project coming along with ChibiOS(trunk) for the Discovery-Kit.
How is the intended way to use the EXT-I-driver within another driver (and fill the EXTConfig-structure correctly)? As i can see, the config structure is declared const and global in the example. At this point i could fill all values but the callback-function, because this callback-function i'd like to declare static and local within "rfm_lld.c"-file. My first intention was to deliver a pointer to this EXTConfig structure to "rfmObjectInit()" and fill it in "rfm_lld_start()" by the rfm-driver itself:
Code: Select all
void rfm_lld_start(RFMDriver *rfmp) {
[...]
spiStart(rfmp->spiDevice, rfmp->spicfg);
rfmp->extcfg->channels[11].mode = EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART;
rfmp->extcfg->channels[11].cb = rfm_cb;
rfmp->extcfg->exti[2] = (EXT_MODE_GPIOB) << 12;
extStart(rfmp->extDevice, rfmp->extcfg);
[...]
}
I hope someone can give me a hint for the right direction.
Kind regards.