aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM4-STM32F407-LWIP-FATFS-USB
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-30 14:41:51 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-30 14:41:51 +0000
commitbfa477e96da26b31d6907260b72037c67cd30d3d (patch)
tree2952bac38e26a0d2afa235127c6bdf975c08856c /demos/ARMCM4-STM32F407-LWIP-FATFS-USB
parent503e05816d39e931a363bdc981e07715e6bfa57e (diff)
downloadChibiOS-bfa477e96da26b31d6907260b72037c67cd30d3d.tar.gz
ChibiOS-bfa477e96da26b31d6907260b72037c67cd30d3d.tar.bz2
ChibiOS-bfa477e96da26b31d6907260b72037c67cd30d3d.zip
Fixed few newly introduced documentation errors. Improved card detection.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4364 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM4-STM32F407-LWIP-FATFS-USB')
-rw-r--r--demos/ARMCM4-STM32F407-LWIP-FATFS-USB/main.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/demos/ARMCM4-STM32F407-LWIP-FATFS-USB/main.c b/demos/ARMCM4-STM32F407-LWIP-FATFS-USB/main.c
index 98f6a3b0f..8ef9b2b7b 100644
--- a/demos/ARMCM4-STM32F407-LWIP-FATFS-USB/main.c
+++ b/demos/ARMCM4-STM32F407-LWIP-FATFS-USB/main.c
@@ -59,28 +59,20 @@ static EventSource inserted_event, removed_event;
static void tmrfunc(void *p) {
BaseBlockDevice *bbdp = p;
- /* The presence check is performed only while the driver is not in a
- transfer state because it is often performed by changing the mode of
- the pin connected to the CS/D3 contact of the card, this could disturb
- the transfer.*/
- blkstate_t state = blkGetDriverState(bbdp);
chSysLockFromIsr();
- if ((state != BLK_READING) && (state != BLK_WRITING)) {
- /* Safe to perform the check.*/
- if (cnt > 0) {
- if (blkIsInserted(bbdp)) {
- if (--cnt == 0) {
- chEvtBroadcastI(&inserted_event);
- }
+ if (cnt > 0) {
+ if (blkIsInserted(bbdp)) {
+ if (--cnt == 0) {
+ chEvtBroadcastI(&inserted_event);
}
- else
- cnt = POLLING_INTERVAL;
}
- else {
- if (!blkIsInserted(bbdp)) {
- cnt = POLLING_INTERVAL;
- chEvtBroadcastI(&removed_event);
- }
+ else
+ cnt = POLLING_INTERVAL;
+ }
+ else {
+ if (!blkIsInserted(bbdp)) {
+ cnt = POLLING_INTERVAL;
+ chEvtBroadcastI(&removed_event);
}
}
chVTSetI(&tmr, MS2ST(POLLING_DELAY), tmrfunc, bbdp);