mbed-os/features/unsupported/tests/mbed/spi/main.cpp

32 lines
728 B
C++
Raw Normal View History

#include "mbed.h"
2016-02-26 17:51:35 +00:00
#if !DEVICE_SPI
#error [NOT_SUPPORTED] SPI is not supported
#endif
#if defined(TARGET_SAMR21G18A)
SPI spi(PB22, PB02, PB23); // mosi, miso, sclk
DigitalOut latchpin(PB03);
2015-09-23 08:18:08 +00:00
#elif defined(TARGET_SAMD21J18A) || defined(TARGET_SAMD21G18A) || defined(TARGET_SAML21J18A)
SPI spi(PA18, PA16, PA19); // mosi, miso, sclk
DigitalOut latchpin(PA17);
Added support for SAMG55 * * Base Commit for SAMG55J19. No errors and no implementations. * * Added gpio files. * * Added pinmap files. * * Base commit for usticker implementation. * * Added gcc_arm export functionality * * added files for usticker. * added template file for samd55j19 * * GPIO IRQ base commit. * * updated with changes in gpio irq driver. * * Reverted back unexpected commit in SAM0 gpio driver. * * updated gpio_irq driver. * * correction in gpio and gpio_irq drivers. * added support for some test for gpio. * * base commit for peripheralpins for usart. * update in serial apis. * * updated serial apis. * * updated serial apis and test. * * update serial apis for asynch apis. * * updated peripheral pins for i2c and spi. * added test support for serial flow control * * Base commit for low power ticker implementation. * * base commit for port apis. * update in lp ticker apis. * * Added test support for port. * * base commit for sleep apis. * * Base commit for spi. * * updated with corrections in gpio irq. * usticker file updated with latest source. * * updated with corrections for unexpected board reset. * updated gpio irq apis and added test for the same. * * updated sleep api for deepsleep. * * updated serial apis. * Added uc_ticker and SPI api implementations * Removed unused SPI pin map * Updated review feedback * * implemented lpticker with TC module. * updated files for KnR Coding Statndard. * updated serial and usticker apis. * * Base commit for AnalogueIn apis. * * RTC apis base commit without implementation. * * Updated with corrections in lpticker implementations. * * Added implementation for rtc apis. * * updated with implementations for pwm. * changed usticker from TC0 to TC1. * Added I2C support * * removed setvector usage from usticker and lpticker implementations * added tests for SAMG55J19 * * Removed unwanted .o and .d files. * Updated I2C files for KnR Coding Standards. * Update for reducing compiler warnings in peripheralpins,c * Updated with PWM free implementation. * * Removed unwanted headers file inclusion. * Compiler warning corrections in serial_api.c * * Updated ADC with 16 bit mode initialization and code refinements. * Updated PWM with code refinements. * Updated I2C review feedback and fixed style * Updated target name for SAMG55 * * Added Test Support for I2C with AT30TSE75X and Added Support for SAMG55J19 in atmelstudio project exporter * * Added Test Support for I2C with AT30TSE75X and Added Support for SAMG55J19 in atmelstudio project exporter * Used NVIC_SetVector for interrupt callback * Removed Target macro define in test * Updated test cases to have SAMG55 support * * Updated with corrections in Serial and SPI asynchronous implementations. * Updated deepsleep api implementation * Merged LP_Ticker with latest code from mbed 3.0 repository. * * updated with corrections in I2C Asynch implementation.
2016-04-05 17:05:59 +00:00
#elif defined(TARGET_SAMG55J19)
SPI spi(PA10, PA09, PB00, PA25); // mosi, miso, sclk cs
DigitalOut latchpin(PA25);
#else
SPI spi(p11, p12, p13);
DigitalOut latchpin(p10);
#endif
int main() {
spi.format(8, 0);
spi.frequency(16 * 1000 * 1000);
2014-05-29 13:49:47 +00:00
latchpin = 0;
while (1) {
latchpin = 1;
spi.write(0);
latchpin = 0;
}
}