Skip to content

Commit

Permalink
add TLSR825x
Browse files Browse the repository at this point in the history
  • Loading branch information
pvvx committed Nov 22, 2021
1 parent 133381a commit ad8deb1
Show file tree
Hide file tree
Showing 88 changed files with 4,685 additions and 5 deletions.
4 changes: 2 additions & 2 deletions AdScanerTrg.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
log('Requesting any Bluetooth Device...');
return navigator.bluetooth.requestDevice({
// filters: [...] <- Prefer filters to save energy & show relevant devices.
filters: [{namePrefix: 'ADSC'}],
filters: [{namePrefix:'BLE'}, {namePrefix:'ADS'}],
optionalServices: [0xffe0,0x1f10]})
.then(device => {
bluetoothDevice = device;
Expand Down Expand Up @@ -566,7 +566,7 @@
};
</script>
<body>
<big><big>TLSR8266 AdScanerTrg</big></big> <a href="https://github.com/pvvx/AdScanerTrg">&#9432;</a><br>
<big><big>AdScanerTrg</big></big> <a href="https://github.com/pvvx/AdScanerTrg">&#9432;</a><br>
Web Experimental Features!<br>
#enable-experimental-web-platform-features (copy link:
<a href=chrome://flags/#enable-experimental-web-platform-features>Chrome</a>,
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
AdScanerTrg - relay control from external BLE sensors for temperature, humidity, lighting, motion, reed switch. A repeater of BLE advertising packages.

Used SoC [TLSR8266](https://github.com/pvvx/AdScanerTrg/TLSR8266) or [TLSR825x](https://github.com/pvvx/AdScanerTrg/TLSR825x) (module: JDY-10, E104-BT05, TB-03F, TB-04, ...)

### Controls three relay outputs:
1. Switching on at a given temperature and / or humidity with hysteresis.
2. Switch the lamp at a given level of illumination and / or motion detection.
3. Repeater of the state of the reed switch.

### Supported BLE sensors devices: LYWSD03MMC, CGG1-M, MHO-C401, LYWSD02, ...

In connection mode, it has the ability to work as a repeater - scanner BLE advertising from other devices.

TelinkOTA - https://pvvx.github.io/UBIA/TelinkOTA.html

Install the Advertising type: "custom" on the custom firmware
(https://github.com/pvvx/ATC_MiThermometer),
Reed Switch (GPIO PA6 - label on the "P8" pin for LYWSD03MMC).

Run [AdScanerTrg.html](https://pvvx.github.io/AdScanerTrg/AdScanerTrg.html)
and configure the MAC of the sensors devices


If sensor data is not received within 60 seconds, then GPIO_xx are set to "0".

* Implementation on E104-BT05-TB and ESP01Relay:

![Implementation on E104-BT05-TB and ESP01Relay](https://raw.githubusercontent.com/pvvx/pvvx.github.io/master/AdScanerTrg/img/AdScanerTrg-E104-BT05.gif)




688 changes: 688 additions & 0 deletions TLSR825x/.cproject

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions TLSR825x/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TLSR825xScaner</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?children?</key>
<value>?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|?name?=outputEntries\||</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>TEL_PATH=E:/Telink/825x/Telink_825X_SDK -j</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/Termometr/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.telink.tc32eclipse.core.TC32nature</nature>
</natures>
<linkedResources>
<link>
<name>sdk</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/Telink_825X_SDK</locationURI>
</link>
</linkedResources>
</projectDescription>
Binary file added TLSR825x/BLE-ScanerTrg.bin
Binary file not shown.
10 changes: 10 additions & 0 deletions TLSR825x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TLSR825x_AdScanerTrg

#### Building the firmware

1. Go to [wiki.telink-semi.cn](http://wiki.telink-semi.cn/wiki/IDE-and-Tools/IDE-for-TLSR8-Chips/) and get the IDE for TLSR8 Chips.
2. Clone https://github.com/Ai-Thinker-Open/Telink_825X_SDK
3. Install the IDE and import the project
4. Change 'Linked resource' and 'C/C++ Build/Build command'
5. Compile the project

126 changes: 126 additions & 0 deletions TLSR825x/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
TEL_CHIP := -DCHIP_TYPE=CHIP_TYPE_8258

LIBS := -llt_8258

TEL_PATH ?= ../..

PROJECT_NAME := BLE-ScanerTrg

PROJECT_PATH := ./source
OUT_PATH :=./out

ifneq ($(TEL_PATH)/make/makefile, $(wildcard $(TEL_PATH)/make/makefile))
$(error "Please check SDK_Path")
endif

OBJ_SRCS :=
S_SRCS :=
ASM_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
O_SRCS :=
FLASH_IMAGE :=
ELFS :=
OBJS :=
LST :=
SIZEDUMMY :=
OUT_DIR :=

GCC_FLAGS := \
-ffunction-sections \
-fdata-sections \
-Wall \
-O2 \
-fpack-struct \
-fshort-enums \
-finline-small-functions \
-std=gnu99 \
-funsigned-char \
-fshort-wchar \
-fms-extensions

INCLUDE_PATHS := -I$(TEL_PATH)/components -I$(PROJECT_PATH)

GCC_FLAGS += $(TEL_CHIP)

LS_FLAGS := $(PROJECT_PATH)/boot.link

#include SDK makefile
#-include $(TEL_PATH)/make/application.mk
#-include $(TEL_PATH)/make/common.mk
#-include $(TEL_PATH)/make/vendor_common.mk
#-include $(TEL_PATH)/make/tinyFlash.mk
-include $(TEL_PATH)/make/drivers_8258.mk
-include $(PROJECT_PATH)/div_mod.mk

ifeq ($(USE_FREE_RTOS), 1)
-include $(TEL_PATH)/make/freertos.mk
GCC_FLAGS += -DUSE_FREE_RTOS
endif

#include Project makefile
-include $(PROJECT_PATH)/project.mk
-include $(PROJECT_PATH)/boot.mk

# Add inputs and outputs from these tool invocations to the build variables
LST_FILE := $(OUT_PATH)/$(PROJECT_NAME).lst
BIN_FILE := $(OUT_PATH)/../$(PROJECT_NAME).bin
ELF_FILE := $(OUT_PATH)/$(PROJECT_NAME).elf

SIZEDUMMY := sizedummy

# All Target
all: clean pre-build main-build

flash: $(BIN_FILE)
@python3 $(PROJECT_PATH)/../TlsrPgm.py -pCOM8 -t50 -a2550 -m -w we 0 $(BIN_FILE)

reset:
@python3 $(PROJECT_PATH)/../TlsrPgm.py -pCOM3 -t50 -a2550 -m -w i

stop:
@python3 $(PROJECT_PATH)/../TlsrPgm.py -pCOM3 -t50 -a2550 i

go:
@python3 $(PROJECT_PATH)/../TlsrPgm.py -pCOM3 -w -m

# Main-build Target
main-build: $(ELF_FILE) secondary-outputs

# Tool invocations
$(ELF_FILE): $(OBJS) $(USER_OBJS)
@echo 'Building Standard target: $@'
@tc32-elf-ld --gc-sections -L $(TEL_PATH)/components/proj_lib -L $(OUT_PATH) -T $(LS_FLAGS) -o $(ELF_FILE) $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Building Reduced target: $@'
@tc32-elf-ld --gc-sections -Ttext `python3 $(PROJECT_PATH)/TlsrRetMemAddr.py -o $(ELF_FILE)` -L $(TEL_PATH)/components/proj_lib -L $(OUT_PATH) -T $(LS_FLAGS) -o $(ELF_FILE) $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

$(LST_FILE): $(ELF_FILE)
@echo 'Invoking: TC32 Create Extended Listing'
@tc32-elf-objdump -x -D -l -S $(ELF_FILE) > $(LST_FILE)
@echo 'Finished building: $@'
@echo ' '

$(BIN_FILE): $(ELF_FILE)
@echo 'Create Flash image (binary format)'
@tc32-elf-objcopy -v -O binary $(ELF_FILE) $(BIN_FILE)
@$(PROJECT_PATH)/../utils/tl_check_fw2.exe $(BIN_FILE)
@echo 'Finished building: $@'
@echo ' '

sizedummy: $(ELF_FILE)
@python3 $(PROJECT_PATH)/TlsrMemInfo.py $(ELF_FILE)

clean:
-$(RM) $(FLASH_IMAGE) $(ELFS) $(OBJS) $(LST) $(SIZEDUMMY) $(ELF_FILE) $(BIN_FILE) $(LST_FILE)
-@echo ' '

pre-build:
mkdir -p $(foreach s,$(OUT_DIR),$(OUT_PATH)$(s))
-@echo ' '

secondary-outputs: $(BIN_FILE) $(LST_FILE) $(SIZEDUMMY)

.PHONY: all clean
.SECONDARY: main-build
Loading

0 comments on commit ad8deb1

Please sign in to comment.