Adapting Sparkfun's DRV8830 Library for ATtiny 85 -- Problem with i2c Pin Define

I'm attempting to convert Sparkfun's GitHub - sparkfun/MiniMoto: Small I2C-based DC motor driver library into an ATtiny library. I've had many problems trying to use the TinyWireM library to interface with the chip. I ended up using the SoftI2CMaster library.

I was able to use the ATtiny 85 to interface with the chip. It works perfect.

But now I'm trying to convert the working functions into a library. I'm all hack and I have surprised myself making it this far. Specifically, it spits back errors when I attempt to define the pins for the SoftI2CMaster from my tinyMoto.h.

I've thrown my code up on a github:

Here's a sample of the errors:

In file included from C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/tinymoto.h:5,
                 from tinyMotoExample.cpp:1:
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'void i2c_wait_scl_high()':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:208: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:208: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'boolean i2c_init()':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:262: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:262: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:264: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:264: error: 'SDA_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'bool i2c_start(uint8_t)':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:282: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:282: error: 'SDA_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:283: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:283: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'bool i2c_rep_start(uint8_t)':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:307: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:307: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:308: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:308: error: 'SDA_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'void i2c_start_wait(uint8_t)':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:335: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:335: error: 'SDA_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:336: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:336: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'void i2c_stop()':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:355: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:355: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:356: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:356: error: 'SDA_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'bool i2c_write(uint8_t)':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:431: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:431: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:432: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:432: error: 'SDA_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h: In function 'uint8_t i2c_read(bool)':
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:500: error: 'SCL_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:500: error: 'SCL_PIN' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:501: error: 'SDA_PORT' was not declared in this scope
C:\Users\Thomas\Documents\Arduino\libraries\TinyMoto/SoftI2CMaster.h:501: error: 'SDA_PIN' was not declared in this scope

All the errors refer to the SoftI2CMaster library, which is NOT included in the sketch, so is not actually available in the build directory.

I guess I'm very confused.

It states the error compiling is "in file included," specifically, in pin definition of within functions located in SoftI2CMaster.h. Regardless, it is included in my .cpp and .h files. Also, I've tried including it in the sketch itself and it still gives the same errors.

I've tried defining the pins in the SoftI2CMaster.h:

#define NO_INTERRUPT 1
#define I2C_TIMEOUT 100
#define SDA_PORT PORTB
#define SDA_PIN 3
#define SCL_PORT PORTB
#define SCL_PIN 1

and the errors change, so I know it's getting added?

Any further guidance ?

Mini moto lbrary

I'm I the only one who get a different i2c address from the I2C scanner, and the minimoto sparkfun library

From the library point of view I must give this:

MiniMoto motor0(0xCE); // A1 = 1, A0 = clear

While the i2cscanner report the module at address 0x67.

Work fine when I use the address given in the library, 0xCE, and does not when I use 0x67 in the library.

I must do some test using plain I2C/TWI library to control the minimoto with out the sparkfun library, cause I'm worry there could be incompatibility. Any ways I'll give news about that later on.

Never mind, it must be pretty much the same, depending on how they take care of the addressing.

in Binary,

0xCE = 0B11001110

while

0x67 = 0B01100111

0xCE is the same as 0x67, bit wise, but with one shift to the left, it must all be taken care of in the library.