Tiny protocol Types.
More...
#include "include/arduino_hal.h"
#include <stdint.h>
Go to the source code of this file.
|
typedef int(* | write_block_cb_t) (void *pdata, const void *buffer, int size) |
|
typedef int(* | read_block_cb_t) (void *pdata, void *buffer, int size) |
|
typedef void(* | on_frame_cb_t) (void *handle, uint16_t uid, uint8_t *pdata, int size) |
|
Tiny protocol Types.
This is Tiny protocol implementation for microcontrollers
◆ on_frame_cb_t
typedef void(* on_frame_cb_t) (void *handle, uint16_t uid, uint8_t *pdata, int size) |
on_frame_cb_t is a callback function, which is called every time new frame is received, or sent. refer to tiny_set_callbacks
- Parameters
-
handle | - handle of Tiny. |
uid | - UID of the received frame or sent frame (if uids are enabled). |
pdata | - data received over Tiny Protocol. |
size | - size of data received. |
- Returns
- None.
- See also
- tiny_set_callbacks
◆ read_block_cb_t
typedef int(* read_block_cb_t) (void *pdata, void *buffer, int size) |
The function reads data from communication channel.
- Parameters
-
pdata | - pointer to user private data. - absent in Arduino version |
buffer | - pointer to a buffer to read data to from the channel. |
size | - maximum size of the buffer. |
- See also
- write_block_cb_t
- Returns
- the function must return negative value in case of error or number of bytes actually read or zero.
◆ write_block_cb_t
typedef int(* write_block_cb_t) (void *pdata, const void *buffer, int size) |
The function writes data to communication channel port.
- Parameters
-
pdata | - pointer to user private data - absent in Arduino version |
buffer | - pointer to the data to send to channel. |
size | - size of data to write. |
- See also
- read_block_cb_t
- Returns
- the function must return negative value in case of error or number of bytes written or zero.
◆ tiny_events_check_int()
uint8_t tiny_events_check_int |
( |
tiny_events_t * |
event, |
|
|
uint8_t |
bits, |
|
|
uint8_t |
clear |
|
) |
| |
Checks specified bits. This API can be used in interrupt handlers
- Parameters
-
event | pointer to tiny_event_t variable. |
bits | bits to wait for |
clear | flags EVENT_BITS_CLEAR or EVENT_BITS_LEAVE |
- Returns
- 0 if no any of requested bits are set list of bits from the input argument, which were set
◆ tiny_events_clear()
void tiny_events_clear |
( |
tiny_events_t * |
event, |
|
|
uint8_t |
bits |
|
) |
| |
Clears bits for cross-platform event group object.
- Parameters
-
event | pointer to tiny_event_t variable. |
bits | bits to clear |
◆ tiny_events_create()
void tiny_events_create |
( |
tiny_events_t * |
events | ) |
|
Creates cross platform event group object.
- Parameters
-
events | pointer to tiny_event_t variable. |
◆ tiny_events_destroy()
void tiny_events_destroy |
( |
tiny_events_t * |
events | ) |
|
Destroys cross platform event group object.
- Parameters
-
events | pointer to tiny_event_t variable. |
◆ tiny_events_set()
void tiny_events_set |
( |
tiny_events_t * |
event, |
|
|
uint8_t |
bits |
|
) |
| |
Sets bits for cross-platform event group object.
- Parameters
-
event | pointer to tiny_event_t variable. |
bits | bits to set |
◆ tiny_events_wait()
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.
- Parameters
-
event | pointer to tiny_event_t variable. |
bits | bits to wait for |
clear | flags EVENT_BITS_CLEAR or EVENT_BITS_LEAVE |
timeout | timeout in milliseconds to wait |
- Returns
- 0 on timeout list of bits from the input argument, which were set
◆ tiny_log_level()
void tiny_log_level |
( |
uint8_t |
level | ) |
|
Sets logging level if tiny library is compiled with logs
- Parameters
-
level | log level to set, or 0 to disable logs |
◆ tiny_millis()
Returns timestamp in milliseconds since system started up.
◆ tiny_mutex_create()
void tiny_mutex_create |
( |
tiny_mutex_t * |
mutex | ) |
|
Creates cross-platform mutex.
- Parameters
-
mutex | pointer to tiny_mutex_t variable. |
◆ tiny_mutex_destroy()
void tiny_mutex_destroy |
( |
tiny_mutex_t * |
mutex | ) |
|
Destroys cross-platform mutex.
- Parameters
-
mutex | pointer to tiny_mutex_t variable. |
◆ tiny_mutex_lock()
void tiny_mutex_lock |
( |
tiny_mutex_t * |
mutex | ) |
|
Locks cross-platform mutex.
- Parameters
-
mutex | pointer to tiny_mutex_t variable. |
◆ tiny_mutex_try_lock()
uint8_t tiny_mutex_try_lock |
( |
tiny_mutex_t * |
mutex | ) |
|
Attempts to lock cross-platform mutex.
- Parameters
-
mutex | pointer to tiny_mutex_t variable. |
- Returns
- 0 if failed to lock 1 if success
◆ tiny_mutex_unlock()
void tiny_mutex_unlock |
( |
tiny_mutex_t * |
mutex | ) |
|
Unlocks cross-platform mutex.
- Parameters
-
mutex | pointer to tiny_mutex_t variable. |
◆ tiny_sleep()
void tiny_sleep |
( |
uint32_t |
ms | ) |
|
Sleeps for specified period in milliseconds.
- Parameters
-
ms | time in milliseconds to sleep |