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: mbed
Fork of minimal_i2c_mother by
master.cpp
- Committer:
- rrbeauch
- Date:
- 2014-12-02
- Revision:
- 2:4709985cf716
- Parent:
- 1:92677fbab5f1
File content as of revision 2:4709985cf716:
#include "mbed.h"
#define ROWSIZE (3)
#define SELECTSIZE (0x04)
//BusOut toCells(p5,p6,p7,p8,p9,p10,p11,p12);
//BusOut select(p13,p14,p15);
I2C Bus(p28, p27);
//I2CSlave Self(p9, p10);
int slaveAddressRow1;
int slaveAddressRow2;
Serial Usb(USBTX, USBRX);
//char buffer[16] = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x00};
//char buffer[16] = {'$', 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF};
char buffer[16];
int ack;
char slaveBuffer[16];
DigitalOut sent(LED1);
DigitalOut received(LED2);
void resetBus()
{
Bus.stop();
Bus.start();
return;
}
int main()
{
slaveAddressRow1 = 0x02;
resetBus();
while (1)
{
for(int i = 0; i < sizeof buffer; buffer[i++]=0x00);
Usb.scanf("%16s", buffer);
Usb.printf("%s \n\r", buffer);
while( Bus.write(slaveAddressRow1 & 0xFE, buffer, 16) != 0);
//if(ack1 == 0)
Usb.printf("Row one sent\n\r");
}
}
