Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: i2c.h
- Revision:
- 227:05e929bdd4dc
- Parent:
- 209:63e9c8f8b5d2
--- a/i2c.h Mon Jul 04 14:31:30 2016 +0000
+++ b/i2c.h Mon Jul 04 20:27:37 2016 +0000
@@ -128,33 +128,35 @@
}
bool FCTN_I2C_WRITE(char *data,int tc_len2) // Returns 0 for success
-{
+{
CDMS_I2C_GPIO = 1;
- write_ack = master.write(addr_bae|0x00,data,tc_len2);
- Thread::wait(1); //As per the tests Thread::wait is not required on master side but its safe to give 1ms
+ write_ack = master.write(addr_bae|0x00,data,tc_len2);
+ wait_ms(1); //As per the tests Thread::wait is not required on master side but its safe to give 1ms
pdirw1=PTE->PDIR;
uint8_t i2c_count = 0;
if(write_ack == 0)
{
while(((pdirw1 & 0x03000000)!=0x03000000)&& i2c_count<10)
{
- Thread::wait(1);
+ wait_ms(1);
pdirw1=PTE->PDIR;
i2c_count++;
}
if(((pdirw1 & 0x03000000)==0x03000000))
{
- gPC.printf("\n\r Data sent");
+ gPC.printf("\n\r Data sent");
}
else
{
I2C_busreset();
+ gPC.printf("\n\rData not sent");
write_ack = 1;
}
}
if (write_ack == 1)
{
I2C_busreset();
+ gPC.printf("\n\rData not sent");
}
CDMS_I2C_GPIO = 0;
i2c_count = 0;
