Skip to content

Commit 1bea099

Browse files
committed
Allow the _state_count properties to be unimplemented
This is the case on the SPI implementations MCP2515 and MCP2518.
1 parent 03bd968 commit 1bea099

File tree

1 file changed

+18
-3
lines changed
  • shared-bindings/canio

1 file changed

+18
-3
lines changed

shared-bindings/canio/CAN.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ STATIC const mp_obj_property_t canio_can_receive_error_count_obj = {
172172
};
173173

174174
//| error_warning_state_count: int
175-
//| """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."""
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."""
176181
//|
177182
STATIC mp_obj_t canio_can_error_warning_state_count_get(mp_obj_t self_in) {
178183
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -189,7 +194,12 @@ STATIC const mp_obj_property_t canio_can_error_warning_state_count_obj = {
189194
};
190195

191196
//| error_passive_state_count: int
192-
//| """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."""
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."""
193203
//|
194204
STATIC mp_obj_t canio_can_error_passive_state_count_get(mp_obj_t self_in) {
195205
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -206,7 +216,12 @@ STATIC const mp_obj_property_t canio_can_error_passive_state_count_obj = {
206216
};
207217

208218
//| bus_off_state_count: int
209-
//| """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."""
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."""
210225
//|
211226
STATIC mp_obj_t canio_can_bus_off_state_count_get(mp_obj_t self_in) {
212227
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);

0 commit comments

Comments
 (0)