wip:
This commit is contained in:
12
README.md
12
README.md
@@ -5,12 +5,17 @@
|
|||||||
1. Support of any data types.
|
1. Support of any data types.
|
||||||
2. The maximum size of the veсtor is 255 elements.
|
2. The maximum size of the veсtor is 255 elements.
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
1. [zh_avr_free_rtos](http://git.zh.com.ru/avr_libraries/zh_avr_free_rtos)
|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
|
|
||||||
In an existing project, run the following command to install the component:
|
In an existing project, run the following command to install the component:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
cd ../your_project/lib
|
cd ../your_project/lib
|
||||||
|
git clone http://git.zh.com.ru/avr_libraries/zh_avr_free_rtos
|
||||||
git clone http://git.zh.com.ru/avr_libraries/zh_avr_vector
|
git clone http://git.zh.com.ru/avr_libraries/zh_avr_vector
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,9 +51,6 @@ void vector_example_task(void *pvParameters)
|
|||||||
{
|
{
|
||||||
zh_avr_vector_t vector = {0};
|
zh_avr_vector_t vector = {0};
|
||||||
char example[10] = {0};
|
char example[10] = {0};
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
printf("Ponter Size %d.\n", sizeof(void *));
|
|
||||||
printf("Free Heap %d.\n", xPortGetFreeHeapSize());
|
printf("Free Heap %d.\n", xPortGetFreeHeapSize());
|
||||||
zh_avr_vector_init(&vector, sizeof(example));
|
zh_avr_vector_init(&vector, sizeof(example));
|
||||||
printf("Initial vector size is: %d\n", zh_avr_vector_get_size(&vector));
|
printf("Initial vector size is: %d\n", zh_avr_vector_get_size(&vector));
|
||||||
@@ -83,8 +85,6 @@ void vector_example_task(void *pvParameters)
|
|||||||
zh_avr_vector_free(&vector);
|
zh_avr_vector_free(&vector);
|
||||||
printf("Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL));
|
printf("Task Remaining Stack Size %d.\n", uxTaskGetStackHighWaterMark(NULL));
|
||||||
printf("Free Heap %d.\n", xPortGetFreeHeapSize());
|
printf("Free Heap %d.\n", xPortGetFreeHeapSize());
|
||||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ int main(void)
|
|||||||
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
|
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
|
||||||
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);
|
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);
|
||||||
stdout = &uart;
|
stdout = &uart;
|
||||||
xTaskCreate(vector_example_task, "vector example task", 200, NULL, tskIDLE_PRIORITY, NULL);
|
xTaskCreate(vector_example_task, "vector example task", 136, NULL, tskIDLE_PRIORITY, NULL);
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1 +1 @@
|
|||||||
1.0.0
|
2.0.0
|
@@ -23,11 +23,12 @@ avr_err_t zh_avr_vector_free(zh_avr_vector_t *vector)
|
|||||||
{
|
{
|
||||||
ZH_ERROR_CHECK(vector != NULL, AVR_ERR_INVALID_ARG);
|
ZH_ERROR_CHECK(vector != NULL, AVR_ERR_INVALID_ARG);
|
||||||
ZH_ERROR_CHECK(vector->status != false, AVR_ERR_INVALID_STATE);
|
ZH_ERROR_CHECK(vector->status != false, AVR_ERR_INVALID_STATE);
|
||||||
for (uint16_t i = 0; i < vector->size; ++i)
|
for (uint8_t i = 0; i < vector->size; ++i)
|
||||||
{
|
{
|
||||||
vPortFree(vector->items[i]);
|
vPortFree(vector->items[i]);
|
||||||
}
|
}
|
||||||
vector->status = false;
|
vector->status = false;
|
||||||
|
vPortFree(vector->items);
|
||||||
return AVR_OK;
|
return AVR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ avr_err_t zh_avr_vector_delete_item(zh_avr_vector_t *vector, uint8_t index)
|
|||||||
vector->items[i + 1] = NULL;
|
vector->items[i + 1] = NULL;
|
||||||
}
|
}
|
||||||
--vector->size;
|
--vector->size;
|
||||||
_resize(vector, vector->capacity - 1);
|
ZH_ERROR_CHECK((_resize(vector, vector->capacity - 1) != AVR_ERR_NO_MEM), AVR_ERR_NO_MEM);
|
||||||
return AVR_OK;
|
return AVR_OK;
|
||||||
}
|
}
|
||||||
return AVR_FAIL;
|
return AVR_FAIL;
|
||||||
|
Reference in New Issue
Block a user