# drivers/sdmmc/card_detect.c File Reference

SD/MMC card detect handler. More...

`#include <debug.h>`
`#include <delayed_work.h>`
`#include <malloc.h>`
`#include <slist.h>`
`#include <workqueue.h>`
`#include <chip/portmux.h>`
`#include <gpio/gpio_irq_handler.h>`
`#include <sdmmc/sdmmc.h>`
`#include <app/timer.h>`
`#include <app/workqueue.h>`

Include dependency graph for card_detect.c:

Go to the source code of this file.

## Defines
#define | SDMMC_CD_DELAY_US 20000
| SD/MMC debounce interval for card detection.
## Functions
struct sdmmc_cd * | sdmmc_cd_init (struct sdmmc_slot *slot, gpio_pin_t pin)
| Initialize card detection handler.
void | sdmmc_cd_enable (struct sdmmc_cd *cd)
| Enable card detection handler.

## Detailed Description

SD/MMC card detect handler.

Card detect handler that listens for interrupt on gpio line and notifies slot on changed status.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file card_detect.c.

## Define Documentation

#define SDMMC_CD_DELAY_US 20000

SD/MMC debounce interval for card detection.

20 ms is assumed to be a good compromise between responsiveness and robustness.

Definition at line 63 of file card_detect.c.

Referenced by sdmmc_cd_enable().

## Function Documentation

void sdmmc_cd_enable | ( | struct sdmmc_cd * | cd | ) |

Enable card detection handler.

Parameters:

  | cd | Private data for card detction handler

Definition at line 118 of file card_detect.c.

References delayed_work_run_us(), and SDMMC_CD_DELAY_US.

Here is the call graph for this function:

struct sdmmc_cd* sdmmc_cd_init | ( | struct sdmmc_slot * | slot,
|  | gpio_pin_t | pin |
| ) |  |  | `[read]`

Initialize card detection handler.

Parameters:

  | slot | sdmmc_slot
  | pin | gpio pin to use as card detect input

Definition at line 97 of file card_detect.c.

References dbg_error, delayed_work_init(), gpio_init_irq_handler(), gpio_register_irq_handler(), and workqueue_init_item().

Referenced by sdmmc_mcihost_init().

Here is the call graph for this function: