VesiScan BASIC origin: Piezo + IMU firmware initial code
- nRF52840 + SoftDevice S140 BLE firmware - Piezo ultrasound TX driver (2MHz, 8ch MUX) - ICM42670P IMU 6-axis driver - Echo AFE chain (ADA2200 + ADC121S051) - BLE NUS command parser (mpa/mpc/mdc/mec/maa/msp) - FDS flash config storage - pc_firm parser and ADC driver included Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
59
pc_firm/pcmain.c
Normal file
59
pc_firm/pcmain.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* pcmain.c : PC에서 parser 테스트용 main
|
||||
* - 펌웨어에서는 이 파일 사용하지 않음
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "parser.h"
|
||||
|
||||
/* PC용 로그 함수 */
|
||||
static void pc_log(const char *fmt, ...)
|
||||
{
|
||||
if (!g_log_enable) {
|
||||
return;
|
||||
}
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* PC용 바이너리 전송 함수 */
|
||||
static void pc_tx_bin(const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
uint16_t i;
|
||||
printf("[TX] ");
|
||||
for (i = 0; i < len; i++) {
|
||||
printf("%02X ", buf[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* 플랫폼 함수 설정 */
|
||||
g_plat.log = pc_log;
|
||||
g_plat.tx_bin = pc_tx_bin;
|
||||
g_log_enable = true; /* 필요시 false로 전체 로그 끄기 */
|
||||
|
||||
/* 테스트 1: sta? (mode=1) */
|
||||
{
|
||||
uint8_t buf[6] = { 's','s','n','?' }; /* value0=1 */
|
||||
dr_cmd_parser(buf, 4);
|
||||
}
|
||||
|
||||
/* 테스트 2: ssz? (Serial 12바이트) */
|
||||
{
|
||||
const char *serial = "ABC123456789";
|
||||
uint8_t buf[4 + 12];
|
||||
uint8_t i;
|
||||
|
||||
buf[0] = 's'; buf[1] = 's'; buf[2] = 'z'; buf[3] = '?';
|
||||
for (i = 0; i < 12; i++) {
|
||||
buf[4 + i] = (uint8_t)serial[i];
|
||||
}
|
||||
dr_cmd_parser(buf, 4 + 12);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user