<commit_before>/*
    opcn2.h - Library for operating the Alphasense OPC-N2 Particle counter.
    Created by <NAME>, March 2016.
    Released with an MIT license.
*/
#ifndef Opcn2_Library_h
#define Opcn2_Library_h

// Includes
#include "application.h"

namespace Opcn2Library
{

    struct histogram_data {

        int bin0;
        int bin1;
        int bin2;
        int bin3;
        int bin4;
        int bin5;
        int bin6;
        int bin7;
        int bin8;
        int bin9;
        int bin10;
        int bin11;
        int bin12;
        int bin13;
        int bin14;
        int bin15;

        // Mass Time-of-Flight
        float bin1MToF;
        float bin3MToF;
        float bin5MToF;
        float bin7MToF;

        // Sample Flow Rate
        float sfr;

        // Either the Temperature or Pressure
        unsigned long temp_pressure;

        // Sampling Period
        float period;

        // Checksum
        unsigned int checksum;

        float pm1;
        float pm25;
        float pm10;

        };

    struct config_variables {

        // Bin Boundaries
        int bb0;
        int bb1;
        int bb2;
        int bb3;
        int bb4;
        int bb5;
        int bb6;
        int bb7;
        int bb8;
        int bb9;
        int bb10;
        int bb11;
        int bb12;
        int bb13;
        int bb14;

        // Bin Particle Volume (floats)
        float bpv0;
        float bpv1;
        float bpv2;
        float bpv3;
        float bpv4;
        float bpv5;
        float bpv6;
        float bpv7;
        float bpv8;
        float bpv9;
        float bpv10;
        float bpv11;
        float bpv12;
        float bpv13;
        float bpv14;
        float bpv15;

        // Bin Particle Densities (floats)
        float bpd0;
        float bpd1;
        float bpd2;
        float bpd3;
        float bpd4;
        float bpd5;
        float bpd6;
        float bpd7;
        float bpd8;
        float bpd9;
        float bpd10;
        float bpd11;
        float bpd12;
        float bpd13;
        float bpd14;
        float bpd15;

        // Bin Sample Volume Weightings (floats)
        float bsvw0;
        float bsvw1;
        float bsvw2;
        float bsvw3;
        float bsvw4;
        float bsvw5;
        float bsvw6;
        float bsvw7;
        float bsvw8;
        float bsvw9;
        float bsvw10;
        float bsvw11;
        float bsvw12;
        float bsvw13;
        float bsvw14;
        float bsvw15;

        // Gain Scaling Coefficient
        float gsc;

        // Sample Flow Rate (ml/s)
        float sfr;

        // LaserDAC 8 bit int
        unsigned int laser_dac;
        unsigned int fan_dac;

        // Time of Flight to Sample Flow Rate Conversion Factor
        unsigned int tof_sfr;
        };


    class OPCN2
    {
    private:
        uint8_t _CS;
        uint16_t _16bit_int(byte MSB, byte LSB);
        bool _compare_arrays(byte array1[], byte array2[]);
        float _calculate_float(byte val0, byte val1, byte val2, byte val3);
        uint32_t _32bit_int(byte val0, byte val1, byte val2, byte val3);

    public:
        OPCN2(int chip_select);

        bool ping();
        bool on();
        bool off():
        bool write_config_variables(byte values[]);
        bool save_config_variables();
        void enter_bootloader();
        void set_fan_power(uint8_t value);
        void set_laser_power(uint8_t value);
        void toggle_fan(bool state);
        void toggle_laser(bool state);
        histogram_data histogram();
        config_variables config();
        String info_string();

        String firmware_version;
    }
}

#endif<commit_msg>attepmt 2<commit_after>/*
    opcn2.h - Library for operating the Alphasense OPC-N2 Particle counter.
    Created by <NAME>, March 2016.
    Released with an MIT license.
*/
#ifndef Opcn2_Library_h
#define Opcn2_Library_h

// Includes
#include "application.h"

namespace Opcn2Library
{

    struct histogram_data {

        int bin0;
        int bin1;
        int bin2;
        int bin3;
        int bin4;
        int bin5;
        int bin6;
        int bin7;
        int bin8;
        int bin9;
        int bin10;
        int bin11;
        int bin12;
        int bin13;
        int bin14;
        int bin15;

        // Mass Time-of-Flight
        float bin1MToF;
        float bin3MToF;
        float bin5MToF;
        float bin7MToF;

        // Sample Flow Rate
        float sfr;

        // Either the Temperature or Pressure
        unsigned long temp_pressure;

        // Sampling Period
        float period;

        // Checksum
        unsigned int checksum;

        float pm1;
        float pm25;
        float pm10;

        };

    struct config_variables {

        // Bin Boundaries
        int bb0;
        int bb1;
        int bb2;
        int bb3;
        int bb4;
        int bb5;
        int bb6;
        int bb7;
        int bb8;
        int bb9;
        int bb10;
        int bb11;
        int bb12;
        int bb13;
        int bb14;

        // Bin Particle Volume (floats)
        float bpv0;
        float bpv1;
        float bpv2;
        float bpv3;
        float bpv4;
        float bpv5;
        float bpv6;
        float bpv7;
        float bpv8;
        float bpv9;
        float bpv10;
        float bpv11;
        float bpv12;
        float bpv13;
        float bpv14;
        float bpv15;

        // Bin Particle Densities (floats)
        float bpd0;
        float bpd1;
        float bpd2;
        float bpd3;
        float bpd4;
        float bpd5;
        float bpd6;
        float bpd7;
        float bpd8;
        float bpd9;
        float bpd10;
        float bpd11;
        float bpd12;
        float bpd13;
        float bpd14;
        float bpd15;

        // Bin Sample Volume Weightings (floats)
        float bsvw0;
        float bsvw1;
        float bsvw2;
        float bsvw3;
        float bsvw4;
        float bsvw5;
        float bsvw6;
        float bsvw7;
        float bsvw8;
        float bsvw9;
        float bsvw10;
        float bsvw11;
        float bsvw12;
        float bsvw13;
        float bsvw14;
        float bsvw15;

        // Gain Scaling Coefficient
        float gsc;

        // Sample Flow Rate (ml/s)
        float sfr;

        // LaserDAC 8 bit int
        unsigned int laser_dac;
        unsigned int fan_dac;

        // Time of Flight to Sample Flow Rate Conversion Factor
        unsigned int tof_sfr;
        };


    class OPCN2
    {
    private:
        uint8_t _CS;
        uint16_t _16bit_int(byte MSB, byte LSB);
        bool _compare_arrays(byte array1[], byte array2[]);
        float _calculate_float(byte val0, byte val1, byte val2, byte val3);
        uint32_t _32bit_int(byte val0, byte val1, byte val2, byte val3);

    public:
        OPCN2(int chip_select);

        bool ping();
        bool on();
        bool off();
        bool write_config_variables(byte values[]);
        bool save_config_variables();
        void enter_bootloader();
        void set_fan_power(uint8_t value);
        void set_laser_power(uint8_t value);
        void toggle_fan(bool state);
        void toggle_laser(bool state);
        histogram_data histogram();
        config_variables config();
        String info_string();

        String firmware_version;
    };
}

#endif
{'fraction_non_alphanumeric': 0.0653924914675768, 'fraction_numerical': 0.04109215017064846, 'mean_word_length': 1.41622691292876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4591893', 'n_tokens_mistral': 2511, 'n_tokens_neox': 2325, 'n_words': 692}