Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial FatFileSystemCpp mbed
Diff: VIPSSerialProtocol.cpp
- Revision:
- 69:47f800793d00
- Parent:
- 66:066b16c6c34f
- Child:
- 72:da2f1df6a50d
--- a/VIPSSerialProtocol.cpp Thu Jan 27 12:56:13 2022 +0000
+++ b/VIPSSerialProtocol.cpp Thu Feb 03 11:50:12 2022 +0000
@@ -11,6 +11,9 @@
#define _VBOXReady 0x05
#define _SetDeltaTime 0x07
+#define IdleTxBuffer (txBuf == TXBuffer1)?TXBuffer2:TXBuffer1
+#define ActiveTxBuffer (txBuf == TXBuffer1)?TXBuffer1:TXBuffer2
+
VIPSSerial::VIPSSerial(const PinName Tx, const PinName Rx) : _port(Tx,Rx)
{
@@ -35,6 +38,9 @@
SmoothRunning = false;
BypassMode = false;
+ directTx = false;
+ txBuf = TXBuffer1;
+ waitingBytes = 0;
nextPosition= 0;
_outputMask = 0x44;
@@ -56,6 +62,9 @@
while (_port.readable()) {
if (BypassMode) {
vipsBypassRx(_port.getc());
+ } else if (directTx) {
+ if (waitingBytes < MaxBuffSize)
+ txBuf[waitingBytes++] = _port.getc();
} else {
messageInBuffer[messagePrt] = _port.getc();
if (messagePrt==0) { // look for header
@@ -189,6 +198,32 @@
queueLen = 0;
}
}
+void VIPSSerial::sendDirectTX(unsigned char* data, int dataLen)
+{
+ for (int i=0; i<dataLen; i++)
+ _port.putc(data[i]);
+}
+
+void VIPSSerial::sendQuiet()
+{
+ _port.putc(0x07);
+ _port.putc(0x05);
+ _port.putc(0x02);
+ _port.putc(0x5A);
+ _port.putc(0x27);
+}
+
+int VIPSSerial::getWaitingBuffer(unsigned char **TXBuffer, int *bytesToSend)
+{
+ __disable_irq();
+ int bytes = waitingBytes;
+ txBuf = IdleTxBuffer;
+ waitingBytes = 0;
+ __enable_irq();
+ *bytesToSend = bytes;
+ *TXBuffer = IdleTxBuffer;
+ return bytes;
+}
void VIPSSerial::getCRC(void *data, int len, void *checksum)
{