Browse Source

update

3lead_uart_test_ok_version
zhaohe 1 year ago
parent
commit
3b090949c6
  1. 3
      .vscode/settings.json
  2. 56
      app/app.uvoptx
  3. 2
      app/app.uvprojx
  4. 4
      app/config/sdk_config.h
  5. 7
      app/main.c
  6. 2
      app/src/one_conduction/one_conduction_main.c
  7. 110
      app/src/three_lead/three_lead_board.c
  8. 2
      libznordic
  9. 2
      sdk

3
.vscode/settings.json

@ -59,6 +59,7 @@
"driver_ssd1306_interface.h": "c",
"three_lead_board.h": "c",
"znordic.h": "c",
"ads1293.h": "c"
"ads1293.h": "c",
"app_scheduler.h": "c"
}
}

56
app/app.uvoptx

@ -152,34 +152,66 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>8</LineNumber>
<LineNumber>245</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>182640</Address>
<Address>162232</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>main.c</Filename>
<Filename>.\src\three_lead\three_lead_board.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\nrf52833_xxaa\main.c\8</Expression>
<Expression>\\nrf52833_xxaa\src/three_lead/three_lead_board.c\245</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>18</LineNumber>
<LineNumber>116</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>171540</Address>
<Address>168702</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>main.c</Filename>
<Filename>..\sdk\external\fatfs\port\diskio_blkdev.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\nrf52833_xxaa\main.c\18</Expression>
<Expression>\\nrf52833_xxaa\../sdk/external/fatfs/port/diskio_blkdev.c\116</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>129</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>168740</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\sdk\external\fatfs\port\diskio_blkdev.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\nrf52833_xxaa\../sdk/external/fatfs/port/diskio_blkdev.c\129</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>120</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>168706</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\sdk\external\fatfs\port\diskio_blkdev.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\nrf52833_xxaa\../sdk/external/fatfs/port/diskio_blkdev.c\120</Expression>
</Bp>
</Breakpoint>
<Tracepoint>
@ -744,7 +776,7 @@
<Group>
<GroupName>nRF_Drivers</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -1468,7 +1500,7 @@
<Group>
<GroupName>libznordic</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -1488,7 +1520,7 @@
<Group>
<GroupName>FATFS</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -1528,7 +1560,7 @@
<Group>
<GroupName>::Device</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>

2
app/app.uvprojx
File diff suppressed because it is too large
View File

4
app/config/sdk_config.h

@ -6313,7 +6313,7 @@
#ifndef APP_TIMER_CONFIG_USE_SCHEDULER
#define APP_TIMER_CONFIG_USE_SCHEDULER 0
#define APP_TIMER_CONFIG_USE_SCHEDULER 1
#endif
// <q> APP_TIMER_KEEPS_RTC_ACTIVE - Enable RTC always on
@ -11963,7 +11963,7 @@
// <2=> NRF_SDH_DISPATCH_MODEL_POLLING
#ifndef NRF_SDH_DISPATCH_MODEL
#define NRF_SDH_DISPATCH_MODEL 0
#define NRF_SDH_DISPATCH_MODEL 1
#endif
// </h>

7
app/main.c

@ -2,11 +2,14 @@
#include "basic/zdatachannel_service.h"
#include "znordic.h"
//
#include "three_lead\three_lead_board.h"
static void test_tx_timer_cb(void* p_context) {
ZLOGI("test_tx_timer_cb");
ThreeLeadECG_sdcard_mount();
uint32_t data;
data = 1;
}
extern uint32_t g_nrf_log_tx_pin;
@ -14,9 +17,11 @@ APP_TIMER_DEF(m_test_tx_timer);
void main() {
g_nrf_log_tx_pin = 2;
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
znordic_init();
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_SINGLE_SHOT, test_tx_timer_cb));
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
znordic_loop();
}

2
app/src/one_conduction/one_conduction_main.c

@ -40,7 +40,7 @@ void on_service_init(void) {
}
void one_conduction_main() {
znordic_init();
znordic_init(0, 20);
NRF_LOG_INFO("compile time :%s", __TIME__);
NRF_LOG_INFO("Version :%d", VERSION);
NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME);

110
app/src/three_lead/three_lead_board.c

