<commit_before>#include "ledMatrix.h"
#include <algorithm>

/*
   This implements a bicolor matrix with
   Holtek HT16K33 controller
*/

LedMatrix::LedMatrix( const char *dev, int address ) : i2c( dev, address )
{
   switchOn( true );
   setBrightness( 0 );
}

LedMatrix::~LedMatrix( )
{
}

void LedMatrix::switchOn( bool on )
{
   // oscillator
   i2c.write1( 0x20 | on, 0 );
   // display
   i2c.write1( 0x80 | on, 0 );
}

void LedMatrix::setBrightness( int k )
{
   if( k < 0 || k > 15 )
      throw std::invalid_argument( "0 <= brightness <= 15" );
   i2c.write1( 0xE0 | k, 0 );
}
<commit_msg>clear buffer in constructor<commit_after>#include "ledMatrix.h"
#include <algorithm>

/*
   This implements a bicolor matrix with
   Holtek HT16K33 controller
*/

LedMatrix::LedMatrix( const char *dev, int address ) : i2c( dev, address )
{
   clearBuffer();
   switchOn( true );
   setBrightness( 0 );
}

LedMatrix::~LedMatrix( )
{
}

void LedMatrix::switchOn( bool on )
{
   // oscillator
   i2c.write1( 0x20 | on, 0 );
   // display
   i2c.write1( 0x80 | on, 0 );
}

void LedMatrix::setBrightness( int k )
{
   if( k < 0 || k > 15 )
      throw std::invalid_argument( "0 <= brightness <= 15" );
   i2c.write1( 0xE0 | k, 0 );
}

{'fraction_non_alphanumeric': 0.14926590538336051, 'fraction_numerical': 0.04730831973898858, 'mean_word_length': 3.173469387755102, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '1144750', 'n_tokens_mistral': 507, 'n_tokens_neox': 470, 'n_words': 122}