pocketbus.h File Reference
Basical functions to use pocketBus protocol. More...
#include "cfg/cfg_pocketbus.h"#include <cfg/compiler.h>#include <algo/rotating_hash.h>#include <io/kfile.h>Go to the source code of this file.
Data Structures | |
| struct | PocketBusHdr |
| Header of pocketBus messages. More... | |
| struct | PocketBusCtx |
| pocketBus context structure. More... | |
| struct | PocketMsg |
| Structure holding pocketBus message parameters. More... | |
Defines | |
| #define | POCKETBUS_BROADCAST_ADDR 0xFFFF |
| pocketBus broadcast address | |
| #define | POCKETBUS_STX 0x02 |
| pocketBus special characters definitions. | |
| #define | POCKETBUS_ETX 0x03 |
| pocketBus special characters definitions. | |
| #define | POCKETBUS_ESC 0x1B |
| pocketBus special characters definitions. | |
| #define | POCKETBUS_ACK 0x06 |
| pocketBus special characters definitions. | |
| #define | POCKETBUS_NAK 0x15 |
| pocketBus special characters definitions. | |
Typedefs | |
| typedef uint16_t | pocketbus_len_t |
| Type for pocketBus length. | |
| typedef uint16_t | pocketbus_addr_t |
| Type for pocketBus addresses. | |
Functions | |
| void | pocketbus_putchar (struct PocketBusCtx *ctx, uint8_t c) |
| Send a character over pocketBus channel stream, handling escape mode. | |
| void | pocketbus_begin (struct PocketBusCtx *ctx, pocketbus_addr_t addr) |
| Send pocketBus packet header. | |
| void | pocketbus_write (struct PocketBusCtx *ctx, const void *_data, size_t len) |
| Send buffer _data over bus, handling escape. | |
| void | pocketbus_end (struct PocketBusCtx *ctx) |
| Send pocketBus packet tail. | |
| void | pocketbus_send (struct PocketBusCtx *ctx, pocketbus_addr_t addr, const void *data, size_t len) |
| Send buffer of data to address addr with a pocketBus packet over channel stream. | |
| bool | pocketbus_recv (struct PocketBusCtx *ctx, struct PocketMsg *msg) |
| Try to read a packet from the pocketBus. | |
| void | pocketbus_init (struct PocketBusCtx *ctx, struct KFile *fd) |
| Initialize pocketBus protocol handler. | |
| STATIC_ASSERT (sizeof(pocketbus_addr_t)==sizeof(uint16_t)) | |
| This ensure that endianess convertion functions work on the right data size. | |
Detailed Description
Basical functions to use pocketBus protocol.
Definition in file pocketbus.h.
Function Documentation
| bool pocketbus_recv | ( | struct PocketBusCtx * | ctx, | |
| struct PocketMsg * | msg | |||
| ) |
Try to read a packet from the pocketBus.
- Returns:
- true if a packet is received, false otherwise.
Definition at line 171 of file pocketbus.c.
