summaryrefslogtreecommitdiff
path: root/comm/spi/arduino_spi_master/arduino_spi_master.ino
diff options
context:
space:
mode:
authorAbel Tim <abel@main.home>2024-06-22 09:17:50 +0200
committerAbel Tim <abel@main.home>2024-06-22 09:17:50 +0200
commit4971e86d05c714ff3630ada8851938614128b412 (patch)
tree35a40d4213bd8bcb47da35ef7a477ae37b28cf05 /comm/spi/arduino_spi_master/arduino_spi_master.ino
parentbec80cbf5f05e2faeeda15b7a8b372d1a3f8e465 (diff)
downloadrobotica-4971e86d05c714ff3630ada8851938614128b412.tar.gz
robotica-4971e86d05c714ff3630ada8851938614128b412.zip
update repo structure
update poster add code flowchart
Diffstat (limited to 'comm/spi/arduino_spi_master/arduino_spi_master.ino')
-rw-r--r--comm/spi/arduino_spi_master/arduino_spi_master.ino34
1 files changed, 0 insertions, 34 deletions
diff --git a/comm/spi/arduino_spi_master/arduino_spi_master.ino b/comm/spi/arduino_spi_master/arduino_spi_master.ino
deleted file mode 100644
index 248ef0f..0000000
--- a/comm/spi/arduino_spi_master/arduino_spi_master.ino
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <SPI.h>
-#define SS_PIN 10
-#define BAUD_RATE 19200
-#define CHAR_BUF 128
-
-void setup() {
- pinMode(SS_PIN, OUTPUT);
- Serial.begin(BAUD_RATE);
- SPI.begin();
- SPI.setBitOrder(MSBFIRST);
- SPI.setClockDivider(SPI_CLOCK_DIV16);
- SPI.setDataMode(SPI_MODE0);
- delay(1000); // Give the OpenMV Cam time to bootup.
-}
-
-void loop() {
- int32_t len = 0;
- char buff[CHAR_BUF] = {0};
- digitalWrite(SS_PIN, LOW);
- delay(1); // Give the OpenMV Cam some time to setup to send data.
-
- if(SPI.transfer(1) == 85) { // saw sync char?
- SPI.transfer(&len, 4); // get length
- if (len) {
- SPI.transfer(&buff, min(len, CHAR_BUF));
- len -= min(len, CHAR_BUF);
- }
- while (len--) SPI.transfer(0); // eat any remaining bytes
- }
-
- digitalWrite(SS_PIN, HIGH);
- Serial.print(buff);
- delay(1); // Don't loop to quickly.
-} \ No newline at end of file