<commit_before>#include <iostream>
#include <unistd.h>
#include <string.h>
#include <cmath>
#include "ds1808lc.h"
#include "mraa-utils.h"

#define DS1808_I2C_ADDR 0x28
#define DS1808_POT2_OFFSET 0x40
#define DS1808_MAX_POT_VALUE 0x20
#define DS1808_LOW_VALUE 32 // Lowest pot value that the eye can differentiate from 0
#define DS1808_HIGH_VALUE 51 // Highest pot value that the eye can differentiate from full

// Used to prevent silent failure in mraa_i2c_write()
// Value from I2C_SMBUS_I2C_BLOCK_MAX in i2c driver
#define MAX_I2C_WRITE_SIZE 32



namespace upm {
DS1808LC::DS1808LC(int gpioPower, int i2cBus)
{
   status = MRAA_ERROR_INVALID_RESOURCE;
   mraa_set_log_level(7);
   pinPower = gpioPower;
   i2c = mraa_i2c_init(i2cBus);
   if (i2c == NULL)
   {
      status = MRAA_ERROR_INVALID_RESOURCE;
      printf("DS1808LC: I2C initialisation failed.\n");
      return;
   }
   mraa_i2c_address(i2c, DS1808_I2C_ADDR);

   // There is a bug in the hardware that prevents us from reading the power GPIO pin
   m_isPowered = false;     // Assume it's off

   int brightness;
   if (getBrightness(brightness))
	   status = MRAA_SUCCESS;
}<commit_msg>DS1808LC: Fix build error.<commit_after>#include <iostream>
#include <unistd.h>
#include <string.h>
#include <cmath>
#include "ds1808lc.h"
#include "mraa-utils.h"

#define DS1808_I2C_ADDR 0x28
#define DS1808_POT2_OFFSET 0x40
#define DS1808_MAX_POT_VALUE 0x20
#define DS1808_LOW_VALUE 32 // Lowest pot value that the eye can differentiate from 0
#define DS1808_HIGH_VALUE 51 // Highest pot value that the eye can differentiate from full

// Used to prevent silent failure in mraa_i2c_write()
// Value from I2C_SMBUS_I2C_BLOCK_MAX in i2c driver
#define MAX_I2C_WRITE_SIZE 32



namespace upm {
DS1808LC::DS1808LC(int gpioPower, int i2cBus)
{
   status = MRAA_ERROR_INVALID_RESOURCE;
   mraa_set_log_level(7);
   pinPower = gpioPower;
   i2c = mraa_i2c_init(i2cBus);
   if (i2c == NULL)
   {
      status = MRAA_ERROR_INVALID_RESOURCE;
      printf("DS1808LC: I2C initialisation failed.\n");
      return;
   }
   mraa_i2c_address(i2c, DS1808_I2C_ADDR);

   // There is a bug in the hardware that prevents us from reading the power GPIO pin
   m_isPowered = false;     // Assume it's off

   int brightness = 0;
   if (getBrightness(&brightness))
	   status = MRAA_SUCCESS;
}
{'fraction_non_alphanumeric': 0.08426483233018056, 'fraction_numerical': 0.0649183147033534, 'mean_word_length': 4.205816554809844, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1972538', 'n_tokens_mistral': 979, 'n_tokens_neox': 888, 'n_words': 234}