acc_integration.h
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2019-2024
2 // All rights reserved
3 
4 #ifndef ACC_INTEGRATION_H_
5 #define ACC_INTEGRATION_H_
6 
7 #include <stdbool.h>
8 #include <stdint.h>
9 #include <stdlib.h>
10 
11 
12 typedef void (*acc_integration_uart_read_func_t)(uint8_t data, uint32_t status);
13 
14 
15 /**
16  * @brief Sleep for a specified number of microseconds
17  *
18  * @param time_usec Time in microseconds to sleep
19  */
20 void acc_integration_sleep_us(uint32_t time_usec);
21 
22 
23 /**
24  * @brief Sleep for a specified number of milliseconds
25  *
26  * @param time_msec Time in milliseconds to sleep
27  */
28 void acc_integration_sleep_ms(uint32_t time_msec);
29 
30 
31 /**
32  * @brief Allocate dynamic memory
33  *
34  * @param[in] size The bytesize of the reuested memory block
35  * @return Returns either NULL or a unique pointer to a memory block
36  */
37 void *acc_integration_mem_alloc(size_t size);
38 
39 
40 /**
41  * @brief Allocate dynamic memory
42  *
43  * Allocate an array of nmemb elements of size bytes each.
44  *
45  * @param[in] nmemb The number of elements in the array
46  * @param[in] size The bytesize of the element
47  * @return Returns either NULL or a unique pointer to a memory block
48  */
49 void *acc_integration_mem_calloc(size_t nmemb, size_t size);
50 
51 
52 /**
53  * @brief Free dynamic memory
54  *
55  * @param[in] ptr A pointer to the memory space to be freed
56  */
57 void acc_integration_mem_free(void *ptr);
58 
59 
60 /**
61  * @brief Get current time
62  *
63  * It is important that this value wraps correctly and uses all bits. I.e. it should count
64  * upwards to 2^32 - 1 and then 0 again.
65  *
66  * @returns Current time as milliseconds
67  */
68 uint32_t acc_integration_get_time(void);
69 
70 
71 #endif
acc_integration_mem_calloc
void * acc_integration_mem_calloc(size_t nmemb, size_t size)
Allocate dynamic memory.
Definition: acc_integration_esp32.c:44
acc_integration_get_time
uint32_t acc_integration_get_time(void)
Get current time.
Definition: acc_integration_esp32.c:32
acc_integration_sleep_us
void acc_integration_sleep_us(uint32_t time_usec)
Sleep for a specified number of microseconds.
Definition: acc_integration_esp32.c:20
acc_integration_uart_read_func_t
void(* acc_integration_uart_read_func_t)(uint8_t data, uint32_t status)
Definition: acc_integration.h:12
acc_integration_mem_alloc
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
Definition: acc_integration_esp32.c:38
acc_integration_sleep_ms
void acc_integration_sleep_ms(uint32_t time_msec)
Sleep for a specified number of milliseconds.
Definition: acc_integration_esp32.c:26
acc_integration_mem_free
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
Definition: acc_integration_esp32.c:57