Library to interface the SCP1000 temperature and pressure sensor.

Dependents:   SCP1000_Example ku-make_sensor ku-make_sensor201302 SCP1000_Example ... more

Committer:
kadams6
Date:
Fri Oct 08 17:39:06 2010 +0000
Revision:
7:61d2e698d988
Parent:
4:295e118b6e85
Child:
8:1049590388b6

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kadams6 3:4d8b8ca54451 1 /** \file
kadams6 3:4d8b8ca54451 2 SCP1000 header file
kadams6 3:4d8b8ca54451 3 */
kadams6 3:4d8b8ca54451 4
kadams6 0:0b8b5828e1a3 5 #ifndef _SCP1000_H
kadams6 0:0b8b5828e1a3 6 #define _SCP1000_H
kadams6 0:0b8b5828e1a3 7
kadams6 0:0b8b5828e1a3 8 #include "mbed.h"
kadams6 0:0b8b5828e1a3 9
kadams6 0:0b8b5828e1a3 10 class SCP1000 {
kadams6 0:0b8b5828e1a3 11 public:
kadams6 7:61d2e698d988 12 /**
kadams6 7:61d2e698d988 13 * Constructor.
kadams6 7:61d2e698d988 14 *
kadams6 7:61d2e698d988 15 * @param mosi SPI MOSI pin
kadams6 7:61d2e698d988 16 * @param miso SPI MISO pin
kadams6 7:61d2e698d988 17 * @param sclk SPI SCLK pin
kadams6 7:61d2e698d988 18 * @param cs Chip select pin
kadams6 7:61d2e698d988 19 */
kadams6 4:295e118b6e85 20 SCP1000(PinName mosi, PinName miso, PinName sclk, PinName cs);
kadams6 0:0b8b5828e1a3 21
kadams6 0:0b8b5828e1a3 22 ~SCP1000() { /* empty */ };
kadams6 0:0b8b5828e1a3 23
kadams6 1:5fcf1fe4a161 24 /**
kadams6 7:61d2e698d988 25 * Read the pressure.
kadams6 7:61d2e698d988 26 *
kadams6 7:61d2e698d988 27 * @returns The pressure in pascals.
kadams6 7:61d2e698d988 28 */
kadams6 4:295e118b6e85 29 unsigned long readPressure();
kadams6 0:0b8b5828e1a3 30
kadams6 7:61d2e698d988 31 /**
kadams6 7:61d2e698d988 32 * Read the temperature.
kadams6 7:61d2e698d988 33 *
kadams6 7:61d2e698d988 34 * @returns The temperature in Celsius.
kadams6 7:61d2e698d988 35 */
kadams6 4:295e118b6e85 36 float readTemperature();
kadams6 0:0b8b5828e1a3 37
kadams6 0:0b8b5828e1a3 38
kadams6 0:0b8b5828e1a3 39 private:
kadams6 0:0b8b5828e1a3 40 static const char PRESSURE = 0x1F; //Pressure 3 MSB
kadams6 0:0b8b5828e1a3 41 static const char PRESSURE_LSB = 0x20; //Pressure 16 LSB
kadams6 0:0b8b5828e1a3 42 static const char TEMP = 0x21; //16 bit temp
kadams6 0:0b8b5828e1a3 43 SPI m_spi;
kadams6 0:0b8b5828e1a3 44 DigitalOut m_cs;
kadams6 0:0b8b5828e1a3 45
kadams6 4:295e118b6e85 46 char read_register(char register_name);
kadams6 4:295e118b6e85 47 void write_register(char register_name, char register_value);
kadams6 4:295e118b6e85 48 float read_register16(char register_name);
kadams6 0:0b8b5828e1a3 49
kadams6 0:0b8b5828e1a3 50 };
kadams6 0:0b8b5828e1a3 51
kadams6 0:0b8b5828e1a3 52 #endif // _SCP1000_H