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.
main.cpp@2:7e5609174292, 2015-02-25 (annotated)
- Committer:
- tsh
- Date:
- Wed Feb 25 20:11:14 2015 +0000
- Revision:
- 2:7e5609174292
- Parent:
- 0:057ae71e1b6f
- Child:
- 3:6122dfbc9d9e
Just SPI pins
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:057ae71e1b6f | 22 | |
tsh | 2:7e5609174292 | 23 | DigitalOut spi_cs(P0_10); |
tsh | 0:057ae71e1b6f | 24 | |
tsh | 0:057ae71e1b6f | 25 | SPIClass SPI1(NRF_SPI1); |
tsh | 0:057ae71e1b6f | 26 | |
tsh | 0:057ae71e1b6f | 27 | Serial pc(USBTX, USBRX); |
tsh | 0:057ae71e1b6f | 28 | |
tsh | 0:057ae71e1b6f | 29 | |
tsh | 0:057ae71e1b6f | 30 | int main(void) |
tsh | 0:057ae71e1b6f | 31 | { |
tsh | 0:057ae71e1b6f | 32 | spi_cs = 1; |
tsh | 0:057ae71e1b6f | 33 | pc.printf("SPI Demo Start \r\n"); |
tsh | 0:057ae71e1b6f | 34 | |
tsh | 0:057ae71e1b6f | 35 | //SPI1.begin(); |
tsh | 2:7e5609174292 | 36 | SPI1.begin(P0_8, P0_9, P0_11);//SCK, MOSI, MISO |
tsh | 0:057ae71e1b6f | 37 | |
tsh | 2:7e5609174292 | 38 | pc.printf("Step 1 \r\n"); |
tsh | 0:057ae71e1b6f | 39 | } |
tsh | 0:057ae71e1b6f | 40 | |
tsh | 0:057ae71e1b6f | 41 | |
tsh | 0:057ae71e1b6f | 42 | |
tsh | 0:057ae71e1b6f | 43 | |
tsh | 0:057ae71e1b6f | 44 | |
tsh | 0:057ae71e1b6f | 45 | |
tsh | 0:057ae71e1b6f | 46 |