Library to interface the SCP1000 temperature and pressure sensor.

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

Committer:
kadams6
Date:
Tue Oct 05 19:59:20 2010 +0000
Revision:
4:295e118b6e85
Parent:
3:4d8b8ca54451
Child:
7:61d2e698d988

        

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 4:295e118b6e85 12 SCP1000(PinName mosi, PinName miso, PinName sclk, PinName cs);
kadams6 0:0b8b5828e1a3 13
kadams6 0:0b8b5828e1a3 14 ~SCP1000() { /* empty */ };
kadams6 0:0b8b5828e1a3 15
kadams6 2:fe7826024fd1 16 ///Reads the pressure
kadams6 1:5fcf1fe4a161 17 /**
kadams6 2:fe7826024fd1 18 Reads the pressure from the sensor
kadams6 2:fe7826024fd1 19 @return Pressure in pascals.
kadams6 2:fe7826024fd1 20 */
kadams6 4:295e118b6e85 21 unsigned long readPressure();
kadams6 0:0b8b5828e1a3 22
kadams6 4:295e118b6e85 23 float readTemperature();
kadams6 0:0b8b5828e1a3 24
kadams6 0:0b8b5828e1a3 25
kadams6 0:0b8b5828e1a3 26 private:
kadams6 0:0b8b5828e1a3 27 static const char PRESSURE = 0x1F; //Pressure 3 MSB
kadams6 0:0b8b5828e1a3 28 static const char PRESSURE_LSB = 0x20; //Pressure 16 LSB
kadams6 0:0b8b5828e1a3 29 static const char TEMP = 0x21; //16 bit temp
kadams6 0:0b8b5828e1a3 30 SPI m_spi;
kadams6 0:0b8b5828e1a3 31 DigitalOut m_cs;
kadams6 0:0b8b5828e1a3 32
kadams6 4:295e118b6e85 33 char read_register(char register_name);
kadams6 4:295e118b6e85 34 void write_register(char register_name, char register_value);
kadams6 4:295e118b6e85 35 float read_register16(char register_name);
kadams6 0:0b8b5828e1a3 36
kadams6 0:0b8b5828e1a3 37 };
kadams6 0:0b8b5828e1a3 38
kadams6 0:0b8b5828e1a3 39 #endif // _SCP1000_H