/* Write Status Register. 
The WRSR instruction is for changing the values of Status Register Bits (and configuration register). */
enum status_code mx25v_write_status(uint8_t value)
/* Write Status Register. 
The WRSR instruction is for changing the values of Status Register Bits (and configuration register). */
enum status_code mx25v_write_status(uint8_t value)
{
	enum status_code status;
	uint8_t tx_buf[2] = {MX25V_CMD_WRSR, value};
	if (_mx25v_is_flash_busy()) {
		return STATUS_BUSY;
	}
	_mx25v_send_cmd_write_latch(MX25V_CMD_WREN);
	_mx25v_chip_select();
	status = spi_write_buffer_wait(&_mx25v_spi, tx_buf, 2);
	if (status != STATUS_OK) {
		return STATUS_ERR_IO;
	}
	_mx25v_chip_deselect();
	if (!_mx25v_wait_flash_ready(MX25V_WAIT_TIMEOUT)) {
		return STATUS_ERR_IO;
	}
	return STATUS_OK;
}