Files
@ a127e9133034
Branch filter:
Location: FeatherHAB/wsprhab/src/main.c - annotation
a127e9133034
2.4 KiB
text/plain
Attempt to get new GPS lib working
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 4202475a7575 4202475a7575 4202475a7575 4202475a7575 0d9900312165 0d9900312165 c1b1dfc6c2f4 0d9900312165 c1b1dfc6c2f4 0d9900312165 a127e9133034 0d9900312165 0d9900312165 23ecc15c694d 0d9900312165 0d9900312165 0d9900312165 0d9900312165 0d9900312165 0dd5c923fdea 4202475a7575 0d9900312165 aa624684a65e aa624684a65e c5bc128e44a6 aa624684a65e aa624684a65e aa624684a65e dd3b59fcb7a7 0d9900312165 4ffdc5eab0ff 4ffdc5eab0ff 4ffdc5eab0ff 23ecc15c694d 0d9900312165 0d9900312165 c5bc128e44a6 0d9900312165 21759af9d2ad 21759af9d2ad 4ffdc5eab0ff b295af18d965 e1db5d4a8be4 4ffdc5eab0ff 21759af9d2ad 21759af9d2ad c1b1dfc6c2f4 dd3b59fcb7a7 0d9900312165 0d9900312165 dd3b59fcb7a7 b295af18d965 f76c13fc8299 dd3b59fcb7a7 e1db5d4a8be4 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 dd3b59fcb7a7 e1db5d4a8be4 b295af18d965 a127e9133034 a127e9133034 a127e9133034 dd3b59fcb7a7 21759af9d2ad a127e9133034 a127e9133034 a127e9133034 a127e9133034 a127e9133034 a127e9133034 21759af9d2ad 21759af9d2ad f76c13fc8299 f76c13fc8299 aa624684a65e e1db5d4a8be4 0d9900312165 a127e9133034 0d9900312165 0d9900312165 2dcb56fc814b 0d9900312165 a127e9133034 a127e9133034 0d9900312165 0d9900312165 4ffdc5eab0ff aa624684a65e 0d9900312165 0d9900312165 0d9900312165 0d9900312165 4ffdc5eab0ff 4ffdc5eab0ff | //
// WSPRHAB: Minimal high-altitude balloon tracker with WSPR telemetry
//
#include "stm32f0xx_hal.h"
#include "adc.h"
#include "system.h"
#include "i2c.h"
#include "uart.h"
#include "gpio.h"
#include "wspr.h"
#include "gps.h"
int main(void)
{
HAL_Init();
sysclk_init();
gpio_init();
adc_init();
i2c_init();
gps_init();
//jtencode_init();
HAL_Delay(300);
//gps_poweroff();
// Disable ICs
HAL_GPIO_WritePin(OSC_NOTEN, 1);
HAL_GPIO_WritePin(TCXO_EN, 0);
uint32_t led_timer = HAL_GetTick();
uint32_t last_gps = HAL_GetTick();
uint32_t last_wspr = HAL_GetTick(); //0xfffff; // start immediately.
led_blink(4);
uint8_t lastMinute = 0;
uint16_t blink_rate = 250;
gps_poweron();
HAL_Delay(500);
gps_update_position();
while (1)
{
// TODO: Trigger this when RTC thinks its time to go
if(HAL_GetTick() - last_wspr > 500)
{
switch(gps_getstate())
{
case GPS_STATE_ACQUIRING:
blink_rate = 250;
break;
case GPS_STATE_FRESHFIX:
blink_rate = 50;
break;
case GPS_STATE_STALEFIX:
case GPS_STATE_NOFIX:
gps_acquirefix();
blink_rate = 500;
break;
}
uint8_t hour, minute, second;
gps_update_time(&hour, &minute, &second);
// EMZ TODO: this needs to trigger off of RTC minute, not GPS minute
// If last minute was odd and this minute is even (transition)
// if(lastMinute%2 == 1 && minute%2 == 0)
// {
// // Wait until the first second of the minute
// HAL_Delay(1000);
// wspr_transmit();
// }
lastMinute = minute;
last_wspr = HAL_GetTick();
}
if(HAL_GetTick() - led_timer > blink_rate)
{
HAL_GPIO_TogglePin(LED_BLUE);
led_timer = HAL_GetTick();
}
if(HAL_GetTick() - last_gps > 10)
{
//gps_process();
gps_update_position();
last_gps = HAL_GetTick();
}
//enter_sleep();
}
}
|