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?
I2C compile error
-
- Member++
- Posts: 18
- Joined: Thu Mar 08, 2018 4:07 pm
-
- XCore Legend
- Posts: 1913
- Joined: Thu Jun 10, 2010 11:43 am
https://www.xmos.com/support/appnotes/AN00156
Start with this appnote and import the posted project (zip file). Compile for your target cpu or kit. Then modify as needed.
Start with this appnote and import the posted project (zip file). Compile for your target cpu or kit. Then modify as needed.