main.c
Go to the documentation of this file.
1 /*
2  main.c : entry routine for for STM32F103CB
3 
4  Adapted from https://github.com/multiwii/baseflight/blob/master/src/main.c
5 
6  This file is part of BreezySTM32.
7 
8  BreezySTM32 is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  BreezySTM32 is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "breezystm32.h"
23 
25 
26 extern void SetSysClock(bool overclock);
27 
28 static void _putc(void *p, char c)
29 {
30  (void)p; // avoid compiler warning about unused variable
31  serialWrite(Serial1, c);
32 
33  while (!isSerialTransmitBufferEmpty(Serial1));
34 }
35 
36 int main(void)
37 {
38  // Configure clock, this figures out HSE for hardware autodetect
39  SetSysClock(0);
40 
41  systemInit();
42 
43  Serial1 = uartOpen(USART1, NULL, 115200, MODE_RXTX);
44 
45  setup();
46 
48 
49  while (1)
50  loop();
51 }
void systemInit(void)
Definition: system.c:55
void SetSysClock(bool overclock)
void setup(void)
Definition: accelgyro.c:40
void loop(void)
Definition: accelgyro.c:50
#define USART1
Definition: stm32f4xx.h:2080
bool isSerialTransmitBufferEmpty(serialPort_t *instance)
Definition: drv_serial.c:60
void serialWrite(serialPort_t *instance, uint8_t ch)
Definition: drv_serial.c:40
serialPort_t * uartOpen(USART_TypeDef *USARTx, serialReceiveCallbackPtr callback, uint32_t baudRate, portMode_t mode)
Definition: drv_uart.c:80
serialPort_t * Serial1
Definition: main.c:24
static void _putc(void *p, char c)
Definition: main.c:28
#define NULL
Definition: usbd_def.h:50
void init_printf(void *putp, void(*putf)(void *, char))
Definition: printf.cpp:264
int main(void)
Definition: main.c:36


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46