diff options
author | Perry Hung <iperry@alum.mit.edu> | 2010-04-24 04:09:16 -0400 |
---|---|---|
committer | Perry Hung <iperry@alum.mit.edu> | 2010-04-24 04:09:16 -0400 |
commit | b41eb846ca60559cff242d0c550699eb8f309909 (patch) | |
tree | 232efb6fb9cd55a57a6632bd88218bc93e540844 | |
parent | bf4fc3bf6bc02342ae508b52fb4515d361d626f6 (diff) | |
download | librambutan-b41eb846ca60559cff242d0c550699eb8f309909.tar.gz librambutan-b41eb846ca60559cff242d0c550699eb8f309909.zip |
Turn the other peripherals back on. Not extensively tested for
interactions between peripherals.
-rw-r--r-- | core/comm/HardwareSPI.cpp | 19 | ||||
-rw-r--r-- | core/wiring.c | 10 |
2 files changed, 19 insertions, 10 deletions
diff --git a/core/comm/HardwareSPI.cpp b/core/comm/HardwareSPI.cpp index 542742b..51093cb 100644 --- a/core/comm/HardwareSPI.cpp +++ b/core/comm/HardwareSPI.cpp @@ -26,7 +26,9 @@ * @brief HardwareSPI "wiring-like" api for SPI */ -/* Speeds: +/* NOTES: + * + * Speeds: * ----------------------------------- * Interface num: SPI1 SPI2 * Bus APB2 APB1 @@ -41,6 +43,8 @@ * 64: 1 125 000 562 500 * 128: 562 500 281 250 * 256: 281 250 140 625 + * + * TODO: Do the complementary PWM outputs mess up SPI2? * */ #include "wiring.h" @@ -58,7 +62,6 @@ static const uint32 prescaleFactors[MAX_SPI_FREQS] = { SPI_PRESCALE_256, // SPI_140_625KHZ }; - /** * @brief Initialize a SPI peripheral * @param freq frequency to run at, must one of the following values: @@ -87,9 +90,15 @@ void HardwareSPI::begin(SPIFrequency freq, uint32 endianness, uint32 mode) { return; } - /* SPI1 is too fast for 140625 */ - if ((spi_num == 1) && (freq == SPI_140_625KHZ)) { - return; + if (spi_num == 1) { + /* SPI1 is too fast for 140625 */ + if (freq == SPI_140_625KHZ) { + return; + } + + /* Turn off PWM on shared pins */ + timers_disable_channel(3, 2); + timers_disable_channel(3, 1); } endianness = (endianness == LSBFIRST) ? SPI_LSBFIRST : SPI_MSBFIRST; diff --git a/core/wiring.c b/core/wiring.c index 290cca1..803b571 100644 --- a/core/wiring.c +++ b/core/wiring.c @@ -40,11 +40,11 @@ void init(void) { nvic_init(); systick_init(); gpio_init(); -// adc_init(); -// timer_init(1, 1); -// timer_init(2, 1); -// timer_init(3, 1); -// timer_init(4, 1); + adc_init(); + timer_init(1, 1); + timer_init(2, 1); + timer_init(3, 1); + timer_init(4, 1); } void nvic_init(void) { |