43 #if defined(CONFIG_ENABLE_CPP_HAL) 44 #include "cpp/cpp_hal.h" 45 #elif defined(TINY_CUSTOM_PLATFORM) 46 #include "no_platform/no_platform_hal.h" 47 #elif defined(__AVR__) 48 #include "avr/avr_hal.h" 49 #elif defined(__XTENSA__) 50 #include "esp32/esp32_hal.h" 51 #elif defined(ARDUINO) 52 #include "arduino/arduino_hal.h" 53 #elif defined(__linux__) 54 #include "linux/linux_hal.h" 55 #elif defined(__APPLE__) && defined(__MACH__) 56 #include "macos/macos_hal.h" 57 #elif defined(__MINGW32__) 58 #include "mingw32/mingw32_hal.h" 60 #include "win32/win32_hal.h" 61 #elif defined(CPU_S32K144HFT0VLLT) 62 #include "freertos/freertos_hal.h" 64 #info "Platform not supported. Multithread support is disabled" 65 #include "no_platform/no_platform_hal.h" 72 #ifndef CONFIG_TINYHAL_THREAD_SUPPORT 76 #define CONFIG_TINYHAL_THREAD_SUPPORT 0 81 #define TINY_ALIGNED(x) __declspec(align(x)) 83 #elif defined(__GNUC__) 84 #define TINY_ALIGNED(x) __attribute__ ((aligned (x))) 87 #define TINY_ALIGNED(x) 92 #if defined(__TARGET_CPU_CORTEX_M0) || defined(__TARGET_CPU_CORTEX_M0_) || defined(__ARM_ARCH_6M__) || \ 93 defined(__TARGET_CPU_CORTEX_M3) || defined(__TARGET_CPU_CORTEX_M4) || defined(__ARM_ARCH_7EM__) || \ 94 defined(__ARM_ARCH_7M__) 97 #define TINY_ALIGN_STRUCT_VALUE (sizeof(uintptr_t)) 99 #elif defined(_MSC_VER) 103 #define TINY_ALIGN_STRUCT_VALUE 8 108 #define TINY_ALIGN_STRUCT_VALUE (uintptr_t)(sizeof(uintptr_t)) 113 #define TINY_ALIGNED_STRUCT TINY_ALIGNED(TINY_ALIGN_STRUCT_VALUE) 116 #define TINY_ALIGN_BUFFER(x) ((uint8_t *)( ((uintptr_t)x + TINY_ALIGN_STRUCT_VALUE - 1) & (~(TINY_ALIGN_STRUCT_VALUE - 1)) )) 122 #define TINY_SUCCESS (0) 124 #define TINY_ERR_FAILED (-1) 126 #define TINY_ERR_TIMEOUT (-2) 128 #define TINY_ERR_DATA_TOO_LARGE (-3) 130 #define TINY_ERR_INVALID_DATA (-4) 132 #define TINY_ERR_BUSY (-5) 134 #define TINY_ERR_OUT_OF_SYNC (-6) 136 #define TINY_ERR_AGAIN (-7) 138 #define TINY_ERR_WRONG_CRC (-8) 140 #define TINY_ERR_OUT_OF_MEMORY (-9) 142 #define TINY_ERR_UNKNOWN_PEER (-10) 144 #define TINY_ERR_IO (-11) 154 #define TINY_FLAG_NO_WAIT (0) 156 #define TINY_FLAG_READ_ALL (1) 158 #define TINY_FLAG_LOCK_SEND (2) 160 #define TINY_FLAG_WAIT_FOREVER (0x80) 234 #define EVENT_BITS_ALL 0xFF 235 #define EVENT_BITS_CLEAR 1 236 #define EVENT_BITS_LEAVE 0 void tiny_mutex_destroy(tiny_mutex_t *mutex)
Destroys cross-platform mutex.
Definition: cpp_hal.inl:37
void tiny_mutex_unlock(tiny_mutex_t *mutex)
Unlocks cross-platform mutex.
Definition: cpp_hal.inl:49
void(* on_frame_cb_t)(void *udata, uint8_t *pdata, int size)
on_frame_cb_t is a callback function, which is called every time new frame is received.
Definition: tiny_types.h:194
void tiny_events_set(tiny_events_t *event, uint8_t bits)
Sets bits for cross-platform event group object.
Definition: cpp_hal.inl:69
void tiny_mutex_lock(tiny_mutex_t *mutex)
Locks cross-platform mutex.
Definition: cpp_hal.inl:41
void(* on_connect_event_cb_t)(void *udata, uint8_t address, bool connected)
on_connect_event_cb_t is a callback function, which is called every time connection is established or...
Definition: tiny_types.h:232
void(* on_frame_send_cb_t)(void *udata, uint8_t address, const uint8_t *pdata, int size)
on_frame_send_cb_t is a callback function, which is called every time new frame is sent...
Definition: tiny_types.h:223
void tiny_mutex_create(tiny_mutex_t *mutex)
Creates cross-platform mutex.
Definition: cpp_hal.inl:33
void tiny_sleep(uint32_t ms)
Sleeps for specified period in milliseconds.
Definition: arduino_hal.inl:84
uint32_t tiny_millis()
Returns timestamp in milliseconds since system started up.
Definition: arduino_hal.inl:94
void tiny_sleep_us(uint32_t us)
Sleeps for specified period in microseconds.
Definition: arduino_hal.inl:89
int(* read_block_cb_t)(void *pdata, void *buffer, int size)
The function reads data from communication channel.
Definition: tiny_types.h:185
uint8_t tiny_events_check_int(tiny_events_t *event, uint8_t bits, uint8_t clear)
Checks specified bits.
Definition: cpp_hal.inl:65
void tiny_events_destroy(tiny_events_t *events)
Destroys cross platform event group object.
Definition: cpp_hal.inl:57
uint32_t tiny_micros()
Returns timestamp in microseconds since system started up.
Definition: arduino_hal.inl:99
void tiny_events_create(tiny_events_t *events)
Creates cross platform event group object.
Definition: cpp_hal.inl:53
void(* on_frame_read_cb_t)(void *udata, uint8_t address, uint8_t *pdata, int size)
on_frame_read_cb_t is a callback function, which is called every time new frame is received...
Definition: tiny_types.h:213
int(* write_block_cb_t)(void *pdata, const void *buffer, int size)
The function writes data to communication channel port.
Definition: tiny_types.h:174
void(* on_tx_frame_cb_t)(void *udata, const uint8_t *pdata, int size)
on_frame_send_cb_t is a callback function, which is called every time new frame is sent...
Definition: tiny_types.h:203
void tiny_events_clear(tiny_events_t *event, uint8_t bits)
Clears bits for cross-platform event group object.
Definition: cpp_hal.inl:73
Events group type used by Tiny Protocol implementation.
Definition: cpp_hal.h:60
uint8_t tiny_events_wait(tiny_events_t *event, uint8_t bits, uint8_t clear, uint32_t timeout)
Waits until any of specified bits is set or timeout.
Definition: cpp_hal.inl:61
void tiny_log_level(uint8_t level)
Sets logging level if tiny library is compiled with logs.
Definition: tiny_types.c:59
uint8_t tiny_mutex_try_lock(tiny_mutex_t *mutex)
Attempts to lock cross-platform mutex.
Definition: cpp_hal.inl:45