Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SCP1000 by
Revision 10:53f432e521a4, committed 2013-07-05
- Comitter:
- YSB
- Date:
- Fri Jul 05 04:17:53 2013 +0000
- Parent:
- 9:47d6f205890b
- Commit message:
- SCP1000
Changed in this revision
SCP1000.cpp | Show annotated file Show diff for this revision Revisions of this file |
SCP1000.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SCP1000.cpp Fri Oct 08 17:44:49 2010 +0000 +++ b/SCP1000.cpp Fri Jul 05 04:17:53 2013 +0000 @@ -1,23 +1,3 @@ -/** - * @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. - */ - #include "SCP1000.h" SCP1000::SCP1000(PinName mosi, PinName miso, PinName sclk, PinName cs) @@ -26,6 +6,7 @@ m_cs=1; m_spi.frequency(500000); // the fastest of the sensor m_spi.format(8, 0); // duda son dos palabras de 8 bits? + /* wait(0.5); //------------------------------------------------ // pc.printf("RESET\r\n"); @@ -35,6 +16,18 @@ // pc.printf("Initialize High Resolution Constant Reading Mode\r\n"); write_register(0x03,0x0A); wait(0.5); + */ +} + +void SCP1000::init_scp1000(){ + //------------------------------------------------ + // pc.printf("RESET\r\n"); + write_register(0x06,0x01); + wait(0.5); + + // pc.printf("Initialize High Resolution Constant Reading Mode\r\n"); + write_register(0x03,0x0A); + wait(0.5); } unsigned long SCP1000::readPressure() {
--- a/SCP1000.h Fri Oct 08 17:44:49 2010 +0000 +++ b/SCP1000.h Fri Jul 05 04:17:53 2013 +0000 @@ -1,59 +1,17 @@ -/** - * @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(); - + void init_scp1000(); private: static const char PRESSURE = 0x1F; //Pressure 3 MSB