Earsuit / I2C

A free I2C library for Arduino Nano and Mega with time-out function.
MIT License
8 stars 0 forks source link

How to use this library with esp32s #2

Open Sketh opened 5 years ago

Sketh commented 5 years ago

Hi i want to use this library with esp32, but when i upload example with this library that provide the error like below: MPU9250:100:5: error: expected constructor, destructor, or type conversion before '(' token

ISR(TIMER1_COMPA_vect){

     ^

MPU9250:100:4: error: expected constructor, destructor, or type conversion before '(' token

 ISR(TIMER1_COMPA_vect){

    ^

C:\Program Files (x86)\Arduino\libraries\I2C-master\examples\MPU9250\MPU9250.ino: In function 'void timerInterruptSetup()':

MPU9250:150:5: error: 'TCCR1A' was not declared in this scope

     TCCR1A = 0x00;

     ^

MPU9250:151:5: error: 'TCCR1B' was not declared in this scope

     TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10));  //CTC mode, clk/64

     ^

In file included from sketch\MPU9250.ino.cpp:1:0:

MPU9250:151:19: error: 'WGM12' was not declared in this scope

     TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10));  //CTC mode, clk/64

                   ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

 #define _BV(b) (1UL << (b))

                         ^

MPU9250:151:34: error: 'CS11' was not declared in this scope

     TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10));  //CTC mode, clk/64

                                  ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

 #define _BV(b) (1UL << (b))

                         ^

MPU9250:151:48: error: 'CS10' was not declared in this scope

     TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10));  //CTC mode, clk/64

                                                ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

 #define _BV(b) (1UL << (b))

                         ^

MPU9250:152:5: error: 'OCR1A' was not declared in this scope

     OCR1A = OUTPUT_COMPARE; //set to 200ms

     ^

MPU9250:153:5: error: 'TCNT1' was not declared in this scope

     TCNT1 = 0x00; //initialise the counter

     ^

MPU9250:154:5: error: 'TIMSK1' was not declared in this scope

     TIMSK1 = _BV(OCIE1A);  //Output Compare A Match Interrupt Enable

     ^

In file included from sketch\MPU9250.ino.cpp:1:0:

MPU9250:154:18: error: 'OCIE1A' was not declared in this scope

     TIMSK1 = _BV(OCIE1A);  //Output Compare A Match Interrupt Enable

                  ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

 #define _BV(b) (1UL << (b))

                         ^

exit status 1
expected constructor, destructor, or type conversion before '(' token
Earsuit commented 5 years ago

Hi Haseo, I'm really sorry this library doesn't work on esp32 as the interrupt routine was wrote for arduino mega.

Yours, Yudi

在 2019年4月8日,上午12:49,Haseo notifications@github.com<mailto:notifications@github.com> 写道:

Hi i want to use this library with esp32, but when i upload example with this library that provide the error like below: MPU9250💯5: error: expected constructor, destructor, or type conversion before '(' token

ISR(TIMER1_COMPA_vect){

^

MPU9250💯4: error: expected constructor, destructor, or type conversion before '(' token

ISR(TIMER1_COMPA_vect){

^

C:\Program Files (x86)\Arduino\libraries\I2C-master\examples\MPU9250\MPU9250.ino: In function 'void timerInterruptSetup()':

MPU9250:150:5: error: 'TCCR1A' was not declared in this scope

TCCR1A = 0x00;

^

MPU9250:151:5: error: 'TCCR1B' was not declared in this scope

TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10)); //CTC mode, clk/64

^

In file included from sketch\MPU9250.ino.cpp:1:0:

MPU9250:151:19: error: 'WGM12' was not declared in this scope

TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10)); //CTC mode, clk/64

           ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

define _BV(b) (1UL << (b))

                 ^

MPU9250:151:34: error: 'CS11' was not declared in this scope

TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10)); //CTC mode, clk/64

                          ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

define _BV(b) (1UL << (b))

                 ^

MPU9250:151:48: error: 'CS10' was not declared in this scope

TCCR1B = (_BV(WGM12)) | (_BV(CS11)) | (_BV(CS10)); //CTC mode, clk/64

                                        ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

define _BV(b) (1UL << (b))

                 ^

MPU9250:152:5: error: 'OCR1A' was not declared in this scope

OCR1A = OUTPUT_COMPARE; //set to 200ms

^

MPU9250:153:5: error: 'TCNT1' was not declared in this scope

TCNT1 = 0x00; //initialise the counter

^

MPU9250:154:5: error: 'TIMSK1' was not declared in this scope

TIMSK1 = _BV(OCIE1A); //Output Compare A Match Interrupt Enable

^

In file included from sketch\MPU9250.ino.cpp:1:0:

MPU9250:154:18: error: 'OCIE1A' was not declared in this scope

TIMSK1 = _BV(OCIE1A); //Output Compare A Match Interrupt Enable

          ^

C:\Users\Haseo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\cores\esp32/Arduino.h:105:25: note: in definition of macro '_BV'

define _BV(b) (1UL << (b))

                 ^

exit status 1 expected constructor, destructor, or type conversion before '(' token

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FEarsuit%2FI2C%2Fissues%2F2&data=02%7C01%7C%7C62a8cce209ad4130811608d6bb78ff64%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636902525682786467&sdata=snpsHTYuZD%2BfqmhhOhHXr%2FGF0FwxhCtxX4CUhjShEYc%3D&reserved=0, or mute the threadhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATn_k_0CTZcM-WBuljFONMs3Y-HXPcdrks5veiGXgaJpZM4cg3yb&data=02%7C01%7C%7C62a8cce209ad4130811608d6bb78ff64%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636902525682796472&sdata=88TNZ7VbrvggPuooOXFjBOs4oLiZO45AHfUJ%2B7O%2B0aE%3D&reserved=0.