![](/media/cache/profiles/3ceca2fc13c2fa01d4aed1e552d3a6fb.50x50_q85.jpg)
there is a problem. i cant send data continuously.
Dependencies: EthernetNetIf mbed HMC6352 ITG3200 ADXL345 IMUfilter
Diff: SCP1000/SCP1000.h
- Revision:
- 0:711905e937b9
diff -r 000000000000 -r 711905e937b9 SCP1000/SCP1000.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SCP1000/SCP1000.h Sun Jul 24 19:49:51 2011 +0000 @@ -0,0 +1,71 @@ +/** + * @section LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @section DESCRIPTION + * Library to interface with the SCP1000 pressure and temperature sensor. + */ + +#ifndef _SCP1000_H +#define _SCP1000_H + +#include "mbed.h" + +/** + * Class to interface with the SCP1000 pressure and temperature sensor. + */ +class SCP1000 { + public: + /** + * Constructor. + * + * @param mosi SPI MOSI pin + * @param miso SPI MISO pin + * @param sclk SPI SCLK pin + * @param cs Chip select pin + */ + SCP1000(PinName mosi, PinName miso, PinName sclk, PinName cs); + + ~SCP1000() { /* empty */ }; + + /** + * Read the pressure. + * + * @returns The pressure in pascals. + */ + unsigned long readPressure(); + + /** + * Read the temperature. + * + * @returns The temperature in Celsius. + */ + float readTemperature(); + + + private: + static const char PRESSURE = 0x1F; //Pressure 3 MSB + static const char PRESSURE_LSB = 0x20; //Pressure 16 LSB + static const char TEMP = 0x21; //16 bit temp + SPI m_spi; + DigitalOut m_cs; + + char read_register(char register_name); + void write_register(char register_name, char register_value); + float read_register16(char register_name); + +}; + +#endif // _SCP1000_H \ No newline at end of file