summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-09-29 14:25:53 -0500
committerJeff Epler <jepler@gmail.com>2020-09-29 14:25:53 -0500
commit611f81ac1afce82b74acbe8b282fef5300dac4d9 (patch)
tree95fd36744f208c98458fe0dab65f4f58360010e9
parent1bea099eb201526a777f3d30b8a9e017724aaa9d (diff)
canio: actually drop the _error_count properties
thanks @tannewt
-rw-r--r--ports/atmel-samd/common-hal/canio/CAN.c26
-rw-r--r--shared-bindings/canio/CAN.c69
-rw-r--r--shared-bindings/canio/CAN.h3
3 files changed, 0 insertions, 98 deletions
diff --git a/ports/atmel-samd/common-hal/canio/CAN.c b/ports/atmel-samd/common-hal/canio/CAN.c
index ec6b75951..76599a9a7 100644
--- a/ports/atmel-samd/common-hal/canio/CAN.c
+++ b/ports/atmel-samd/common-hal/canio/CAN.c
@@ -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);
}
diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c
index 15ce3dc08..e8ab15a3c 100644
--- a/shared-bindings/canio/CAN.c
+++ b/shared-bindings/canio/CAN.c
@@ -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) },
diff --git a/shared-bindings/canio/CAN.h b/shared-bindings/canio/CAN.h
index 8d61bc8ed..968b71f14 100644
--- a/shared-bindings/canio/CAN.h
+++ b/shared-bindings/canio/CAN.h
@@ -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);