comments and formatting
This commit is contained in:
parent
463109a981
commit
32cd24b5c8
18
fw/main.c
18
fw/main.c
@ -138,7 +138,6 @@ static inline void setup_i2c(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME: this holds the max number of ADC channels, ideally this would be lower
|
|
||||||
volatile uint16_t adc_buffer[16];
|
volatile uint16_t adc_buffer[16];
|
||||||
// Set-up the adc to perform continous conversion of enabled channels, enable
|
// Set-up the adc to perform continous conversion of enabled channels, enable
|
||||||
// channel injection and setup DMA to automatically transfer conversion results
|
// channel injection and setup DMA to automatically transfer conversion results
|
||||||
@ -363,7 +362,7 @@ uint16_t pid(int16_t delta, int16_t max_duty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Board Setup
|
/* ------------------------------ Board Setup ------------------------------- */
|
||||||
static inline void setup(void)
|
static inline void setup(void)
|
||||||
{
|
{
|
||||||
// Generic system setup
|
// Generic system setup
|
||||||
@ -371,7 +370,7 @@ static inline void setup(void)
|
|||||||
funGpioInitAll();
|
funGpioInitAll();
|
||||||
USBFSSetup();
|
USBFSSetup();
|
||||||
|
|
||||||
// Analog pin configuration
|
// ====================== Analog pin configuration ====================== //
|
||||||
funPinMode(PIN_VBUS, GPIO_CFGLR_IN_ANALOG);
|
funPinMode(PIN_VBUS, GPIO_CFGLR_IN_ANALOG);
|
||||||
funPinMode(PIN_CURRENT, GPIO_CFGLR_IN_ANALOG);
|
funPinMode(PIN_CURRENT, GPIO_CFGLR_IN_ANALOG);
|
||||||
funPinMode(PIN_NTC, GPIO_CFGLR_IN_ANALOG);
|
funPinMode(PIN_NTC, GPIO_CFGLR_IN_ANALOG);
|
||||||
@ -389,13 +388,13 @@ static inline void setup(void)
|
|||||||
};
|
};
|
||||||
setup_adc_and_dma(adc_channels, sizeof(adc_channels), adc_injected, sizeof(adc_injected));
|
setup_adc_and_dma(adc_channels, sizeof(adc_channels), adc_injected, sizeof(adc_injected));
|
||||||
|
|
||||||
// Digital pin configuration
|
// ====================== Digital pin configuration ===================== //
|
||||||
funPinMode(PIN_12V, GPIO_CFGLR_OUT_10Mhz_PP);
|
funPinMode(PIN_12V, GPIO_CFGLR_OUT_10Mhz_PP);
|
||||||
funDigitalWrite(PIN_12V, 0);
|
funDigitalWrite(PIN_12V, 0);
|
||||||
funPinMode(PIN_HEATER, GPIO_CFGLR_OUT_10Mhz_AF_PP);
|
funPinMode(PIN_HEATER, GPIO_CFGLR_OUT_10Mhz_AF_PP);
|
||||||
funDigitalWrite(PIN_HEATER, 0);
|
funDigitalWrite(PIN_HEATER, 0);
|
||||||
funPinMode(PIN_DISP_RST, GPIO_CFGLR_OUT_10Mhz_PP);
|
funPinMode(PIN_DISP_RST, GPIO_CFGLR_OUT_10Mhz_PP);
|
||||||
funDigitalWrite(PIN_DISP_RST, 1); // start with display disabled
|
funDigitalWrite(PIN_DISP_RST, 1);
|
||||||
|
|
||||||
funPinMode(PIN_ENC_A, GPIO_CFGLR_IN_PUPD); // enable pull-up/down
|
funPinMode(PIN_ENC_A, GPIO_CFGLR_IN_PUPD); // enable pull-up/down
|
||||||
funDigitalWrite(PIN_ENC_A, 1); // specify pull-up
|
funDigitalWrite(PIN_ENC_A, 1); // specify pull-up
|
||||||
@ -403,13 +402,11 @@ static inline void setup(void)
|
|||||||
funDigitalWrite(PIN_ENC_B, 1); // specify pull-up
|
funDigitalWrite(PIN_ENC_B, 1); // specify pull-up
|
||||||
funPinMode(PIN_BTN, GPIO_CFGLR_IN_FLOAT);
|
funPinMode(PIN_BTN, GPIO_CFGLR_IN_FLOAT);
|
||||||
|
|
||||||
// Setup PWM timer
|
// Setup PWM timer, includes pin setup
|
||||||
setup_pwm();
|
setup_pwm();
|
||||||
pwm_off();
|
pwm_off();
|
||||||
|
|
||||||
// Setup i2c line, includes setting the pin alternate mode
|
// =========================== Encoder Setup ============================ //
|
||||||
setup_i2c();
|
|
||||||
|
|
||||||
// Configure the IO as an interrupt.
|
// Configure the IO as an interrupt.
|
||||||
// PIN_ENC_B is on port B, channel 11
|
// PIN_ENC_B is on port B, channel 11
|
||||||
AFIO->EXTICR1 |= AFIO_EXTICR1_EXTI11_PB; // Port B channel (pin) 11
|
AFIO->EXTICR1 |= AFIO_EXTICR1_EXTI11_PB; // Port B channel (pin) 11
|
||||||
@ -427,6 +424,9 @@ static inline void setup(void)
|
|||||||
// enable interrupt
|
// enable interrupt
|
||||||
NVIC_EnableIRQ(EXTI7_0_IRQn);
|
NVIC_EnableIRQ(EXTI7_0_IRQn);
|
||||||
|
|
||||||
|
// ============================= I2C Setup ============================== //
|
||||||
|
// Setup i2c line, includes setting the pin alternate mode
|
||||||
|
setup_i2c();
|
||||||
// Start i2c peripherals
|
// Start i2c peripherals
|
||||||
u8g2 = display_init();
|
u8g2 = display_init();
|
||||||
sc7a20_init();
|
sc7a20_init();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user