mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Update Setup.c
This commit is contained in:
@@ -12,9 +12,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define ADC_NORM_CHANNELS 2
|
#define ADC_NORM_CHANNELS 2
|
||||||
#define ADC_NORM_SAMPLES 32
|
#define ADC_NORM_SAMPLES 32
|
||||||
uint16_t
|
uint16_t ADCReadings[ADC_NORM_SAMPLES *
|
||||||
ADCReadings[ADC_NORM_SAMPLES *
|
ADC_NORM_CHANNELS]; // room for 32 lots of the pair of readings
|
||||||
ADC_NORM_CHANNELS]; // room for 32 lots of the pair of readings
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
void setup_gpio();
|
void setup_gpio();
|
||||||
@@ -94,9 +93,9 @@ void setup_dma() {
|
|||||||
dma_deinit(DMA0, DMA_CH0);
|
dma_deinit(DMA0, DMA_CH0);
|
||||||
|
|
||||||
/* initialize DMA data mode */
|
/* initialize DMA data mode */
|
||||||
dma_data_parameter.periph_addr = (uint32_t)(&ADC_RDATA(ADC0));
|
dma_data_parameter.periph_addr = (uint32_t) (&ADC_RDATA(ADC0));
|
||||||
dma_data_parameter.periph_inc = DMA_PERIPH_INCREASE_DISABLE;
|
dma_data_parameter.periph_inc = DMA_PERIPH_INCREASE_DISABLE;
|
||||||
dma_data_parameter.memory_addr = (uint32_t)(ADCReadings);
|
dma_data_parameter.memory_addr = (uint32_t) (ADCReadings);
|
||||||
dma_data_parameter.memory_inc = DMA_MEMORY_INCREASE_ENABLE;
|
dma_data_parameter.memory_inc = DMA_MEMORY_INCREASE_ENABLE;
|
||||||
dma_data_parameter.periph_width = DMA_PERIPHERAL_WIDTH_16BIT;
|
dma_data_parameter.periph_width = DMA_PERIPHERAL_WIDTH_16BIT;
|
||||||
dma_data_parameter.memory_width = DMA_MEMORY_WIDTH_16BIT;
|
dma_data_parameter.memory_width = DMA_MEMORY_WIDTH_16BIT;
|
||||||
@@ -229,8 +228,7 @@ void setup_timers() {
|
|||||||
timer_ocintpara.outputstate = TIMER_CCX_ENABLE;
|
timer_ocintpara.outputstate = TIMER_CCX_ENABLE;
|
||||||
timer_channel_output_config(TIMER1, TIMER_CH_0, &timer_ocintpara);
|
timer_channel_output_config(TIMER1, TIMER_CH_0, &timer_ocintpara);
|
||||||
|
|
||||||
timer_channel_output_pulse_value_config(TIMER1, TIMER_CH_0,
|
timer_channel_output_pulse_value_config(TIMER1, TIMER_CH_0, powerPWM + holdoffTicks);
|
||||||
powerPWM + holdoffTicks);
|
|
||||||
timer_channel_output_mode_config(TIMER1, TIMER_CH_0, TIMER_OC_MODE_PWM1);
|
timer_channel_output_mode_config(TIMER1, TIMER_CH_0, TIMER_OC_MODE_PWM1);
|
||||||
timer_channel_output_shadow_config(TIMER1, TIMER_CH_0,
|
timer_channel_output_shadow_config(TIMER1, TIMER_CH_0,
|
||||||
TIMER_OC_SHADOW_DISABLE);
|
TIMER_OC_SHADOW_DISABLE);
|
||||||
@@ -282,7 +280,9 @@ void setup_timers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setup_iwdg() {
|
void setup_iwdg() {
|
||||||
// TODO
|
|
||||||
|
fwdgt_config(0x0FFF, FWDGT_PSC_DIV256);
|
||||||
|
fwdgt_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupFUSBIRQ() {
|
void setupFUSBIRQ() {
|
||||||
|
|||||||
Reference in New Issue
Block a user