mirror of
https://github.com/m5stack/M5Stack_MicroPython.git
synced 2026-05-20 10:14:44 -07:00
update spi speed
This commit is contained in:
@@ -3,7 +3,7 @@ import machine, network, utime
|
||||
print("")
|
||||
print("Starting WiFi ...")
|
||||
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
|
||||
sta_if.connect("MasterHax_5G", "wittyercheese551")
|
||||
sta_if.connect("mySSID", "wifi_password")
|
||||
tmo = 50
|
||||
while not sta_if.isconnected():
|
||||
utime.sleep_ms(100)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# This file is executed on every boot (including wake-boot from deepsleep)
|
||||
|
||||
import sys
|
||||
|
||||
# Set default path
|
||||
# Needed for importing modules and upip
|
||||
sys.path[1] = '/flash/lib'
|
||||
@@ -1,34 +0,0 @@
|
||||
import machine, network, utime
|
||||
|
||||
print("")
|
||||
print("Starting WiFi ...")
|
||||
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
|
||||
sta_if.connect("mySSID", "wifi_password")
|
||||
tmo = 50
|
||||
while not sta_if.isconnected():
|
||||
utime.sleep_ms(100)
|
||||
tmo -= 1
|
||||
if tmo == 0:
|
||||
sta_if.disconnect()
|
||||
break
|
||||
|
||||
if tmo > 0:
|
||||
print("WiFi started")
|
||||
utime.sleep_ms(500)
|
||||
|
||||
rtc = machine.RTC()
|
||||
print("Synchronize time from NTP server ...")
|
||||
rtc.ntp_sync(server="hr.pool.ntp.org")
|
||||
tmo = 100
|
||||
while not rtc.synced():
|
||||
utime.sleep_ms(100)
|
||||
tmo -= 1
|
||||
if tmo == 0:
|
||||
break
|
||||
|
||||
if tmo > 0:
|
||||
print("Time set")
|
||||
utime.sleep_ms(500)
|
||||
t = rtc.now()
|
||||
utime.strftime("%c")
|
||||
print("")
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
def conncb(task):
|
||||
print("[{}] Connected".format(task))
|
||||
|
||||
def disconncb(task):
|
||||
print("[{}] Disconnected".format(task))
|
||||
|
||||
def subscb(task):
|
||||
print("[{}] Subscribed".format(task))
|
||||
|
||||
def pubcb(pub):
|
||||
print("[{}] Published: {}".format(pub[0], pub[1]))
|
||||
|
||||
def datacb(msg):
|
||||
print("[{}] Data arrived from topic: {}, Message:\n".format(msg[0], msg[1]), msg[2])
|
||||
|
||||
mqtt = network.mqtt("loboris", "loboris.eu", user="wifimcu", password="wifimculobo", cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb)
|
||||
|
||||
mqtts = network.mqtt("eclipse", "iot.eclipse.org", secure=True, cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb)
|
||||
|
||||
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
import machine
|
||||
from ssd1306 import SSD1306_SPI
|
||||
|
||||
WIDTH = const(128)
|
||||
HEIGHT = const (64)
|
||||
pdc = machine.Pin(27, machine.Pin.OUT)
|
||||
pcs = machine.Pin(26, machine.Pin.OUT)
|
||||
sck_pin = machine.Pin(19, machine.Pin.OUT)
|
||||
mosi_pin = machine.Pin(23, machine.Pin.IN)
|
||||
miso_pin = machine.Pin(25, machine.Pin.OUT)
|
||||
|
||||
prst = machine.Pin(18, machine.Pin.OUT)
|
||||
|
||||
spi = machine.SPI(1,baudrate=1000000, sck=sck_pin, mosi=mosi_pin, miso=miso_pin)
|
||||
|
||||
ssd = SSD1306_SPI(WIDTH, HEIGHT, spi, pdc, prst, pcs)
|
||||
|
||||
import freesans20
|
||||
|
||||
from writer import Writer
|
||||
wri2 = Writer(ssd, freesans20, verbose=True)
|
||||
|
||||
Writer.set_clip(True, True)
|
||||
Writer.set_textpos(0, 0)
|
||||
wri2.printstring('MicroPython\n')
|
||||
|
||||
ssd.show()
|
||||
@@ -1,283 +0,0 @@
|
||||
"""
|
||||
Demo program demonstrating the capabities of the MicroPython display module
|
||||
Author: LoBo (https://github/loboris)
|
||||
Date: 08/10/2017
|
||||
|
||||
"""
|
||||
|
||||
import machine, display, time, math
|
||||
|
||||
tft = display.TFT()
|
||||
|
||||
#ESP32-WROVER-KIT v3:
|
||||
#tft.init(tft.ST7789, rst_pin=18, backl_pin=5, miso=25,mosi=23,clk=19,cs=22,dc=21)
|
||||
|
||||
#Adafruit:
|
||||
#tft.init(tft.ILI9341, width=240, height=320, miso=19,mosi=18,clk=5,cs=15,dc=33, bgr=True)
|
||||
|
||||
#Set correct configuration
|
||||
tft.init(tft.ILI9341, width=240, height=320, miso=19,mosi=23,clk=18,cs=5,dc=26,tcs=27,hastouch=True, bgr=True)
|
||||
|
||||
maxx = 240
|
||||
maxy = 320
|
||||
miny = 12
|
||||
touch = False
|
||||
|
||||
# fonts used in this demo
|
||||
fontnames = (
|
||||
tft.FONT_Default,
|
||||
tft.FONT_7seg,
|
||||
tft.FONT_Ubuntu,
|
||||
tft.FONT_Comic,
|
||||
tft.FONT_Tooney,
|
||||
tft.FONT_Minya
|
||||
)
|
||||
|
||||
|
||||
# Check if the display is touched
|
||||
#-------------
|
||||
def touched():
|
||||
if not touch:
|
||||
return False
|
||||
else:
|
||||
tch,_,_ = tft.gettouch()
|
||||
if tch <= 0:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
# print display header
|
||||
#----------------------
|
||||
def header(tx, setclip):
|
||||
# adjust screen dimensions (depends on used display and orientation)
|
||||
global maxx, maxy, miny
|
||||
|
||||
maxx, maxy = tft.screensize()
|
||||
tft.clear()
|
||||
if maxx < 240:
|
||||
tft.font(tft.FONT_Small, rotate=0)
|
||||
else:
|
||||
tft.font(tft.FONT_Default, rotate=0)
|
||||
_,miny = tft.fontSize()
|
||||
miny += 5
|
||||
tft.rect(0, 0, maxx-1, miny-1, tft.OLIVE, tft.DARKGREY)
|
||||
tft.text(tft.CENTER, 2, tx, tft.CYAN, transparent=True)
|
||||
|
||||
if setclip:
|
||||
tft.setwin(0, miny, maxx, maxy)
|
||||
|
||||
# Display some fonts
|
||||
#-------------------
|
||||
def dispFont(sec=5):
|
||||
header("DISPLAY FONTS", False)
|
||||
|
||||
if maxx < 240:
|
||||
tx = "MicroPython"
|
||||
else:
|
||||
tx = "Hi from MicroPython"
|
||||
starty = miny + 4
|
||||
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
y = starty
|
||||
x = 0
|
||||
i = 0
|
||||
while y < maxy:
|
||||
if i == 0:
|
||||
x = 0
|
||||
elif i == 1:
|
||||
x = tft.CENTER
|
||||
elif i == 2:
|
||||
x = tft.RIGHT
|
||||
i = i + 1
|
||||
if i > 2:
|
||||
i = 0
|
||||
|
||||
for font in fontnames:
|
||||
if font == tft.FONT_7seg:
|
||||
tft.font(font)
|
||||
tft.text(x,y,"-12.45/",machine.random(0xFFFFFF))
|
||||
else:
|
||||
tft.font(font)
|
||||
tft.text(x,y,tx, machine.random(0xFFFFFF))
|
||||
_,fsz = tft.fontSize()
|
||||
y = y + 2 + fsz
|
||||
if y > (maxy-fsz):
|
||||
y = maxy
|
||||
if touched():
|
||||
break
|
||||
|
||||
# Display random fonts
|
||||
#------------------------------
|
||||
def fontDemo(sec=5, rot=False):
|
||||
tx = "FONTS"
|
||||
if rot:
|
||||
tx = "ROTATED " + tx
|
||||
header(tx, True)
|
||||
|
||||
tx = "ESP32-MicrpPython"
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
frot = 0
|
||||
if rot:
|
||||
frot = math.floor(machine.random(359)/5)*5
|
||||
for font in fontnames:
|
||||
if (not rot) or (font != tft.FONT_7seg):
|
||||
x = machine.random(maxx-8)
|
||||
if font != tft.FONT_7seg:
|
||||
tft.font(font, rotate=frot)
|
||||
_,fsz = tft.fontSize()
|
||||
y = machine.random(miny, maxy-fsz)
|
||||
tft.text(x,y,tx, machine.random(0xFFFFFF))
|
||||
else:
|
||||
l = machine.random(6,12)
|
||||
w = machine.random(1,l // 3)
|
||||
tft.font(font, rotate=frot, dist=l, width=w)
|
||||
_,fsz = tft.fontSize()
|
||||
y = machine.random(miny, maxy-fsz)
|
||||
tft.text(x,y,"-12.45/", machine.random(0xFFFFFF))
|
||||
if touched():
|
||||
break
|
||||
tft.resetwin()
|
||||
|
||||
# Display random lines
|
||||
#-------------------
|
||||
def lineDemo(sec=5):
|
||||
header("LINE DEMO", True)
|
||||
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
x1 = machine.random(maxx-4)
|
||||
y1 = machine.random(miny, maxy-4)
|
||||
x2 = machine.random(maxx-1)
|
||||
y2 = machine.random(miny, maxy-1)
|
||||
color = machine.random(0xFFFFFF)
|
||||
tft.line(x1,y1,x2,y2,color)
|
||||
if touched():
|
||||
break
|
||||
tft.resetwin()
|
||||
|
||||
# Display random circles
|
||||
#----------------------------------
|
||||
def circleDemo(sec=5,dofill=False):
|
||||
tx = "CIRCLE"
|
||||
if dofill:
|
||||
tx = "FILLED " + tx
|
||||
header(tx, True)
|
||||
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
color = machine.random(0xFFFFFF)
|
||||
fill = machine.random(0xFFFFFF)
|
||||
x = machine.random(4, maxx-2)
|
||||
y = machine.random(miny+2, maxy-2)
|
||||
if x < y:
|
||||
r = machine.random(2, x)
|
||||
else:
|
||||
r = machine.random(2, y)
|
||||
if dofill:
|
||||
tft.circle(x,y,r,color,fill)
|
||||
else:
|
||||
tft.circle(x,y,r,color)
|
||||
if touched():
|
||||
break
|
||||
tft.resetwin()
|
||||
|
||||
#------------------
|
||||
def circleSimple():
|
||||
tx = "CIRCLE"
|
||||
header(tx, True)
|
||||
|
||||
x = 110
|
||||
y = 160
|
||||
r = 110
|
||||
z = 0
|
||||
while z < 12:
|
||||
color = machine.random(0xFFFFFF)
|
||||
fill = machine.random(0xFFFFFF)
|
||||
tft.circle(x,y,r,color,fill)
|
||||
r -= 10
|
||||
x += 10
|
||||
z += 1
|
||||
|
||||
# Display random ellipses
|
||||
#-----------------------------------
|
||||
def ellipseDemo(sec=5,dofill=False):
|
||||
tx = "ELLIPSE"
|
||||
if dofill:
|
||||
tx = "FILLED " + tx
|
||||
header(tx, True)
|
||||
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
x = machine.random(4, maxx-2)
|
||||
y = machine.random(miny+2, maxy-2)
|
||||
if x < y:
|
||||
rx = machine.random(2, x)
|
||||
else:
|
||||
rx = machine.random(2, y)
|
||||
if x < y:
|
||||
ry = machine.random(2, x)
|
||||
else:
|
||||
ry = machine.random(2, y)
|
||||
color = machine.random(0xFFFFFF)
|
||||
if dofill:
|
||||
fill = machine.random(0xFFFFFF)
|
||||
tft.ellipse(x,y,rx,ry,15, color,fill)
|
||||
else:
|
||||
tft.ellipse(x,y,rx,ry,15,color)
|
||||
if touched():
|
||||
break
|
||||
tft.resetwin()
|
||||
|
||||
# Display random rectangles
|
||||
#---------------------------------
|
||||
def rectDemo(sec=5, dofill=False):
|
||||
tx = "RECTANGLE"
|
||||
if dofill:
|
||||
tx = "FILLED " + tx
|
||||
header(tx, True)
|
||||
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
x = machine.random(4, maxx-2)
|
||||
y = machine.random(miny, maxy-2)
|
||||
w = machine.random(2, maxx-x)
|
||||
h = machine.random(2, maxy-y)
|
||||
color = machine.random(0xFFFFFF)
|
||||
if dofill:
|
||||
fill = machine.random(0xFFFFFF)
|
||||
tft.rect(x,y,w,h,color,fill)
|
||||
else:
|
||||
tft.rect(x,y,w,h,color)
|
||||
if touched():
|
||||
break
|
||||
tft.resetwin()
|
||||
|
||||
# Display random rounded rectangles
|
||||
#--------------------------------------
|
||||
def roundrectDemo(sec=5, dofill=False):
|
||||
tx = "ROUND RECT"
|
||||
if dofill:
|
||||
tx = "FILLED " + tx
|
||||
header(tx, True)
|
||||
|
||||
n = time.time() + sec
|
||||
while time.time() < n:
|
||||
x = machine.random(2, maxx-18)
|
||||
y = machine.random(miny, maxy-18)
|
||||
w = machine.random(12, maxx-x)
|
||||
h = machine.random(12, maxy-y)
|
||||
if w > h:
|
||||
r = machine.random(2, h // 2)
|
||||
else:
|
||||
r = machine.random(2, w // 2)
|
||||
color = machine.random(0xFFFFFF)
|
||||
if dofill:
|
||||
fill = machine.random(0xFFFFFF)
|
||||
tft.roundrect(x,y,w,h,r,color,fill)
|
||||
else:
|
||||
tft.roundrect(x,y,w,h,r,color)
|
||||
if touched():
|
||||
break
|
||||
tft.resetwin()
|
||||
@@ -1,145 +0,0 @@
|
||||
import machine, _thread, time
|
||||
import micropython, gc
|
||||
import bme280
|
||||
|
||||
# Setup the LED pins
|
||||
bled = machine.Pin(4, mode=machine.Pin.OUT)
|
||||
#rled = machine.Pin(0, mode=machine.Pin.OUT)
|
||||
#gled = machine.Pin(2, mode=machine.Pin.OUT)
|
||||
|
||||
bled.value(0)
|
||||
#gled.value(0)
|
||||
#rled.value(0)
|
||||
|
||||
# Setup I2C to be used with BME280 sensor
|
||||
i2c=machine.I2C(scl=machine.Pin(26),sda=machine.Pin(25),speed=400000)
|
||||
# Initialize BME280
|
||||
bme=bme280.BME280(i2c=i2c)
|
||||
|
||||
# Define LED thread function
|
||||
#---------------------------
|
||||
def rgbled(n=200, led=bled):
|
||||
notif_exit = 4718
|
||||
notif_replay = 2
|
||||
notif_count = 3
|
||||
x = 0
|
||||
_thread.allowsuspend(True)
|
||||
while True:
|
||||
led.value(1)
|
||||
time.sleep_ms(n)
|
||||
led.value(0)
|
||||
x = x + 1
|
||||
|
||||
t = 10
|
||||
while t > 0:
|
||||
notif = _thread.getnotification()
|
||||
if notif == notif_exit:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] Exiting" % (_thread.getSelfName()))
|
||||
return
|
||||
elif notif == notif_replay:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] I've been notified" % (_thread.getSelfName()))
|
||||
elif notif == notif_count:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] Run counter = %u" % (_thread.getSelfName(), x))
|
||||
elif notif == 777:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] Forced EXCEPTION" % (_thread.getSelfName()))
|
||||
time.sleep_ms(1000)
|
||||
zz = 234 / 0
|
||||
elif notif != 0:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] Got unknown notification: %u" % (_thread.getSelfName(), notif))
|
||||
|
||||
typ, sender, msg = _thread.getmsg()
|
||||
if msg:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] Message from '%s'\n'%s'" % (_thread.getSelfName(), _thread.getThreadName(sender), msg))
|
||||
time.sleep_ms(100)
|
||||
t = t - 1
|
||||
gc.collect()
|
||||
|
||||
# For LED thread we don't need more than 3K stack
|
||||
_ = _thread.stack_size(3*1024)
|
||||
# Start LED thread
|
||||
#rth=_thread.start_new_thread("R_Led", rgbled, (100, rled))
|
||||
|
||||
time.sleep_ms(500)
|
||||
#gth=_thread.start_new_thread("G_Led", rgbled, (250, gled))
|
||||
bth=_thread.start_new_thread("B_Led", rgbled, (100, bled))
|
||||
|
||||
# Function to generate BME280 values string
|
||||
#---------------
|
||||
def bmevalues():
|
||||
t, p, h = bme.read_compensated_data()
|
||||
|
||||
p = p // 256
|
||||
pi = p // 100
|
||||
pd = p - pi * 100
|
||||
|
||||
hi = h // 1024
|
||||
hd = h * 100 // 1024 - hi * 100
|
||||
#return "[{}] T={0:1g}C ".format(time.strftime("%H:%M:%S",time.localtime()), round(t / 100,1)) + "P={}.{:02d}hPa ".format(pi, pd) + "H={}.{:01d}%".format(hi, hd)
|
||||
return "[{}] T={}C ".format(time.strftime("%H:%M:%S",time.localtime()), t / 100) + "P={}.{:02d}hPa ".format(pi, pd) + "H={}.{:02d}%".format(hi, hd)
|
||||
|
||||
# Define BME280 thread function
|
||||
#-----------------------
|
||||
def bmerun(interval=60):
|
||||
_thread.allowsuspend(True)
|
||||
sendmsg = True
|
||||
send_time = time.time() + interval
|
||||
while True:
|
||||
while time.time() < send_time:
|
||||
notif = _thread.getnotification()
|
||||
if notif == 10002:
|
||||
_thread.sendmsg(_thread.getReplID(), bmevalues())
|
||||
elif notif == 10004:
|
||||
sendmsg = False
|
||||
elif notif == 10006:
|
||||
sendmsg = True
|
||||
elif (notif <= 3600) and (notif >= 10):
|
||||
interval = notif
|
||||
send_time = time.time() + interval
|
||||
_thread.sendmsg(_thread.getReplID(), "Interval set to {} seconds".format(interval))
|
||||
|
||||
time.sleep_ms(100)
|
||||
send_time = send_time + interval
|
||||
if sendmsg:
|
||||
_thread.sendmsg(_thread.getReplID(), bmevalues())
|
||||
|
||||
# 3K is enough for BME280 thread
|
||||
_ = _thread.stack_size(3*1024)
|
||||
# start the BME280 thread
|
||||
bmeth=_thread.start_new_thread("BME280", bmerun, (60,))
|
||||
|
||||
# === In the 3rd thread we will run Neopixels rainbow demo ===
|
||||
|
||||
np=machine.Neopixel(machine.Pin(22), 24)
|
||||
|
||||
# DEfine Neopixels thread function
|
||||
#---------------
|
||||
def thrainbow():
|
||||
pos = 0
|
||||
bri = 0.02
|
||||
while True:
|
||||
for i in range(0, 24):
|
||||
dHue = 360.0/24*(pos+i);
|
||||
hue = dHue % 360;
|
||||
np.setHSB(i, hue, 1.0, bri, 1, False)
|
||||
np.show()
|
||||
notif = _thread.getnotification()
|
||||
if (notif > 0) and (notif <= 100):
|
||||
bri = notif / 100.0
|
||||
elif notif == 1000:
|
||||
_thread.sendmsg(_thread.getReplID(), "[%s] Run counter = %u" % (_thread.getSelfName(), pos))
|
||||
pos = pos + 1
|
||||
|
||||
# Start the Neopixels thread
|
||||
npth=_thread.start_new_thread("Neopixel", thrainbow, ())
|
||||
|
||||
|
||||
utime.sleep(1)
|
||||
|
||||
machine.heap_info()
|
||||
_thread.list()
|
||||
|
||||
# Set neopixel brightnes (%)
|
||||
#_thread.notify(npth, 20)
|
||||
# Get counter value from Neopixel thread
|
||||
#_thread.notify(npth, 1000)
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
|
||||
from microWebSrv import MicroWebSrv
|
||||
import _thread
|
||||
|
||||
def _httpHandlerTestGet(httpClient, httpResponse) :
|
||||
content = """\
|
||||
<!DOCTYPE html>
|
||||
<html lang=fr>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>TEST GET</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>TEST GET</h1>
|
||||
Client IP address = %s
|
||||
<br />
|
||||
<form action="/TEST" method="post" accept-charset="ISO-8859-1">
|
||||
First name: <input type="text" name="firstname"><br />
|
||||
Last name: <input type="text" name="lastname"><br />
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
""" % httpClient.GetIPAddr()
|
||||
httpResponse.WriteResponseOk( headers = None,
|
||||
contentType = "text/html",
|
||||
contentCharset = "UTF-8",
|
||||
content = content )
|
||||
|
||||
def _httpHandlerTestPost(httpClient, httpResponse) :
|
||||
formData = httpClient.ReadRequestPostedFormData()
|
||||
firstname = formData["firstname"]
|
||||
lastname = formData["lastname"]
|
||||
escape = httpClient.GetServer().HTMLEscape
|
||||
content = """\
|
||||
<!DOCTYPE html>
|
||||
<html lang=fr>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>TEST POST</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>TEST POST</h1>
|
||||
Firstname = %s<br />
|
||||
Lastname = %s<br />
|
||||
</body>
|
||||
</html>
|
||||
""" % (escape(firstname), escape(lastname))
|
||||
httpResponse.WriteResponseOk( headers = None,
|
||||
contentType = "text/html",
|
||||
contentCharset = "UTF-8",
|
||||
content = content )
|
||||
|
||||
routeHandlers = [
|
||||
( "/test", "GET", _httpHandlerTestGet ),
|
||||
( "/test", "POST", _httpHandlerTestPost )
|
||||
]
|
||||
|
||||
srv = MicroWebSrv(routeHandlers=routeHandlers)
|
||||
|
||||
srv.Start(threaded=True)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,119 +0,0 @@
|
||||
// OCR_A_Extended_M.c
|
||||
// Font type : Full (95 characters)
|
||||
// Font size : 16x24 pixels
|
||||
// Memory usage : 4564 bytes
|
||||
|
||||
#if defined(__AVR__)
|
||||
#include <avr/pgmspace.h>
|
||||
#define fontdatatype const uint8_t
|
||||
#elif defined(__PIC32MX__)
|
||||
#define PROGMEM
|
||||
#define fontdatatype const unsigned char
|
||||
#elif defined(__arm__)
|
||||
#define PROGMEM
|
||||
#define fontdatatype const unsigned char
|
||||
#endif
|
||||
|
||||
fontdatatype OCR_A_Extended_M[4564] PROGMEM={
|
||||
0x10,0x18,0x20,0x5F,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <space>
|
||||
0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // !
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x1E,0x78,0x1E,0x78,0x0E,0x70,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // "
|
||||
0x00,0x00,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x1F,0xF8,0x1F,0xF8,0x06,0x60,0x06,0x60,0x06,0x60,0x1F,0xF8,0x1F,0xF8,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // #
|
||||
0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0xF8,0x1F,0xF8,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x18,0x00,0x18,0x1F,0xF8,0x1F,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // $
|
||||
0x00,0x00,0x1C,0x00,0x1C,0x18,0x1C,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0xE0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x07,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x38,0x18,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // %
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x0F,0xC0,0x18,0x60,0x18,0x60,0x18,0x60,0x18,0x60,0x0C,0xC0,0x07,0x80,0x07,0x00,0x0F,0x80,0x1D,0xC8,0x18,0xF8,0x18,0x70,0x18,0xF0,0x0F,0xD8,0x0F,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // &
|
||||
0x00,0x00,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
|
||||
0x00,0x00,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x80,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x00,0xC0,0x00,0x60,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // (
|
||||
0x00,0x00,0x0C,0x00,0x06,0x00,0x03,0x00,0x01,0x80,0x01,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x01,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // )
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x19,0x88,0x19,0x98,0x0F,0xF0,0x07,0xE0,0x03,0xC0,0x03,0xC0,0x07,0xE0,0x0F,0xF0,0x1D,0xB8,0x11,0x98,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // *
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0xF8,0x1F,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // +
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x07,0xE0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // .
|
||||
0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // /
|
||||
|
||||
0x00,0x00,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0
|
||||
0x00,0x00,0x1F,0x80,0x1F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x98,0x01,0x98,0x01,0x98,0x01,0x98,0x01,0x98,0x01,0x98,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 1
|
||||
0x00,0x00,0x1F,0xF0,0x1F,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0F,0xF8,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 2
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xFC,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x07,0xF8,0x07,0xF8,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x1F,0xFC,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 3
|
||||
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x1F,0xF8,0x1F,0xF8,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 4
|
||||
0x00,0x00,0x07,0xF8,0x07,0xF8,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x07,0xF0,0x07,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x18,0x18,0x1F,0xF8,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 5
|
||||
0x00,0x00,0x1C,0x00,0x1C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 6
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 7
|
||||
0x00,0x00,0x07,0xE0,0x07,0xE0,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 8
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 9
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // :
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x07,0xE0,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ;
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x78,0x00,0xE0,0x01,0xC0,0x07,0x00,0x0E,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x01,0xC0,0x00,0xE0,0x00,0x78,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // =
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x1E,0x00,0x07,0x00,0x03,0x80,0x00,0xE0,0x00,0x70,0x00,0x38,0x00,0x70,0x00,0xE0,0x03,0x80,0x07,0x00,0x1E,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // >
|
||||
0x00,0x00,0x00,0x20,0x00,0x60,0x01,0xF0,0x03,0x98,0x07,0x18,0x0E,0x18,0x18,0x70,0x10,0xE0,0x01,0xC0,0x03,0x80,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ?
|
||||
|
||||
0x00,0x00,0x07,0xE0,0x0F,0xF0,0x18,0x18,0x18,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0F,0x98,0x0F,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // @
|
||||
0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x0C,0x30,0x0F,0xF0,0x0F,0xF0,0x0C,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // A
|
||||
0x00,0x00,0x1F,0xF0,0x1F,0xF8,0x18,0x1C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x1C,0x1F,0xF8,0x1F,0xF8,0x18,0x1C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x1C,0x1F,0xF8,0x1F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // B
|
||||
0x00,0x00,0x01,0xFC,0x03,0xFC,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1C,0x00,0x0C,0x00,0x0E,0x00,0x06,0x00,0x07,0x00,0x03,0xFC,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // C
|
||||
0x00,0x00,0x1F,0xC0,0x1F,0xE0,0x06,0x70,0x06,0x30,0x06,0x30,0x06,0x18,0x06,0x18,0x06,0x0C,0x06,0x0C,0x06,0x0C,0x06,0x0C,0x06,0x1C,0x06,0x18,0x06,0x38,0x06,0x30,0x06,0x70,0x1F,0xE0,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // D
|
||||
0x00,0x00,0x1F,0xFC,0x1F,0xFC,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xC0,0x1F,0xC0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xFC,0x1F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // E
|
||||
0x00,0x00,0x1F,0xFC,0x1F,0xFC,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF0,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // F
|
||||
0x00,0x00,0x01,0xF8,0x03,0xF8,0x03,0x00,0x06,0x00,0x0E,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // G
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // H
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // I
|
||||
0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x0C,0x18,0x07,0xF0,0x03,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // J
|
||||
0x00,0x00,0x18,0x0C,0x18,0x18,0x18,0x30,0x18,0x60,0x18,0xC0,0x19,0x80,0x1B,0x00,0x1E,0x00,0x1C,0x00,0x1E,0x00,0x1F,0x00,0x1B,0x80,0x19,0xC0,0x18,0xE0,0x18,0x70,0x18,0x30,0x18,0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // K
|
||||
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // L
|
||||
0x00,0x00,0x1C,0x38,0x1C,0x38,0x1E,0x78,0x1E,0xF8,0x1B,0xD8,0x19,0x98,0x19,0x98,0x19,0x98,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // M
|
||||
0x00,0x00,0x1C,0x18,0x1C,0x18,0x1E,0x18,0x1E,0x18,0x1E,0x18,0x1B,0x18,0x1B,0x18,0x1B,0x18,0x19,0x98,0x19,0x98,0x18,0xD8,0x18,0xD8,0x18,0xD8,0x18,0x78,0x18,0x78,0x18,0x78,0x18,0x38,0x18,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // N
|
||||
0x00,0x00,0x03,0xC0,0x03,0xC0,0x06,0x60,0x06,0x60,0x0E,0x70,0x0C,0x30,0x0C,0x30,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x30,0x0C,0x30,0x0E,0x70,0x06,0x60,0x06,0x60,0x03,0xC0,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // O
|
||||
|
||||
0x00,0x00,0x1F,0xF0,0x1F,0xF0,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF0,0x1F,0xF0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // P
|
||||
0x00,0x00,0x00,0x70,0x00,0xF8,0x01,0xD8,0x03,0x98,0x07,0x18,0x0C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x98,0x19,0x98,0x19,0xF0,0x18,0xE0,0x19,0xC0,0x1B,0xE0,0x1F,0x78,0x0E,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Q
|
||||
0x00,0x00,0x1F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF0,0x19,0x80,0x19,0x80,0x18,0xC0,0x18,0xC0,0x18,0x60,0x18,0x60,0x18,0x30,0x18,0x30,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // R
|
||||
0x00,0x00,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x18,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0xC0,0x00,0x60,0x00,0x60,0x00,0x30,0x18,0x18,0x18,0x18,0x1F,0xF8,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // S
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x19,0x98,0x19,0x98,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // T
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // U
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x30,0x0C,0x30,0x0E,0x70,0x06,0x60,0x06,0x60,0x07,0xE0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // V
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x19,0x98,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // W
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x0C,0x30,0x0C,0x30,0x06,0x60,0x06,0x60,0x03,0xC0,0x03,0xC0,0x01,0x80,0x01,0x80,0x03,0xC0,0x03,0xC0,0x06,0x60,0x06,0x60,0x0C,0x30,0x0C,0x30,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // X
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x30,0x0E,0x60,0x07,0xE0,0x03,0xC0,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Y
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Z
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // [
|
||||
0x00,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x07,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0xC0,0x00,0xC0,0x00,0x60,0x00,0x70,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <backslash>
|
||||
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x00,0xD8,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ]
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0xC0,0x03,0xC0,0x07,0xE0,0x07,0xE0,0x0E,0x70,0x0E,0x70,0x1C,0x30,0x1C,0x38,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, // _
|
||||
|
||||
0x00,0x00,0x06,0x00,0x07,0xC0,0x03,0xE0,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // `
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x07,0xF0,0x00,0x18,0x00,0x18,0x00,0x18,0x0F,0xF8,0x0F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1F,0xF8,0x0F,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // a
|
||||
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1B,0xE0,0x1F,0xF0,0x1E,0x38,0x1C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,0x18,0x1E,0x38,0x1F,0xF0,0x1B,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // b
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x07,0xFC,0x0E,0x00,0x1C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x1C,0x00,0x0E,0x00,0x07,0xFC,0x03,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // c
|
||||
0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x07,0xD8,0x0F,0xF8,0x1C,0x78,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1C,0x78,0x0F,0xF8,0x07,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // d
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x0F,0xF0,0x1C,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x18,0x00,0x18,0x00,0x1C,0x00,0x0F,0xF8,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // e
|
||||
0x00,0x00,0x00,0xFC,0x01,0xFC,0x03,0x80,0x03,0x00,0x03,0x00,0x0F,0xF0,0x0F,0xF0,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // f
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xD8,0x0F,0xF8,0x1C,0x78,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1C,0x78,0x0F,0xF8,0x07,0xD8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x38,0x0F,0xF0,0x0F,0xE0, // g
|
||||
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x19,0xF0,0x1B,0xF0,0x1F,0x18,0x1C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // h
|
||||
0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x0F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // i
|
||||
0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x03,0xF8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x0C,0x18,0x0C,0x18,0x07,0xF0,0x03,0xE0, // j
|
||||
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x30,0x18,0x60,0x18,0xC0,0x19,0x80,0x1B,0x80,0x1F,0x00,0x1E,0x00,0x1F,0x00,0x19,0x80,0x18,0xC0,0x18,0x60,0x18,0x30,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // k
|
||||
0x00,0x00,0x0F,0x80,0x0F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // l
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x78,0x3F,0xFC,0x39,0xCC,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // m
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0xF0,0x1B,0xF0,0x1F,0x18,0x1C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // n
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x0F,0xF0,0x1C,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,0x38,0x0F,0xF0,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // o
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0xC0,0x1F,0xE0,0x1E,0x70,0x1C,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,0x38,0x1E,0x70,0x1F,0xE0,0x1B,0xC0,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00, // p
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xD8,0x0F,0xF8,0x1C,0x78,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x1C,0x78,0x0F,0xF8,0x07,0xD8,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18, // q
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0xF0,0x1B,0xF8,0x1F,0x0C,0x1C,0x0C,0x18,0x0C,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // r
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x1F,0xF8,0x18,0x18,0x18,0x00,0x1E,0x00,0x07,0x80,0x01,0xF0,0x00,0x70,0x00,0x18,0x00,0x18,0x18,0x18,0x1F,0xF0,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // s
|
||||
0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x1F,0xF8,0x1F,0xF8,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x0C,0x06,0x1C,0x03,0xF8,0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // t
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x38,0x18,0xF8,0x0F,0xD8,0x07,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // u
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x38,0x38,0x18,0x30,0x18,0x30,0x0C,0x60,0x0C,0x60,0x06,0xC0,0x06,0xC0,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // v
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x31,0x8C,0x33,0xCC,0x1F,0xF8,0x1E,0x78,0x1C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // w
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x1C,0x38,0x0C,0x30,0x06,0x60,0x03,0xC0,0x03,0xC0,0x01,0x80,0x03,0xC0,0x06,0xE0,0x0E,0x70,0x0C,0x30,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // x
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x18,0x30,0x18,0x30,0x18,0x30,0x18,0x38,0x38,0x18,0x30,0x18,0x30,0x0C,0x60,0x0C,0x60,0x06,0xC0,0x07,0xC0,0x07,0x80,0x01,0x80,0x03,0x80,0x03,0x00,0x03,0x00,0x3E,0x00,0x3E,0x00, // y
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x38,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x1C,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // z
|
||||
0x00,0x00,0x00,0xF8,0x01,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x00,0x1F,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0xF8,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // {
|
||||
0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // |
|
||||
0x00,0x00,0x1F,0x00,0x1F,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0xF8,0x00,0xF8,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // }
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x8C,0x1F,0xFC,0x18,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~
|
||||
};
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
def receive(lora):
|
||||
print("LoRa Receiver")
|
||||
|
||||
while True:
|
||||
if lora.receivedPacket():
|
||||
lora.blink_led()
|
||||
payload = lora.read_payload()
|
||||
|
||||
try:
|
||||
print("*** Received message ***\n{}".format(payload.decode()))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("with RSSI: {}\n".format(lora.packetRssi()))
|
||||
@@ -1,14 +0,0 @@
|
||||
from time import sleep
|
||||
|
||||
|
||||
def send(lora):
|
||||
counter = 0
|
||||
print("LoRa Sender")
|
||||
|
||||
while True:
|
||||
payload = 'Hello ({0})'.format(counter)
|
||||
print("Sending packet: \n{}\n".format(payload))
|
||||
lora.println(payload)
|
||||
|
||||
counter += 1
|
||||
sleep(5)
|
||||
@@ -1,206 +0,0 @@
|
||||
# Authors: Paul Cunnane 2016, Peter Dahlebrg 2016
|
||||
#
|
||||
# This module borrows from the Adafruit BME280 Python library. Original
|
||||
# Copyright notices are reproduced below.
|
||||
#
|
||||
# Those libraries were written for the Raspberry Pi. This modification is
|
||||
# intended for the MicroPython and esp8266 boards.
|
||||
#
|
||||
# Copyright (c) 2014 Adafruit Industries
|
||||
# Author: Tony DiCola
|
||||
#
|
||||
# Based on the BMP280 driver with BME280 changes provided by
|
||||
# David J Taylor, Edinburgh (www.satsignal.eu)
|
||||
#
|
||||
# Based on Adafruit_I2C.py created by Kevin Townsend.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
import time
|
||||
from ustruct import unpack, unpack_from
|
||||
from array import array
|
||||
|
||||
# BME280 default address.
|
||||
BME280_I2CADDR = 0x76
|
||||
|
||||
# Operating Modes
|
||||
BME280_OSAMPLE_1 = 1
|
||||
BME280_OSAMPLE_2 = 2
|
||||
BME280_OSAMPLE_4 = 3
|
||||
BME280_OSAMPLE_8 = 4
|
||||
BME280_OSAMPLE_16 = 5
|
||||
|
||||
BME280_REGISTER_CONTROL_HUM = 0xF2
|
||||
BME280_REGISTER_CONTROL = 0xF4
|
||||
|
||||
|
||||
class BME280:
|
||||
|
||||
def __init__(self,
|
||||
mode=BME280_OSAMPLE_1,
|
||||
address=BME280_I2CADDR,
|
||||
i2c=None,
|
||||
**kwargs):
|
||||
# Check that mode is valid.
|
||||
if mode not in [BME280_OSAMPLE_1, BME280_OSAMPLE_2, BME280_OSAMPLE_4,
|
||||
BME280_OSAMPLE_8, BME280_OSAMPLE_16]:
|
||||
raise ValueError(
|
||||
'Unexpected mode value {0}. Set mode to one of '
|
||||
'BME280_ULTRALOWPOWER, BME280_STANDARD, BME280_HIGHRES, or '
|
||||
'BME280_ULTRAHIGHRES'.format(mode))
|
||||
self._mode = mode
|
||||
self.address = address
|
||||
if i2c is None:
|
||||
raise ValueError('An I2C object is required.')
|
||||
self.i2c = i2c
|
||||
|
||||
# load calibration data
|
||||
dig_88_a1 = self.i2c.readfrom_mem(self.address, 0x88, 26)
|
||||
dig_e1_e7 = self.i2c.readfrom_mem(self.address, 0xE1, 7)
|
||||
self.dig_T1, self.dig_T2, self.dig_T3, self.dig_P1, \
|
||||
self.dig_P2, self.dig_P3, self.dig_P4, self.dig_P5, \
|
||||
self.dig_P6, self.dig_P7, self.dig_P8, self.dig_P9, \
|
||||
_, self.dig_H1 = unpack("<HhhHhhhhhhhhBB", dig_88_a1)
|
||||
|
||||
self.dig_H2, self.dig_H3 = unpack("<hB", dig_e1_e7)
|
||||
e4_sign = unpack_from("<b", dig_e1_e7, 3)[0]
|
||||
self.dig_H4 = (e4_sign << 4) | (dig_e1_e7[4] & 0xF)
|
||||
|
||||
e6_sign = unpack_from("<b", dig_e1_e7, 5)[0]
|
||||
self.dig_H5 = (e6_sign << 4) | (dig_e1_e7[4] >> 4)
|
||||
|
||||
self.dig_H6 = unpack_from("<b", dig_e1_e7, 6)[0]
|
||||
|
||||
self.i2c.writeto_mem(self.address, BME280_REGISTER_CONTROL,
|
||||
bytearray([0x3F]))
|
||||
self.t_fine = 0
|
||||
|
||||
# temporary data holders which stay allocated
|
||||
self._l1_barray = bytearray(1)
|
||||
self._l8_barray = bytearray(8)
|
||||
self._l3_resultarray = array("i", [0, 0, 0])
|
||||
|
||||
def read_raw_data(self, result):
|
||||
""" Reads the raw (uncompensated) data from the sensor.
|
||||
|
||||
Args:
|
||||
result: array of length 3 or alike where the result will be
|
||||
stored, in temperature, pressure, humidity order
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
|
||||
self._l1_barray[0] = self._mode
|
||||
self.i2c.writeto_mem(self.address, BME280_REGISTER_CONTROL_HUM,
|
||||
self._l1_barray)
|
||||
self._l1_barray[0] = self._mode << 5 | self._mode << 2 | 1
|
||||
self.i2c.writeto_mem(self.address, BME280_REGISTER_CONTROL,
|
||||
self._l1_barray)
|
||||
|
||||
sleep_time = 1250 + 2300 * (1 << self._mode)
|
||||
sleep_time = sleep_time + 2300 * (1 << self._mode) + 575
|
||||
sleep_time = sleep_time + 2300 * (1 << self._mode) + 575
|
||||
time.sleep_us(sleep_time) # Wait the required time
|
||||
|
||||
# burst readout from 0xF7 to 0xFE, recommended by datasheet
|
||||
self.i2c.readfrom_mem_into(self.address, 0xF7, self._l8_barray)
|
||||
readout = self._l8_barray
|
||||
# pressure(0xF7): ((msb << 16) | (lsb << 8) | xlsb) >> 4
|
||||
raw_press = ((readout[0] << 16) | (readout[1] << 8) | readout[2]) >> 4
|
||||
# temperature(0xFA): ((msb << 16) | (lsb << 8) | xlsb) >> 4
|
||||
raw_temp = ((readout[3] << 16) | (readout[4] << 8) | readout[5]) >> 4
|
||||
# humidity(0xFD): (msb << 8) | lsb
|
||||
raw_hum = (readout[6] << 8) | readout[7]
|
||||
|
||||
result[0] = raw_temp
|
||||
result[1] = raw_press
|
||||
result[2] = raw_hum
|
||||
|
||||
def read_compensated_data(self, result=None):
|
||||
""" Reads the data from the sensor and returns the compensated data.
|
||||
|
||||
Args:
|
||||
result: array of length 3 or alike where the result will be
|
||||
stored, in temperature, pressure, humidity order. You may use
|
||||
this to read out the sensor without allocating heap memory
|
||||
|
||||
Returns:
|
||||
array with temperature, pressure, humidity. Will be the one from
|
||||
the result parameter if not None
|
||||
"""
|
||||
self.read_raw_data(self._l3_resultarray)
|
||||
raw_temp, raw_press, raw_hum = self._l3_resultarray
|
||||
# temperature
|
||||
var1 = ((raw_temp >> 3) - (self.dig_T1 << 1)) * (self.dig_T2 >> 11)
|
||||
var2 = (((((raw_temp >> 4) - self.dig_T1) *
|
||||
((raw_temp >> 4) - self.dig_T1)) >> 12) * self.dig_T3) >> 14
|
||||
self.t_fine = var1 + var2
|
||||
temp = (self.t_fine * 5 + 128) >> 8
|
||||
|
||||
# pressure
|
||||
var1 = self.t_fine - 128000
|
||||
var2 = var1 * var1 * self.dig_P6
|
||||
var2 = var2 + ((var1 * self.dig_P5) << 17)
|
||||
var2 = var2 + (self.dig_P4 << 35)
|
||||
var1 = (((var1 * var1 * self.dig_P3) >> 8) +
|
||||
((var1 * self.dig_P2) << 12))
|
||||
var1 = (((1 << 47) + var1) * self.dig_P1) >> 33
|
||||
if var1 == 0:
|
||||
pressure = 0
|
||||
else:
|
||||
p = 1048576 - raw_press
|
||||
p = (((p << 31) - var2) * 3125) // var1
|
||||
var1 = (self.dig_P9 * (p >> 13) * (p >> 13)) >> 25
|
||||
var2 = (self.dig_P8 * p) >> 19
|
||||
pressure = ((p + var1 + var2) >> 8) + (self.dig_P7 << 4)
|
||||
|
||||
# humidity
|
||||
h = self.t_fine - 76800
|
||||
h = (((((raw_hum << 14) - (self.dig_H4 << 20) -
|
||||
(self.dig_H5 * h)) + 16384)
|
||||
>> 15) * (((((((h * self.dig_H6) >> 10) *
|
||||
(((h * self.dig_H3) >> 11) + 32768)) >> 10) +
|
||||
2097152) * self.dig_H2 + 8192) >> 14))
|
||||
h = h - (((((h >> 15) * (h >> 15)) >> 7) * self.dig_H1) >> 4)
|
||||
h = 0 if h < 0 else h
|
||||
h = 419430400 if h > 419430400 else h
|
||||
humidity = h >> 12
|
||||
|
||||
if result:
|
||||
result[0] = temp
|
||||
result[1] = pressure
|
||||
result[2] = humidity
|
||||
return result
|
||||
|
||||
return array("i", (temp, pressure, humidity))
|
||||
|
||||
@property
|
||||
def values(self):
|
||||
""" human readable values """
|
||||
|
||||
t, p, h = self.read_compensated_data()
|
||||
|
||||
p = p // 256
|
||||
pi = p // 100
|
||||
pd = p - pi * 100
|
||||
|
||||
hi = h // 1024
|
||||
hd = h * 100 // 1024 - hi * 100
|
||||
return ("{}C".format(t / 100), "{}.{:02d}hPa".format(pi, pd),
|
||||
"{}.{:02d}%".format(hi, hd))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user