diff --git a/Makefile b/Makefile index 2ea93c5ca..53ea7dce3 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,8 @@ sdk/OpenLN882H/project/OpenBeken/app: @mkdir -p "sdk/OpenLN882H/project/OpenBeken" ln -s "$(shell pwd)/" "sdk/OpenLN882H/project/OpenBeken/app" -.PHONY: prebuild_OpenBK7231N prebuild_OpenBK7231T prebuild_OpenBL602 prebuild_OpenLN882H prebuild_OpenW600 prebuild_OpenW800 prebuild_OpenXR809 prebuild_ESPIDF +.PHONY: prebuild_OpenBK7231N prebuild_OpenBK7231T prebuild_OpenBL602 prebuild_OpenLN882H +.PHONY: prebuild_OpenW600 prebuild_OpenW800 prebuild_OpenXR809 prebuild_ESPIDF prebuild_OpenTR6260 prebuild_OpenBK7231N: @if [ -e platforms/BK7231N/pre_build.sh ]; then \ @@ -132,6 +133,13 @@ prebuild_ESPIDF: else echo "prebuild for ESP-IDF not found ... "; \ fi +prebuild_OpenTR6260: + @if [ -e platforms/TR6260/pre_build.sh ]; then \ + echo "prebuild found for TR6260"; \ + sh platforms/TR6260/pre_build.sh; \ + else echo "prebuild for TR6260 not found ... "; \ + fi + # Build main binaries OpenBK7231T: prebuild_OpenBK7231T $(MAKE) APP_NAME=OpenBK7231T TARGET_PLATFORM=bk7231t SDK_PATH=sdk/OpenBK7231T APPS_BUILD_PATH=../bk7231t_os build-BK7231 @@ -260,7 +268,7 @@ OpenESP32S3: prebuild_ESPIDF cp ./platforms/ESP-IDF/build-s3/OpenBeken.bin output/$(APP_VERSION)/OpenESP32S3_$(APP_VERSION).img .PHONY: OpenTR6260 -OpenTR6260: +OpenTR6260: prebuild_OpenTR6260 if [ ! -e sdk/OpenTR6260/toolchain/nds32le-elf-mculib-v3 ]; then cd sdk/OpenTR6260/toolchain && xz -d < nds32le-elf-mculib-v3.txz | tar xvf - > /dev/null; fi cd sdk/OpenTR6260/scripts && APP_VERSION=$(APP_VERSION) bash build_tr6260s1.sh mkdir -p output/$(APP_VERSION) diff --git a/sdk/OpenTR6260 b/sdk/OpenTR6260 index 345a10e88..a29f94b99 160000 --- a/sdk/OpenTR6260 +++ b/sdk/OpenTR6260 @@ -1 +1 @@ -Subproject commit 345a10e88f71e7543afc65fb4e32a245c67aa94d +Subproject commit a29f94b999e9237fa3aa4b90069fe75dffb2bc56 diff --git a/sdk/beken_freertos_sdk b/sdk/beken_freertos_sdk new file mode 160000 index 000000000..426bb965b --- /dev/null +++ b/sdk/beken_freertos_sdk @@ -0,0 +1 @@ +Subproject commit 426bb965b38f95ef03cb20f1b8c9e7f0a8ec4fe4 diff --git a/src/hal/tr6260/hal_pins_tr6260.c b/src/hal/tr6260/hal_pins_tr6260.c index d6e670d5a..388211ef4 100644 --- a/src/hal/tr6260/hal_pins_tr6260.c +++ b/src/hal/tr6260/hal_pins_tr6260.c @@ -6,6 +6,7 @@ #include "../../new_pins.h" #include "drv_gpio.h" #include "drv_pwm.h" +#include "soc_pin_mux.h" extern int g_pwmFrequency; @@ -66,6 +67,94 @@ int PIN_GetPWMIndexForPinIndex(int pin) } } +void HAL_PIN_Set_As_GPIO(DRV_GPIO_PIN_NAME pin) +{ + switch(pin) + { + case DRV_GPIO_0: + PIN_FUNC_SET(IO_MUX0_GPIO0, FUNC_GPIO0_GPIO0); + break; + case DRV_GPIO_1: + PIN_FUNC_SET(IO_MUX0_GPIO1, FUNC_GPIO1_GPIO1); + break; + case DRV_GPIO_2: + PIN_FUNC_SET(IO_MUX0_GPIO2, FUNC_GPIO2_GPIO2); + break; + case DRV_GPIO_3: + PIN_FUNC_SET(IO_MUX0_GPIO3, FUNC_GPIO3_GPIO3); + break; + case DRV_GPIO_4: + PIN_FUNC_SET(IO_MUX0_GPIO4, FUNC_GPIO4_GPIO4); + break; + case DRV_GPIO_5: + PIN_FUNC_SET(IO_MUX0_GPIO5, FUNC_GPIO5_GPIO5); + break; + case DRV_GPIO_6: + PIN_FUNC_SET(IO_MUX0_GPIO6, FUNC_GPIO6_GPIO6); + break; + case DRV_GPIO_7: +#ifndef _USR_TR6260S1 + PIN_FUNC_SET(IO_MUX0_GPIO7, FUNC_GPIO7_GPIO7); + break; + case DRV_GPIO_8: + PIN_FUNC_SET(IO_MUX0_GPIO8, FUNC_GPIO8_GPIO8); + break; + case DRV_GPIO_9: + PIN_FUNC_SET(IO_MUX0_GPIO9, FUNC_GPIO9_GPIO9); + break; + case DRV_GPIO_10: + PIN_FUNC_SET(IO_MUX0_GPIO10, FUNC_GPIO10_GPIO10); + break; + case DRV_GPIO_11: + PIN_FUNC_SET(IO_MUX0_GPIO11, FUNC_GPIO11_GPIO11); + break; + case DRV_GPIO_12: + PIN_FUNC_SET(IO_MUX0_GPIO12, FUNC_GPIO12_GPIO12); +#endif + break; + case DRV_GPIO_13: /*don't use in gpio mode*/ + //PIN_FUNC_SET(IO_MUX0_GPIO13, FUNC_GPIO13_GPIO13); + break; + case DRV_GPIO_14: + PIN_FUNC_SET(IO_MUX0_GPIO14, FUNC_GPIO14_GPIO14); + break; + case DRV_GPIO_15: + PIN_FUNC_SET(IO_MUX0_GPIO15, FUNC_GPIO15_GPIO15); + break; + case DRV_GPIO_16: /*don't use in gpio mode*/ + break; + case DRV_GPIO_17: /*don't use in gpio mode*/ + break; +#ifndef _USR_TR6260S1 + case DRV_GPIO_18: + PIN_FUNC_SET(IO_MUX0_GPIO18, FUNC_GPIO18_GPIO18); + break; + case DRV_GPIO_19: + PIN_FUNC_SET(IO_MUX0_GPIO19, FUNC_GPIO19_GPIO19); +#endif + break; + case DRV_GPIO_20: + PIN_FUNC_SET(IO_MUX0_GPIO20, FUNC_GPIO20_GPIO20); + break; + case DRV_GPIO_21: + PIN_FUNC_SET(IO_MUX0_GPIO21, FUNC_GPIO21_GPIO21); + break; + case DRV_GPIO_22: + PIN_FUNC_SET(IO_MUX0_GPIO22, FUNC_GPIO22_GPIO22); + break; + case DRV_GPIO_23: +#ifndef _USR_TR6260S1 + PIN_FUNC_SET(IO_MUX0_GPIO23, FUNC_GPIO23_GPIO23); + break; + case DRV_GPIO_24: + PIN_FUNC_SET(IO_MUX0_GPIO24, FUNC_GPIO24_GPIO24); +#endif + break; + default: + break; + } +} + const char* HAL_PIN_GetPinNameAlias(int index) { if(index >= g_numPins) @@ -104,6 +193,7 @@ void HAL_PIN_Setup_Input_Pullup(int index) if(index >= g_numPins) return; trPinMapping_t* pin = g_pins + index; + HAL_PIN_Set_As_GPIO(pin->pin); DRV_GPIO_CONFIG gpioCfg; gpioCfg.GPIO_Pin = pin->pin; gpioCfg.GPIO_PullEn = DRV_GPIO_PULL_EN; @@ -118,6 +208,7 @@ void HAL_PIN_Setup_Input_Pulldown(int index) if(index >= g_numPins) return; trPinMapping_t* pin = g_pins + index; + HAL_PIN_Set_As_GPIO(pin->pin); DRV_GPIO_CONFIG gpioCfg; gpioCfg.GPIO_Pin = pin->pin; gpioCfg.GPIO_PullEn = DRV_GPIO_PULL_EN; @@ -132,6 +223,7 @@ void HAL_PIN_Setup_Input(int index) if(index >= g_numPins) return; trPinMapping_t* pin = g_pins + index; + HAL_PIN_Set_As_GPIO(pin->pin); DRV_GPIO_CONFIG gpioCfg; gpioCfg.GPIO_Pin = pin->pin; gpioCfg.GPIO_PullEn = DRV_GPIO_PULL_DIS; @@ -145,7 +237,14 @@ void HAL_PIN_Setup_Output(int index) if(index >= g_numPins) return; trPinMapping_t* pin = g_pins + index; - gpio_set_dir(pin->pin, DRV_GPIO_DIR_OUTPUT); + HAL_PIN_Set_As_GPIO(pin->pin); + DRV_GPIO_CONFIG gpioCfg; + gpioCfg.GPIO_Pin = pin->pin; + gpioCfg.GPIO_PullEn = DRV_GPIO_PULL_EN; + gpioCfg.GPIO_Dir = DRV_GPIO_DIR_OUTPUT; + gpioCfg.GPIO_PullType = DRV_GPIO_PULL_TYPE_UP; + gpio_config(&gpioCfg); + //gpio_set_dir(pin->pin, DRV_GPIO_DIR_OUTPUT); } void HAL_PIN_PWM_Stop(int index) diff --git a/src/obk_config.h b/src/obk_config.h index fff44d7c3..b26445123 100644 --- a/src/obk_config.h +++ b/src/obk_config.h @@ -201,6 +201,7 @@ #define ENABLE_LITTLEFS 1 #define NEW_TCP_SERVER 1 #define ENABLE_EXPAND_CONSTANT 1 +#define ENABLE_I2C 1 #define ENABLE_DRIVER_AHT2X 1 #define ENABLE_DRIVER_BMPI2C 1 #define ENABLE_DRIVER_DS1820 1