I2C compile error
Posted: Fri Mar 09, 2018 4:14 am
Just started out and am already perplexed by a the non-compilation of some trivial i2c code:
#include <i2c.h>
#include <xs1.h>
#include <xclib.h>
#include <timer.h>
//port I2C_SCL = XS1_PORT_1E; //I2C clock
//port I2C_SDA = XS1_PORT_1H; //I2C data
port p_scl = XS1_PORT_4C;
port p_sda = XS1_PORT_1G;
i2c_master_if xx;
..... for which I am rewarded with:
../src/I2C testing.xc:18:8: warning: type defaults to `int' in declaration of `i2c_master_if' [-Wimplicit-int]
static i2c_master_if xx;
^~~~~~~~~~~~~
../src/I2C testing.xc:18:22: error: parse error before "xx"
i2c_master_if xx;
^
../src/I2C testing.xc:18:22: warning: type defaults to `int' in declaration of `xx' [-Wimplicit-int]
i2c_master_if xx;
^~
../src/I2C testing.xc:18:22: warning: data definition has no type or storage class [-Wunusual-code]
i2c_master_if xx;
this makes no sense to me as xs1.h is not complained about so the declarations must be there.
the i2c module is also a dependency in the Makefile.
someone know what the issue is?
#include <i2c.h>
#include <xs1.h>
#include <xclib.h>
#include <timer.h>
//port I2C_SCL = XS1_PORT_1E; //I2C clock
//port I2C_SDA = XS1_PORT_1H; //I2C data
port p_scl = XS1_PORT_4C;
port p_sda = XS1_PORT_1G;
i2c_master_if xx;
..... for which I am rewarded with:
../src/I2C testing.xc:18:8: warning: type defaults to `int' in declaration of `i2c_master_if' [-Wimplicit-int]
static i2c_master_if xx;
^~~~~~~~~~~~~
../src/I2C testing.xc:18:22: error: parse error before "xx"
i2c_master_if xx;
^
../src/I2C testing.xc:18:22: warning: type defaults to `int' in declaration of `xx' [-Wimplicit-int]
i2c_master_if xx;
^~
../src/I2C testing.xc:18:22: warning: data definition has no type or storage class [-Wunusual-code]
i2c_master_if xx;
this makes no sense to me as xs1.h is not complained about so the declarations must be there.
the i2c module is also a dependency in the Makefile.
someone know what the issue is?