RS41ng/src/radio_internal.h

87 wiersze
2.1 KiB
C
Czysty Zwykły widok Historia

#ifndef __RADIO_INTERNAL_H
#define __RADIO_INTERNAL_H
#include <stdint.h>
#include "payload.h"
#include "codecs/jtencode/jtencode.h"
#include "codecs/fsk/fsk.h"
typedef enum _radio_type {
RADIO_TYPE_SI4032 = 1,
RADIO_TYPE_SI5351,
Graw DFM-17 radiosonde support (#61) * Initial plumbing for DFM17 (#54) * Implementing Si4063 radio chip support for DFM17 sonde. Work in progress. * Add an error to indicate that the code does not work yet * Removed copyrighted docs from documentation and provided links instead (#55) * Fix SPI bus initialization for DFM17. Trying to make Si4063 SPI communication work (in progress). Fix LED bit polarity. * Set DFM17 clocks correctly to 24 MHz * Still trying to fix Si4063 SPI communication, no luck * Add clearing of SPI overrun status flag to make Si4063 comm work properly in DFM17. Not sure about the reason this is required. * Fix bug when setting Si4063 frequency. Remove unnecessary GPS debug and delays. Add Si4063 debug printout. Find a suitable frequency offset multiplier to achieve 270 Hz tone spacing for Horus 4FSK. * Add some known good Si4063 configuration values. Implement direct GPIO-based modulation for Si4063 that allows support for CW now. * DFM-17 APRS work (#60) * Modify for APRS on DFM17 * Clean up Si4063 APRS work and make APRS deviation configurable * Add documentation for DFM-17 * Add a note about the DFM-17 connector * More work on docs and config for DFM-17 * Docs * Mor work on config * Fix RS41 URL * Added info about high-altitude balloon flights * Fix typo * More code cleanup * Update authors * Improve DFM-17 docs * Added a timepulse routine for DFM17 and also a millis() routine. Working toward clock calibration. * More refinements to the HCI calibration * Cleaned up clock calibration code and integrated into the main radio loop. Also added APRS telemetry for calibration. * Added logic to (hopefully) avoid over-calibration if there is an errant timepulse. * Clean up DFM-17 clock calibration implementation and make RS41 compile properly * Adjust README * Add notes about DFM-17 clock calibration * Fix typo * Add DFM-17 note about clock calibration to the top of the README * Text style * Working on README * Working on README * Move datasheet links to main README * Markdown styling * Improve config file structure * Remove unnecessary comments --------- Co-authored-by: Mike Hojnowski <kd2eat@gmail.com>
2023-10-15 09:38:05 +00:00
RADIO_TYPE_SI4063,
} radio_type;
typedef enum _radio_data_mode {
RADIO_DATA_MODE_CW = 1,
RADIO_DATA_MODE_PIP,
RADIO_DATA_MODE_RTTY,
RADIO_DATA_MODE_APRS_1200,
RADIO_DATA_MODE_HORUS_V1,
RADIO_DATA_MODE_HORUS_V2,
RADIO_DATA_MODE_WSPR,
RADIO_DATA_MODE_FT8,
RADIO_DATA_MODE_JT65,
RADIO_DATA_MODE_JT4,
RADIO_DATA_MODE_JT9,
RADIO_DATA_MODE_FSQ_2,
RADIO_DATA_MODE_FSQ_3,
RADIO_DATA_MODE_FSQ_4_5,
RADIO_DATA_MODE_FSQ_6,
} radio_data_mode;
typedef struct _radio_transmit_entry {
bool enabled;
bool end;
radio_type radio_type;
radio_data_mode data_mode;
uint16_t time_sync_seconds;
uint16_t time_sync_seconds_offset;
uint32_t frequency;
uint8_t tx_power;
uint32_t symbol_rate;
char **messages;
uint8_t current_message_index;
uint8_t message_count;
uint8_t current_transmit_index;
uint8_t transmit_count;
payload_encoder *payload_encoder;
fsk_encoder_api *fsk_encoder_api;
fsk_encoder fsk_encoder;
} radio_transmit_entry;
typedef struct _radio_module_state {
volatile bool radio_transmission_active;
volatile bool radio_transmission_finished;
volatile bool radio_transmit_next_symbol_flag;
volatile uint32_t radio_symbol_count_interrupt;
volatile uint32_t radio_symbol_count_loop;
volatile bool radio_dma_transfer_active;
volatile bool radio_manual_transmit_active;
volatile bool radio_interrupt_transmit_active;
fsk_tone *radio_current_fsk_tones;
int8_t radio_current_fsk_tone_count;
uint32_t radio_current_tone_spacing_hz_100;
uint32_t radio_current_symbol_rate;
uint32_t radio_current_symbol_delay_ms_100;
} radio_module_state;
extern radio_transmit_entry *radio_current_transmit_entry;
extern radio_module_state radio_shared_state;
Graw DFM-17 radiosonde support (#61) * Initial plumbing for DFM17 (#54) * Implementing Si4063 radio chip support for DFM17 sonde. Work in progress. * Add an error to indicate that the code does not work yet * Removed copyrighted docs from documentation and provided links instead (#55) * Fix SPI bus initialization for DFM17. Trying to make Si4063 SPI communication work (in progress). Fix LED bit polarity. * Set DFM17 clocks correctly to 24 MHz * Still trying to fix Si4063 SPI communication, no luck * Add clearing of SPI overrun status flag to make Si4063 comm work properly in DFM17. Not sure about the reason this is required. * Fix bug when setting Si4063 frequency. Remove unnecessary GPS debug and delays. Add Si4063 debug printout. Find a suitable frequency offset multiplier to achieve 270 Hz tone spacing for Horus 4FSK. * Add some known good Si4063 configuration values. Implement direct GPIO-based modulation for Si4063 that allows support for CW now. * DFM-17 APRS work (#60) * Modify for APRS on DFM17 * Clean up Si4063 APRS work and make APRS deviation configurable * Add documentation for DFM-17 * Add a note about the DFM-17 connector * More work on docs and config for DFM-17 * Docs * Mor work on config * Fix RS41 URL * Added info about high-altitude balloon flights * Fix typo * More code cleanup * Update authors * Improve DFM-17 docs * Added a timepulse routine for DFM17 and also a millis() routine. Working toward clock calibration. * More refinements to the HCI calibration * Cleaned up clock calibration code and integrated into the main radio loop. Also added APRS telemetry for calibration. * Added logic to (hopefully) avoid over-calibration if there is an errant timepulse. * Clean up DFM-17 clock calibration implementation and make RS41 compile properly * Adjust README * Add notes about DFM-17 clock calibration * Fix typo * Add DFM-17 note about clock calibration to the top of the README * Text style * Working on README * Working on README * Move datasheet links to main README * Markdown styling * Improve config file structure * Remove unnecessary comments --------- Co-authored-by: Mike Hojnowski <kd2eat@gmail.com>
2023-10-15 09:38:05 +00:00
extern uint32_t precalculated_pwm_periods[];
#endif