예제 #1
0
/*********************************************************************//**
 * @brief 		Main I2C0 interrupt handler sub-routine
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void I2C0_IRQHandler(void)
{
	done = I2C_MonitorHandler(LPC_I2C0,buffer,count);
	if(done)
	{
		I2C_MonitorModeConfig(I2CDEV,(uint32_t)I2C_MONITOR_CFG_MATCHALL, DISABLE);
		I2C_MonitorModeCmd(I2CDEV, DISABLE);
	}
}
예제 #2
0
int _I2C_MonitorHandler(uint8_t * args)
{
	uint8_t * arg_ptr;
	LPC_I2C_TypeDef* I2Cx;
	uint8_t* buffer;
	uint32_t size;

	if ((arg_ptr = (uint8_t *) strtok(NULL, " ")) == NULL) return 1;
	I2Cx = (LPC_I2C_TypeDef*) strtoul((char *) arg_ptr, NULL, 16);
	if ((arg_ptr = (uint8_t *) strtok(NULL, " ")) == NULL) return 1;
	buffer = (uint8_t*) strtoul((char *) arg_ptr, NULL, 16);
	if ((arg_ptr = (uint8_t *) strtok(NULL, " ")) == NULL) return 1;
	size = (uint32_t) strtoul((char *) arg_ptr, NULL, 16);

	sprintf((char *) str, "%x\r\n", (unsigned int) I2C_MonitorHandler(I2Cx, buffer, size));
	writeUSBOutString(str);
	return 0;
}