Disable timeout, remove redundancy

This commit is contained in:
Hierophect 2019-10-03 14:43:25 -04:00
parent 83c49a5c80
commit eacdb1da6e
2 changed files with 6 additions and 24 deletions

View File

@ -383,21 +383,21 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
bool common_hal_busio_spi_write(busio_spi_obj_t *self, bool common_hal_busio_spi_write(busio_spi_obj_t *self,
const uint8_t *data, size_t len) { const uint8_t *data, size_t len) {
HAL_StatusTypeDef result = HAL_SPI_Transmit (&self->handle, (uint8_t *)data, (uint16_t)len, 500); HAL_StatusTypeDef result = HAL_SPI_Transmit (&self->handle, (uint8_t *)data, (uint16_t)len, HAL_MAX_DELAY);
return result == HAL_OK ? 1 : 0; return result == HAL_OK;
} }
bool common_hal_busio_spi_read(busio_spi_obj_t *self, bool common_hal_busio_spi_read(busio_spi_obj_t *self,
uint8_t *data, size_t len, uint8_t write_value) { uint8_t *data, size_t len, uint8_t write_value) {
HAL_StatusTypeDef result = HAL_SPI_Receive (&self->handle, data, (uint16_t)len, 500); HAL_StatusTypeDef result = HAL_SPI_Receive (&self->handle, data, (uint16_t)len, HAL_MAX_DELAY);
return result == HAL_OK ? 1 : 0; return result == HAL_OK;
} }
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
uint8_t *data_out, uint8_t *data_in, size_t len) { uint8_t *data_out, uint8_t *data_in, size_t len) {
HAL_StatusTypeDef result = HAL_SPI_TransmitReceive (&self->handle, HAL_StatusTypeDef result = HAL_SPI_TransmitReceive (&self->handle,
data_out, data_in, (uint16_t)len,500); data_out, data_in, (uint16_t)len,HAL_MAX_DELAY);
return result == HAL_OK ? 1 : 0; return result == HAL_OK;
} }
uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) { uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) {

View File

@ -443,22 +443,4 @@ typedef struct {
.single_status_byte = false, \ .single_status_byte = false, \
} }
// Settings for the Micron N25Q128A 16MiB SPI flash.
// Datasheet: https://www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/n25q/n25q_128mb_3v_65nm.pdf
#define N25Q128A {\
.total_size = (1 << 24), /* 16 MiB */ \
.start_up_time_us = 5000, \
.manufacturer_id = 0x20, \
.memory_type = 0xBA, \
.capacity = 0x18, \
.max_clock_speed_mhz = 108, \
.quad_enable_bit_mask = 0x00, \
.has_sector_protection = false, \
.supports_fast_read = true, \
.supports_qspi = true, \
.supports_qspi_writes = true, \
.write_status_register_split = false, \
.single_status_byte = false, \
}
#endif // MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H #endif // MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H