/*****************************************************************************

    source::worx libPiGPio
    Copyright © 2022 c.holzheuer
    chris@sourceworx.org

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Uses:

    pigpiod_if2 by joan2937, pigpio @ abyz.me.uk
    https://abyz.me.uk/rpi/pigpio

    sigslot  by 2017 Pierre-Antoine Lacaze
    https://github.com/palacaze/sigslot

***************************************************************************/


#include <pigi2c.h>

pigI2C::pigI2C()
{

}


pigI2C::pigI2C( i2c_addr_t aaddr, i2c_bus_t abus  )
{
    init( aaddr, abus );
}


pigI2C::~pigI2C()
{
    pigpio::i2c_close( *this );
}


void pigI2C::init( i2c_addr_t aaddr , i2c_bus_t abus )
{
    addr = aaddr;
    bus  = abus;

    handle = pigpio::i2c_open( *this );
}


int pigI2C::i2c_write_device( char* buf, unsigned count )
{
    return pigpio::i2c_write_device( *this, buf, count );
}
