kopia lustrzana https://github.com/mikaelnousiainen/RS41ng
More code cleanup
rodzic
f8ed6c1346
commit
f34b20c3f2
|
@ -101,7 +101,7 @@ static void gpio_init()
|
|||
GPIO_Init(BANK_SHUTDOWN, &gpio_init);
|
||||
#ifdef DFM17
|
||||
GPIO_SetBits(BANK_SHUTDOWN, PIN_SHUTDOWN); // Pull high to keep BMS from removing battery power after startup
|
||||
#endif //DFM17
|
||||
#endif
|
||||
|
||||
// Battery voltage (analog)
|
||||
gpio_init.GPIO_Pin = PIN_VOLTAGE;
|
||||
|
@ -142,10 +142,10 @@ static void dma_adc_init()
|
|||
|
||||
#ifdef RS41
|
||||
dma_init.DMA_BufferSize = 2;
|
||||
#endif //RS41
|
||||
#endif
|
||||
#ifdef DFM17
|
||||
dma_init.DMA_BufferSize = 1;
|
||||
#endif //DFM17
|
||||
#endif
|
||||
dma_init.DMA_DIR = DMA_DIR_PeripheralSRC;
|
||||
dma_init.DMA_M2M = DMA_M2M_Disable;
|
||||
dma_init.DMA_MemoryBaseAddr = (uint32_t) &dma_buffer_adc;
|
||||
|
@ -171,19 +171,19 @@ static void dma_adc_init()
|
|||
adc_init.ADC_DataAlign = ADC_DataAlign_Right;
|
||||
#ifdef RS41
|
||||
adc_init.ADC_NbrOfChannel = 2;
|
||||
#endif //RS41
|
||||
#endif
|
||||
#ifdef DFM17
|
||||
adc_init.ADC_NbrOfChannel = 1;
|
||||
#endif //DFM17
|
||||
#endif
|
||||
ADC_Init(ADC1, &adc_init);
|
||||
|
||||
ADC_RegularChannelConfig(ADC1, CHANNEL_VOLTAGE, 1, ADC_SampleTime_28Cycles5);
|
||||
#ifdef RS41
|
||||
ADC_RegularChannelConfig(ADC1, CHANNEL_BUTTON, 2, ADC_SampleTime_28Cycles5);
|
||||
#endif //RS41
|
||||
#endif
|
||||
#ifdef DFM17
|
||||
// Not using ADC for button on DFM17
|
||||
#endif //DFM17
|
||||
#endif
|
||||
|
||||
// ADC1 DMA requests are routed to DMA1 Channel1
|
||||
ADC_DMACmd(ADC1, ENABLE);
|
||||
|
@ -209,21 +209,21 @@ uint16_t system_get_button_adc_value()
|
|||
{
|
||||
#ifdef RS41
|
||||
return (uint16_t) dma_buffer_adc[1];
|
||||
#endif //RS41
|
||||
#endif
|
||||
#ifdef DFM17
|
||||
// Fake being an ADC. Take the binary value and if non-zero, make it trigger button-down
|
||||
return ( ((int) GPIO_ReadInputDataBit(BANK_BUTTON,PIN_BUTTON)) * 2100);
|
||||
#endif //DFM17
|
||||
#endif
|
||||
}
|
||||
|
||||
void system_shutdown()
|
||||
{
|
||||
#ifdef RS41
|
||||
GPIO_SetBits(BANK_SHUTDOWN, PIN_SHUTDOWN);
|
||||
#endif // RS41
|
||||
#endif
|
||||
#ifdef DFM17
|
||||
GPIO_ResetBits(BANK_SHUTDOWN, PIN_SHUTDOWN);
|
||||
#endif //DFM17
|
||||
#endif
|
||||
}
|
||||
|
||||
void system_handle_button()
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#include "config.h"
|
||||
|
||||
#ifdef RS41
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -27,6 +30,7 @@
|
|||
static bool si4032_use_dma = false;
|
||||
|
||||
// TODO: Add support for multiple APRS baud rates
|
||||
// This delay is for RS41 radiosondes
|
||||
#define symbol_delay_bell_202_1200bps_us 823
|
||||
|
||||
static volatile bool radio_si4032_state_change = false;
|
||||
|
@ -403,3 +407,4 @@ void radio_init_si4032()
|
|||
pwm_dma_init();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -18,11 +18,8 @@
|
|||
#define CW_SYMBOL_RATE_MULTIPLIER 4
|
||||
|
||||
// TODO: Add support for multiple APRS baud rates
|
||||
#if defined(RS41)
|
||||
#define symbol_delay_bell_202_1200bps_us 823
|
||||
#elif defined(DFM17)
|
||||
// This delay is for DFM-17 radiosondes
|
||||
#define symbol_delay_bell_202_1200bps_us 820
|
||||
#endif
|
||||
|
||||
static volatile bool radio_si4063_state_change = false;
|
||||
static volatile uint32_t radio_si4063_freq = 0;
|
||||
|
|
Ładowanie…
Reference in New Issue