Alex Borisevich / Mbed 2 deprecated OpenBCI

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PlatformGPIO.cpp Source File

PlatformGPIO.cpp

00001 // interface for SPI implemented with mbed framework
00002 
00003 #include "PlatformGPIO.h"
00004 
00005 
00006 DigitalOut adc_SS(BOARD_ADS);
00007 DigitalOut adc_reset(ADS_RST);
00008 DigitalOut sd_SS(SD_SS);
00009 DigitalOut daisy_SS(DAISY_ADS);
00010 DigitalOut accel_SS(LIS3DH_SS);
00011 
00012 InterruptIn adc_ready(ADS_DRDY);
00013 DigitalIn accel_ready(LIS3DH_DRDY);
00014 
00015 void digitalWrite(int pin, unsigned char value)
00016 {
00017   if (pin == BOARD_ADS)
00018     adc_SS = value;
00019   else
00020   if (pin == ADS_RST)
00021     adc_reset = value;
00022   else
00023   if (pin == SD_SS)
00024     sd_SS = value;
00025   else
00026   if (pin == DAISY_ADS)
00027     daisy_SS = value;
00028   else
00029   if (pin == LIS3DH_SS)
00030     accel_SS = value;
00031 }
00032 
00033 unsigned char digitalRead(int pin)
00034 {
00035   if (pin == ADS_DRDY)
00036     return adc_ready;
00037   else
00038   if (pin == LIS3DH_DRDY)
00039     return accel_ready;
00040 }
00041 
00042 // external interrupt as ready signal
00043 extern void ADS_DRDY_Service();
00044 
00045 void setIntEnable(int x)
00046 {
00047   adc_ready.fall(&ADS_DRDY_Service);
00048 }