Advertisement
Guest User

Untitled

a guest
Jan 7th, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #include "wiced.h"
  2.  
  3. void application_start(void)
  4. {
  5.     /* Initialise the device and WICED framework */
  6.     wiced_init( );
  7.  
  8.     wiced_spi_device_t spi = {
  9.         .port        = WICED_SPI_1,
  10.         .chip_select = WICED_SPI_FLASH_CS,
  11.         .speed       = 750000,
  12.         .mode        = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_LOW | SPI_NO_DMA | SPI_MSB_FIRST),
  13.         .bits        = 8
  14.     };
  15.     wiced_spi_init(&spi);
  16.  
  17.     uint8_t out[33];
  18.     uint8_t in[33];
  19.     memset(in, 0, 33);
  20.     memset(out, 0, 33);
  21.     while(1) {
  22.         wiced_spi_message_segment_t segments[1];
  23.         //out[0] = i;
  24.         segments[0].tx_buffer = out;
  25.         segments[0].length = 32;
  26.         segments[0].rx_buffer = in;
  27.  
  28.         wiced_spi_transfer(&spi, segments, 1);
  29.         out[0] = in[0];
  30.         WPRINT_APP_INFO( ("[SPI] in: %s\r\n", (char *)in) );
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement