summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266/modesp.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-10-07 14:00:51 +1100
committerDamien George <damien.p.george@gmail.com>2016-10-07 14:00:51 +1100
commit23a568240d9fb216c5f2ca9feeb3134725c9eea0 (patch)
treef814b2b6c03910604797263c23e58b8a5c353c0c /esp8266/modesp.c
parenta2bfcbe029a4c0d47efe5b1b51d4cd2c010f748d (diff)
downloadmicropython-23a568240d9fb216c5f2ca9feeb3134725c9eea0.tar.gz
micropython-23a568240d9fb216c5f2ca9feeb3134725c9eea0.zip
esp8266: Use mp_raise_OSError helper function.
Diffstat (limited to 'esp8266/modesp.c')
-rw-r--r--esp8266/modesp.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index 9a7d4ad18f..e081f57dab 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -583,7 +583,7 @@ STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t len_or_buf_in) {
if (alloc_buf) {
m_del(byte, buf, len);
}
- nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO)));
+ mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read);
@@ -598,9 +598,7 @@ STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, const mp_obj_t buf_in) {
if (res == SPI_FLASH_RESULT_OK) {
return mp_const_none;
}
- nlr_raise(mp_obj_new_exception_arg1(
- &mp_type_OSError,
- MP_OBJ_NEW_SMALL_INT(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO)));
+ mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write);
@@ -610,9 +608,7 @@ STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
if (res == SPI_FLASH_RESULT_OK) {
return mp_const_none;
}
- nlr_raise(mp_obj_new_exception_arg1(
- &mp_type_OSError,
- MP_OBJ_NEW_SMALL_INT(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO)));
+ mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);