added fuzzy matching feature to at_echo; added set some AT+ commands for RHF76; added support for LSM6DS3;

1. in tos_at.h, added int  fuzzy_matching; field into at_echo_st struct, if this field is set to K_TRUE, then if echo message contains the string in "echo_expect" field.
2. added __API__ int tos_at_echo_fuzzy_matching_create(at_echo_t *echo, char *buffer, size_t buffer_size, char *echo_expect_contains) api to tos_at.c, which will create an at_echo_t with fuzzy_matching = K_TRUE;
3. added RHF76_ATCMD_SET_DELAY and  rhf76_set_delay to RHF76.h to allow set/query RX delay config
4. added RHF76_ATCMD_SET_DATA_RATE and rhf76_set_data_rate to RHF76.h to allow set/query date rate config
5. added rhf76_at_cmd_exe for DEBUG purpose, so that user can execute any AT+ commands they want
6. added code in lora_demo.c to demonstrate package segmentation.
This commit is contained in:
Winfred LIN
2020-04-06 23:11:48 +10:00
parent 47d6313ba1
commit b6cb7147cc
14 changed files with 1258 additions and 522 deletions

View File

@@ -161,9 +161,18 @@ __STATIC__ int at_is_echo_expect(void)
return 0;
}
if(at_echo->fuzzy_matching){
if(strstr(recv_buffer, expect)!=NULL){
return 0;
}
return -1;
}
if (strncmp(expect, recv_buffer, expect_len) == 0) {
return 1;
}
return 0;
}
@@ -337,6 +346,28 @@ __API__ int tos_at_echo_create(at_echo_t *echo, char *buffer, size_t buffer_size
echo->status = AT_ECHO_STATUS_NONE;
echo->__w_idx = 0;
echo->__is_expecting = K_FALSE;
echo->fuzzy_matching = K_FALSE;
return 0;
}
__API__ int tos_at_echo_fuzzy_matching_create(at_echo_t *echo, char *buffer, size_t buffer_size, char *echo_expect_contains)
{
if (!echo) {
return -1;
}
if (buffer) {
memset(buffer, 0, buffer_size);
}
echo->buffer = buffer;
echo->buffer_size = buffer_size;
echo->echo_expect = echo_expect_contains;
echo->line_num = 0;
echo->status = AT_ECHO_STATUS_NONE;
echo->__w_idx = 0;
echo->__is_expecting = K_FALSE;
echo->fuzzy_matching = K_TRUE;
return 0;
}