Timer tick now activated for each telemetry burst

geofence_dev
Richard Meadows 2015-03-02 19:35:16 +00:00
rodzic cbb004db7e
commit fa4efbc79a
2 zmienionych plików z 21 dodań i 12 usunięć

Wyświetl plik

@ -315,15 +315,6 @@ int main(void)
/* Initialise Si4060 interface */ /* Initialise Si4060 interface */
si_trx_init(); si_trx_init();
/* Timer 0 clocks out data */
#ifdef RTTY
timer0_tick_init(50);
#endif
#ifdef CONTESTIA
timer0_tick_init(31.25);
#endif
led_on(); led_on();
while (1) { while (1) {

Wyświetl plik

@ -127,11 +127,17 @@ int telemetry_start(enum telemetry_t type) {
telemetry_index = 0; telemetry_index = 0;
/* Initialise first block / character */ /* Initialise first block / character */
telemetry_string_length = TELEMETRY_STRING_MAX; telemetry_string_length = TELEMETRY_STRING_MAX;
/* Setup timer tick */
switch(telemetry_type) {
case TELEMETRY_CONTESTIA:
timer0_tick_init(31.25);
break;
case TELEMETRY_RTTY:
timer0_tick_init(50);
break;
}
return 0; /* Success */ return 0; /* Success */
} else { } else {
@ -161,6 +167,9 @@ uint8_t is_telemetry_finished(void) {
/* Turn radio off */ /* Turn radio off */
si_trx_off(); radio_on = 0; si_trx_off(); radio_on = 0;
/* De-init timer */
timer0_tick_deinit();
return 1; return 1;
} }
return 0; return 0;
@ -285,6 +294,15 @@ void timer0_tick_init(float frequency)
tc_enable(TC0); tc_enable(TC0);
tc_start_counter(TC0); tc_start_counter(TC0);
} }
/**
* Disables the timer
*/
void timer0_tick_deinit()
{
tc_stop_counter(TC0);
tc_disable(TC0);
}
/** /**
* Called at the symbol rate * Called at the symbol rate