Alex Borisevich / Mbed 2 deprecated OpenBCI

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PlatformSPI.cpp Source File

PlatformSPI.cpp

00001 // interface for SPI implemented with mbed framework
00002 
00003 #include "PlatformSPI.h"
00004 #include "mbed.h"
00005 
00006 SPI spi_adc(PA_7, PA_6, PA_5); // PinName mosi, PinName miso, PinName sclk, PinName ssel=NC
00007 
00008 void DSPI0::begin()
00009 {
00010 
00011 }
00012 
00013 void DSPI0::setSpeed(int speed_hz)
00014 {
00015   spi_adc.frequency(speed_hz); 
00016 }
00017 
00018 void DSPI0::setMode(int mode)
00019 {
00020   spi_adc.format(8,mode); 
00021 }
00022 
00023 int DSPI0::transfer(int data)
00024 {
00025   return spi_adc.write(data);
00026 }
00027