diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-02-27 22:03:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-27 22:03:52 -0500 |
| commit | 568c04e6afa8016062f685b2198c0209f62827f4 (patch) | |
| tree | d07b76119f715add462983b335797adf64b61249 /examples/pyb.py | |
| parent | 6a2379fd0bfe10017d8abc5c36ef1d470c0d9b27 (diff) | |
| parent | ea633117d01d94e8d56ed94344e4b3e46b4eef03 (diff) | |
Merge pull request #650 from tannewt/merge_2x3.0.0-alpha.2
Merge in commits from 2.x branch.
Diffstat (limited to 'examples/pyb.py')
| -rw-r--r-- | examples/pyb.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/examples/pyb.py b/examples/pyb.py deleted file mode 100644 index b303777e5..000000000 --- a/examples/pyb.py +++ /dev/null @@ -1,49 +0,0 @@ -# pyboard testing functions for CPython -import time - -def delay(n): - #time.sleep(float(n) / 1000) - pass - -rand_seed = 1 -def rng(): - global rand_seed - # for these choice of numbers, see P L'Ecuyer, "Tables of linear congruential generators of different sizes and good lattice structure" - rand_seed = (rand_seed * 653276) % 8388593 - return rand_seed - -# LCD testing object for PC -# uses double buffering -class LCD: - def __init__(self, port): - self.width = 128 - self.height = 32 - self.buf1 = [[0 for x in range(self.width)] for y in range(self.height)] - self.buf2 = [[0 for x in range(self.width)] for y in range(self.height)] - - def light(self, value): - pass - - def fill(self, value): - for y in range(self.height): - for x in range(self.width): - self.buf1[y][x] = self.buf2[y][x] = value - - def show(self): - print('') # blank line to separate frames - for y in range(self.height): - for x in range(self.width): - self.buf1[y][x] = self.buf2[y][x] - for y in range(self.height): - row = ''.join(['*' if self.buf1[y][x] else ' ' for x in range(self.width)]) - print(row) - - def get(self, x, y): - if 0 <= x < self.width and 0 <= y < self.height: - return self.buf1[y][x] - else: - return 0 - - def pixel(self, x, y, value): - if 0 <= x < self.width and 0 <= y < self.height: - self.buf2[y][x] = value |
