diff --git a/stmhal/dac.c b/stmhal/dac.c index df46d24904..acfcf4e91a 100644 --- a/stmhal/dac.c +++ b/stmhal/dac.c @@ -68,6 +68,8 @@ /// dac = DAC(1) /// dac.write_timed(buf, 400 * len(buf), mode=DAC.CIRCULAR) +#if MICROPY_HW_ENABLE_DAC + STATIC DAC_HandleTypeDef DAC_Handle; void dac_init(void) { @@ -354,3 +356,5 @@ const mp_obj_type_t pyb_dac_type = { .make_new = pyb_dac_make_new, .locals_dict = (mp_obj_t)&pyb_dac_locals_dict, }; + +#endif // MICROPY_HW_ENABLE_DAC diff --git a/stmhal/modos.c b/stmhal/modos.c index 66e22bd284..c83d350923 100644 --- a/stmhal/modos.c +++ b/stmhal/modos.c @@ -253,6 +253,7 @@ STATIC mp_obj_t os_sync(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync); +#if MICROPY_HW_ENABLE_RNG STATIC mp_obj_t os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); byte *data; @@ -263,6 +264,7 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) { return mp_obj_str_builder_end(o); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom); +#endif STATIC const mp_map_elem_t os_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_os) }, @@ -280,7 +282,9 @@ STATIC const mp_map_elem_t os_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_OBJ_NEW_QSTR(MP_QSTR__slash_) }, +#if MICROPY_HW_ENABLE_RNG { MP_OBJ_NEW_QSTR(MP_QSTR_urandom), (mp_obj_t)&os_urandom_obj }, +#endif }; STATIC const mp_obj_dict_t os_module_globals = {