/* Initiates a write packet operation. 
The I2C_SLAVE_CALLBACK_READ_REQUEST callback can be used to call this function. */
enum status_code i2c_slave_write_packet_job(struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
/* Initiates a write packet operation. 
The I2C_SLAVE_CALLBACK_READ_REQUEST callback can be used to call this function. */
enum status_code i2c_slave_write_packet_job(struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
{
	Assert(module);
	Assert(module->hw);
	Assert(packet);
	if (module->buffer_remaining > 0) {
		return STATUS_BUSY;
	}
	module->buffer           = packet->data;
	module->buffer_remaining = packet->data_length;
	module->buffer_length    = packet->data_length;
	module->status           = STATUS_BUSY;
	SercomI2cs *const i2c_hw = &(module->hw->I2CS);
	i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH |
			SERCOM_I2CS_INTFLAG_DRDY | SERCOM_I2CS_INTFLAG_PREC;
	return STATUS_OK;
}