fome-fw/firmware/egt2can.cpp

80 lines
1.7 KiB
C++
Raw Normal View History

2014-12-23 18:03:36 -08:00
#include "main.h"
2014-12-31 15:03:34 -08:00
#include "engine_configuration.h"
#include "max31855.h"
egt_cs_array_t max31855_cs;
2014-12-23 18:03:36 -08:00
2014-12-23 20:03:31 -08:00
int main_loop_started;
2015-01-08 12:03:45 -08:00
int maxNesting = 0;
2014-12-23 20:03:31 -08:00
void firmwareError(const char *fmt, ...) {
2015-01-08 12:03:45 -08:00
}
2014-12-23 18:03:36 -08:00
/*
* Blue LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker1");
while (TRUE) {
2015-01-08 12:03:45 -08:00
palClearPad(GPIOC, 13);
2014-12-23 18:03:36 -08:00
chThdSleepMilliseconds(500);
2015-01-08 12:03:45 -08:00
palSetPad(GPIOC, 13);
2014-12-23 18:03:36 -08:00
chThdSleepMilliseconds(500);
}
return 0;
}
2014-12-31 15:03:34 -08:00
void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin) {
spiConfig->end_cb = NULL;
// ioportid_t port = getHwPort(csPin);
// ioportmask_t pin = getHwPin(csPin);
// spiConfig->ssport = port;
// spiConfig->sspad = pin;
// mySetPadMode("chip select", port, pin, PAL_STM32_MODE_OUTPUT);
}
2014-12-23 18:03:36 -08:00
void runRusEfi(void) {
2015-01-08 12:03:45 -08:00
#if EFI_USE_UART_FOR_CONSOLE
2014-12-23 18:03:36 -08:00
/*
* Activates the serial driver 1 using the driver default configuration.
* PA9 and PA10 are routed to USART1.
*/
sdStart(&SD1, NULL);
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(1)); /* USART1 TX. */
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(1)); /* USART1 RX. */
2015-01-08 12:03:45 -08:00
#endif
2014-12-23 18:03:36 -08:00
/*
* Creates the blinker threads.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
2014-12-31 15:03:34 -08:00
initMax31855(NULL, max31855_cs);
2014-12-23 18:03:36 -08:00
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched with output on the serial
* driver 1.
*/
2014-12-31 15:03:34 -08:00
while (true) {
2014-12-23 18:03:36 -08:00
// if (palReadPad(GPIOA, GPIOA_BUTTON))
// TestThread(&SD1);
2014-12-31 15:03:34 -08:00
chThdSleepMilliseconds(50);
printPending();
2014-12-23 18:03:36 -08:00
}
2014-12-23 20:03:31 -08:00
}