Changeset - f76c13fc8299
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2016-03-07 20:00:41
ez@ethanzonca.com
Cycle through different tones son the si5351
1 file changed with 43 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/main.c
Show inline comments
 
@@ -11,12 +11,45 @@
 
 
void sysclk_init(void);
 
#define WSPR_DEFAULT_FREQ 14097100UL
 
#define WSPR_TONE_SPACING 146 // ~1.46 Hz
 
#define WSPR_CTC 10672 // CTC value for WSPR
 
 
char call[7] = "N0CALL";
 
char loc[5] = "AA00";
 
uint8_t dbm = 27;
 
uint8_t tx_buffer[255];
 
 
 
uint32_t freq = WSPR_DEFAULT_FREQ;
 
uint8_t symbol_count = WSPR_SYMBOL_COUNT;
 
uint16_t ctc = WSPR_CTC;
 
uint16_t tone_spacing = WSPR_TONE_SPACING;
 
volatile uint8_t proceed = 0;
 
 
void encode_wspr(void)
 
{
 
    uint8_t i;
 
    //for(i=0; i<255; i++)
 
    //    tx_buffer[i] = 0;
 
 
    wspr_encode(call, loc, dbm, tx_buffer);
 
 
 
    //si5351_output_enable(SI5351_CLK0, 1);
 
 
    for(i=0; i<symbol_count; i++)
 
    {
 
 
        uint32_t freq2 = (freq * 100) + (tx_buffer[i] * tone_spacing);
 
        si5351_set_freq(freq2, 0, SI5351_CLK0);
 
 
          //si5351_set_freq((freq * 100) + (tx_buffer[i] * tone_spacing), 0, SI5351_CLK0);
 
          HAL_Delay(300);
 
          //proceed = 0;
 
          //while(!proceed);
 
    }
 
}
 
 
int main(void)
 
{
 
    HAL_Init();
 
@@ -44,18 +77,26 @@ int main(void)
 
    si5351_output_enable(SI5351_CLK0, 1);
 
    //si5351_pll_reset(SI5351_PLLA);
 
 
    wspr_encode(call, loc, dbm, tx_buffer);
 
    //wspr_encode(call, loc, dbm, tx_buffer);
 
 
    encode_wspr();
 
 
    HAL_Delay(1000);
 
 
    uint32_t led_timer = HAL_GetTick();
 
    uint32_t last_gps  = HAL_GetTick();
 
    uint32_t last_wspr  = HAL_GetTick();
 
 
    while (1)
 
    {
 
        if(HAL_GetTick() - last_wspr > 6000)
 
        {
 
            last_wspr = HAL_GetTick();
 
        }
 
        
 
        if(HAL_GetTick() - led_timer > 100)
 
        {
 
            HAL_GPIO_TogglePin(LED_BLUE);
 
            //HAL_GPIO_TogglePin(LED_BLUE);
 
            led_timer = HAL_GetTick();
 
        }
 
        if(HAL_GetTick() - last_gps > 100)
0 comments (0 inline, 0 general)