Ejemplo n.º 1
0
    def CommandLocalGPIO(self, p3_bitmask_on, p4_bitmask_on, p5_bitmask_on, p3_bitmask_off, p4_bitmask_off, p5_bitmask_off):
        """
        A predefined command to return a complete command datagram and command packet to create a generic GPIO ON/OFF bitmask command.

        :param p3_bitmask_on: A 1 byte bitmask for PORT 3 GPIO that if bit HIGH it will toggle the corresponding GPIO HIGH. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p4_bitmask_on: A 1 byte bitmask for PORT 4 GPIO that if bit HIGH it will toggle the corresponding GPIO HIGH. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p5_bitmask_on: A 1 byte bitmask for PORT 5 GPIO that if bit HIGH it will toggle the corresponding GPIO HIGH. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p3_bitmask_off: A 1 byte bitmask for PORT 3 GPIO that if bit HIGH it will toggle the corresponding GPIO LOW. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p4_bitmask_off: A 1 byte bitmask for PORT 4 GPIO that if bit HIGH it will toggle the corresponding GPIO LOW. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p5_bitmask_off: A 1 byte bitmask for PORT 5 GPIO that if bit HIGH it will toggle the corresponding GPIO LOW. If bit is LOW it will have no affect on the corresponding GPIO.

        :Return: Returns the complete generated packet as a string of bytes.


        :Example:

        >>> faraday_cmd = faradaycommands.faraday_commands()
        #Turn ON LED 1
        >>> command_packet = faraday_cmd.CommandLocalGPIO(faradaycommands.gpioallocations.LED_1, 0,0,0,0,0)
        #Turn OFF LED 1
        >>> command_packet = faraday_cmd.CommandLocalGPIO(0, 0,0,faradaycommands.gpioallocations.LED_1,0,0)
        #Turn ON LED 1 & LED 2
        >>> command_packet = faraday_cmd.CommandLocalGPIO(faradaycommands.gpioallocations.LED_1 | faradaycommands.gpioallocations.LED_2, 0,0,0,0,0)

        """
        packet = commandmodule.create_command_datagram(self.CMD_GPIO, commandmodule.create_gpio_command_packet(p3_bitmask_on, p4_bitmask_on, p5_bitmask_on, p3_bitmask_off, p4_bitmask_off, p5_bitmask_off))
        return packet
Ejemplo n.º 2
0
    def CommandLocalGPIOLED2Off(self):
        """
        A predefined command to return a complete datagram and command packet to turn OFF the LOCAL Faraday's LED #2 using the standard Faraday GPIO commanding packet.

        :Return: Returns the complete generated packet as a string of bytes.

        """
        packet = commandmodule.create_command_datagram(self.CMD_GPIO, commandmodule.create_gpio_command_packet(0, 0, 0, int(gpioallocations.LED_2), 0, 0))
        return packet
Ejemplo n.º 3
0
    def CommandRemoteGPIO(self, remote_callsign, remote_node_id, p3_bitmask_on, p4_bitmask_on, p5_bitmask_on, p3_bitmask_off, p4_bitmask_off, p5_bitmask_off):
        """
        A predefined command to return a complete datagram and command packet to command ALL GPIO's avaailable on a REMOTE (RF) Faraday device (see documentation).

        .. Note:: Please see the Faraday documentation on GPIO for more information about the GPIO bitmask assignments.

        :param remote_callsign: The callsign of the remote target Faraday device
        :param remote_node_id: The ID number (0-255) of the remote target Faraday device.
        :param p3_bitmask_on: A 1 byte bitmask for PORT 3 GPIO that if bit HIGH it will toggle the corresponding GPIO HIGH. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p4_bitmask_on: A 1 byte bitmask for PORT 4 GPIO that if bit HIGH it will toggle the corresponding GPIO HIGH. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p5_bitmask_on: A 1 byte bitmask for PORT 5 GPIO that if bit HIGH it will toggle the corresponding GPIO HIGH. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p3_bitmask_off: A 1 byte bitmask for PORT 3 GPIO that if bit HIGH it will toggle the corresponding GPIO LOW. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p4_bitmask_off: A 1 byte bitmask for PORT 4 GPIO that if bit HIGH it will toggle the corresponding GPIO LOW. If bit is LOW it will have no affect on the corresponding GPIO.
        :param p5_bitmask_off: A 1 byte bitmask for PORT 5 GPIO that if bit HIGH it will toggle the corresponding GPIO LOW. If bit is LOW it will have no affect on the corresponding GPIO.

        :Return: Returns the complete generated packet as a string of bytes.


        :Example:

        >>> faraday_cmd = faradaycommands.faraday_commands()
        #Turn ON LED 1
        >>> command_packet = faraday_cmd.CommandRemoteGPIO("KB1LQD", 1, faradaycommands.gpioallocations.LED_1, 0,0,0,0,0)
        #Turn OFF LED 1
        >>> command_packet = faraday_cmd.CommandRemoteGPIO("KB1LQD", 1, 0, 0,0,faradaycommands.gpioallocations.LED_1,0,0)
        #Turn ON LED 1 & LED 2
        >>> command_packet = faraday_cmd.CommandRemoteGPIO("KB1LQD", 1, faradaycommands.gpioallocations.LED_1 | faradaycommands.gpioallocations.LED_2, 0,0,0,0,0)

        """
        packet = commandmodule.create_rf_command_datagram(remote_callsign, remote_node_id, self.CMD_GPIO, commandmodule.create_gpio_command_packet(p3_bitmask_on, p4_bitmask_on, p5_bitmask_on, p3_bitmask_off, p4_bitmask_off, p5_bitmask_off))
        return packet
Ejemplo n.º 4
0
    def CommandRemoteGPIOLED2Off(self, remote_callsign, remote_node_id):
        """
        A predefined command to return a complete datagram and command packet to turn OFF the REMOTE (RF) Faraday's LED #2 using the standard Faraday GPIO commanding packet.

        :param remote_callsign: The callsign of the remote target Faraday device
        :param remote_node_id: The ID number (0-255) of the remote target Faraday device.

        :Return: Returns the complete generated packet as a string of bytes.

        """
        packet = commandmodule.create_rf_command_datagram(remote_callsign, remote_node_id, self.CMD_GPIO, commandmodule.create_gpio_command_packet(0, 0, 0, int(gpioallocations.LED_2), 0, 0))
        return packet