Trouble understanding python modules
Posted: Fri Jun 12, 2015 10:38 pm
I've written a new module using the LED and UART modules for reference. I am struggling to understand a few points and was hoping someone could explain.
I can't get this function to work unless I remove the self_in variable. I don't understand how this works.
I need the OBJ_2 function even though I have only on parameter - 'mp_obj_t str'. It seems my module does not know about 'self'.
I haven't setup the instance properly in init0 which is probably related:
Unlike the LED or UART module where you can have multiple instances of the object the FSMC has only one. Am I over complicating this is there a simpler or better way to do this? Thanks in advance.
I can't get this function to work unless I remove the self_in variable. I don't understand how this works.
Code: Select all
STATIC mp_uint_t fsmc_obj_write(mp_obj_t self_in,mp_obj_t str)
{
...
}
Code: Select all
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fsmc_obj_write_obj, fsmc_obj_write);
I haven't setup the instance properly in init0 which is probably related:
Code: Select all
#if defined(MICROPY_HW_ENABLE_FSMC)
SRAM_HandleTypeDef hsram = {.Instance = NULL};
NOR_HandleTypeDef exflash = {.Instance = NULL};
#endif
void fmsc_init0(void){
#if defined(MICROPY_HW_ENABLE_FSMC)
memset(&hsram, 0, sizeof(SRAM_HandleTypeDef));
memset(&exflash, 0, sizeof(NOR_HandleTypeDef));
// I don't get this
//hsram.Instance = ;
//exflash.Instance = ;
#endif
}