Beruflich Dokumente
Kultur Dokumente
Sources dinterruptions
GPIO
Priphriques autres pour
rveiller le cur
Ethernet
USB OTG
Horloge RTC
Exemple pratique
Faire changer ltat dune LED depuis un bouton (via EXTI)
https://gist.github.com/anonymous/5006972
CH_IRQ_PROLOGUE();
/* IRQ handling code, preemptable if the architecture supports it.*/
chSysLockFromIsr();
/* Invocation of some I-Class system APIs, never preemptable.*/
chSysUnlockFromIsr();
/* More IRQ handling code, again preemptable.*/
CH_IRQ_EPILOGUE();
}
CH_FAST_IRQ_HANDLER(myIRQ){
EXTI : le handler
static void extcb1(EXTDriver *extp, expchannel_t channel) {
palTogglePad(GPIOD, GPIOD_LED4);
}
EXTI : Configuration
Options gnrales :
EXT_CH_MODE_DISABLED
EXT_CH_MODE_RISING_EDGE
EXT_CH_MODE_FALLING_EDGE
EXT_CH_MODE_BOTH_EDGES
EXT_CH_MODE_AUTOSTART
/* Configure EXTI */
static const EXTConfig extcfg = {
{
extStart(&EXTD1, &extcfg);
EXTI : le main
int main(void) {
halInit(); // Initialise la HAL
chSysInit(); // Initialise ChibiOS