12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef MAIN_KISS_H_
- #define MAIN_KISS_H_
- #define TNC_TAG "kiss"
- #define FRAME_BUFFER_SIZE 1024
- #define KISS_FEND 0xC0
- #define KISS_FESC 0xDB
- #define KISS_TFEND 0xDC
- #define KISS_TFESC 0xDD
- #define KISS_DATAFRAME 0x00
- #define KISS_CMD_TXDELAY 0x01
- #define KISS_CMD_P 0x02
- #define KISS_CMD_SLOTTIME 0x03
- #define KISS_CMD_TXTAIL 0x04
- #define KISS_CMD_FULLDUPLEX 0x05
- #define KISS_CMD_SETHARDWARE 0x06
- #define KISS_CMD_RETURN 0xFF
- typedef void (*kiss_cb_t)(uint8_t *, uint32_t);
- typedef struct {
- uint8_t tnc_number;
- kiss_cb_t rx_callback;
- kiss_cb_t tx_callback;
- } kiss_settings_t;
- typedef enum {
- ESC_MODE = 0,
- FRAME_ASS,
- FRAME_END,
- } KISS_STATE_t;
- typedef enum {
- FRAME_INVALID = 0,
- FRAME_INCOMPLETE,
- FRAME_COMPLETE,
- } FRAME_STATUS_t;
- typedef struct {
- uint8_t buf[FRAME_BUFFER_SIZE];
- uint32_t max_len;
- uint32_t index;
- FRAME_STATUS_t status;
- } kiss_buffer_t;
- typedef struct {
- uint8_t *data;
- uint16_t len;
- } raw_kiss_frame_t;
- typedef struct {
- uint8_t *data;
- uint16_t len;
- } raw_ax25_frame_t;
- void kiss_receive(uint8_t *data, uint16_t len);
- void kiss_init(uint8_t tnc_number, kiss_cb_t tx_cb, kiss_cb_t rx_cb);
- void kiss_transmit(uint8_t type, uint8_t *data, uint32_t len);
- #endif
|