Changeset - 2fa25ca2db21
[Not reviewed]
default
0 2 0
Ethan Zonca - 9 years ago 2016-10-13 22:08:54
ez@ethanzonca.com
Don't zero out everything in position, because we need some of that data; fix timer clocking
2 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/gps.c
Show inline comments
 
@@ -213,54 +213,54 @@ void gps_poweron(void)
 
//    //gps_sendubx(enable_powersave, 10);
 
//    res = HAL_UART_Transmit(uart_gethandle(), enable_powersave, 10, 100);
 
//
 
//
 
//    // Set dynamic model 6 (<1g airborne platform)
 
//    uint8_t airborne_model[] = { 0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, 0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xDC };
 
//    //gps_sendubx(airborne_model, sizeof(airborne_model)/sizeof(uint8_t));
 
//    res = HAL_UART_Transmit(uart_gethandle(), airborne_model, sizeof(airborne_model)/sizeof(uint8_t), 100);
 

	
 

	
 

	
 

	
 

	
 
    // Begin DMA reception
 
    //HAL_UART_Receive_DMA(uart_gethandle(), nmeaBuffer, NMEABUFFER_SIZE);
 

	
 
    gpson = 1;
 
}
 

	
 

	
 
// Power off GPS module
 
void gps_poweroff(void)
 
{
 
    // NOTE: pchannel
 
	position.hour = 0;
 
	position.minute = 0;
 
	position.second = 0;
 
	position.altitude = 0;
 
	position.latitude = 0;
 
	position.longitude = 0;
 
	position.day = 0;
 
	position.month = 0;
 
	position.fixtype = 0;
 
	position.valid = 0;
 
//	position.hour = 0;
 
//	position.minute = 0;
 
//	position.second = 0;
 
//	position.altitude = 0;
 
//	position.latitude = 0;
 
//	position.longitude = 0;
 
//	position.day = 0;
 
//	position.month = 0;
 
//	position.fixtype = 0;
 
//	position.valid = 0;
 
	position.pdop = 0;
 
	position.sats_in_solution = 0;
 
	position.speed = 0;
 
//	position.speed = 0;
 

	
 
    uart_deinit();
 
    HAL_GPIO_WritePin(GPS_NOTEN, 1);
 
    gpson = 0;
 
}
 

	
 
gps_data_t* gps_getdata(void)
 
{
 
    return &position;
 
}
 

	
 
uint8_t gps_ison(void)
 
{
 
    return gpson;
 
}
 

	
 
// vim:softtabstop=4 shiftwidth=4 expandtab 
src/wspr.c
Show inline comments
 
@@ -38,49 +38,49 @@ void wspr_init(void)
 
// Do anything needed to prepare for sleep
 
void wspr_sleep(void)
 
{
 
    HAL_TIM_Base_Stop_IT(&htim1);
 
}
 

	
 
void wspr_wakeup(void)
 
{
 
    HAL_TIM_Base_Start_IT(&htim1);
 
}
 

	
 

	
 
// Bring up TCXO and oscillator IC
 
void wspr_transmit(uint8_t* grid_locator)
 
{
 
	// Copy 4 digit grid locator to local buffer; null terminate
 
	for(uint8_t i=0; i<4; i++)
 
		loc[i] = grid_locator[i];
 
	loc[4] = '\0';
 

	
 

	
 
    // Start timer for WSPR
 
    __TIM1_CLK_ENABLE();
 
    htim1.Instance = TIM1;
 
    htim1.Init.Prescaler = 512; // gives 64uS ticks from 8MHz ahbclk
 
    htim1.Init.Prescaler = 512 / 4; // FIXED gives 64us ticks from 2mhz clock // gives 64uS ticks from 8MHz ahbclk
 
    htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
 
    htim1.Init.Period = ctc; // Count up to this value (how many 64uS ticks per symbol)
 
    htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
 
    htim1.Init.RepetitionCounter = 0;
 
    HAL_TIM_Base_Init(&htim1);
 
    HAL_TIM_Base_Start_IT(&htim1);
 
    HAL_NVIC_SetPriority(TIM1_BRK_UP_TRG_COM_IRQn, 0, 0);
 
    HAL_NVIC_EnableIRQ(TIM1_BRK_UP_TRG_COM_IRQn);
 

	
 

	
 
    HAL_GPIO_WritePin(OSC_NOTEN, 0);
 
    HAL_GPIO_WritePin(TCXO_EN, 1);
 
    HAL_Delay(100);
 

	
 
    // Bring up the chip
 
    i2c_init();
 
    si5351_init(i2c_get(), SI5351_CRYSTAL_LOAD_8PF, 0);
 
    si5351_set_correction(0);
 
    //si5351_set_pll(SI5351_PLL_FIXED, SI5351_PLLA);
 
    //si5351_set_ms_source(SI5351_CLK0, SI5351_PLLA);
 
    si5351_set_freq(WSPR_DEFAULT_FREQ * 100, 0, SI5351_CLK0);
 
    si5351_drive_strength(SI5351_CLK0, SI5351_DRIVE_8MA); // Set for max power if desired (8ma max)
 
    si5351_output_enable(SI5351_CLK0, 1);
 
    //si5351_pll_reset(SI5351_PLLA);
0 comments (0 inline, 0 general)