forked from lucysrausch/hoverboard-firmware-hack
► Warning fixes
- Changed all float constants to use f suffix to prevent double conversions - Removed compile warnings due to HAL_GPIO_* related calls - Added comms.h with prototypes for functions which were used in main() - Casts and externs to fix compile warnings in various files. - Made a bunch of file-local variables static. - Fixed buzzerFreq/buzzerPattern extern declarations with correct type (uint8_t) - Since this is C, void func() { } needs to be void func(void) { }, so fixed that in all instances. These updates follows from @trollcop
This commit is contained in:
19
Src/comms.c
19
Src/comms.c
@@ -1,9 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "defines.h"
|
||||
#include "setup.h"
|
||||
#include "config.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "comms.h"
|
||||
|
||||
UART_HandleTypeDef huart2;
|
||||
|
||||
@@ -16,15 +17,15 @@ UART_HandleTypeDef huart2;
|
||||
#endif
|
||||
|
||||
|
||||
volatile uint8_t uart_buf[100];
|
||||
volatile int16_t ch_buf[8];
|
||||
static volatile uint8_t uart_buf[100];
|
||||
static volatile int16_t ch_buf[8];
|
||||
//volatile char char_buf[300];
|
||||
|
||||
void setScopeChannel(uint8_t ch, int16_t val) {
|
||||
ch_buf[ch] = val;
|
||||
}
|
||||
|
||||
void consoleScope() {
|
||||
void consoleScope(void) {
|
||||
#if defined DEBUG_SERIAL_SERVOTERM && (defined DEBUG_SERIAL_USART2 || defined DEBUG_SERIAL_USART3)
|
||||
uart_buf[0] = 0xff;
|
||||
uart_buf[1] = CLAMP(ch_buf[0]+127, 0, 255);
|
||||
@@ -46,12 +47,12 @@ void consoleScope() {
|
||||
#endif
|
||||
|
||||
#if defined DEBUG_SERIAL_ASCII && (defined DEBUG_SERIAL_USART2 || defined DEBUG_SERIAL_USART3)
|
||||
memset(uart_buf, 0, sizeof(uart_buf));
|
||||
sprintf(uart_buf, "1:%i 2:%i 3:%i 4:%i 5:%i 6:%i 7:%i 8:%i\r\n", ch_buf[0], ch_buf[1], ch_buf[2], ch_buf[3], ch_buf[4], ch_buf[5], ch_buf[6], ch_buf[7]);
|
||||
memset((void *)(uintptr_t)uart_buf, 0, sizeof(uart_buf));
|
||||
sprintf((char *)(uintptr_t)uart_buf, "1:%i 2:%i 3:%i 4:%i 5:%i 6:%i 7:%i 8:%i\r\n", ch_buf[0], ch_buf[1], ch_buf[2], ch_buf[3], ch_buf[4], ch_buf[5], ch_buf[6], ch_buf[7]);
|
||||
|
||||
if(UART_DMA_CHANNEL->CNDTR == 0) {
|
||||
UART_DMA_CHANNEL->CCR &= ~DMA_CCR_EN;
|
||||
UART_DMA_CHANNEL->CNDTR = strlen(uart_buf);
|
||||
UART_DMA_CHANNEL->CNDTR = strlen((char *)(uintptr_t)uart_buf);
|
||||
UART_DMA_CHANNEL->CMAR = (uint32_t)uart_buf;
|
||||
UART_DMA_CHANNEL->CCR |= DMA_CCR_EN;
|
||||
}
|
||||
@@ -60,5 +61,5 @@ void consoleScope() {
|
||||
|
||||
void consoleLog(char *message)
|
||||
{
|
||||
HAL_UART_Transmit_DMA(&huart2, (uint8_t *)message, strlen(message));
|
||||
HAL_UART_Transmit_DMA(&huart2, (uint8_t *)message, (uint16_t)strlen(message));
|
||||
}
|
||||
|
Reference in New Issue
Block a user