Merge branch 'bugfix/gcc8_warnings' into 'master'
Fix or silence warnings found by GCC 8 See merge request idf/esp-idf!3130
This commit is contained in:
commit
27f3c3e668
19 changed files with 97 additions and 53 deletions
|
@ -41,6 +41,7 @@ static inline void esp_apptrace_tmo_init(esp_apptrace_tmo_t *tmo, uint32_t user_
|
|||
{
|
||||
tmo->start = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
tmo->tmo = user_tmo;
|
||||
tmo->elapsed = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1291,7 +1291,9 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
|||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if (p_clcb == NULL) {
|
||||
return NULL;
|
||||
*count = 0;
|
||||
*char_db = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
|
@ -1671,7 +1673,8 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
|
|||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if (p_clcb == NULL) {
|
||||
return NULL;
|
||||
*count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
|
|
|
@ -578,13 +578,14 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
|
|||
for (i = 0 ; i < BTA_GATTC_NOTIF_REG_MAX; i ++) {
|
||||
if (p_clrcb->notif_reg[i].in_use &&
|
||||
!bdcmp(p_clrcb->notif_reg[i].remote_bda, remote_bda))
|
||||
|
||||
{
|
||||
/* It's enough to get service or characteristic handle, as
|
||||
* clear boundaries are always around service.
|
||||
*/
|
||||
handle = p_clrcb->notif_reg[i].handle;
|
||||
if (handle >= start_handle && handle <= end_handle)
|
||||
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -336,7 +336,8 @@ static int get_config_size_from_flash(nvs_handle fp)
|
|||
assert(fp != 0);
|
||||
|
||||
esp_err_t err;
|
||||
char *keyname = osi_calloc(sizeof(CONFIG_KEY) + 1);
|
||||
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
||||
char *keyname = osi_calloc(keyname_bufsz);
|
||||
if (!keyname){
|
||||
OSI_TRACE_ERROR("%s, malloc error\n", __func__);
|
||||
return 0;
|
||||
|
@ -344,7 +345,7 @@ static int get_config_size_from_flash(nvs_handle fp)
|
|||
size_t length = CONFIG_FILE_DEFAULE_LENGTH;
|
||||
size_t total_length = 0;
|
||||
uint16_t i = 0;
|
||||
snprintf(keyname, sizeof(CONFIG_KEY) + 1, "%s%d", CONFIG_KEY, 0);
|
||||
snprintf(keyname, keyname_bufsz, "%s%d", CONFIG_KEY, 0);
|
||||
err = nvs_get_blob(fp, keyname, NULL, &length);
|
||||
if (err == ESP_ERR_NVS_NOT_FOUND) {
|
||||
osi_free(keyname);
|
||||
|
@ -358,7 +359,7 @@ static int get_config_size_from_flash(nvs_handle fp)
|
|||
total_length += length;
|
||||
while (length == CONFIG_FILE_MAX_SIZE) {
|
||||
length = CONFIG_FILE_DEFAULE_LENGTH;
|
||||
snprintf(keyname, sizeof(CONFIG_KEY) + 1, "%s%d", CONFIG_KEY, ++i);
|
||||
snprintf(keyname, keyname_bufsz, "%s%d", CONFIG_KEY, ++i);
|
||||
err = nvs_get_blob(fp, keyname, NULL, &length);
|
||||
|
||||
if (err == ESP_ERR_NVS_NOT_FOUND) {
|
||||
|
@ -385,7 +386,8 @@ bool config_save(const config_t *config, const char *filename)
|
|||
int err_code = 0;
|
||||
nvs_handle fp;
|
||||
char *line = osi_calloc(1024);
|
||||
char *keyname = osi_calloc(sizeof(CONFIG_KEY) + 1);
|
||||
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
||||
char *keyname = osi_calloc(keyname_bufsz);
|
||||
int config_size = get_config_size(config);
|
||||
char *buf = osi_calloc(config_size + 100);
|
||||
if (!line || !buf || !keyname) {
|
||||
|
@ -430,7 +432,7 @@ bool config_save(const config_t *config, const char *filename)
|
|||
}
|
||||
buf[w_cnt_total] = '\0';
|
||||
if (w_cnt_total < CONFIG_FILE_MAX_SIZE) {
|
||||
snprintf(keyname, sizeof(CONFIG_KEY)+1, "%s%d", CONFIG_KEY, 0);
|
||||
snprintf(keyname, keyname_bufsz, "%s%d", CONFIG_KEY, 0);
|
||||
err = nvs_set_blob(fp, keyname, buf, w_cnt_total);
|
||||
if (err != ESP_OK) {
|
||||
nvs_close(fp);
|
||||
|
@ -441,7 +443,7 @@ bool config_save(const config_t *config, const char *filename)
|
|||
uint count = (w_cnt_total / CONFIG_FILE_MAX_SIZE);
|
||||
for (int i = 0; i <= count; i++)
|
||||
{
|
||||
snprintf(keyname, sizeof(CONFIG_KEY)+1, "%s%d", CONFIG_KEY, i);
|
||||
snprintf(keyname, keyname_bufsz, "%s%d", CONFIG_KEY, i);
|
||||
if (i == count) {
|
||||
err = nvs_set_blob(fp, keyname, buf + i*CONFIG_FILE_MAX_SIZE, w_cnt_total - i*CONFIG_FILE_MAX_SIZE);
|
||||
OSI_TRACE_DEBUG("save keyname = %s, i = %d, %d\n", keyname, i, w_cnt_total - i*CONFIG_FILE_MAX_SIZE);
|
||||
|
@ -518,14 +520,15 @@ static void config_parse(nvs_handle fp, config_t *config)
|
|||
size_t total_length = 0;
|
||||
char *line = osi_calloc(1024);
|
||||
char *section = osi_calloc(1024);
|
||||
char *keyname = osi_calloc(sizeof(CONFIG_KEY) + 1);
|
||||
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
||||
char *keyname = osi_calloc(keyname_bufsz);
|
||||
int buf_size = get_config_size_from_flash(fp);
|
||||
char *buf = osi_calloc(buf_size + 100);
|
||||
if (!line || !section || !buf || !keyname) {
|
||||
err_code |= 0x01;
|
||||
goto error;
|
||||
}
|
||||
snprintf(keyname, sizeof(CONFIG_KEY)+1, "%s%d", CONFIG_KEY, 0);
|
||||
snprintf(keyname, keyname_bufsz, "%s%d", CONFIG_KEY, 0);
|
||||
err = nvs_get_blob(fp, keyname, buf, &length);
|
||||
if (err == ESP_ERR_NVS_NOT_FOUND) {
|
||||
goto error;
|
||||
|
@ -537,7 +540,7 @@ static void config_parse(nvs_handle fp, config_t *config)
|
|||
total_length += length;
|
||||
while (length == CONFIG_FILE_MAX_SIZE) {
|
||||
length = CONFIG_FILE_DEFAULE_LENGTH;
|
||||
snprintf(keyname, sizeof(CONFIG_KEY) + 1, "%s%d", CONFIG_KEY, ++i);
|
||||
snprintf(keyname, keyname_bufsz, "%s%d", CONFIG_KEY, ++i);
|
||||
err = nvs_get_blob(fp, keyname, buf + CONFIG_FILE_MAX_SIZE * i, &length);
|
||||
|
||||
if (err == ESP_ERR_NVS_NOT_FOUND) {
|
||||
|
|
|
@ -99,13 +99,13 @@ list_node_t *list_back_node(const list_t *list) {
|
|||
}
|
||||
|
||||
bool list_insert_after(list_t *list, list_node_t *prev_node, void *data) {
|
||||
assert(list != NULL);
|
||||
assert(prev_node != NULL);
|
||||
assert(data != NULL);
|
||||
assert(list != NULL);
|
||||
assert(prev_node != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
list_node_t *node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
|
||||
if (!node)
|
||||
return false;
|
||||
list_node_t *node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
|
||||
if (!node)
|
||||
return false;
|
||||
|
||||
node->next = prev_node->next;
|
||||
node->data = data;
|
||||
|
|
|
@ -352,8 +352,8 @@ UINT8 A2D_SetTraceLevel (UINT8 new_level)
|
|||
******************************************************************************/
|
||||
UINT8 A2D_BitsSet(UINT8 num)
|
||||
{
|
||||
UINT8 count;
|
||||
BOOLEAN res;
|
||||
UINT8 count;
|
||||
UINT8 res;
|
||||
if (num == 0) {
|
||||
res = A2D_SET_ZERO_BIT;
|
||||
} else {
|
||||
|
|
|
@ -331,8 +331,8 @@ void btm_ble_scan_pf_cmpl_cback(tBTM_VSC_CMPL *p_params)
|
|||
break;
|
||||
}
|
||||
|
||||
BTM_TRACE_DEBUG("btm_ble_scan_pf_cmpl_cback: calling the cback: %d", cb_evt);
|
||||
switch (cb_evt) {
|
||||
BTM_TRACE_DEBUG("btm_ble_scan_pf_cmpl_cback: calling the cback: %d", cb_evt);
|
||||
case BTM_BLE_FILT_CFG:
|
||||
if (NULL != p_scan_cfg_cback) {
|
||||
p_scan_cfg_cback(action, cond_type, num_avail, status, ref_value);
|
||||
|
|
|
@ -41,8 +41,8 @@ void p_256_init_curve(UINT32 keyLength)
|
|||
ec->p[1] = 0xFFFFFFFF;
|
||||
ec->p[0] = 0xFFFFFFFF;
|
||||
|
||||
memset(ec->omega, 0, KEY_LENGTH_DWORDS_P256);
|
||||
memset(ec->a, 0, KEY_LENGTH_DWORDS_P256);
|
||||
memset(ec->omega, 0, KEY_LENGTH_DWORDS_P256 * sizeof(ec->omega[0]));
|
||||
memset(ec->a, 0, KEY_LENGTH_DWORDS_P256 * sizeof(ec->a[0]));
|
||||
|
||||
ec->a_minus3 = TRUE;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static void fill_item_end(rmt_item32_t* item)
|
|||
/**
|
||||
* @brief Check whether duration is around target_us
|
||||
*/
|
||||
inline bool check_in_range(int duration_ticks, int target_us, int margin_us)
|
||||
static inline bool check_in_range(int duration_ticks, int target_us, int margin_us)
|
||||
{
|
||||
if(( ITEM_DURATION(duration_ticks) < (target_us + margin_us))
|
||||
&& ( ITEM_DURATION(duration_ticks) > (target_us - margin_us))) {
|
||||
|
|
|
@ -579,7 +579,7 @@ TEST_CASE("SPI Master DMA test, TX and RX in different regions", "[spi]")
|
|||
ESP_LOGI(TAG, "iram: %p, dram: %p", data_iram, data_dram);
|
||||
ESP_LOGI(TAG, "drom: %p, malloc: %p", data_drom, data_malloc);
|
||||
|
||||
memset(trans, 0, 6*sizeof(spi_transaction_t));
|
||||
memset(trans, 0, sizeof(trans));
|
||||
|
||||
trans[0].length = 320*8,
|
||||
trans[0].tx_buffer = data_iram;
|
||||
|
|
|
@ -54,54 +54,54 @@ void emac_enable_flowctrl(void);
|
|||
void emac_disable_flowctrl(void);
|
||||
void emac_mac_enable_txrx(void);
|
||||
|
||||
uint32_t inline emac_read_tx_cur_reg(void)
|
||||
static inline uint32_t emac_read_tx_cur_reg(void)
|
||||
{
|
||||
return REG_READ(EMAC_DMATXCURRDESC_REG);
|
||||
}
|
||||
|
||||
uint32_t inline emac_read_rx_cur_reg(void)
|
||||
static inline uint32_t emac_read_rx_cur_reg(void)
|
||||
{
|
||||
return REG_READ(EMAC_DMARXCURRDESC_REG);
|
||||
}
|
||||
|
||||
void inline emac_poll_tx_cmd(void)
|
||||
static inline void emac_poll_tx_cmd(void)
|
||||
{
|
||||
//write any to wake up dma
|
||||
REG_WRITE(EMAC_DMATXPOLLDEMAND_REG, 1);
|
||||
}
|
||||
|
||||
void inline emac_poll_rx_cmd(void)
|
||||
static inline void emac_poll_rx_cmd(void)
|
||||
{
|
||||
//write any to wake up dma
|
||||
REG_WRITE(EMAC_DMARXPOLLDEMAND_REG, 1);
|
||||
}
|
||||
|
||||
void inline emac_disable_rx_intr(void)
|
||||
static inline void emac_disable_rx_intr(void)
|
||||
{
|
||||
REG_CLR_BIT(EMAC_DMAIN_EN_REG, EMAC_DMAIN_RIE);
|
||||
}
|
||||
|
||||
void inline emac_enable_rx_intr(void)
|
||||
static inline void emac_enable_rx_intr(void)
|
||||
{
|
||||
REG_SET_BIT(EMAC_DMAIN_EN_REG, EMAC_DMAIN_RIE);
|
||||
}
|
||||
|
||||
void inline emac_disable_rx_unavail_intr(void)
|
||||
static inline void emac_disable_rx_unavail_intr(void)
|
||||
{
|
||||
REG_CLR_BIT(EMAC_DMAIN_EN_REG, EMAC_DMAIN_RBUE);
|
||||
}
|
||||
|
||||
void inline emac_enable_rx_unavail_intr(void)
|
||||
static inline void emac_enable_rx_unavail_intr(void)
|
||||
{
|
||||
REG_SET_BIT(EMAC_DMAIN_EN_REG, EMAC_DMAIN_RBUE);
|
||||
}
|
||||
|
||||
void IRAM_ATTR inline emac_send_pause_frame_enable(void)
|
||||
static inline void IRAM_ATTR emac_send_pause_frame_enable(void)
|
||||
{
|
||||
REG_SET_BIT(EMAC_EX_PHYINF_CONF_REG, EMAC_EX_SBD_FLOWCTRL);
|
||||
}
|
||||
|
||||
void inline emac_send_pause_zero_frame_enable(void)
|
||||
static inline void emac_send_pause_zero_frame_enable(void)
|
||||
{
|
||||
REG_CLR_BIT(EMAC_EX_PHYINF_CONF_REG, EMAC_EX_SBD_FLOWCTRL);
|
||||
}
|
||||
|
|
|
@ -88,23 +88,42 @@ TEST_CASE("Check if reserved DMA pool still can allocate even when malloc()'ed m
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
/* As you see, we are desperately trying to outsmart the compiler, so that it
|
||||
* doesn't warn about oversized allocations in the next two unit tests.
|
||||
* To be removed when we switch to GCC 8.2 and add
|
||||
* -Wno-alloc-size-larger-than=PTRDIFF_MAX to CFLAGS for this file.
|
||||
*/
|
||||
void* (*g_test_malloc_ptr)(size_t) = &malloc;
|
||||
void* (*g_test_calloc_ptr)(size_t, size_t) = &calloc;
|
||||
|
||||
void* test_malloc_wrapper(size_t size)
|
||||
{
|
||||
return (*g_test_malloc_ptr)(size);
|
||||
}
|
||||
|
||||
void* test_calloc_wrapper(size_t count, size_t size)
|
||||
{
|
||||
return (*g_test_calloc_ptr)(count, size);
|
||||
}
|
||||
|
||||
TEST_CASE("alloc overflows should all fail", "[heap]")
|
||||
{
|
||||
/* allocates 8 bytes */
|
||||
TEST_ASSERT_NULL(calloc(SIZE_MAX / 2 + 4, 2));
|
||||
TEST_ASSERT_NULL(test_calloc_wrapper(SIZE_MAX / 2 + 4, 2));
|
||||
|
||||
/* will overflow if any poisoning is enabled
|
||||
(should fail for sensible OOM reasons, otherwise) */
|
||||
TEST_ASSERT_NULL(malloc(SIZE_MAX - 1));
|
||||
TEST_ASSERT_NULL(calloc(SIZE_MAX - 1, 1));
|
||||
TEST_ASSERT_NULL(test_malloc_wrapper(SIZE_MAX - 1));
|
||||
TEST_ASSERT_NULL(test_calloc_wrapper(SIZE_MAX - 1, 1));
|
||||
}
|
||||
|
||||
TEST_CASE("unreasonable allocs should all fail", "[heap]")
|
||||
{
|
||||
TEST_ASSERT_NULL(calloc(16, 1024*1024));
|
||||
TEST_ASSERT_NULL(malloc(16*1024*1024));
|
||||
TEST_ASSERT_NULL(malloc(SIZE_MAX / 2));
|
||||
TEST_ASSERT_NULL(malloc(SIZE_MAX - 256));
|
||||
TEST_ASSERT_NULL(malloc(xPortGetFreeHeapSize() - 1));
|
||||
TEST_ASSERT_NULL(test_calloc_wrapper(16, 1024*1024));
|
||||
TEST_ASSERT_NULL(test_malloc_wrapper(16*1024*1024));
|
||||
TEST_ASSERT_NULL(test_malloc_wrapper(SIZE_MAX / 2));
|
||||
TEST_ASSERT_NULL(test_malloc_wrapper(SIZE_MAX - 256));
|
||||
TEST_ASSERT_NULL(test_malloc_wrapper(xPortGetFreeHeapSize() - 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ extern int _scanf_float(struct _reent *rptr,
|
|||
FILE *fp,
|
||||
va_list *ap);
|
||||
|
||||
static void raise_r_stub(struct _reent *rptr)
|
||||
{
|
||||
_raise_r(rptr, 0);
|
||||
}
|
||||
|
||||
static struct syscall_stub_table s_stub_table = {
|
||||
.__getreent = &__getreent,
|
||||
|
@ -53,7 +57,7 @@ static struct syscall_stub_table s_stub_table = {
|
|||
._rename_r = &esp_vfs_rename,
|
||||
._times_r = &_times_r,
|
||||
._gettimeofday_r = &_gettimeofday_r,
|
||||
._raise_r = (void (*)(struct _reent *r)) &_raise_r,
|
||||
._raise_r = &raise_r_stub,
|
||||
._unlink_r = &esp_vfs_unlink,
|
||||
._link_r = &esp_vfs_link,
|
||||
._stat_r = &esp_vfs_stat,
|
||||
|
|
|
@ -291,7 +291,8 @@ void test_spiffs_readdir_many_files(const char* dir_prefix)
|
|||
if (!de) {
|
||||
break;
|
||||
}
|
||||
snprintf(file_name, sizeof(file_name), "%s/%s", dir_prefix, de->d_name);
|
||||
int len = snprintf(file_name, sizeof(file_name), "%s/%s", dir_prefix, de->d_name);
|
||||
assert(len < sizeof(file_name));
|
||||
unlink(file_name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ void bt_app_rc_ct_cb(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_param_t *param
|
|||
switch (event) {
|
||||
case ESP_AVRC_CT_METADATA_RSP_EVT:
|
||||
bt_app_alloc_meta_buffer(param);
|
||||
/* fall through */
|
||||
case ESP_AVRC_CT_CONNECTION_STATE_EVT:
|
||||
case ESP_AVRC_CT_PASSTHROUGH_RSP_EVT:
|
||||
case ESP_AVRC_CT_CHANGE_NOTIFY_EVT:
|
||||
|
|
|
@ -75,6 +75,7 @@ void bt_app_rc_ct_cb(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_param_t *param
|
|||
switch (event) {
|
||||
case ESP_AVRC_CT_METADATA_RSP_EVT:
|
||||
bt_app_alloc_meta_buffer(param);
|
||||
/* fall through */
|
||||
case ESP_AVRC_CT_CONNECTION_STATE_EVT:
|
||||
case ESP_AVRC_CT_PASSTHROUGH_RSP_EVT:
|
||||
case ESP_AVRC_CT_CHANGE_NOTIFY_EVT:
|
||||
|
|
|
@ -67,8 +67,11 @@ static void spp_read_handle(void * param)
|
|||
spp_wr_task_shut_down();
|
||||
}
|
||||
|
||||
static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
||||
static void esp_spp_cb(uint16_t e, void *p)
|
||||
{
|
||||
esp_spp_cb_event_t event = e;
|
||||
esp_spp_cb_param_t *param = p;
|
||||
|
||||
switch (event) {
|
||||
case ESP_SPP_INIT_EVT:
|
||||
ESP_LOGI(SPP_TAG, "ESP_SPP_INIT_EVT");
|
||||
|
@ -102,7 +105,7 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
|||
|
||||
static void esp_spp_stack_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
||||
{
|
||||
spp_task_work_dispatch((spp_task_cb_t)esp_spp_cb, event, param, sizeof(esp_spp_cb_param_t), NULL);
|
||||
spp_task_work_dispatch(esp_spp_cb, event, param, sizeof(esp_spp_cb_param_t), NULL);
|
||||
}
|
||||
|
||||
void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||
|
|
|
@ -105,8 +105,11 @@ static bool get_name_from_eir(uint8_t *eir, char *bdname, uint8_t *bdname_len)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
||||
static void esp_spp_cb(uint16_t e, void *p)
|
||||
{
|
||||
esp_spp_cb_event_t event = e;
|
||||
esp_spp_cb_param_t *param = p;
|
||||
|
||||
switch (event) {
|
||||
case ESP_SPP_INIT_EVT:
|
||||
ESP_LOGI(SPP_TAG, "ESP_SPP_INIT_EVT");
|
||||
|
@ -198,7 +201,7 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
|||
|
||||
static void esp_spp_stack_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
||||
{
|
||||
spp_task_work_dispatch((spp_task_cb_t)esp_spp_cb, event, param, sizeof(esp_spp_cb_param_t), NULL);
|
||||
spp_task_work_dispatch(esp_spp_cb, event, param, sizeof(esp_spp_cb_param_t), NULL);
|
||||
}
|
||||
|
||||
void app_main()
|
||||
|
|
|
@ -118,8 +118,8 @@ void app_main()
|
|||
};
|
||||
|
||||
int n=0;
|
||||
char sendbuf[128]="";
|
||||
char recvbuf[128]="";
|
||||
char sendbuf[128] = {0};
|
||||
char recvbuf[128] = {0};
|
||||
spi_transaction_t t;
|
||||
memset(&t, 0, sizeof(t));
|
||||
|
||||
|
@ -143,8 +143,12 @@ void app_main()
|
|||
xSemaphoreGive(rdySem);
|
||||
|
||||
while(1) {
|
||||
snprintf(sendbuf, 128, "Sender, transmission no. %04i. Last time, I received: \"%s\"", n, recvbuf);
|
||||
t.length=128*8; //128 bytes
|
||||
int res = snprintf(sendbuf, sizeof(sendbuf),
|
||||
"Sender, transmission no. %04i. Last time, I received: \"%s\"", n, recvbuf);
|
||||
if (res >= sizeof(sendbuf)) {
|
||||
printf("Data truncated\n");
|
||||
}
|
||||
t.length=sizeof(sendbuf)*8;
|
||||
t.tx_buffer=sendbuf;
|
||||
t.rx_buffer=recvbuf;
|
||||
//Wait for slave to be ready for next byte before sending
|
||||
|
|
Loading…
Reference in a new issue