canio: RemoteTransmissionRequest: Split implementation, keep one structure
This already begins obscuring things, because now there are two sets of shared-module functions for manipulating the same structure, e.g., common_hal_canio_remote_transmission_request_get_id and common_hal_canio_message_get_id
This commit is contained in:
parent
3e97e9c4be
commit
a4cc3ad6cb
@ -411,6 +411,7 @@ SRC_SHARED_MODULE_ALL = \
|
||||
_bleio/ScanResults.c \
|
||||
canio/Match.c \
|
||||
canio/Message.c \
|
||||
canio/RemoteTransmissionRequest.c \
|
||||
_eve/__init__.c \
|
||||
_pixelbuf/PixelBuf.c \
|
||||
_pixelbuf/__init__.c \
|
||||
|
@ -144,77 +144,6 @@ STATIC const mp_obj_property_t canio_message_extended_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| class RemoteTransmissionRequest:
|
||||
//| def __init__(self, id: int, length: int, *, extended: bool = False):
|
||||
//| """Construct a Message to send on a CAN bus.
|
||||
//|
|
||||
//| :param int id: The numeric ID of the requested message
|
||||
//| :param int length: The length of the requested message
|
||||
//| :param bool extended: True if the message has an extended identifier, False if it has a standard identifier
|
||||
//|
|
||||
//| In CAN, messages can have a length from 0 to 8 bytes.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t canio_remote_transmission_request_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_id, ARG_length, ARG_extended, NUM_ARGS };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_id, MP_ARG_INT | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_length, MP_ARG_INT | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_extended, MP_ARG_BOOL, {.u_bool = false} },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS );
|
||||
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
int length = args[ARG_length].u_int;
|
||||
if (length < 0 || length > 8) {
|
||||
mp_raise_ValueError(translate("Messages limited to 8 bytes"));
|
||||
}
|
||||
|
||||
canio_message_obj_t *self = m_new_obj(canio_message_obj_t);
|
||||
self->base.type = &canio_remote_transmission_request_type;
|
||||
common_hal_canio_message_construct(self, args[ARG_id].u_int, NULL, length, args[ARG_extended].u_bool);
|
||||
return self;
|
||||
}
|
||||
|
||||
//| extended: bool
|
||||
//| """True if the message's id is an extended id"""
|
||||
//|
|
||||
|
||||
//| id: int
|
||||
//| """The numeric ID of the message"""
|
||||
//|
|
||||
|
||||
//| length: int
|
||||
//| """The length of the requested message."""
|
||||
//|
|
||||
STATIC mp_obj_t canio_remote_transmission_request_length_get(const mp_obj_t self_in) {
|
||||
canio_message_obj_t *self = self_in;
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_message_get_length(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(canio_remote_transmission_request_length_get_obj, canio_remote_transmission_request_length_get);
|
||||
|
||||
STATIC mp_obj_t canio_remote_transmission_request_length_set(const mp_obj_t self_in, const mp_obj_t length_in) {
|
||||
canio_message_obj_t *self = self_in;
|
||||
int length = mp_obj_get_int(length_in);
|
||||
if (length < 0 || length > 8) {
|
||||
mp_raise_ValueError(translate("Messages limited to 8 bytes"));
|
||||
}
|
||||
common_hal_canio_remote_transmission_request_set_length(self, length);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(canio_remote_transmission_request_length_set_obj, canio_remote_transmission_request_length_set);
|
||||
|
||||
|
||||
STATIC const mp_obj_property_t canio_remote_transmission_request_length_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&canio_remote_transmission_request_length_get_obj,
|
||||
(mp_obj_t)&canio_remote_transmission_request_length_set_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t canio_message_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_id), MP_ROM_PTR(&canio_message_id_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_data), MP_ROM_PTR(&canio_message_data_obj) },
|
||||
@ -228,17 +157,3 @@ const mp_obj_type_t canio_message_type = {
|
||||
.make_new = canio_message_make_new,
|
||||
.locals_dict = (mp_obj_t)&canio_message_locals_dict,
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t canio_remote_transmission_request_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_id), MP_ROM_PTR(&canio_message_id_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_length), MP_ROM_PTR(&canio_remote_transmission_request_length_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_extended), MP_ROM_PTR(&canio_message_extended_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(canio_remote_transmission_request_locals_dict, canio_remote_transmission_request_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t canio_remote_transmission_request_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_RemoteTransmissionRequest,
|
||||
.make_new = canio_remote_transmission_request_make_new,
|
||||
.locals_dict = (mp_obj_t)&canio_remote_transmission_request_locals_dict,
|
||||
};
|
||||
|
@ -39,7 +39,5 @@ bool common_hal_canio_message_get_extended(const canio_message_obj_t *self);
|
||||
void common_hal_canio_message_set_extended(canio_message_obj_t *self, bool extended);
|
||||
int common_hal_canio_message_get_id(const canio_message_obj_t *self);
|
||||
void common_hal_canio_message_set_id(canio_message_obj_t *self, int id);
|
||||
bool common_hal_canio_message_get_rtr(const canio_message_obj_t *self);
|
||||
void common_hal_canio_message_set_rtr(canio_message_obj_t *self, bool rtr);
|
||||
size_t common_hal_canio_message_get_length(const canio_message_obj_t *self);
|
||||
void common_hal_canio_remote_transmission_request_set_length(canio_message_obj_t *self, size_t length);
|
||||
|
164
shared-bindings/canio/RemoteTransmissionRequest.c
Normal file
164
shared-bindings/canio/RemoteTransmissionRequest.c
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Jeff Epler for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/canio/RemoteTransmissionRequest.h"
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
//| class RemoteTransmissionRequest:
|
||||
//| def __init__(self, id: int, length: int, *, extended: bool = False):
|
||||
//| """Construct a RemoteTransmissionRequest to send on a CAN bus.
|
||||
//|
|
||||
//| :param int id: The numeric ID of the requested message
|
||||
//| :param int length: The length of the requested message
|
||||
//| :param bool extended: True if the message has an extended identifier, False if it has a standard identifier
|
||||
//|
|
||||
//| In CAN, messages can have a length from 0 to 8 bytes.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t canio_remote_transmission_request_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_id, ARG_length, ARG_extended, NUM_ARGS };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_id, MP_ARG_INT | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_length, MP_ARG_INT | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_extended, MP_ARG_BOOL, {.u_bool = false} },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS );
|
||||
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
int length = args[ARG_length].u_int;
|
||||
if (length < 0 || length > 8) {
|
||||
mp_raise_ValueError(translate("RemoteTransmissionRequests limited to 8 bytes"));
|
||||
}
|
||||
|
||||
canio_remote_transmission_request_obj_t *self = m_new_obj(canio_remote_transmission_request_obj_t);
|
||||
self->base.type = &canio_remote_transmission_request_type;
|
||||
common_hal_canio_remote_transmission_request_construct(self, args[ARG_id].u_int, length, args[ARG_extended].u_bool);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
//| id: int
|
||||
//| """The numeric ID of the message"""
|
||||
//|
|
||||
STATIC mp_obj_t canio_remote_transmission_request_id_get(const mp_obj_t self_in) {
|
||||
canio_remote_transmission_request_obj_t *self = self_in;
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_remote_transmission_request_get_id(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(canio_remote_transmission_request_id_get_obj, canio_remote_transmission_request_id_get);
|
||||
|
||||
STATIC mp_obj_t canio_remote_transmission_request_id_set(const mp_obj_t self_in, const mp_obj_t id) {
|
||||
canio_remote_transmission_request_obj_t *self = self_in;
|
||||
common_hal_canio_remote_transmission_request_set_id(self, mp_obj_get_int(id));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(canio_remote_transmission_request_id_set_obj, canio_remote_transmission_request_id_set);
|
||||
|
||||
STATIC const mp_obj_property_t canio_remote_transmission_request_id_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&canio_remote_transmission_request_id_get_obj,
|
||||
(mp_obj_t)&canio_remote_transmission_request_id_set_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| extended: bool
|
||||
//| """True if the message's id is an extended id"""
|
||||
//|
|
||||
STATIC mp_obj_t canio_remote_transmission_request_extended_get(const mp_obj_t self_in) {
|
||||
canio_remote_transmission_request_obj_t *self = self_in;
|
||||
return mp_obj_new_bool(common_hal_canio_remote_transmission_request_get_extended(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(canio_remote_transmission_request_extended_get_obj, canio_remote_transmission_request_extended_get);
|
||||
|
||||
STATIC mp_obj_t canio_remote_transmission_request_extended_set(const mp_obj_t self_in, const mp_obj_t extended) {
|
||||
canio_remote_transmission_request_obj_t *self = self_in;
|
||||
common_hal_canio_remote_transmission_request_set_extended(self, mp_obj_is_true(extended));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(canio_remote_transmission_request_extended_set_obj, canio_remote_transmission_request_extended_set);
|
||||
|
||||
|
||||
STATIC const mp_obj_property_t canio_remote_transmission_request_extended_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&canio_remote_transmission_request_extended_get_obj,
|
||||
(mp_obj_t)&canio_remote_transmission_request_extended_set_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| extended: bool
|
||||
//| """True if the message's id is an extended id"""
|
||||
//|
|
||||
|
||||
//| id: int
|
||||
//| """The numeric ID of the message"""
|
||||
//|
|
||||
|
||||
//| length: int
|
||||
//| """The length of the requested message."""
|
||||
//|
|
||||
STATIC mp_obj_t canio_remote_transmission_request_length_get(const mp_obj_t self_in) {
|
||||
canio_remote_transmission_request_obj_t *self = self_in;
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_canio_remote_transmission_request_get_length(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(canio_remote_transmission_request_length_get_obj, canio_remote_transmission_request_length_get);
|
||||
|
||||
STATIC mp_obj_t canio_remote_transmission_request_length_set(const mp_obj_t self_in, const mp_obj_t length_in) {
|
||||
canio_remote_transmission_request_obj_t *self = self_in;
|
||||
int length = mp_obj_get_int(length_in);
|
||||
if (length < 0 || length > 8) {
|
||||
mp_raise_ValueError(translate("RemoteTransmissionRequests limited to 8 bytes"));
|
||||
}
|
||||
common_hal_canio_remote_transmission_request_set_length(self, length);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(canio_remote_transmission_request_length_set_obj, canio_remote_transmission_request_length_set);
|
||||
|
||||
|
||||
STATIC const mp_obj_property_t canio_remote_transmission_request_length_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&canio_remote_transmission_request_length_get_obj,
|
||||
(mp_obj_t)&canio_remote_transmission_request_length_set_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t canio_remote_transmission_request_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_id), MP_ROM_PTR(&canio_remote_transmission_request_id_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_length), MP_ROM_PTR(&canio_remote_transmission_request_length_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_extended), MP_ROM_PTR(&canio_remote_transmission_request_extended_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(canio_remote_transmission_request_locals_dict, canio_remote_transmission_request_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t canio_remote_transmission_request_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_RemoteTransmissionRequest,
|
||||
.make_new = canio_remote_transmission_request_make_new,
|
||||
.locals_dict = (mp_obj_t)&canio_remote_transmission_request_locals_dict,
|
||||
};
|
42
shared-bindings/canio/RemoteTransmissionRequest.h
Normal file
42
shared-bindings/canio/RemoteTransmissionRequest.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Jeff Epler for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "shared-module/canio/RemoteTransmissionRequest.h"
|
||||
|
||||
extern const mp_obj_type_t canio_remote_transmission_request_type;
|
||||
|
||||
void common_hal_canio_remote_transmission_request_construct(canio_remote_transmission_request_obj_t *self, int id, size_t size, bool extended);
|
||||
const void *common_hal_canio_remote_transmission_request_get_data(const canio_remote_transmission_request_obj_t *self);
|
||||
void common_hal_canio_remote_transmission_request_set_data(canio_remote_transmission_request_obj_t *self, const void *data, size_t size);
|
||||
bool common_hal_canio_remote_transmission_request_get_extended(const canio_remote_transmission_request_obj_t *self);
|
||||
void common_hal_canio_remote_transmission_request_set_extended(canio_remote_transmission_request_obj_t *self, bool extended);
|
||||
int common_hal_canio_remote_transmission_request_get_id(const canio_remote_transmission_request_obj_t *self);
|
||||
void common_hal_canio_remote_transmission_request_set_id(canio_remote_transmission_request_obj_t *self, int id);
|
||||
size_t common_hal_canio_remote_transmission_request_get_length(const canio_remote_transmission_request_obj_t *self);
|
||||
void common_hal_canio_remote_transmission_request_set_length(canio_remote_transmission_request_obj_t *self, size_t length);
|
@ -68,26 +68,6 @@ size_t common_hal_canio_message_get_length(const canio_message_obj_t *self)
|
||||
return self->size;
|
||||
}
|
||||
|
||||
void common_hal_canio_remote_transmission_request_set_length(canio_message_obj_t *self, size_t size)
|
||||
{
|
||||
memset(self->data, 0, size);
|
||||
self->size = size;
|
||||
}
|
||||
|
||||
|
||||
bool common_hal_canio_message_get_rtr(const canio_message_obj_t *self)
|
||||
{
|
||||
return self->rtr;
|
||||
}
|
||||
|
||||
void common_hal_canio_message_set_rtr(canio_message_obj_t *self, bool rtr)
|
||||
{
|
||||
self->rtr = rtr;
|
||||
if (rtr) {
|
||||
memset(self->data, 0, self->size);
|
||||
}
|
||||
}
|
||||
|
||||
bool common_hal_canio_message_get_extended(const canio_message_obj_t *self)
|
||||
{
|
||||
return self->extended;
|
||||
|
68
shared-module/canio/RemoteTransmissionRequest.c
Normal file
68
shared-module/canio/RemoteTransmissionRequest.c
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Jeff Epler for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-module/canio/RemoteTransmissionRequest.h"
|
||||
#include "shared-bindings/canio/RemoteTransmissionRequest.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void common_hal_canio_remote_transmission_request_construct(canio_remote_transmission_request_obj_t *self, int id, size_t size, bool extended)
|
||||
{
|
||||
self->id = id;
|
||||
self->size = size;
|
||||
self->rtr = true;
|
||||
self->extended = extended;
|
||||
}
|
||||
|
||||
int common_hal_canio_remote_transmission_request_get_id(const canio_remote_transmission_request_obj_t *self)
|
||||
{
|
||||
return self->id;
|
||||
}
|
||||
|
||||
void common_hal_canio_remote_transmission_request_set_id(canio_remote_transmission_request_obj_t *self, int id)
|
||||
{
|
||||
self->id = id;
|
||||
}
|
||||
|
||||
size_t common_hal_canio_remote_transmission_request_get_length(const canio_remote_transmission_request_obj_t *self)
|
||||
{
|
||||
return self->size;
|
||||
}
|
||||
|
||||
void common_hal_canio_remote_transmission_request_set_length(canio_remote_transmission_request_obj_t *self, size_t size)
|
||||
{
|
||||
self->size = size;
|
||||
}
|
||||
|
||||
bool common_hal_canio_remote_transmission_request_get_extended(const canio_remote_transmission_request_obj_t *self)
|
||||
{
|
||||
return self->extended;
|
||||
}
|
||||
|
||||
void common_hal_canio_remote_transmission_request_set_extended(canio_remote_transmission_request_obj_t *self, bool extended)
|
||||
{
|
||||
self->extended = extended;
|
||||
}
|
33
shared-module/canio/RemoteTransmissionRequest.h
Normal file
33
shared-module/canio/RemoteTransmissionRequest.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Jeff Epler for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
#include "shared-bindings/canio/Message.h"
|
||||
|
||||
typedef canio_message_obj_t canio_remote_transmission_request_obj_t;
|
Loading…
Reference in New Issue
Block a user