radio.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * radio.h
  3. *
  4. * Created on: Oct 11, 2019
  5. * Author: curiousmuch
  6. */
  7. #include <stdint.h>
  8. #ifndef RADIO_H_
  9. #define RADIO_H_
  10. /* Data Structures */
  11. typedef enum {
  12. NOT_CONFIGURED = 0,
  13. AX25,
  14. ARROW_MESH,
  15. ESP_MESH,
  16. } radio_config_t;
  17. typedef enum {
  18. RADIO_IDLE = 0,
  19. RADIO_TX,
  20. RADIO_RX,
  21. } radio_status_t;
  22. typedef struct {
  23. radio_config_t type;
  24. radio_status_t status;
  25. void (*rx_cb)(uint8_t *, uint32_t);
  26. void (*tx_cb)(uint8_t *, uint32_t);
  27. } radio_param_t;
  28. typedef struct {
  29. uint8_t tx_delay;
  30. uint8_t tx_tail;
  31. uint32_t sample_rate;
  32. uint32_t symbol0_freq;
  33. uint32_t symbol1_freq;
  34. uint8_t *rx_buf;
  35. uint32_t rx_buf_len;
  36. void (*rx_cb)(uint8_t *, uint32_t);
  37. uint8_t cpu_core;
  38. } ax25_param_t;
  39. /* Public Functions */
  40. void radio_init(radio_config_t type, void *settings);
  41. void radio_set_frequency(uint32_t);
  42. void radio_set_power(int8_t);
  43. int8_t radio_set_cs(void);
  44. int8_t radio_get_cs(void);
  45. int8_t radio_get_rssi(void);
  46. int8_t radio_get_sample(void);
  47. void radio_packet_rx(void *settings);
  48. void radio_packet_tx(uint8_t *data, int32_t len, void *settings);
  49. #endif /* COMPONENTS_RADIO_INCLUDE_RADIO_H_ */