canio: actually drop the _error_count properties

thanks @tannewt
This commit is contained in:
Jeff Epler 2020-09-29 14:25:53 -05:00
parent 1bea099eb2
commit 611f81ac1a
3 changed files with 0 additions and 98 deletions

View File

@ -275,21 +275,6 @@ int common_hal_canio_can_receive_error_count_get(canio_can_obj_t *self)
return self->hw->ECR.bit.REC;
}
int common_hal_canio_can_error_warning_state_count_get(canio_can_obj_t *self)
{
return self->error_warning_state_count;
}
int common_hal_canio_can_error_passive_state_count_get(canio_can_obj_t *self)
{
return self->error_passive_state_count;
}
int common_hal_canio_can_bus_off_state_count_get(canio_can_obj_t *self)
{
return self->bus_off_state_count;
}
canio_bus_state_t common_hal_canio_can_state_get(canio_can_obj_t *self) {
CAN_PSR_Type psr = self->hw->PSR;
if (psr.bit.BO) {
@ -419,17 +404,6 @@ STATIC void can_handler(int i) {
Can *hw = can_insts[i];
uint32_t ir = hri_can_read_IR_reg(hw);
/* Count up errors*/
if (ir & CAN_IE_EWE) {
self->error_warning_state_count += 1;
}
if (ir & CAN_IE_EPE) {
self->error_passive_state_count += 1;
}
if (ir & CAN_IE_BOE) {
self->bus_off_state_count += 1;
}
/* Acknowledge interrupt */
hri_can_write_IR_reg(hw, ir);
}

View File

@ -171,72 +171,6 @@ STATIC const mp_obj_property_t canio_can_receive_error_count_obj = {
(mp_obj_t)mp_const_none},
};
//| error_warning_state_count: int
//| """The number of times the controller enterted the Error Warning
//| state (read-only). This number wraps around to 0 after an
//| implementation-defined number of errors.
//|
//| Not all implementations support this property. If the property
//| is unsupported, AttributeError will be raised."""
//|
STATIC mp_obj_t canio_can_error_warning_state_count_get(mp_obj_t self_in) {
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_canio_can_check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_can_error_warning_state_count_get(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(canio_can_error_warning_state_count_get_obj, canio_can_error_warning_state_count_get);
STATIC const mp_obj_property_t canio_can_error_warning_state_count_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&canio_can_error_warning_state_count_get_obj,
(mp_obj_t)mp_const_none,
(mp_obj_t)mp_const_none},
};
//| error_passive_state_count: int
//| """The number of times the controller enterted the Error Passive
//| state (read-only). This number wraps around to 0 after an
//| implementation-defined number of errors.
//|
//| Not all implementations support this property. If the property
//| is unsupported, AttributeError will be raised."""
//|
STATIC mp_obj_t canio_can_error_passive_state_count_get(mp_obj_t self_in) {
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_canio_can_check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_can_error_passive_state_count_get(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(canio_can_error_passive_state_count_get_obj, canio_can_error_passive_state_count_get);
STATIC const mp_obj_property_t canio_can_error_passive_state_count_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&canio_can_error_passive_state_count_get_obj,
(mp_obj_t)mp_const_none,
(mp_obj_t)mp_const_none},
};
//| bus_off_state_count: int
//| """The number of times the controller enterted the Bus Off state
//| (read-only). This number wraps around to 0 after an
//| implementation-defined number of errors.
//|
//| Not all implementations support this property. If the property
//| is unsupported, AttributeError will be raised."""
//|
STATIC mp_obj_t canio_can_bus_off_state_count_get(mp_obj_t self_in) {
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_canio_can_check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_can_bus_off_state_count_get(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(canio_can_bus_off_state_count_get_obj, canio_can_bus_off_state_count_get);
STATIC const mp_obj_property_t canio_can_bus_off_state_count_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&canio_can_bus_off_state_count_get_obj,
(mp_obj_t)mp_const_none,
(mp_obj_t)mp_const_none},
};
//| state: State
//| """The current state of the bus."""
STATIC mp_obj_t canio_can_state_get(mp_obj_t self_in) {
@ -414,10 +348,7 @@ STATIC const mp_rom_map_elem_t canio_can_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&canio_can_exit_obj) },
{ MP_ROM_QSTR(MP_QSTR_auto_restart), MP_ROM_PTR(&canio_can_auto_restart_obj) },
{ MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&canio_can_baudrate_obj) },
{ MP_ROM_QSTR(MP_QSTR_bus_off_state_count), MP_ROM_PTR(&canio_can_bus_off_state_count_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&canio_can_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_error_passive_state_count), MP_ROM_PTR(&canio_can_error_passive_state_count_obj) },
{ MP_ROM_QSTR(MP_QSTR_error_warning_state_count), MP_ROM_PTR(&canio_can_error_warning_state_count_obj) },
{ MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&canio_can_listen_obj) },
{ MP_ROM_QSTR(MP_QSTR_loopback), MP_ROM_PTR(&canio_can_loopback_obj) },
{ MP_ROM_QSTR(MP_QSTR_receive_error_count), MP_ROM_PTR(&canio_can_receive_error_count_obj) },

View File

@ -39,9 +39,6 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *tx, mc
bool common_hal_canio_can_auto_restart_get(canio_can_obj_t *self);
bool common_hal_canio_can_deinited(canio_can_obj_t *self);
int common_hal_canio_can_baudrate_get(canio_can_obj_t *self);
int common_hal_canio_can_bus_off_state_count_get(canio_can_obj_t *self);
int common_hal_canio_can_error_passive_state_count_get(canio_can_obj_t *self);
int common_hal_canio_can_error_warning_state_count_get(canio_can_obj_t *self);
bool common_hal_canio_can_loopback_get(canio_can_obj_t *self);
int common_hal_canio_can_receive_error_count_get(canio_can_obj_t *self);
canio_bus_state_t common_hal_canio_can_state_get(canio_can_obj_t *self);