Skip to content

Commit

Permalink
Merge pull request #9684 from diamant3/GH-9660
Browse files Browse the repository at this point in the history
remove 'mp_obj_property_t' usage remains
  • Loading branch information
tannewt authored Oct 4, 2024
2 parents 7f14b9c + 2a85894 commit 54d4827
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 72 deletions.
19 changes: 7 additions & 12 deletions extmod/vfs_fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,9 @@ static mp_obj_t vfs_fat_getreadonly(mp_obj_t self_in) {
return mp_obj_new_bool(!filesystem_is_writable_by_python(self));
}
static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getreadonly_obj, vfs_fat_getreadonly);
static const mp_obj_property_t fat_vfs_readonly_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&fat_vfs_getreadonly_obj,
MP_ROM_NONE,
MP_ROM_NONE},
};

static MP_PROPERTY_GETTER(fat_vfs_readonly_obj,
(mp_obj_t)&fat_vfs_getreadonly_obj);

#if MICROPY_FATFS_USE_LABEL
static mp_obj_t vfs_fat_getlabel(mp_obj_t self_in) {
Expand Down Expand Up @@ -517,12 +514,10 @@ static mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_setlabel_obj, vfs_fat_setlabel);
static const mp_obj_property_t fat_vfs_label_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&fat_vfs_getlabel_obj,
(mp_obj_t)&fat_vfs_setlabel_obj,
MP_ROM_NONE},
};

static MP_PROPERTY_GETSET(fat_vfs_label_obj,
(mp_obj_t)&fat_vfs_getlabel_obj,
(mp_obj_t)&fat_vfs_setlabel_obj);
#endif

static const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
Expand Down
26 changes: 6 additions & 20 deletions ports/raspberrypi/bindings/rp2pio/StateMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,8 @@ static mp_obj_t rp2pio_statemachine_obj_get_writing(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_get_writing_obj, rp2pio_statemachine_obj_get_writing);

const mp_obj_property_t rp2pio_statemachine_writing_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&rp2pio_statemachine_get_writing_obj,
MP_ROM_NONE,
MP_ROM_NONE},
};

MP_PROPERTY_GETTER(rp2pio_statemachine_writing_obj,
(mp_obj_t)&rp2pio_statemachine_get_writing_obj);

//| pending: int
//| """Returns the number of pending buffers for background writing.
Expand All @@ -628,12 +623,8 @@ static mp_obj_t rp2pio_statemachine_obj_get_pending(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_get_pending_obj, rp2pio_statemachine_obj_get_pending);

const mp_obj_property_t rp2pio_statemachine_pending_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&rp2pio_statemachine_get_pending_obj,
MP_ROM_NONE,
MP_ROM_NONE},
};
MP_PROPERTY_GETTER(rp2pio_statemachine_pending_obj,
(mp_obj_t)&rp2pio_statemachine_get_pending_obj);

//| def readinto(
//| self,
Expand Down Expand Up @@ -847,13 +838,8 @@ static mp_obj_t rp2pio_statemachine_obj_get_txstall(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_get_txstall_obj, rp2pio_statemachine_obj_get_txstall);

const mp_obj_property_t rp2pio_statemachine_txstall_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&rp2pio_statemachine_get_txstall_obj,
MP_ROM_NONE,
MP_ROM_NONE},
};

MP_PROPERTY_GETTER(rp2pio_statemachine_txstall_obj,
(mp_obj_t)&rp2pio_statemachine_get_txstall_obj);

//| rxstall: bool
//| """True when the state machine has stalled due to a full RX FIFO since the last
Expand Down
9 changes: 2 additions & 7 deletions shared-bindings/displayio/OnDiskBitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,8 @@ static mp_obj_t displayio_ondiskbitmap_obj_get_pixel_shader(mp_obj_t self_in) {

MP_DEFINE_CONST_FUN_OBJ_1(displayio_ondiskbitmap_get_pixel_shader_obj, displayio_ondiskbitmap_obj_get_pixel_shader);

const mp_obj_property_t displayio_ondiskbitmap_pixel_shader_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&displayio_ondiskbitmap_get_pixel_shader_obj,
(mp_obj_t)MP_ROM_NONE,
(mp_obj_t)MP_ROM_NONE},
};

