summaryrefslogtreecommitdiff
path: root/shared-module/_canio/Match.h
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-08-20 11:08:00 -0500
committerJeff Epler <jepler@gmail.com>2020-09-21 16:44:26 -0500
commita2e1867f69ec2d703a9651e5c36a02b0e14dfd9c (patch)
treed114916bc977fce546d3b6a5aaca3f925971bf86 /shared-module/_canio/Match.h
parente7a213a11420ed362dfb672cd0fa6e77c032fa07 (diff)
_canio: Minimal implementation for SAM E5x MCUs
Tested & working: * Send standard packets * Receive standard packets (1 FIFO, no filter) Interoperation between SAM E54 Xplained running this tree and MicroPython running on STM32F405 Feather with an external transceiver was also tested. Many other aspects of a full implementation are not yet present, such as error detection and recovery.
Diffstat (limited to 'shared-module/_canio/Match.h')
-rw-r--r--shared-module/_canio/Match.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/shared-module/_canio/Match.h b/shared-module/_canio/Match.h
new file mode 100644
index 000000000..099df976d
--- /dev/null
+++ b/shared-module/_canio/Match.h
@@ -0,0 +1,41 @@
+/*
+ * 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"
+
+typedef struct {
+ mp_obj_base_t base;
+ int address;
+ int mask;
+ bool extended;
+} canio_match_obj_t;
+
+void common_hal_canio_match_construct(canio_match_obj_t *self, int address, int mask, bool extended);
+int common_hal_canio_match_address_get(const canio_match_obj_t *self);
+int common_hal_canio_match_mask_get(const canio_match_obj_t *self);
+bool common_hal_canio_match_extended_get(const canio_match_obj_t *self);