mirror of https://github.com/ARMmbed/mbed-os.git
Remove empty files, and not ported driver code.
parent
af5bc356ca
commit
fe625b1f65
|
|
@ -292,87 +292,4 @@ int i2c_byte_write(i2c_t *obj, int data) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEVICE_I2CSLAVE
|
|
||||||
void i2c_slave_mode(i2c_t *obj, int enable_slave) {
|
|
||||||
if (enable_slave != 0) {
|
|
||||||
i2c_conclr(obj, 1, 1, 1, 0);
|
|
||||||
i2c_conset(obj, 0, 0, 0, 1);
|
|
||||||
} else {
|
|
||||||
i2c_conclr(obj, 1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int i2c_slave_receive(i2c_t *obj) {
|
|
||||||
int status;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
status = i2c_status(obj);
|
|
||||||
switch(status) {
|
|
||||||
case 0x60: retval = 3; break;
|
|
||||||
case 0x70: retval = 2; break;
|
|
||||||
case 0xA8: retval = 1; break;
|
|
||||||
default : retval = 0; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
int i2c_slave_read(i2c_t *obj, char *data, int length) {
|
|
||||||
int count = 0;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
do {
|
|
||||||
i2c_clear_SI(obj);
|
|
||||||
i2c_wait_SI(obj);
|
|
||||||
status = i2c_status(obj);
|
|
||||||
if((status == 0x80) || (status == 0x90)) {
|
|
||||||
data[count] = I2C_DAT(obj) & 0xFF;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
} while (((status == 0x80) || (status == 0x90) ||
|
|
||||||
(status == 0x060) || (status == 0x70)) && (count < length));
|
|
||||||
|
|
||||||
if(status != 0xA0) {
|
|
||||||
i2c_stop(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_clear_SI(obj);
|
|
||||||
|
|
||||||
return (count - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int i2c_slave_write(i2c_t *obj, const char *data, int length) {
|
|
||||||
int count = 0;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
if(length <= 0) {
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
status = i2c_do_write(obj, data[count], 0);
|
|
||||||
count++;
|
|
||||||
} while ((count < length) && (status == 0xB8));
|
|
||||||
|
|
||||||
if((status != 0xC0) && (status != 0xC8)) {
|
|
||||||
i2c_stop(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_clear_SI(obj);
|
|
||||||
|
|
||||||
return(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
|
|
||||||
uint32_t addr;
|
|
||||||
|
|
||||||
if ((idx >= 0) && (idx <= 3)) {
|
|
||||||
addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
|
|
||||||
*((uint32_t *) addr) = address & 0xFF;
|
|
||||||
addr = ((uint32_t)obj->i2c) + I2C_addr_offset[1][idx];
|
|
||||||
*((uint32_t *) addr) = mask & 0xFE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ int port_read(port_t *obj) {
|
||||||
case PIN_OUTPUT: return *obj->reg_out & obj->mask;
|
case PIN_OUTPUT: return *obj->reg_out & obj->mask;
|
||||||
case PIN_INPUT: return *obj->reg_in & obj->mask;
|
case PIN_INPUT: return *obj->reg_in & obj->mask;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue