summaryrefslogtreecommitdiff
path: root/shared-module/busdevice/SPIDevice.h
diff options
context:
space:
mode:
authorgamblor21 <mark.komus@gmail.com>2020-10-31 12:17:29 -0500
committergamblor21 <mark.komus@gmail.com>2020-10-31 12:17:29 -0500
commit78477a374afad09aa7141af5cf590652b32c141f (patch)
treee40a77146ba3219f5fb181cf4bc5ed41ff4909a6 /shared-module/busdevice/SPIDevice.h
parente7da852db7c3784c8c162f7914815ba439baa989 (diff)
Initial SPI commit
Diffstat (limited to 'shared-module/busdevice/SPIDevice.h')
-rw-r--r--shared-module/busdevice/SPIDevice.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/shared-module/busdevice/SPIDevice.h b/shared-module/busdevice/SPIDevice.h
new file mode 100644
index 000000000..ffabf79df
--- /dev/null
+++ b/shared-module/busdevice/SPIDevice.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft 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.
+ */
+
+#ifndef MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H
+#define MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H
+
+#include "py/obj.h"
+#include "common-hal/busio/SPI.h"
+#include "common-hal/digitalio/DigitalInOut.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ busio_spi_obj_t *spi;
+ uint32_t baudrate;
+ uint8_t polarity;
+ uint8_t phase;
+ uint8_t extra_clocks;
+ digitalio_digitalinout_obj_t *chip_select;
+} busdevice_spidevice_obj_t;
+
+#endif // MICROPY_INCLUDED_ATMEL_SAMD_SHARED_MODULE_BUSDEVICE_SPIDEVICE_H