Class I2CLink

  • All Implemented Interfaces:
    Link

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

      Constructors 
      Constructor Description
      I2CLink()  
    • Method Summary

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

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

      • I2CLink

        public I2CLink()
    • Method Detail

      • open

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

        public void close()
        Closes I2C 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 I2C
        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 I2C
        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 I2C
        Specified by:
        send in interface Link
        Parameters:
        buffer - Byte buffer to send
        length - Length of value to send
        Returns:
        Length of value sent