-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9578627
commit 141f50b
Showing
19 changed files
with
90 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.4.2 | ||
3.4.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
from typing import * | ||
|
||
from pros.serial.devices.vex.v5_device import V5Device | ||
from pros.serial.ports import BasePort, DirectPort | ||
|
||
|
||
class V5WirelessPort(BasePort): | ||
def __init__(self, port): | ||
self.buffer: bytearray = bytearray() | ||
|
||
self.port_instance = DirectPort(port) | ||
self.device = V5Device(self.port_instance) | ||
self.download_channel = self.device.DownloadChannel(self.device) | ||
self.download_channel.__enter__() | ||
|
||
def destroy(self): | ||
self.port_instance.destroy() | ||
self.download_channel.__exit__() | ||
|
||
def config(self, command: str, argument: Any): | ||
return self.port_instance.config(command, argument) | ||
|
||
# TODO: buffer input? technically this is done by the user_fifo_write cmd blocking until whole input is written? | ||
def write(self, data: bytes): | ||
self.device.user_fifo_write(data) | ||
|
||
def read(self, n_bytes: int = 0) -> bytes: | ||
if n_bytes > len(self.buffer): | ||
self.buffer.extend(self.device.user_fifo_read()) | ||
ret = self.buffer[:n_bytes] | ||
self.buffer = self.buffer[n_bytes:] | ||
return ret | ||
|
||
@property | ||
def name(self) -> str: | ||
return self.port_instance.name | ||
from typing import * | ||
|
||
from pros.serial.devices.vex.v5_device import V5Device | ||
from pros.serial.ports import BasePort, DirectPort | ||
|
||
|
||
class V5WirelessPort(BasePort): | ||
def __init__(self, port): | ||
self.buffer: bytearray = bytearray() | ||
|
||
self.port_instance = DirectPort(port) | ||
self.device = V5Device(self.port_instance) | ||
self.download_channel = self.device.DownloadChannel(self.device) | ||
self.download_channel.__enter__() | ||
|
||
def destroy(self): | ||
self.port_instance.destroy() | ||
self.download_channel.__exit__() | ||
|
||
def config(self, command: str, argument: Any): | ||
return self.port_instance.config(command, argument) | ||
|
||
# TODO: buffer input? technically this is done by the user_fifo_write cmd blocking until whole input is written? | ||
def write(self, data: bytes): | ||
self.device.user_fifo_write(data) | ||
|
||
def read(self, n_bytes: int = 0) -> bytes: | ||
if n_bytes > len(self.buffer): | ||
self.buffer.extend(self.device.user_fifo_read()) | ||
ret = self.buffer[:n_bytes] | ||
self.buffer = self.buffer[n_bytes:] | ||
return ret | ||
|
||
@property | ||
def name(self) -> str: | ||
return self.port_instance.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.4.2 | ||
3.4.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.4.2.0 | ||
3.4.2.0 |