Small fix to the SPI demo. SPI I/O pins were no initialized as alternate.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2135 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2010-08-20 07:40:01 +00:00
parent fef1911a8f
commit 29226ecec7
4 changed files with 27 additions and 4 deletions

View File

@ -88,8 +88,21 @@
#include "chqueues.h"
#include "chstreams.h"
#include "chioch.h"
#include "chfiles.h"
#include "chdebug.h"
#if !defined(__DOXYGEN__)
extern WORKING_AREA(_idle_thread_wa, IDLE_THREAD_STACK_SIZE);
#endif
#ifdef __cplusplus
extern "C" {
#endif
void _idle_thread(void *p);
#ifdef __cplusplus
}
#endif
#endif /* _CH_H_ */
/** @} */

View File

@ -178,12 +178,9 @@
*/
#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
extern WORKING_AREA(_idle_thread_wa, IDLE_THREAD_STACK_SIZE);
#ifdef __cplusplus
extern "C" {
#endif
void _idle_thread(void *p);
void chSysInit(void);
void chSysTimerHandlerI(void);
#if CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED

View File

@ -34,6 +34,10 @@
#include "ch.h"
/**
* @brief Idle thread working area.
* @see IDLE_THREAD_STACK_SIZE
*/
WORKING_AREA(_idle_thread_wa, IDLE_THREAD_STACK_SIZE);
/**
@ -87,7 +91,7 @@ void chSysInit(void) {
/* This thread has the lowest priority in the system, its role is just to
serve interrupts in its context while keeping the lowest energy saving
mode compatible with the system status.*/
chThdCreateStatic(idle_thread_wa, sizeof(_idle_thread_wa), IDLEPRIO,
chThdCreateStatic(_idle_thread_wa, sizeof(_idle_thread_wa), IDLEPRIO,
(tfunc_t)_idle_thread, NULL);
}

View File

@ -94,6 +94,15 @@ int main(int argc, char **argv) {
(void)argc;
(void)argv;
/*
* SPI1 I/O pins setup.
*/
palSetPadMode(IOPORT1, 5, PAL_MODE_STM32_ALTERNATE_PUSHPULL); /* SCK. */
palSetPadMode(IOPORT1, 6, PAL_MODE_STM32_ALTERNATE_PUSHPULL); /* MISO.*/
palSetPadMode(IOPORT1, 7, PAL_MODE_STM32_ALTERNATE_PUSHPULL); /* MOSI.*/
palSetPadMode(IOPORT1, GPIOA_SPI1NSS, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(IOPORT1, GPIOA_SPI1NSS);
/*
* Prepare transmit pattern.
*/