aboutsummaryrefslogtreecommitdiffstats
path: root/demos/STM32
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-09-29 08:42:00 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-09-29 08:42:00 +0000
commit4aea87925ed88c86e2e3475aa031c6a80920b829 (patch)
treee81d339be6b30c3d31199a1180eb44813cb4a8b1 /demos/STM32
parentbd746baee2d88ed193cf55a85bb284b3c8cf59cc (diff)
downloadChibiOS-4aea87925ed88c86e2e3475aa031c6a80920b829.tar.gz
ChibiOS-4aea87925ed88c86e2e3475aa031c6a80920b829.tar.bz2
ChibiOS-4aea87925ed88c86e2e3475aa031c6a80920b829.zip
STM32F746 demo complete.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8334 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/STM32')
-rw-r--r--demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/Makefile2
-rw-r--r--demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c39
2 files changed, 19 insertions, 22 deletions
diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/Makefile b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/Makefile
index 404fc2901..c06650307 100644
--- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/Makefile
+++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/Makefile
@@ -100,7 +100,7 @@ include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk
-#include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
+include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F746xG.ld
diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c
index f7e4851c8..9bd5d5c8b 100644
--- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c
+++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c
@@ -27,9 +27,8 @@
#include "lwipthread.h"
#include "web/web.h"
-//#include "ff.h"
+#include "ff.h"
-#if 0
/*===========================================================================*/
/* Card insertion monitor. */
/*===========================================================================*/
@@ -150,7 +149,6 @@ static FRESULT scan_files(BaseSequentialStream *chp, char *path) {
}
return res;
}
-#endif
/*===========================================================================*/
/* USB related stuff. */
@@ -520,7 +518,6 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
chThdWait(tp);
}
-#if 0
static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) {
FRESULT err;
uint32_t clusters;
@@ -547,13 +544,12 @@ static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) {
fbuff[0] = 0;
scan_files(chp, (char *)fbuff);
}
-#endif
static const ShellCommand commands[] = {
{"mem", cmd_mem},
{"threads", cmd_threads},
{"test", cmd_test},
-// {"tree", cmd_tree},
+ {"tree", cmd_tree},
{NULL, NULL}
};
@@ -566,7 +562,6 @@ static const ShellConfig shell_cfg1 = {
/* Main and generic code. */
/*===========================================================================*/
-#if 0
/*
* Card insertion event.
*/
@@ -597,7 +592,6 @@ static void RemoveHandler(eventid_t id) {
sdcDisconnect(&SDCD1);
fs_ready = FALSE;
}
-#endif
/*
* Green LED blinker thread, times are in milliseconds.
@@ -608,9 +602,8 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
while (true) {
-// palTogglePad(GPIOC, GPIOC_LED);
-// chThdSleepMilliseconds(fs_ready ? 125 : 500);
- chThdSleepMilliseconds(500);
+ palTogglePad(GPIOI, GPIOI_ARD_D13);
+ chThdSleepMilliseconds(fs_ready ? 250 : 500);
}
}
@@ -619,11 +612,11 @@ static THD_FUNCTION(Thread1, arg) {
*/
int main(void) {
static thread_t *shelltp = NULL;
-// static const evhandler_t evhndl[] = {
-// InsertHandler,
-// RemoveHandler
-// };
-// event_listener_t el0, el1;
+ static const evhandler_t evhndl[] = {
+ InsertHandler,
+ RemoveHandler
+ };
+ event_listener_t el0, el1;
/*
* System initializations.
@@ -638,6 +631,11 @@ int main(void) {
lwipInit(NULL);
/*
+ * Initialize board LED.
+ */
+ palSetPadMode(GPIOI, GPIOI_ARD_D13, PAL_MODE_OUTPUT_PUSHPULL);
+
+ /*
* Initializes a serial-over-USB CDC driver.
*/
sduObjectInit(&SDU2);
@@ -668,7 +666,7 @@ int main(void) {
/*
* Activates the card insertion monitor.
*/
-// tmr_init(&SDCD1);
+ tmr_init(&SDCD1);
/*
* Creates the blinker thread.
@@ -685,8 +683,8 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and listen for events.
*/
-// chEvtRegister(&inserted_event, &el0, 0);
-// chEvtRegister(&removed_event, &el1, 1);
+ chEvtRegister(&inserted_event, &el0, 0);
+ chEvtRegister(&removed_event, &el1, 1);
while (true) {
if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
@@ -696,7 +694,6 @@ int main(void) {
}
if (palReadPad(GPIOI, GPIOI_BUTTON_USER) != 0) {
}
-// chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(500)));
- chThdSleepMilliseconds(500);
+ chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(500)));
}
}