Browse Source

update

master
zhaohe 1 year ago
parent
commit
9eb8231c41
  1. 2
      .vscode
  2. 2
      Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c
  3. 2
      Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h
  4. 2
      a8000_protocol
  5. 22
      encode_convert.bat
  6. 2
      sdk
  7. 4
      usrc/main.cpp
  8. 10
      usrc/project_configs.h
  9. 10
      usrc/public_service/common_hardware_init.c
  10. 22
      usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp

2
.vscode

@ -1 +1 @@
Subproject commit ef748d9d2b722efecc06364d13cbc76a8dd23c92
Subproject commit 13b086073e8e162b38e929b9ef54f84c5425db0a

2
Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c

@ -26,7 +26,7 @@
*
*----------------------------------------------------------------------------
*
* Portions Copyright © 2016 STMicroelectronics International N.V. All rights reserved.
* Portions Copyright ?2016 STMicroelectronics International N.V. All rights reserved.
* Portions Copyright (c) 2013 ARM LIMITED
* All rights reserved.
* Redistribution and use in source and binary forms, with or without

2
Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h

@ -26,7 +26,7 @@
*
*----------------------------------------------------------------------------
*
* Portions Copyright © 2016 STMicroelectronics International N.V. All rights reserved.
* Portions Copyright ?2016 STMicroelectronics International N.V. All rights reserved.
* Portions Copyright (c) 2013 ARM LIMITED
* All rights reserved.
* Redistribution and use in source and binary forms, with or without

2
a8000_protocol

@ -1 +1 @@
Subproject commit f9b196b0c9c7b54739212c0c84bcfc60f84cc8bd
Subproject commit 232ed7c739e2ee86fe127f6364648a0d50378391

22
encode_convert.bat

@ -0,0 +1,22 @@
@echo off
title Encoding Converter
REM 指定的一种文件类型(只支持一类)
set fileType=*.h
REM 是否遍历子目录:需要遍历则设置为:-Recurse,否则置为空
REM set isRecurse=
set isRecurse=-Recurse
REM 转换前的文件编码(可以随便填一个,程序自动判断)
set fromEnc=GBK
REM 转换后的文件编码
set toEnc=UTF-8
REM 转换后的文件名前缀,默认与转换的文件在同一目录,可以为空(如果为空则直接覆盖原文件)
REM set prefix=
set prefix=
powershell.exe -command "$files = dir %fileType% %isRecurse%; $prefix = '%prefix%'; $from = '%fromEnc%'; $to = '%toEnc%'; $e = [System.Text.Encoding]; $sr = [System.IO.StreamReader]; $sw = [System.IO.StreamWriter]; $isSame=[string]::IsNullOrEmpty($prefix); function getEnc($encName){if('UTF-8' -eq $encName.ToUpper()){return [System.Text.UTF8Encoding]::new($false);}return [System.Text.Encoding]::GetEncoding($encName); }; function getFileEnc($data) {[object[]]$res = @([System.Text.Encoding]::Default,$false);if($data[0] -eq 0x2B -and $data[1] -eq 0x2F -and $data[2] -eq 0x76) { return @([System.Text.Encoding]::UTF7,$true);}elseif($data[0] -eq 0xEF -and $data[1] -eq 0xBB -and $data[2] -eq 0xBF) { return @([System.Text.Encoding]::UTF8,$true);}elseif($data[0] -eq 0xFF -and $data[1] -eq 0xFE) { return @([System.Text.Encoding]::Unicode,$true);}elseif($data[0] -eq 0xFE -and $data[1] -eq 0xFF) { return @([System.Text.Encoding]::BigEndianUnicode,$true);}elseif($data[0] -eq 0 -and $data[1] -eq 0 -and $data[2] -eq 0xFE -and $data[3] -eq 0xFF) { return @([System.Text.Encoding]::UTF32,$true);}else{ [int]$charByteCounter = 1; [byte]$curByte = 0; for ($i = 0; $i -lt $data.Length; $i++) {$curByte = $data[$i];if ($charByteCounter -eq 1){if ($curByte -ge 0x80){ while (( ($curByte = ($curByte -shl 1)) -band 0x80) -ne 0) {$charByteCounter++; } if ($charByteCounter -eq 1 -or $charByteCounter -gt 6) {return $res; }}}else{if (($curByte -band 0xC0) -ne 0x80){ return $res;}$charByteCounter--;} } if ($charByteCounter -gt 1) {return $res; } return @([System.Text.Encoding]::UTF8,$false);}}; if($files.Count -lt 1){Write-Host 'No Files...';exit; }; Write-Host ('Begin:'+(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')); foreach($file in $files){ $newFile = (Join-Path -Path $file.DirectoryName -ChildPath ($prefix+$file.BaseName+$file.Extension)); if($isSame){ $newFile = (Join-Path -Path $file.DirectoryName -ChildPath ('TEMP_'+$file.BaseName+$file.Extension));}; $fromEnc = (getEnc -encName $from); $toEnc = (getEnc -encName $to); $fileEnc = (getFileEnc -data ([System.IO.File]::ReadAllBytes($file.FullName))); if($fileEnc[0].BodyName -eq $toEnc.BodyName -and $fileEnc[1] -eq $false){ Write-Host ($file.FullName+',no need to convert.'); continue; } if($fromEnc -ne $fileEnc[0]){ Write-Host ($file.FullName+',encoding should be:' + $fileEnc[0].BodyName); $fromEnc = (getEnc -encName $fileEnc[0].BodyName); } $srIn = $sr::new($file.FullName,$fromEnc); $swOut = $sw::new($newFile,$false,$toEnc,4096); while(($line = $srIn.ReadLine()) -ne $null){$swOut.WriteLine($line);} $srIn.Close();$swOut.Flush();$swOut.Close(); if($isSame){Move-Item -Path $newFile -Destination $file -Force};}; Write-Host ('Files:'+$files.Count+',success...'); Write-Host ('End:'+(Get-Date -Format 'yyyy-MM-dd HH:mm:ss'));"
pause

