Skip to content

Commit

Permalink
first init
Browse files Browse the repository at this point in the history
  • Loading branch information
MakerM0 committed Sep 6, 2023
1 parent 2ea1b24 commit dbd7d84
Show file tree
Hide file tree
Showing 23 changed files with 1,024 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
# PixelTime

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/117961102" width="150"/>
<br>
</p>
<p align="center">
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/MakerM0/PixelTime">
<img alt="GitHub top language" src="https://img.shields.io/github/languages/top/MakerM0/PixelTime">
</p>


# [PixelTime](https://oshwhub.com/kakaka/PixelTime)
a low power led watch based on ESP32 C3

![5](documents/images/5.png)

![7](documents/images/7.jpg)

![4](documents/images/4.jpg)

![2](documents/images/2.jpg)

![3](documents/images/3.jpg)

![6](documents/images/6.jpg)

![1](documents/images/1.png)

## Software

based on MicroPython





## Mechanical



## License

(hardware/mechanical)[Creative Commons — Attribution-NonCommercial-ShareAlike 4.0 International — CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)



## Extra


Binary file added documents/images/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added hardware/SCH_1.3a.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added mechanical/Panel/Panel_2023-08-08.epanm
Binary file not shown.
Binary file added mechanical/stl/压板.stl
Binary file not shown.
Binary file added mechanical/stl/外壳.stl
Binary file not shown.
Binary file added mechanical/stl/按键.stl
Binary file not shown.
69 changes: 69 additions & 0 deletions software/bitmapfont.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# MicroPython basic bitmap font renderer.
# Author: Tony DiCola
# License: MIT License (https://opensource.org/licenses/MIT)
try:
import ustruct
except ImportError:
import struct as ustruct


class BitmapFont:

def __init__(self, width, height, pixel, font_name='font5x8.bin'):
# Specify the drawing area width and height, and the pixel function to
# call when drawing pixels (should take an x and y param at least).
# Optionally specify font_name to override the font file to use (default
# is font5x8.bin). The font format is a binary file with the following
# format:
# - 1 unsigned byte: font character width in pixels
# - 1 unsigned byte: font character height in pixels
# - x bytes: font data, in ASCII order covering all 255 characters.
# Each character should have a byte for each pixel column of
# data (i.e. a 5x8 font has 5 bytes per character).
self._width = width
self._height = height
self._pixel = pixel
self._font_name = font_name

def init(self):
# Open the font file and grab the character width and height values.
# Note that only fonts up to 8 pixels tall are currently supported.
self._font = open(self._font_name, 'rb')
self._font_width, self._font_height = ustruct.unpack('BB', self._font.read(2))

def deinit(self):
# Close the font file as cleanup.
self._font.close()

def __enter__(self):
self.init()
return self

def __exit__(self, exception_type, exception_value, traceback):
self.deinit()

def draw_char(self, ch, x, y, *args, **kwargs):
# Don't draw the character if it will be clipped off the visible area.
if x < -self._font_width or x >= self._width or \
y < -self._font_height or y >= self._height:
return
# Go through each column of the character.
for char_x in range(self._font_width):
# Grab the byte for the current column of font data.
self._font.seek(2 + (ord(ch) * self._font_width) + char_x)
line = ustruct.unpack('B', self._font.read(1))[0]
# Go through each row in the column byte.
for char_y in range(self._font_height):
# Draw a pixel for each bit that's flipped on.
if (line >> char_y) & 0x1:
self._pixel(x + char_x, y + char_y, *args, **kwargs)

def text(self, text, x, y, *args, **kwargs):
# Draw the specified text at the specified location.
for i in range(len(text)):
self.draw_char(text[i], x + (i * (self._font_width + 1)), y,
*args, **kwargs)

def width(self, text):
# Return the pixel width of the specified text message.
return len(text) * (self._font_width + 1)
5 changes: 5 additions & 0 deletions software/boot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
#import webrepl
#webrepl.start()
6 changes: 6 additions & 0 deletions software/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@



#wifi
ssid = " "
password = " "
122 changes: 122 additions & 0 deletions software/font3x8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
FONT3X8 = (
#
# NUM0 =
(
1, 1, 1,
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 1, 1,
),
#
# NUM1 =
(
0, 1, 0,
1, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
1, 1, 1,
),
#
# NUM2 =
(
1, 1, 1,
0, 0, 1,
0, 0, 1,
1, 1, 1,
1, 0, 0,
1, 0, 0,
1, 0, 0,
1, 1, 1,
),
#
# NUM3 =
(
1, 1, 1,
0, 0, 1,
0, 0, 1,
1, 1, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
1, 1, 1,
),
#
# NUM4 =
(
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 1, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
),
#
# NUM5 =
(
1, 1, 1,
1, 0, 0,
1, 0, 0,
1, 1, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
1, 1, 1,
),
#
# NUM6 =
(
1, 1, 1,
1, 0, 0,
1, 0, 0,
1, 1, 1,
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 1, 1,
),
#
# NUM7 =
(
1, 1, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
),
#
# NUM8 =
(
1, 1, 1,
1, 0, 1,
1, 0, 1,
1, 1, 1,
1, 0, 1,
1, 0, 1,
1, 0, 1,
1, 1, 1,
),
#
# NUM9 =
(
1, 1, 1,
1, 0, 1,
1, 0, 1,
1, 1, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
1, 1, 1,
)
)
Binary file added software/font5x8.bin
Binary file not shown.
Loading

0 comments on commit dbd7d84

Please sign in to comment.