uart

Dependencies:   MAX32620FTHR USBDevice

Committer:
rsjawale24
Date:
Sun Oct 16 15:35:01 2022 +0000
Revision:
0:c62425b2f286
ok

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rsjawale24 0:c62425b2f286 1 /*******************************************************************************
rsjawale24 0:c62425b2f286 2 * Copyright (C) Maxim Integrated Products, Inc., All rights Reserved.
rsjawale24 0:c62425b2f286 3 *
rsjawale24 0:c62425b2f286 4 * This software is protected by copyright laws of the United States and
rsjawale24 0:c62425b2f286 5 * of foreign countries. This material may also be protected by patent laws
rsjawale24 0:c62425b2f286 6 * and technology transfer regulations of the United States and of foreign
rsjawale24 0:c62425b2f286 7 * countries. This software is furnished under a license agreement and/or a
rsjawale24 0:c62425b2f286 8 * nondisclosure agreement and may only be used or reproduced in accordance
rsjawale24 0:c62425b2f286 9 * with the terms of those agreements. Dissemination of this information to
rsjawale24 0:c62425b2f286 10 * any party or parties not specified in the license agreement and/or
rsjawale24 0:c62425b2f286 11 * nondisclosure agreement is expressly prohibited.
rsjawale24 0:c62425b2f286 12 *
rsjawale24 0:c62425b2f286 13 * The above copyright notice and this permission notice shall be included
rsjawale24 0:c62425b2f286 14 * in all copies or substantial portions of the Software.
rsjawale24 0:c62425b2f286 15 *
rsjawale24 0:c62425b2f286 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
rsjawale24 0:c62425b2f286 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
rsjawale24 0:c62425b2f286 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
rsjawale24 0:c62425b2f286 19 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
rsjawale24 0:c62425b2f286 20 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
rsjawale24 0:c62425b2f286 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
rsjawale24 0:c62425b2f286 22 * OTHER DEALINGS IN THE SOFTWARE.
rsjawale24 0:c62425b2f286 23 *
rsjawale24 0:c62425b2f286 24 * Except as contained in this notice, the name of Maxim Integrated
rsjawale24 0:c62425b2f286 25 * Products, Inc. shall not be used except as stated in the Maxim Integrated
rsjawale24 0:c62425b2f286 26 * Products, Inc. Branding Policy.
rsjawale24 0:c62425b2f286 27 *
rsjawale24 0:c62425b2f286 28 * The mere transfer of this software does not imply any licenses
rsjawale24 0:c62425b2f286 29 * of trade secrets, proprietary technology, copyrights, patents,
rsjawale24 0:c62425b2f286 30 * trademarks, maskwork rights, or any other form of intellectual
rsjawale24 0:c62425b2f286 31 * property whatsoever. Maxim Integrated Products, Inc. retains all
rsjawale24 0:c62425b2f286 32 * ownership rights.
rsjawale24 0:c62425b2f286 33 *******************************************************************************
rsjawale24 0:c62425b2f286 34 */
rsjawale24 0:c62425b2f286 35
rsjawale24 0:c62425b2f286 36 #ifndef INTERFACE_H_INCLUDED
rsjawale24 0:c62425b2f286 37 #define INTERFACE_H_INCLUDED
rsjawale24 0:c62425b2f286 38
rsjawale24 0:c62425b2f286 39 #include "mbed.h"
rsjawale24 0:c62425b2f286 40 #include "gesture_lib.h"
rsjawale24 0:c62425b2f286 41
rsjawale24 0:c62425b2f286 42 // Option to implement serial API over UART instead of USB
rsjawale24 0:c62425b2f286 43 #define USE_UART_INTERFACE 1
rsjawale24 0:c62425b2f286 44 #define UART_BAUD_RATE 115200
rsjawale24 0:c62425b2f286 45
rsjawale24 0:c62425b2f286 46 // Bytes prefixed to pixel data to create data frame
rsjawale24 0:c62425b2f286 47 const int NUM_INFO_BYTES = 40;
rsjawale24 0:c62425b2f286 48
rsjawale24 0:c62425b2f286 49 const unsigned int USB_BLOCK_SIZE = 64;
rsjawale24 0:c62425b2f286 50
rsjawale24 0:c62425b2f286 51 // Data streaming over USB or UART, depending on which is enabled
rsjawale24 0:c62425b2f286 52 void sendDataStream(uint8_t *str, const unsigned int num_chars);
rsjawale24 0:c62425b2f286 53
rsjawale24 0:c62425b2f286 54 #endif