-
Notifications
You must be signed in to change notification settings - Fork 1
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
mattd
committed
Nov 26, 2024
0 parents
commit ab23611
Showing
2,125 changed files
with
389,276 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<h1 align = "center">🌟LilyGo T-Wristband🌟</h1> | ||
|
||
- LSM9DS1 is an alternative sensor for MPU9250. How to distinguish the version you purchased, please see the upper right part of the board below to distinguish | ||
|
||
- LSM9DS1 为MPU9250的替代传感器,如何分辨你购买的版本,请看下图板子的右上半部分,进行区分 | ||
|
||
![](image/3.jpg) | ||
|
||
|
||
|
||
<h2 align = "left">📷 Product:</h2> | ||
|
||
| Examples | Product Link | Schematic | Status | | ||
| :---------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------: | :----: | | ||
| [Click to view LSM9DS1 Version(点击查看)](./examples/T-Wristband-LSM9DS1/README.MD) | [Click to view product link](https://pt.aliexpress.com/item/4000527495064.html?spm=a2g0o.store_home.hotSpots_1000010030514.0) | [Click to view](./schematic/T_Wristband_lsm9ds1_20200306.pdf) | ✅ | | ||
| [Click to view MPU9250 Version(点击查看)](./examples/T-Wristband-MPU9250/README.MD) | Obsolete | [Click to view](./schematic/T_Wristband_mpu9250.pdf) | ❌ | | ||
| [Click to view MAX3010X (点击查看)](./examples/T-Wristband-MAX3010X/README.MD) | [Click to view product link](https://pt.aliexpress.com/item/4000527495064.html?spm=a2g0o.store_home.hotSpots_1000010030514.0) | [Click to view](./schematic/T_Wristband_MAX30102.pdf) | ✅ | | ||
|
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/env python3 | ||
|
||
import bluetooth | ||
import pdb | ||
|
||
|
||
pdb.set_trace() | ||
uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee" | ||
|
||
server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) | ||
server_sock.bind(("",bluetooth.PORT_ANY)) | ||
server_sock.listen(1) | ||
|
||
port = server_sock.getsockname()[1] | ||
|
||
bluetooth.advertise_service( server_sock, "SampleServer", service_id = uuid, | ||
service_classes=[uuid, bluetooth.SERIAL_PORT_CLASS], | ||
profiles=[bluetooth.SERIAL_PORT_PROFILE], | ||
) | ||
|
||
print("Waiting for connection on RFCOMM channel %d" % port) | ||
|
||
client_sock, client_info = server_sock.accept() | ||
print("Accepted connection from ", client_info) | ||
|
||
# Automatically accept pairing | ||
#client_sock.set_security(bluetooth.BT_SECURITY_LOW) | ||
|
||
while True: | ||
data = client_sock.recv(1024) | ||
if not data: break | ||
print("received [%s]" % data) |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# https://raspberrypi.stackexchange.com/questions/50496/automatically-accept-bluetooth-pairings#55589 | ||
|
||
sudo hciconfig hci0 reset | ||
sudo hciconfig hci0 up | ||
sudo hciconfig hci0 piscan | ||
sudo hciconfig hci0 sspmode 1 | ||
|
||
exit 0 | ||
|
||
cat << CMDS | | ||
power on | ||
discoverable on | ||
pairable on | ||
trust 24:29:34:93:39:AB | ||
pair 24:29:34:93:39:AB | ||
agent NoInputNoOutput | ||
default-agent | ||
quit | ||
CMDS | ||
|
||
while read line; do | ||
bluetoothctl ${line} | ||
done |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/env python3 | ||
import bluetooth | ||
|
||
server_sock=bluetooth.BluetoothSocket(bluetooth.RFCOMM) | ||
port = 1 | ||
server_sock.bind(("",port)) | ||
server_sock.listen(1) | ||
|
||
client_sock,address = server_sock.accept() | ||
print("Accepted connection from ",address) | ||
|
||
data = client_sock.recv(1024) | ||
print("received [%s]" % data) | ||
|
||
client_sock.close() | ||
server_sock.close() |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/env python3 | ||
|
||
import socket | ||
import pdb | ||
import pydbus | ||
|
||
pdb.set_trace() | ||
bus = pydbus.SystemBus() | ||
adapter = bus.get('org.bluez', '/org/bluez/hci0') | ||
|
||
adapter_addr = adapter.Address | ||
port = 3 # Normal port for rfcomm? | ||
buf_size = 1024 | ||
|
||
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) | ||
#s.bind((adapter_addr, port)) | ||
s.bind((socket.BDADDR_ANY, port)) | ||
s.listen(1) | ||
try: | ||
print('Listening for connection...') | ||
client, address = s.accept() | ||
print(f'Connected to {address}') | ||
|
||
while True: | ||
client.send('hi') | ||
data = client.recv(buf_size) | ||
if data: | ||
print(data) | ||
except Exception as e: | ||
print(f'Something went wrong: {e}') | ||
client.close() | ||
s.close() |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/env python3 | ||
|
||
import pdb | ||
import pexpect | ||
import subprocess | ||
import sys | ||
|
||
|
||
def main(): | ||
pdb.set_trace() | ||
|
||
shcommands = ['power on','agent off','default-agent','pairable on','discoverable on'] | ||
[ subprocess.run(f'bluetoothctl {x}'.split()) for x in shcommands ] | ||
bc = pexpect.spawn('/usr/bin/bluetoothctl') | ||
# bc.logfile = sys.stdout.buffer | ||
# bc.sendline('power on') | ||
# bc.expect('succeeded') | ||
# bc.sendline('agent off') | ||
# bc.expect('unregistered') | ||
# bc.sendline('default-agent') | ||
# bc.expect('registered') | ||
# bc.sendline('pairable on') | ||
# bc.expect('succeeded') | ||
# bc.sendline('discoverable on') | ||
# bc.expect('succeeded') | ||
bc.expect_exact('[New]') | ||
bc.expect_exact('Confirm passkey') | ||
bc.sendline('yes') | ||
bc.expect_exact('yes/no') | ||
bc.sendline('yes') | ||
|
||
main() |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/expect -f | ||
|
||
#hciconfig hci0 sspmode 1 | ||
|
||
set prompt "#" | ||
#timeout 10 | ||
|
||
spawn /usr/bin/bluetoothctl | ||
send -- "power on\n" | ||
expect succeeded | ||
sleep 1 | ||
send -- "agent off\n" | ||
expect unregistered | ||
sleep 1 | ||
send -- "default-agent\n" | ||
expect registered | ||
sleep 1 | ||
send -- "pairable on\n" | ||
expect succeeded | ||
sleep 1 | ||
send -- "discoverable on\n" | ||
expect succeeded | ||
sleep 4 | ||
expect "Confirm passkey" | ||
send -- "yes\r" | ||
sleep 1 | ||
expect yes/no | ||
send -- "yes\r" | ||
sleep 1 | ||
expect eof |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/env python3 | ||
|
||
import pdb | ||
import re | ||
|
||
msg='WIFI:S:yfinity;T:WPA;P:24HoursADay;H:false;;' | ||
pdb.set_trace() | ||
data = re.match('WIFI:S:(\w+);T:(\w+);P:(\w+);', msg) | ||
pass | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/env python3 | ||
|
||
import pdb | ||
import subprocess | ||
|
||
def main(): | ||
pdb.set_trace() | ||
sp = subprocess.Popen(['ls'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | ||
print(sp.stdout.read()) | ||
sp.stdin.write(b'pwd\n') | ||
print(sp.stdout.read()) | ||
sp.terminate() | ||
|
||
|
||
main() |
Oops, something went wrong.