programme ok

Fork of pixy by Arcadie Cracan

Files at this revision

API Documentation at this revision

Comitter:
pirottealex
Date:
Fri Jun 23 11:18:38 2017 +0000
Parent:
0:ed8dc4531ac1
Commit message:
version ok;

Changed in this revision

Pixy.cpp Show annotated file Show diff for this revision Revisions of this file
Pixy.h Show annotated file Show diff for this revision Revisions of this file
PixyLinkUART.h Show annotated file Show diff for this revision Revisions of this file
diff -r ed8dc4531ac1 -r a4c25c179e7a Pixy.cpp
--- a/Pixy.cpp	Sun Nov 16 11:52:55 2014 +0000
+++ b/Pixy.cpp	Fri Jun 23 11:18:38 2017 +0000
@@ -20,6 +20,15 @@
     blocks = new Block[blockArraySize];
 }
 
+Pixy::Pixy(PinName tx, PinName rx)
+{
+    m_link = new PixyLinkUART(tx,rx);
+    skipStart = false;
+    blockCount = 0;
+    blockArraySize = PIXY_INITIAL_ARRAYSIZE;
+    blocks = new Block[blockArraySize];
+}
+
 Pixy::~Pixy()
 {
     delete[] blocks;
@@ -62,7 +71,7 @@
         if (checksum == sum)
             blockCount++;
         else if (pc)
-            pc->printf("cs error\n\r");
+           // pc->printf("cs error\n\r");
 
         w = m_link->getWord();
         if (w != PIXY_START_WORD)
@@ -107,7 +116,7 @@
             return true;
         else if (w == PIXY_START_WORDX) {
             if (pc)
-                pc->printf("reorder\n\r");
+             //   pc->printf("reorder\n\r");
             m_link->getByte(); // resync
         }
         lastw = w;
diff -r ed8dc4531ac1 -r a4c25c179e7a Pixy.h
--- a/Pixy.h	Sun Nov 16 11:52:55 2014 +0000
+++ b/Pixy.h	Fri Jun 23 11:18:38 2017 +0000
@@ -22,6 +22,7 @@
 public:
     enum LinkType {SPI, I2C, UART};
     Pixy(LinkType linkType, PinName mosi_sda_tx, PinName miso_scl_rx, PinName sclk = NC);
+    Pixy(PinName tx, PinName rx);
     ~Pixy();
     uint16_t getBlocks(uint16_t maxBlocks=1000);
     int8_t setServos(uint16_t s0, uint16_t s1);
diff -r ed8dc4531ac1 -r a4c25c179e7a PixyLinkUART.h
--- a/PixyLinkUART.h	Sun Nov 16 11:52:55 2014 +0000
+++ b/PixyLinkUART.h	Fri Jun 23 11:18:38 2017 +0000
@@ -1,4 +1,4 @@
-#ifndef TUIASI_PIXYLINKUART_H
+ #ifndef TUIASI_PIXYLINKUART_H
 #define TUIASI_PIXYLINKUART_H
 
 #include "Serial.h"