12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /*
- * radio.h
- *
- * Created on: Oct 11, 2019
- * Author: curiousmuch
- */
- #include <stdint.h>
- #ifndef RADIO_H_
- #define RADIO_H_
- #include "freertos/task.h"
- /* Data Structures */
- typedef enum {
- NOT_CONFIGURED = 0,
- AX25,
- ARROW_NARROWBAND,
- ESP_MESH,
- } radio_config_t;
- typedef enum {
- RADIO_IDLE = 0,
- RADIO_TX,
- RADIO_RX,
- } radio_status_t;
- // internal radio data structure
- typedef struct {
- radio_config_t type;
- radio_status_t status;
- void (*rx_cb)(uint8_t *, uint32_t);
- void (*tx_cb)(void);
- TaskHandle_t tx_task;
- TaskHandle_t rx_task;
- } radio_param_t;
- // holds all the settings for AX25
- // style communications used typically
- // on 2M band
- typedef struct {
- uint8_t tx_delay;
- uint8_t tx_tail;
- uint32_t sample_rate;
- uint32_t symbol0_freq;
- uint32_t symbol1_freq;
- uint8_t *rx_buf;
- uint32_t rx_buf_len;
- void (*rx_cb)(uint8_t *, uint32_t);
- void (*tx_cb)(void);
- uint8_t cpu_core;
- } ax25_param_t;
- /* Public Functions */
- void radio_init(radio_config_t type, void *settings);
- void radio_reinit(radio_config_t type, void *settings);
- void radio_set_frequency(uint32_t);
- void radio_set_power(int8_t);
- uint8_t radio_get_cs(void);
- int8_t radio_get_rssi(void);
- int8_t radio_get_sample(void);
- void radio_packet_rx(void *settings);
- void radio_packet_tx(uint8_t *data, int32_t len, void *settings);
- #endif /* COMPONENTS_RADIO_INCLUDE_RADIO_H_ */
|