File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 99
1010using namespace scope ;
1111
12- static ScopeMCU scopeMcu;
12+ static const size_t MaxSn = 4096 ;
13+ static uint8_t Buffer[Message::CalcBytes(MaxSn)];
14+ static ScopeMCU scopeMcu (MaxSn, Buffer);
1315
1416void init (void ) {
1517 usb_plugged ();
1618 std::set_new_handler ([] {
17- FATAL (" out of memory" );
19+ LOGW (" out of memory" );
20+ for (;;){
21+ led_toggle ();
22+ HAL_Delay (50 );
23+ }
1824 });
1925}
2026
@@ -25,7 +31,6 @@ void setup(void) {
2531
2632 scopeMcu.setVolLimits (0 , 3300 );
2733 scopeMcu.setFsLimits (1 , 70000 );
28- scopeMcu.setMaxSn (2048 );
2934 scopeMcu.setMcuImpl (
3035 {
3136 .sendData = [](uint8_t * data, size_t size) {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ MCU: STM32F103C8Tx
2525* Timer触发ADC+DMA 精确采样
2626* ADC数值已校准(使用内部基准电压)
2727* 采样率无级可调 最高采样率1Msps
28- * 采样深度可调 默认最大2048点
28+ * 采样深度可调 当前6144(1024 * 6)点
2929* 内置自测信号(1kHz方波)
3030* 多种触发方式(自动、正常、单次)
3131* FFT频谱分析(上位机实现)
@@ -70,12 +70,13 @@ PA10 | USART1 RX 调试串口
7070* 初始化scope
7171``` cpp
7272 // 在全局初始化
73- static ScopeMCU scopeMcu;
73+ static const size_t MaxSn = 1024 * 6 ; // 取决于RAM大小
74+ static uint8_t Buffer[Message::CalcBytes(MaxSn)];
75+ static ScopeMCU scopeMcu (MaxSn, Buffer);
7476 ...
7577
7678 scopeMcu.setVolLimits(0, 3300);
7779 scopeMcu.setFsLimits(1, 10000);
78- scopeMcu.setMaxSn(2048 );
7980 scopeMcu.setMcuImpl(
8081 {
8182 .sendData = [](uint8_t* data, size_t size) {
You can’t perform that action at this time.
0 commit comments