A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Untitled - Stikked
From Emerald Bird, 7 Years ago, written in C.
Embed
  1. /***************************************************************************
  2.   This is a library for the BME280 humidity, temperature & pressure sensor
  3.  
  4.   Designed specifically to work with the Adafruit BME280 Breakout
  5.   ----> http://www.adafruit.com/products/2650
  6.  
  7.   These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  8.   to interface.
  9.  
  10.   Adafruit invests time and resources providing this open source code,
  11.   please support Adafruit andopen-source hardware by purchasing products
  12.   from Adafruit!
  13.  
  14.   Written by Limor Fried & Kevin Townsend for Adafruit Industries.
  15.   BSD license, all text above must be included in any redistribution
  16.  ***************************************************************************/
  17. #ifndef __BME280_H__
  18. #define __BME280_H__
  19.  
  20. #if (ARDUINO >= 100)
  21.  #include "Arduino.h"
  22. #else
  23.  #include "WProgram.h"
  24. #endif
  25.  
  26. #include <Adafruit_Sensor.h>
  27. #include <Wire.h>
  28.  
  29. /*=========================================================================
  30.     I2C ADDRESS/BITS
  31.     -----------------------------------------------------------------------*/
  32.     #define BME280_ADDRESS                (0x76)
  33. /*=========================================================================*/
  34.  
  35. /*=========================================================================
  36.     REGISTERS
  37.     -----------------------------------------------------------------------*/
  38.     enum
  39.     {
  40.         BME280_REGISTER_DIG_T1              = 0x88,
  41.         BME280_REGISTER_DIG_T2              = 0x8A,
  42.         BME280_REGISTER_DIG_T3              = 0x8C,
  43.  
  44.         BME280_REGISTER_DIG_P1              = 0x8E,
  45.         BME280_REGISTER_DIG_P2              = 0x90,
  46.         BME280_REGISTER_DIG_P3              = 0x92,
  47.         BME280_REGISTER_DIG_P4              = 0x94,
  48.         BME280_REGISTER_DIG_P5              = 0x96,
  49.         BME280_REGISTER_DIG_P6              = 0x98,
  50.         BME280_REGISTER_DIG_P7              = 0x9A,
  51.         BME280_REGISTER_DIG_P8              = 0x9C,
  52.         BME280_REGISTER_DIG_P9              = 0x9E,
  53.  
  54.         BME280_REGISTER_DIG_H1              = 0xA1,
  55.         BME280_REGISTER_DIG_H2              = 0xE1,
  56.         BME280_REGISTER_DIG_H3              = 0xE3,
  57.         BME280_REGISTER_DIG_H4              = 0xE4,
  58.         BME280_REGISTER_DIG_H5              = 0xE5,
  59.         BME280_REGISTER_DIG_H6              = 0xE7,
  60.  
  61.         BME280_REGISTER_CHIPID             = 0xD0,
  62.         BME280_REGISTER_VERSION            = 0xD1,
  63.         BME280_REGISTER_SOFTRESET          = 0xE0,
  64.  
  65.         BME280_REGISTER_CAL26              = 0xE1,  // R calibration stored in 0xE1-0xF0
  66.  
  67.         BME280_REGISTER_CONTROLHUMID       = 0xF2,
  68.         BME280_REGISTER_STATUS             = 0XF3,
  69.         BME280_REGISTER_CONTROL            = 0xF4,
  70.         BME280_REGISTER_CONFIG             = 0xF5,
  71.         BME280_REGISTER_PRESSUREDATA       = 0xF7,
  72.         BME280_REGISTER_TEMPDATA           = 0xFA,
  73.         BME280_REGISTER_HUMIDDATA          = 0xFD
  74.     };
  75.  
  76. /*=========================================================================*/
  77.  
  78. /*=========================================================================
  79.     CALIBRATION DATA
  80.     -----------------------------------------------------------------------*/
  81.     typedef struct
  82.     {
  83.         uint16_t dig_T1;
  84.         int16_t  dig_T2;
  85.         int16_t  dig_T3;
  86.  
  87.         uint16_t dig_P1;
  88.         int16_t  dig_P2;
  89.         int16_t  dig_P3;
  90.         int16_t  dig_P4;
  91.         int16_t  dig_P5;
  92.         int16_t  dig_P6;
  93.         int16_t  dig_P7;
  94.         int16_t  dig_P8;
  95.         int16_t  dig_P9;
  96.  
  97.         uint8_t  dig_H1;
  98.         int16_t  dig_H2;
  99.         uint8_t  dig_H3;
  100.         int16_t  dig_H4;
  101.         int16_t  dig_H5;
  102.         int8_t   dig_H6;
  103.     } bme280_calib_data;
  104. /*=========================================================================*/
  105.  
  106. /*
  107. class Adafruit_BME280_Unified : public Adafruit_Sensor
  108. {
  109.   public:
  110.     Adafruit_BME280_Unified(int32_t sensorID = -1);
  111.  
  112.     bool  begin(uint8_t addr = BME280_ADDRESS);
  113.     void  getTemperature(float *temp);
  114.     void  getPressure(float *pressure);
  115.     float pressureToAltitude(float seaLevel, float atmospheric, float temp);
  116.     float seaLevelForAltitude(float altitude, float atmospheric, float temp);
  117.     void  getEvent(sensors_event_t*);
  118.     void  getSensor(sensor_t*);
  119.  
  120.   private:
  121.     uint8_t   _i2c_addr;
  122.     int32_t   _sensorID;
  123. };
  124.  
  125. */
  126.  
  127. class Adafruit_BME280 {
  128.     public:
  129.         enum sensor_sampling {
  130.             SAMPLING_NONE = 0b000,
  131.             SAMPLING_X1   = 0b001,
  132.             SAMPLING_X2   = 0b010,
  133.             SAMPLING_X4   = 0b011,
  134.             SAMPLING_X8   = 0b100,
  135.             SAMPLING_X16  = 0b101
  136.         };
  137.  
  138.         enum sensor_mode {
  139.             MODE_SLEEP  = 0b00,
  140.             MODE_FORCED = 0b01,
  141.             MODE_NORMAL = 0b11
  142.         };
  143.  
  144.         enum sensor_filter {
  145.             FILTER_OFF = 0b000,
  146.             FILTER_X2  = 0b001,
  147.             FILTER_X4  = 0b010,
  148.             FILTER_X8  = 0b011,
  149.             FILTER_X16 = 0b100
  150.         };
  151.  
  152.         // standby durations in ms
  153.         enum standby_duration {
  154.             STANDBY_MS_0_5  = 0b000,
  155.             STANDBY_MS_10   = 0b110,
  156.             STANDBY_MS_20   = 0b111,
  157.             STANDBY_MS_62_5 = 0b001,
  158.             STANDBY_MS_125  = 0b010,
  159.             STANDBY_MS_250  = 0b011,
  160.             STANDBY_MS_500  = 0b100,
  161.             STANDBY_MS_1000 = 0b101
  162.         };
  163.    
  164.         // constructors
  165.         Adafruit_BME280(void);
  166.         Adafruit_BME280(int8_t cspin);
  167.         Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin);
  168.                
  169.                 bool begin(void);
  170.                 bool begin(TwoWire *theWire);
  171.                 bool begin(uint8_t addr);
  172.         bool begin(uint8_t addr, TwoWire *theWire);
  173.                 bool init();
  174.  
  175.         void setSampling(sensor_mode mode              = MODE_NORMAL,
  176.                          sensor_sampling tempSampling  = SAMPLING_X16,
  177.                          sensor_sampling pressSampling = SAMPLING_X16,
  178.                          sensor_sampling humSampling   = SAMPLING_X16,
  179.                          sensor_filter filter          = FILTER_OFF,
  180.                          standby_duration duration     = STANDBY_MS_0_5
  181.                          );
  182.                    
  183.         void takeForcedMeasurement();
  184.         float readTemperature(void);
  185.         float readPressure(void);
  186.         float readHumidity(void);
  187.        
  188.         float readAltitude(float seaLevel);
  189.         float seaLevelForAltitude(float altitude, float pressure);
  190.  
  191.        
  192.     private:
  193.                 TwoWire *_wire;
  194.         void readCoefficients(void);
  195.         bool isReadingCalibration(void);
  196.         uint8_t spixfer(uint8_t x);
  197.  
  198.         void      write8(byte reg, byte value);
  199.         uint8_t   read8(byte reg);
  200.         uint16_t  read16(byte reg);
  201.         uint32_t  read24(byte reg);
  202.         int16_t   readS16(byte reg);
  203.         uint16_t  read16_LE(byte reg); // little endian
  204.         int16_t   readS16_LE(byte reg); // little endian
  205.  
  206.         uint8_t   _i2caddr;
  207.         int32_t   _sensorID;
  208.         int32_t   t_fine;
  209.  
  210.         int8_t _cs, _mosi, _miso, _sck;
  211.  
  212.         bme280_calib_data _bme280_calib;
  213.  
  214.         // The config register
  215.         struct config {
  216.             // inactive duration (standby time) in normal mode
  217.             // 000 = 0.5 ms
  218.             // 001 = 62.5 ms
  219.             // 010 = 125 ms
  220.             // 011 = 250 ms
  221.             // 100 = 500 ms
  222.             // 101 = 1000 ms
  223.             // 110 = 10 ms
  224.             // 111 = 20 ms
  225.             unsigned int t_sb : 3;
  226.  
  227.             // filter settings
  228.             // 000 = filter off
  229.             // 001 = 2x filter
  230.             // 010 = 4x filter
  231.             // 011 = 8x filter
  232.             // 100 and above = 16x filter
  233.             unsigned int filter : 3;
  234.  
  235.             // unused - don't set
  236.             unsigned int none : 1;
  237.             unsigned int spi3w_en : 1;
  238.  
  239.             unsigned int get() {
  240.                 return (t_sb << 5) | (filter << 3) | spi3w_en;
  241.             }
  242.         };
  243.         config _configReg;
  244.  
  245.        
  246.         // The ctrl_meas register
  247.         struct ctrl_meas {
  248.             // temperature oversampling
  249.             // 000 = skipped
  250.             // 001 = x1
  251.             // 010 = x2
  252.             // 011 = x4
  253.             // 100 = x8
  254.             // 101 and above = x16
  255.             unsigned int osrs_t : 3;
  256.  
  257.             // pressure oversampling
  258.             // 000 = skipped
  259.             // 001 = x1
  260.             // 010 = x2
  261.             // 011 = x4
  262.             // 100 = x8
  263.             // 101 and above = x16
  264.             unsigned int osrs_p : 3;
  265.  
  266.             // device mode
  267.             // 00       = sleep
  268.             // 01 or 10 = forced
  269.             // 11       = normal
  270.             unsigned int mode : 2;
  271.  
  272.             unsigned int get() {
  273.                 return (osrs_t << 5) | (osrs_p << 3) | mode;
  274.             }
  275.         };
  276.         ctrl_meas _measReg;
  277.  
  278.        
  279.         // The ctrl_hum register
  280.         struct ctrl_hum {
  281.             // unused - don't set
  282.             unsigned int none : 5;
  283.  
  284.             // pressure oversampling
  285.             // 000 = skipped
  286.             // 001 = x1
  287.             // 010 = x2
  288.             // 011 = x4
  289.             // 100 = x8
  290.             // 101 and above = x16
  291.             unsigned int osrs_h : 3;
  292.  
  293.             unsigned int get() {
  294.                 return (osrs_h);
  295.             }
  296.         };
  297.         ctrl_hum _humReg;
  298. };
  299.  
  300. #endif
  301.