Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 4 months ago.
Can't initialise my i2c
Trying to initialise my eeprom interface using:
main.cpp
#include "mbed.h" EEPROM rom(p9, p10, 0xA0, T24C32);
I get this error:
Error: Identifier "T24C32" is undefined in "main.cpp", Line: 10, Col: 27
This is part of the header file from the "EEPROM" library from "CODE" on Mbed:
eeprom.h
#include "mbed.h" class EEPROM { public: enum TypeEeprom {T24C01=128,T24C02=256,T24C04=512,T24C08=1024,T24C16=2048, T24C32=4096,T24C64=8192,T24C128=16384,T24C256=32768, T24C512=65536,T24C1024=131072,T24C1025=131073} type; /* * Constructor, initialize the eeprom on i2c interface. * @param sda : sda i2c pin (PinName) * @param scl : scl i2c pin (PinName) * @param address : eeprom address, according to eeprom type (uint8_t) * @param type : eeprom type (TypeEeprom) * @return none */ EEPROM(PinName sda, PinName scl, uint8_t address, TypeEeprom type);
Any suggestions?
Many thanks
1 Answer
10 years, 4 months ago.
Thank you Martin, its now working, I have not come across this way before, normally just specify pin names.
Hello,
you have to identify with a class name it belongs to:
Otherwise, compiler looks at global scope and there's not any T24C32 symbol.
Regards,
posted by Martin Kojtal 10 Jan 20140xc0170