Demo of Adafruit_SSD1306 graphics library and SPI interface on RedBear NANO nRF51822 board

Dependencies:   Adafruit_GFX_nano SPI_Demo_Nano

This is a test of the RedBear nano board and the Adafruit oled display. Currently not working because of some problem with the SPI driver which I can't understand.

Revision:
2:7e5609174292
Parent:
0:057ae71e1b6f
Child:
3:6122dfbc9d9e
--- a/main.cpp	Wed Feb 25 20:05:46 2015 +0000
+++ b/main.cpp	Wed Feb 25 20:11:14 2015 +0000
@@ -20,78 +20,22 @@
 #include "mbed.h"
 #include "spi_master.h"
 
-DigitalOut spi_cs(P0_7);
+DigitalOut spi_cs(P0_10);
 
 SPIClass SPI1(NRF_SPI1);
 
 Serial pc(USBTX, USBRX);
 
-void Flash_Buff_WriteBytes(uint16_t addr, uint8_t *pbuf, uint16_t len)
-{
-    uint16_t index;
-    
-    spi_cs = 0;
-    wait_us(200);
-    
-    SPI1.transfer(0x84);   
-    SPI1.transfer(0x00);    
-    SPI1.transfer((uint8_t)(addr>>8));    
-    SPI1.transfer((uint8_t)addr);     
-    for(index=0; index<len; index++)
-    {
-        SPI1.transfer(*pbuf);
-        pbuf++;        
-    }
-    
-    wait_us(200);
-    spi_cs = 1;
-}
-
-void Flash_Buff_ReadBytes(uint16_t addr, uint8_t *pbuf, uint16_t len)
-{
-    uint16_t index;
-    
-    spi_cs = 0;
-    wait_us(200);
-    
-    SPI1.transfer(0xD1);   
-    SPI1.transfer(0x00);    
-    SPI1.transfer((uint8_t)(addr>>8));    
-    SPI1.transfer((uint8_t)addr);     
-    for(index=0; index<len; index++)
-    {
-        *pbuf = SPI1.transfer(0x00);
-        pbuf++;        
-    }
-    
-    wait_us(200);
-    spi_cs = 1;
-}
-
-uint8_t i;
-uint8_t wt_buf[7] = {'H','e','l','l', 'o', '\r', '\n'};
-uint8_t rd_buf[7];
 
 int main(void)
 {   
-    pc.baud(9600);
-    wait(8);
     spi_cs = 1;
     pc.printf("SPI Demo Start \r\n");
     
     //SPI1.begin();
-    SPI1.begin(P0_6, P0_15, P0_29);//SCK, MOSI, MOSI
+    SPI1.begin(P0_8, P0_9, P0_11);//SCK, MOSI, MISO
     
-    wait(1);
-    Flash_Buff_WriteBytes(0, wt_buf, 7);
-    while(1)
-    {
-         memset(rd_buf, 0x00, 7);
-         Flash_Buff_ReadBytes(0, rd_buf, 7);
-         for(i=0; i<7; i++)
-            pc.putc(rd_buf[i]);
-         wait(1);
-    }
+   pc.printf("Step 1 \r\n");
 }