MP_PROPERTY_GETTER(displayio_ondiskbitmap_pixel_shader_obj,
(mp_obj_t)&displayio_ondiskbitmap_get_pixel_shader_obj);

static const mp_rom_map_elem_t displayio_ondiskbitmap_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_ondiskbitmap_height_obj) },
Expand Down
17 changes: 4 additions & 13 deletions shared-bindings/keypad/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ static mp_obj_t keypad_generic_get_key_count(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(keypad_generic_get_key_count_obj, keypad_generic_get_key_count);

const mp_obj_property_t keypad_generic_key_count_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&keypad_generic_get_key_count_obj,
MP_ROM_NONE,
MP_ROM_NONE},
};
MP_PROPERTY_GETTER(keypad_generic_key_count_obj,
(mp_obj_t)&keypad_generic_get_key_count_obj);

static mp_obj_t keypad_generic_get_events(mp_obj_t self_in) {
keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in);
Expand All @@ -52,13 +48,8 @@ static mp_obj_t keypad_generic_get_events(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(keypad_generic_get_events_obj, keypad_generic_get_events);

const mp_obj_property_t keypad_generic_events_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&keypad_generic_get_events_obj,
MP_ROM_NONE,
MP_ROM_NONE},
};

MP_PROPERTY_GETTER(keypad_generic_events_obj,
(mp_obj_t)&keypad_generic_get_events_obj);

//| """Support for scanning keys and key matrices
//|
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/keypad/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ mp_obj_t common_hal_keypad_generic_get_events(void *self);

MP_DECLARE_CONST_FUN_OBJ_1(keypad_generic_reset_obj);

extern const mp_obj_property_t keypad_generic_events_obj;
extern const mp_obj_property_t keypad_generic_key_count_obj;
extern const mp_obj_property_getter_t keypad_generic_events_obj;
extern const mp_obj_property_getter_t keypad_generic_key_count_obj;
27 changes: 9 additions & 18 deletions shared-bindings/vectorio/Rectangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,9 @@ static mp_obj_t vectorio_rectangle_obj_set_width(mp_obj_t self_in, mp_obj_t widt
}
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_rectangle_set_width_obj, vectorio_rectangle_obj_set_width);

const mp_obj_property_t vectorio_rectangle_width_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&vectorio_rectangle_get_width_obj,
(mp_obj_t)&vectorio_rectangle_set_width_obj,
MP_ROM_NONE},
};
MP_PROPERTY_GETSET(vectorio_rectangle_width_obj,
(mp_obj_t)&vectorio_rectangle_get_width_obj,
(mp_obj_t)&vectorio_rectangle_set_width_obj);

//| height: int
//| """The height of the rectangle in pixels."""
Expand All @@ -107,12 +104,9 @@ static mp_obj_t vectorio_rectangle_obj_set_height(mp_obj_t self_in, mp_obj_t hei
}
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_rectangle_set_height_obj, vectorio_rectangle_obj_set_height);

const mp_obj_property_t vectorio_rectangle_height_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&vectorio_rectangle_get_height_obj,
(mp_obj_t)&vectorio_rectangle_set_height_obj,
MP_ROM_NONE},
};
MP_PROPERTY_GETSET(vectorio_rectangle_height_obj,
(mp_obj_t)&vectorio_rectangle_get_height_obj,
(mp_obj_t)&vectorio_rectangle_set_height_obj);

//| color_index: int
//| """The color_index of the rectangle in 1 based index of the palette."""
Expand All @@ -129,12 +123,9 @@ static mp_obj_t vectorio_rectangle_obj_set_color_index(mp_obj_t self_in, mp_obj_
}
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_rectangle_set_color_index_obj, vectorio_rectangle_obj_set_color_index);

const mp_obj_property_t vectorio_rectangle_color_index_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&vectorio_rectangle_get_color_index_obj,
(mp_obj_t)&vectorio_rectangle_set_color_index_obj,
MP_ROM_NONE},
};
MP_PROPERTY_GETSET(vectorio_rectangle_color_index_obj,
(mp_obj_t)&vectorio_rectangle_get_color_index_obj,
(mp_obj_t)&vectorio_rectangle_set_color_index_obj);

// Documentation for properties inherited from VectorShape.

Expand Down

0 comments on commit 54d4827

Please sign in to comment.