prepare to remove tuya lib from BK7231N version (it was required for BK7231N version beause for N version the functions like tuya hal flash read or tuya hal wifi ap scan was in .lib instead of source c files of SDK)

This commit is contained in:
openshwprojects
2022-02-20 01:15:22 +01:00
parent 0fb2c3f778
commit 5af030eefe
4 changed files with 30 additions and 4 deletions

View File

@ -266,6 +266,24 @@ INFO_ITEM_ST *config_search_item_type(UINT32 type){
return _search_item(&item, NULL);
}
int bekken_hal_flash_read(const uint32_t addr, void *dst, const UINT32 size)
{
UINT32 status;
if(NULL == dst) {
return 1;
}
hal_flash_lock();
DD_HANDLE flash_handle;
flash_handle = ddev_open(FLASH_DEV_NAME, &status, 0);
ddev_read(flash_handle, dst, size, addr);
ddev_close(flash_handle);
hal_flash_unlock();
return 0;
}
int config_delete_item(UINT32 type)
{
UINT32 addr, end_addr;

View File

@ -38,6 +38,8 @@ int config_dump_table();
// debug
int config_get_tableOffsets(int tableID, int *outStart, int *outLen);
// copy of tuya_hal_flash_read (in BK7231T it was in SDK source, but in BK7231N it was in tuya lib)
int bekken_hal_flash_read(const uint32_t addr, void *dst, const UINT32 size);
/////////////////////////////////////////

View File

@ -800,7 +800,7 @@ int HTTP_ProcessPacket(http_request_t *request) {
#elif PLATFORM_XR809
poststr(request,"TODO XR809<br>");
#else
#elif PLATFORM_BK7231T
AP_IF_S *ar;
uint32_t num;
@ -812,6 +812,12 @@ int HTTP_ProcessPacket(http_request_t *request) {
poststr(request,tmpA);
}
tuya_hal_wifi_release_ap(ar);
#elif PLATFORM_BK7231N
poststr(request,"TODO: BK7231N support for scan<br>");
#else
#error "Unknown platform"
poststr(request,Unknown platform<br>");
#endif
}
poststr(request,"<form action=\"/cfg_wifi\">\
@ -905,7 +911,7 @@ int HTTP_ProcessPacket(http_request_t *request) {
poststr(request,tmpA);
poststr(request,"<br>");
///res = tuya_hal_flash_read (ofs, buffer,len);
///res = bekken_hal_flash_read (ofs, buffer,len);
//sprintf(tmpA,"Result %i",res);
// strcat(outbuf,tmpA);
/// strcat(outbuf,"<br>");
@ -923,7 +929,7 @@ int HTTP_ProcessPacket(http_request_t *request) {
#define FLASH_INDEX_XR809 0
res = flash_read(FLASH_INDEX_XR809, nowOfs, buffer, now);
#else
res = tuya_hal_flash_read (nowOfs, buffer,now);
res = bekken_hal_flash_read (nowOfs, buffer,now);
#endif
for(i = 0; i < now; i++) {
u8 val = buffer[i];

View File

@ -4,7 +4,7 @@
#if WINDOWS
int tuya_hal_flash_read(const uint32_t addr, uint8_t *dst, const uint32_t size) {
int bekken_hal_flash_read(const uint32_t addr, uint8_t *dst, const uint32_t size) {
int i;
memset(dst,0,size);
for(i = 0; i < size; i++){