@ -115,8 +115,7 @@ int16_t ThreeLeadECG_battery_get_adc_val() {
* sd card
* switch
*/
#define SDCARD_SPI_CS_PIN 20
#define SDCARD_SPI_CS_PIN 28
#define SDCARD_SPI_MISO_PIN 31
#define SDCARD_SPI_MOSI_PIN 30
#define SDCARD_SPI_SCK_PIN 29
@ -196,14 +195,40 @@ NRF_BLOCK_DEV_SDC_DEFINE(m_block_dev_sdc,
static FATFS fs;
void sdcard_test_write_text() {
#define FILE_NAME "IFLYTOP_W_TEST.TXT"
static FIL file;
uint32_t bytes_written;
#define FILE_NAME "/5.TXT"
static FIL file;
uint32_t bytes_written;
static DIR dir;
static FILINFO fno;
NRF_LOG_INFO("\r\n Listing directory: /");
FRESULT ff_result = f_opendir(&dir, "/");
if (ff_result) {
NRF_LOG_INFO("Directory listing failed!");
return;
}
do {
ff_result = f_readdir(&dir, &fno);
if (ff_result != FR_OK) {
NRF_LOG_INFO("Directory read failed.");
return;
}
if (fno.fname[0]) {
if (fno.fattrib & AM_DIR) {
NRF_LOG_RAW_INFO(" <DIR> %s", (uint32_t)fno.fname);
} else {
NRF_LOG_RAW_INFO("%9lu %s", fno.fsize, (uint32_t)fno.fname);
}
}
} while (fno.fname[0]);
NRF_LOG_RAW_INFO("");
NRF_LOG_INFO("Writing to file " FILE_NAME "...");
FRESULT ff_result = f_open(&file, FILE_NAME, FA_READ | FA_WRITE | FA_OPEN_APPEND);
ff_result = f_open(&file, FILE_NAME, FA_CREATE_ALWAYS | FA_READ | FA_WRITE | FA_CREATE_NEW);
if (ff_result != FR_OK) {
NRF_LOG_INFO("Unable to open or create file: " FILE_NAME ".");
NRF_LOG_INFO("Unable to open or create file: " FILE_NAME ". %d", ff_result);
return;
}
@ -216,6 +241,29 @@ void sdcard_test_write_text() {
(void)f_close(&file);
}
bool mountsuc = false;
/**
* @brief get_fattime
* @return DWORD
*/
static DWORD get_fattime_0(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec) {
// return ((DWORD)(year - 1980) << 25 | (DWORD)month << 21 | (DWORD)day << 16);
DWORD fattime = 0;
fattime |= ((DWORD)(year - 1980) << 25); // 1980
fattime |= ((DWORD)(month + 1) << 21); // 1-12
fattime |= ((DWORD)day << 16); //
fattime |= ((DWORD)hour << 11); //
fattime |= ((DWORD)min << 5); //
fattime |= ((DWORD)sec / 2); // 2
return fattime;
}
DWORD get_fattime(void) {
return get_fattime_0(2024, 1, 23, 23, 29, 31);
// ((DWORD)(_NORTC_YEAR - 1980) << 25 | (DWORD)_NORTC_MON << 21 | (DWORD)_NORTC_MDAY << 16)
}
void ThreeLeadECG_sdcard_mount() {
/**
@ -234,27 +282,35 @@ void ThreeLeadECG_sdcard_mount() {
* @brief
* 1. SPI引脚flash
*/
static diskio_blkdev_t drives[] = //
{DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)};
diskio_blockdev_register(drives, ARRAY_SIZE(drives));
DSTATUS disk_state = STA_NOINIT;
for (uint32_t retries = 3; retries && disk_state; --retries) {
disk_state = disk_initialize(0);
}
if (disk_state) {
NRF_LOG_INFO("Disk initialization failed. %d", disk_state);
return;
}
NRF_LOG_INFO("Disk initialization succeeded.");
FRESULT ff_result;
ff_result = f_mount(&fs, "", 1);
if (ff_result) {
NRF_LOG_INFO("Mount failed.");
return;
if (!mountsuc) {
static diskio_blkdev_t drives[] = //
{DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)};
diskio_blockdev_register(drives, ARRAY_SIZE(drives));
DSTATUS disk_state = STA_NOINIT;
for (uint32_t retries = 3; retries && disk_state; --retries) {
disk_state = disk_initialize(0);
}
if (disk_state) {
NRF_LOG_INFO("Disk initialization failed. %d", disk_state);
return;
}
NRF_LOG_INFO("Disk initialization succeeded.");
FRESULT ff_result;
ff_result = f_mount(&fs, "", 1);
if (ff_result) {
NRF_LOG_INFO("Mount failed.");
return;
}
uint32_t blocks_per_mb = (1024uL * 1024uL) / m_block_dev_sdc.block_dev.p_ops->geometry(&m_block_dev_sdc.block_dev)->blk_size;
uint32_t capacity = m_block_dev_sdc.block_dev.p_ops->geometry(&m_block_dev_sdc.block_dev)->blk_count / blocks_per_mb;
NRF_LOG_INFO("Capacity: %d MB", capacity);
mountsuc = true;
}
sdcard_test_write_text();
}
void ThreeLeadECG_sdcard_umount() {

2
libznordic

@ -1 +1 @@
Subproject commit fbcd219fb95c6c1af8a9c2ee62854dd989d941e8
Subproject commit 326ebab17be4472520b0b077f59edf09be8e0dda

2
sdk

@ -1 +1 @@
Subproject commit 65387c8fdeef99d05d9a2fce75a99df87dda4fb8
Subproject commit d1b8e44a3b818ea9571baf5efe79b6bd5d295dd2
Loading…
Cancel
Save