Skip to content

Commit da5b78b

Browse files
committed
samd/flash: Implement the review comments.
Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent b5d6ea0 commit da5b78b

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

ports/samd/modsamd.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@
3535
extern const mp_obj_type_t samd_flash_type;
3636
#ifdef MICROPY_HW_QSPIFLASH
3737
extern const mp_obj_type_t samd_qspiflash_type;
38+
#define SPIFLASH_TYPE samd_qspiflash_type
3839
#endif
3940
#if MICROPY_HW_SPIFLASH
4041
extern const mp_obj_type_t spiflash_type;
42+
#define SPIFLASH_TYPE spiflash_type
43+
#endif
44+
#if MICROPY_HW_MCUFLASH
45+
#define SPIFLASH_TYPE samd_flash_type
4146
#endif
4247

4348
STATIC mp_obj_t samd_pininfo(mp_obj_t pin_obj) {
@@ -74,24 +79,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(samd_pininfo_obj, samd_pininfo);
7479
STATIC const mp_rom_map_elem_t samd_module_globals_table[] = {
7580
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_samd) },
7681
{ MP_ROM_QSTR(MP_QSTR_pininfo), MP_ROM_PTR(&samd_pininfo_obj) },
77-
#if MICROPY_HW_MCUFLASH
78-
#if defined(MICROPY_HW_QSPIFLASH) || defined(MICROPY_HW_SPIFLASH)
79-
#error Only one type of flash must be used
80-
#endif
81-
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&samd_flash_type) },
82-
#endif
83-
#ifdef MICROPY_HW_QSPIFLASH
84-
#if defined(MICROPY_HW_MCUFLASH) || defined(MICROPY_HW_SPIFLASH)
85-
#error Only one type of flash must be used
86-
#endif
87-
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&samd_qspiflash_type) },
88-
#endif
89-
#if defined(MICROPY_HW_SPIFLASH) && defined(MICROPY_HW_SPIFLASH_ID)
90-
#if defined(MICROPY_HW_MCUFLASH) || defined(MICROPY_HW_QSPIFLASH)
91-
#error Only one type of flash must be used
92-
#endif
93-
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&spiflash_type) },
94-
#endif
82+
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&SPIFLASH_TYPE) },
9583
};
9684
STATIC MP_DEFINE_CONST_DICT(samd_module_globals, samd_module_globals_table);
9785

ports/samd/samd_qspiflash.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,6 @@ static void samd_peripherals_enable_cache(void) {
124124
CMCC->CTRL.bit.CEN = 1;
125125
}
126126

127-
/*
128-
@brief Run a single QSPI instruction.
129-
@param command instruction code
130-
@param iframe iframe register value (configured by caller according to command code)
131-
@param addr the address to read or write from. If the instruction doesn't require an address, this parameter is meaningless.
132-
@param buffer pointer to the data to be written or stored depending on the type is Read or Write
133-
@param size the number of bytes to read or write.
134-
*/
135127
bool run_instruction(uint8_t command, uint32_t iframe, uint32_t addr, uint8_t *buffer, uint32_t size) {
136128

137129
samd_peripherals_disable_and_clear_cache();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy