df8oe-master
Łukasz Nidecki 2017-06-03 19:56:07 +02:00
rodzic c8d09f11d5
commit d9c64c2b8e
4 zmienionych plików z 17 dodań i 17 usunięć

Wyświetl plik

@ -65,6 +65,7 @@ uint8_t QAPRSBase::canTransmit(){
*/ */
void QAPRSBase::ax25SendHeaderBegin() { void QAPRSBase::ax25SendHeaderBegin() {
this->enableTransmission(); this->enableTransmission();
timerInterruptHandler();
this->ax25CRC = 0xFFFF; this->ax25CRC = 0xFFFF;
this->currentTone = QAPRSMark; this->currentTone = QAPRSMark;
//this->currentTone = QAPRSSpace; //this->currentTone = QAPRSSpace;
@ -155,20 +156,7 @@ void QAPRSBase::ax25CalcCRC(uint8_t ls_bit) {
*/ */
inline void QAPRSBase::toggleTone() { inline void QAPRSBase::toggleTone() {
this->currentTone = (this->currentTone == QAPRSSpace) ? QAPRSMark : QAPRSSpace; this->currentTone = (this->currentTone == QAPRSSpace) ? QAPRSMark : QAPRSSpace;
TIM2->CR1 &= (uint16_t)(~((uint16_t)TIM_CR1_CEN));
uint16_t used = TIM2->CNT;
this->timer1StartValue = (this->currentTone == QAPRSMark) ? MarkTimerValue : SpaceTimerValue; this->timer1StartValue = (this->currentTone == QAPRSMark) ? MarkTimerValue : SpaceTimerValue;
if (used >= this->timer1StartValue){
this->timerInterruptHandler();
} else {
TIM2->ARR = this->timer1StartValue - used;
TIM2->CNT = 0;
}
TIM2->CR1 |= TIM_CR1_CEN;
} }
/** /**
@ -216,6 +204,7 @@ void QAPRSBase::enableTransmission() {
#endif #endif
radio_set_tx_frequency(APRS_FREQUENCY); radio_set_tx_frequency(APRS_FREQUENCY);
radio_rw_register(0x72, 5, 1);
GPIO_SetBits(GPIOC, radioNSELpin); GPIO_SetBits(GPIOC, radioNSELpin);
radio_rw_register(0x71, 0b00010010, 1); radio_rw_register(0x71, 0b00010010, 1);
spi_deinit(); spi_deinit();

Wyświetl plik

@ -58,7 +58,7 @@ private:
/** /**
* @brief ilosć bajtów synchronizacyjnych do nadania przed zawartoscią pakietu * @brief ilosć bajtów synchronizacyjnych do nadania przed zawartoscią pakietu
*/ */
static const uint8_t ax25HeaderFlagFieldCount1200 = 45; static const uint8_t ax25HeaderFlagFieldCount1200 = 25;
/** /**
* @brief ilosć bajtów synchronizacyjnych do nadania przed zawartoscią pakietu * @brief ilosć bajtów synchronizacyjnych do nadania przed zawartoscią pakietu
*/ */
@ -82,7 +82,7 @@ private:
#elif F_CPU == 8000000UL #elif F_CPU == 8000000UL
static const uint16_t toneSendTime1200 = 785; static const uint16_t toneSendTime1200 = 785;
#else #else
static const uint16_t toneSendTime1200 = 717; //static const uint16_t toneSendTime1200 = 1000000/1200;
#endif #endif
/** /**
* @brief Czas wysyłania podedynczego tonu. W ms. * @brief Czas wysyłania podedynczego tonu. W ms.
@ -182,8 +182,10 @@ public:
private: private:
static const uint16_t toneSendTime = 833; static const uint16_t toneSendTime = 833;
static const uint16_t MarkTimerValue = (uint16_t) ((1000000 / ((1245)*2)) - 1);
static const uint16_t SpaceTimerValue = (uint16_t) ((1000000 / ((2750)*2)) - 1); static const uint16_t toneSendTime1200 = 795;
static const uint16_t MarkTimerValue = 393;
static const uint16_t SpaceTimerValue = 202;
void togglePin(); void togglePin();
uint8_t pin; uint8_t pin;
public: public:

Wyświetl plik

@ -39,6 +39,14 @@ void calcDMH(long x, int8_t* degrees, uint8_t* minutes, uint8_t* h_minutes) {
} }
} }
void aprs_test(){
char packet_buffer[128];
sprintf(packet_buffer,
(":TEST1234567890")
);
qaprs.sendData(packet_buffer);
}
void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage) { void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage) {
char packet_buffer[128]; char packet_buffer[128];
int8_t la_degrees, lo_degrees; int8_t la_degrees, lo_degrees;

1
aprs.h
Wyświetl plik

@ -17,6 +17,7 @@ extern "C" {
uint8_t aprs_is_active(); uint8_t aprs_is_active();
void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage); void aprs_send_position(GPSEntry gpsData, int8_t temperature, uint16_t voltage);
void aprs_change_tone_time(uint16_t x); void aprs_change_tone_time(uint16_t x);
void aprs_test();
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif