* �������� * @i2c_info_p i2cģ����Ϣ * @data �����͵����� * @len ���������ݵij��� */
| 320 | * @len ���������ݵij��� |
| 321 | */ |
| 322 | ls1c_i2c_ret_t i2c_send_data(ls1c_i2c_info_t *i2c_info_p, unsigned char *data, int len) |
| 323 | { |
| 324 | void *i2c_base = i2c_get_base(i2c_info_p->I2Cx); |
| 325 | int i = 0; |
| 326 | |
| 327 | for (i=0; i<len; i++) |
| 328 | { |
| 329 | // ��һ���ֽ�����д�����ݼĴ��� |
| 330 | reg_write_8(*data++, i2c_base + LS1C_I2C_DATA_OFFSET); |
| 331 | |
| 332 | // ��ʼ���� |
| 333 | reg_write_8(LS1C_I2C_CMD_WRITE, i2c_base + LS1C_I2C_CMD_OFFSET); |
| 334 | |
| 335 | // �ȴ���ֱ��������� |
| 336 | if (!i2c_poll_status(i2c_info_p, LS1C_I2C_STATUS_TIP)) |
| 337 | return LS1C_I2C_RET_TIMEOUT; |
| 338 | |
| 339 | // ��ȡӦ���ź� |
| 340 | if (LS1C_I2C_ACK != i2c_receive_ack(i2c_info_p)) |
| 341 | return len; |
| 342 | } |
| 343 | |
| 344 | return LS1C_I2C_RET_OK; |
| 345 | } |
| 346 | |
| 347 | |
| 348 |
no test coverage detected