mahmoud2 / pinguino32

Automatically exported from code.google.com/p/pinguino32
0 stars 0 forks source link

I2C library does not compile for GENERIC32MX250F128) || defined(GENERIC32MX220F032) #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. tried to compile some I2C test code
2. compilation failed with errors like the following:

i2c.c:140:12 error:'__IFS0bits_t' has no member named I2C1MIF
i2c.c:141:12 error:'__IFS0bits_t' has no member named I2C1MIF
i2c.c:142:12 error:'__IFS0bits_t' has no member named I2C1MIF
i2c.c:416:19 error:'__IFS0bits_t' has no member named I2C1MIF
i2c.c:417:12 error:'__IFS0bits_t' has no member named I2C1MIF

3. Looking at the related lines in i2c.c we see that there is no
"ifdef" statement for the ..32B device just ..32D.  

i2c.c: from line 110 ff.:
                        #ifdef __32MX220F032D__
                        IFS1bits.I2C1MIF = 0;
                        IFS1bits.I2C1SIF = 0;
                        IFS1bits.I2C1BIF = 0;

                        IEC1bits.I2C1MIE = 1;
                        IEC1bits.I2C1SIE = 1;
                        IEC1bits.I2C1BIE = 1;
                        #else
                        IFS0bits.I2C1MIF = 0;
                        IFS0bits.I2C1SIF = 0;
                        IFS0bits.I2C1BIF = 0;

                        IEC0bits.I2C1MIE = 1;
                        IEC0bits.I2C1SIE = 1;
                        IEC0bits.I2C1BIE = 1;
                        #endif

What is the expected output? What do you see instead?
Code that makes calls to i2c library should compile without errors.

What version of the product are you using? On what operating system?
X.4 ref 713

Please provide any additional information below.

I patched i2c.c to include an "if defined" statement for GENERIC32MX250F128 and 
GENERIC32MX220F032. 

in I2C_init line 132 and in  413 in I2C_Wait.

e.g. change  fom 
 #ifdef __32MX220F032D__

to 

#if defined(__32MX220F032D__) || defined (__32MX220F032B__) || defined 
(__32MX250F128B__)

I'm not sure if this is the best way to fix it. I'm still new to pinguino, but 
I tested that on a pic 32 DIY board with a    
32MX220F032 device. That worked. 

Original issue reported on code.google.com by gerrit.b...@gmail.com on 24 Feb 2013 at 4:26

GoogleCodeExporter commented 9 years ago
Fixed in rev. 774.
Thank you for this report.

Original comment by rblanchot@gmail.com on 23 Apr 2013 at 10:04