|
1、在上一帖中,导入开发范例程序后,就可以用DAVE开发并编写程序了。编译范例程序,
然后选择编译器J-LINK,创建一个新的编译
这样就可以写入程序了.
2.另外一个编译的方法是直接用XMC Flasher,这个是直接写入.启动程序,
选择XMC-4700-2048,然后连接开发板,按照手册的提示,需要两个USB口都连接好,一个是调试接口,另一个emulator也是需要廉洁的.
然后点击program,就可以写入程序了.
显示写入成功.
3 继续测试各项指标和功能.
在空中直立并面对障碍物移动开发板的,同时在显示屏上显示初开发板的各项读数.
可以看到移动的障碍物.
程序读写和编译成功.
4 对应于需要继续开发的项目,可以看到范例程序其实提供了一个基本的框架,可以方便的定制个性化的程序.
这个框架使用了Application和radar的一些API,可以直接调用读取的数据,避免了自由读写所带来的解析和数据分析工作,提高了开发效率.
在main.c中的主要代码如下,user code也可以在显示的位置添加.
- int main(void)
- {
- DAVE_STATUS_t status;
-
- /* Initialize DAVE APPs */
- status = DAVE_Init();
-
- if(status != DAVE_STATUS_SUCCESS)
- {
- /* Placeholder for error handler code.
- * The while loop below can be replaced with an user error handler. */
- XMC_DEBUG("DAVE APPs initialization failed\n");
- while(1U);
- }
-
- /* Register algorithm processing function:
- * Set the algorithm processing function pointer, it will
- * be used by the application for algorithm data processing */
- app_register_algo_process(NULL);
-
- /* Initialize the application */
- app_init();
-
- /* Infinite loop */
- while(1U)
- {
- /* Main application process */
- app_process();
- }
- }
- /*
- ==============================================================================
- 3. USER CALLBACK FUNCTIONS
- ==============================================================================
- */
- void acq_completed_cb(void)
- {
- /*
- * The following code shows an example of how to access raw data buffer.
- */
- /*
- acq_buf_obj *p_acq_buf = ds_get_active_acq_buf();
- uint8_t *raw_data = p_acq_buf->p_acq_buf;
- uint32_t raw_data_size = p_acq_buf->used_size_of_acq_buffer;
-
- -- Add your code here --
-
- */
- }
- void algo_completed_cb(void)
- {
- /*
- * The following sample code could be seen as a small example,
- * how to get the information from the algorithm and use it accordingly.
- */
-
- /*
- static float s_max_level = 0;
- static uint32_t countFrames = 0;
- static uint32_t s_max_num_targets = 0;
-
- extern Radar_Handle_t h_radar_device;
-
- Target_Info_t target_info[MAX_NUM_OF_TARGETS];
-
- uint8_t num_targets;
-
- if(radar_get_target_info(h_radar_device, target_info, &num_targets) == RADAR_ERR_OK)
- {
- float max_level = 0;
- for(int i= 0; i< num_targets; i++)
- {
- if(target_info[i].level > max_level)
- {
- s_max_level = target_info[i].level;
- }
- }
- countFrames += 1;
-
- if(num_targets > s_max_num_targets)
- {
- s_max_num_targets = num_targets;
- }
-
- }
- */
- }
复制代码
|
|