2
sdk

@ -1 +1 @@
Subproject commit 1908f8afec32ebb6009e3d43b6306572c8cb9c7e
Subproject commit faf6a7ee02b3b4d2efa1231430a64ed982ac0f84

4
usrc/main.cpp

@ -18,7 +18,7 @@ void StartDefaultTask(void const* argument) { umain(); }
void umain() {
int32_t id = zdevice_id_mgr_get_device_id();
switch (id) {
case 30: // Ò¡ÔÈÄ£×é
case 30: // 摇匀模组
subboard30_shake_module_board_init();
break;
default:
@ -55,7 +55,7 @@ void umain() {
GService::inst()->initialize();
switch (id) {
case 30: // Ò¡ÔÈÄ£×é
case 30: // 摇匀模组
Subboard30ShakeModule::ins()->initialize();
break;

10
usrc/project_configs.h

@ -9,9 +9,9 @@
#define PC_DEBUG_UART_RX_BUF_SIZE 1024
#define PC_DEBUG_LIGHT_GPIO PE2
#define PC_SYS_DELAY_US_TIMER htim6 // US延时定时器
#define PC_SYS_ZTICKET_TIMER TIM11 // 系统ticket定时器
#define PC_SYS_TIM_IRQ_SCHEDULER_TIMER htim7 // 中断定时器中断调度器
#define PC_SYS_DELAY_US_TIMER htim6 // US寤舵椂瀹氭椂鍣�
#define PC_SYS_ZTICKET_TIMER TIM11 // 绯荤粺ticket瀹氭椂鍣�
#define PC_SYS_TIM_IRQ_SCHEDULER_TIMER htim7 // 涓�柇瀹氭椂鍣ㄤ腑鏂�皟搴﹀櫒
#define PC_IRQ_PREEMPTPRIORITY_DEFAULT 5
@ -38,5 +38,5 @@
* 10 0x080C0000 128k
* 11 0x080E0000 128k
*/
#define SN_FLASH_ADD 0x080E0000 // 使用扇区11存储SN编码
#define SN_FLASH_EARSE_SECTOR FLASH_SECTOR_11
#define SN_FLASH_ADD 0x080E0000 // 浣跨敤鎵囧尯11瀛樺偍SN缂栫爜
#define SN_FLASH_EARSE_SECTOR FLASH_SECTOR_11

10
usrc/public_service/common_hardware_init.c

@ -56,7 +56,7 @@ static void debug_uart_init() {
GPIO_InitTypeDef GPIO_InitStruct = {0};
/***********************************************************************************************************************
* IO³õʼ»¯ *
* IOåˆå§åŒ *
***********************************************************************************************************************/
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
@ -82,7 +82,7 @@ static void debug_uart_init() {
}
/***********************************************************************************************************************
* DMA³õʼ»¯ *
* DMAåˆå§åŒ *
***********************************************************************************************************************/
HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
@ -150,18 +150,18 @@ static void can1_init() {
void common_hardware_init() {
/***********************************************************************************************************************
* ϵͳ¨Ê±Æ÷³õʼ»¯ *
* 系统定æå¨åˆå§åŒ *
***********************************************************************************************************************/
{
MX_TIM6_Init();
MX_TIM7_Init();
}
/***********************************************************************************************************************
* µ÷ÊÔ´®¿Ú³õʼ»¯ *
* è°ƒè¯ä¸²å£åˆå§åŒ *
***********************************************************************************************************************/
debug_uart_init();
/***********************************************************************************************************************
* CAN³õʼ»¯ *
* CANåˆå§åŒ *
***********************************************************************************************************************/
can1_init();
}

22
usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp

@ -2,6 +2,8 @@
extern "C" {
#include "subboard30_shake_module_board.h"
}
#include "sdk\components\step_motor_ctrl_module\step_motor_ctrl_module.hpp"
#include "public_service/public_service.hpp"
#define TAG "ShakeModule"
@ -29,7 +31,7 @@ int32_t Subboard30ShakeModule::board_write_io(int32_t ioindex, int32_t val) { re
void Subboard30ShakeModule::initialize() {
#if 0
#if 1
/***********************************************************************************************************************
* ID1 *
@ -52,11 +54,11 @@ void Subboard30ShakeModule::initialize() {
input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
StepMotorCtrlModule::flash_config_t stepcfg = {0};
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.base_param.stepmotor_irun = 15;
stepcfg.stepmotor_irun = 15;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), nullptr, &stepcfg);
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
@ -82,11 +84,11 @@ void Subboard30ShakeModule::initialize() {
input[0].initAsInput(MOTOR2_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
input[1].initAsInput(MOTOR2_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
StepMotorCtrlModule::flash_config_t stepcfg = {0};
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.base_param.stepmotor_irun = 15;
stepcfg.stepmotor_irun = 15;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), nullptr, &stepcfg);
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}
@ -111,11 +113,11 @@ void Subboard30ShakeModule::initialize() {
input[0].initAsInput(MOTOR3_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
input[1].initAsInput(MOTOR3_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
StepMotorCtrlModule::flash_config_t stepcfg = {0};
StepMotorCtrlModule::config_t stepcfg = {0};
StepMotorCtrlModule::create_default_cfg(stepcfg);
stepcfg.base_param.stepmotor_irun = 15;
stepcfg.stepmotor_irun = 15;
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), nullptr, &stepcfg);
module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg);
GService::inst()->getZCanProtocolParser()->registerModule(&module);
ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion());
}

Loading…
Cancel
Save