Skip to content

Commit 611f81a

Browse files
committed
canio: actually drop the _error_count properties
thanks @tannewt
1 parent 1bea099 commit 611f81a

File tree

3 files changed

+0
-98
lines changed

3 files changed

+0
-98
lines changed

ports/atmel-samd/common-hal/canio/CAN.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -275,21 +275,6 @@ int common_hal_canio_can_receive_error_count_get(canio_can_obj_t *self)
275275
return self->hw->ECR.bit.REC;
276276
}
277277

278-
int common_hal_canio_can_error_warning_state_count_get(canio_can_obj_t *self)
279-
{
280-
return self->error_warning_state_count;
281-
}
282-
283-
int common_hal_canio_can_error_passive_state_count_get(canio_can_obj_t *self)
284-
{
285-
return self->error_passive_state_count;
286-
}
287-
288-
int common_hal_canio_can_bus_off_state_count_get(canio_can_obj_t *self)
289-
{
290-
return self->bus_off_state_count;
291-
}
292-
293278
canio_bus_state_t common_hal_canio_can_state_get(canio_can_obj_t *self) {
294279
CAN_PSR_Type psr = self->hw->PSR;
295280
if (psr.bit.BO) {
@@ -419,17 +404,6 @@ STATIC void can_handler(int i) {
419404
Can *hw = can_insts[i];
420405
uint32_t ir = hri_can_read_IR_reg(hw);
421406

422-
/* Count up errors*/
423-
if (ir & CAN_IE_EWE) {
424-
self->error_warning_state_count += 1;
425-
}
426-
if (ir & CAN_IE_EPE) {
427-
self->error_passive_state_count += 1;
428-
}
429-
if (ir & CAN_IE_BOE) {
430-
self->bus_off_state_count += 1;
431-
}
432-
433407
/* Acknowledge interrupt */
434408
hri_can_write_IR_reg(hw, ir);
435409
}

shared-bindings/canio/CAN.c

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -171,72 +171,6 @@ STATIC const mp_obj_property_t canio_can_receive_error_count_obj = {
171171
(mp_obj_t)mp_const_none},
172172
};
173173

174-
//| error_warning_state_count: int
175-
//| """The number of times the controller enterted the Error Warning
176-
//| state (read-only). This number wraps around to 0 after an
177-
//| implementation-defined number of errors.
178-
//|
179-
//| Not all implementations support this property. If the property
180-
//| is unsupported, AttributeError will be raised."""
181-
//|
182-
STATIC mp_obj_t canio_can_error_warning_state_count_get(mp_obj_t self_in) {
183-
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
184-
common_hal_canio_can_check_for_deinit(self);
185-
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_can_error_warning_state_count_get(self));
186-
}
187-
MP_DEFINE_CONST_FUN_OBJ_1(canio_can_error_warning_state_count_get_obj, canio_can_error_warning_state_count_get);
188-
189-
STATIC const mp_obj_property_t canio_can_error_warning_state_count_obj = {
190-
.base.type = &mp_type_property,
191-
.proxy = {(mp_obj_t)&canio_can_error_warning_state_count_get_obj,
192-
(mp_obj_t)mp_const_none,
193-
(mp_obj_t)mp_const_none},
194-
};
195-
196-
//| error_passive_state_count: int
197-
//| """The number of times the controller enterted the Error Passive
198-
//| state (read-only). This number wraps around to 0 after an
199-
//| implementation-defined number of errors.
200-
//|
201-
//| Not all implementations support this property. If the property
202-
//| is unsupported, AttributeError will be raised."""
203-
//|
204-
STATIC mp_obj_t canio_can_error_passive_state_count_get(mp_obj_t self_in) {
205-
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
206-
common_hal_canio_can_check_for_deinit(self);
207-
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_can_error_passive_state_count_get(self));
208-
}
209-
MP_DEFINE_CONST_FUN_OBJ_1(canio_can_error_passive_state_count_get_obj, canio_can_error_passive_state_count_get);
210-
211-
STATIC const mp_obj_property_t canio_can_error_passive_state_count_obj = {
212-
.base.type = &mp_type_property,
213-
.proxy = {(mp_obj_t)&canio_can_error_passive_state_count_get_obj,
214-
(mp_obj_t)mp_const_none,
215-
(mp_obj_t)mp_const_none},
216-
};
217-
218-
//| bus_off_state_count: int
219-
//| """The number of times the controller enterted the Bus Off state
220-
//| (read-only). This number wraps around to 0 after an
221-
//| implementation-defined number of errors.
222-
//|
223-
//| Not all implementations support this property. If the property
224-
//| is unsupported, AttributeError will be raised."""
225-
//|
226-
STATIC mp_obj_t canio_can_bus_off_state_count_get(mp_obj_t self_in) {
227-
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
228-
common_hal_canio_can_check_for_deinit(self);
229-
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_can_bus_off_state_count_get(self));
230-
}
231-
MP_DEFINE_CONST_FUN_OBJ_1(canio_can_bus_off_state_count_get_obj, canio_can_bus_off_state_count_get);
232-
233-
STATIC const mp_obj_property_t canio_can_bus_off_state_count_obj = {
234-
.base.type = &mp_type_property,
235-
.proxy = {(mp_obj_t)&canio_can_bus_off_state_count_get_obj,
236-
(mp_obj_t)mp_const_none,
237-
(mp_obj_t)mp_const_none},
238-
};
239-
240174
//| state: State
241175
//| """The current state of the bus."""
242176
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[] = {
414348
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&canio_can_exit_obj) },
415349
{ MP_ROM_QSTR(MP_QSTR_auto_restart), MP_ROM_PTR(&canio_can_auto_restart_obj) },
416350
{ MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&canio_can_baudrate_obj) },
417-
{ MP_ROM_QSTR(MP_QSTR_bus_off_state_count), MP_ROM_PTR(&canio_can_bus_off_state_count_obj) },
418351
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&canio_can_deinit_obj) },
419-
{ MP_ROM_QSTR(MP_QSTR_error_passive_state_count), MP_ROM_PTR(&canio_can_error_passive_state_count_obj) },
420-
{ MP_ROM_QSTR(MP_QSTR_error_warning_state_count), MP_ROM_PTR(&canio_can_error_warning_state_count_obj) },
421352
{ MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&canio_can_listen_obj) },
422353
{ MP_ROM_QSTR(MP_QSTR_loopback), MP_ROM_PTR(&canio_can_loopback_obj) },
423354
{ MP_ROM_QSTR(MP_QSTR_receive_error_count), MP_ROM_PTR(&canio_can_receive_error_count_obj) },

shared-bindings/canio/CAN.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *tx, mc
3939
bool common_hal_canio_can_auto_restart_get(canio_can_obj_t *self);
4040
bool common_hal_canio_can_deinited(canio_can_obj_t *self);
4141
int common_hal_canio_can_baudrate_get(canio_can_obj_t *self);
42-
int common_hal_canio_can_bus_off_state_count_get(canio_can_obj_t *self);
43-
int common_hal_canio_can_error_passive_state_count_get(canio_can_obj_t *self);
44-
int common_hal_canio_can_error_warning_state_count_get(canio_can_obj_t *self);
4542
bool common_hal_canio_can_loopback_get(canio_can_obj_t *self);
4643
int common_hal_canio_can_receive_error_count_get(canio_can_obj_t *self);
4744
canio_bus_state_t common_hal_canio_can_state_get(canio_can_obj_t *self);

0 commit comments

Comments
 (0)