Class UARTLink

  • All Implemented Interfaces:
    Link

    public class UARTLink
    extends java.lang.Object
    implements Link
    Java Port of Pixy2 Arduino Library FIRST Robotics WPI API UART/Serial Link to Pixy2 CURRENTLY UNTESTED - Use SPI if possible! https://github.com/PseudoResonance/Pixy2JavaAPI
    • Constructor Summary

      Constructors 
      Constructor Description
      UARTLink()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes UART/Serial port
      int open​(int arg)
      Opens UART/Serial port
      int receive​(byte[] buffer, int length)
      Receives and reads specified length of bytes from UART/Serial
      int receive​(byte[] buffer, int length, Pixy2.Checksum cs)
      Receives and reads specified length of bytes from UART/Serial
      int send​(byte[] buffer, int length)
      Writes and sends buffer over UART/Serial
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UARTLink

        public UARTLink()
    • Method Detail

      • open

        public int open​(int arg)
        Opens UART/Serial port
        Specified by:
        open in interface Link
        Parameters:
        arg - UART/Serial port
        Returns:
        Returns 0
      • close

        public void close()
        Closes UART/Serial port
        Specified by:
        close in interface Link
      • receive

        public int receive​(byte[] buffer,
                           int length,
                           Pixy2.Checksum cs)
        Receives and reads specified length of bytes from UART/Serial
        Specified by:
        receive in interface Link
        Parameters:
        buffer - Byte buffer to return value
        length - Length of value to read
        cs - Checksum
        Returns:
        Length of value read
      • receive

        public int receive​(byte[] buffer,
                           int length)
        Receives and reads specified length of bytes from UART/Serial
        Specified by:
        receive in interface Link
        Parameters:
        buffer - Byte buffer to return value
        length - Length of value to read
        Returns:
        Length of value read
      • send

        public int send​(byte[] buffer,
                        int length)
        Writes and sends buffer over UART/Serial
        Specified by:
        send in interface Link
        Parameters:
        buffer - Byte buffer to send
        length - Length of value to send
        Returns:
        Length of value sent