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.

Committer:
tsh
Date:
Thu Feb 26 00:05:22 2015 +0000
Revision:
11:9ebbb4dd9760
Parent:
10:d9a6a2fede8c
Child:
12:1404f010d12c
no spi inside begin

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsh 0:057ae71e1b6f 1 /*
tsh 0:057ae71e1b6f 2
tsh 0:057ae71e1b6f 3 Copyright (c) 2012-2014 RedBearLab
tsh 0:057ae71e1b6f 4
tsh 0:057ae71e1b6f 5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
tsh 0:057ae71e1b6f 6 and associated documentation files (the "Software"), to deal in the Software without restriction,
tsh 0:057ae71e1b6f 7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
tsh 0:057ae71e1b6f 8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
tsh 0:057ae71e1b6f 9 subject to the following conditions:
tsh 0:057ae71e1b6f 10 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
tsh 0:057ae71e1b6f 11
tsh 0:057ae71e1b6f 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
tsh 0:057ae71e1b6f 13 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
tsh 0:057ae71e1b6f 14 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
tsh 0:057ae71e1b6f 15 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
tsh 0:057ae71e1b6f 16 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tsh 0:057ae71e1b6f 17
tsh 0:057ae71e1b6f 18 */
tsh 0:057ae71e1b6f 19
tsh 0:057ae71e1b6f 20 #include "mbed.h"
tsh 0:057ae71e1b6f 21 #include "spi_master.h"
tsh 3:6122dfbc9d9e 22 #include "Adafruit_SSD1306.h"
tsh 0:057ae71e1b6f 23
tsh 4:9decf12340fa 24 //DigitalOut spi_cs(P0_10);
tsh 11:9ebbb4dd9760 25 //DigitalOut rst(A3);
tsh 11:9ebbb4dd9760 26 //DigitalOut dc(A4);
tsh 11:9ebbb4dd9760 27 //DigitalOut cs(D2);
tsh 4:9decf12340fa 28 DigitalOut led(D13);
tsh 0:057ae71e1b6f 29
tsh 11:9ebbb4dd9760 30 //SPIClass SPI1(NRF_SPI1);
tsh 0:057ae71e1b6f 31
tsh 8:971ea27171dd 32
tsh 11:9ebbb4dd9760 33 Adafruit_SSD1306_nrf gOled1(P0_5,P0_4,P0_10);// DC, RST, CS
tsh 0:057ae71e1b6f 34
tsh 0:057ae71e1b6f 35 int main(void)
tsh 0:057ae71e1b6f 36 {
tsh 8:971ea27171dd 37
tsh 4:9decf12340fa 38 led = 1; // off
tsh 9:bbe01bf9a3ef 39 wait (0.3);
tsh 9:bbe01bf9a3ef 40 led = 0; // ON
tsh 9:bbe01bf9a3ef 41 wait (0.3);
tsh 9:bbe01bf9a3ef 42 led = 1; // off
tsh 8:971ea27171dd 43
tsh 8:971ea27171dd 44
tsh 8:971ea27171dd 45 while(1){
tsh 8:971ea27171dd 46 led = 0; // on
tsh 8:971ea27171dd 47 wait(1);
tsh 8:971ea27171dd 48 led = 1;
tsh 8:971ea27171dd 49 wait(1);
tsh 8:971ea27171dd 50 }
tsh 0:057ae71e1b6f 51 }
tsh 0:057ae71e1b6f 52
tsh 0:057ae71e1b6f 53
tsh 0:057ae71e1b6f 54
tsh 0:057ae71e1b6f 55
tsh 0:057ae71e1b6f 56
tsh 0:057ae71e1b6f 57
tsh 0:057ae71e1b6f 58