Some warning cleanups

This commit is contained in:
whowechina 2024-06-18 11:48:39 +08:00
parent 8c84a99134
commit 31f981f421
8 changed files with 406 additions and 414 deletions

8
.gitignore vendored
View File

@ -1,7 +1,5 @@
PCB/Keyboard/iidx_teeny-backups/
Production/PCB/Turntable
Production/PCB/teeny_iidx
Production/PCB/*/
*-backups
.editorconfig
.vscode
firmware/mai2/mai2hook
PCB/IO/mai_io-backups

Binary file not shown.

View File

@ -1,8 +1,9 @@
set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack)
set(LWIP_ROOT ${PICO_SDK_PATH}/lib/lwip)
pico_sdk_init()
include_directories(${CMAKE_CURRENT_LIST_DIR})
add_compile_options(-Wall -Werror -Wfatal-errors -O3)
function(make_firmware board board_def)
pico_sdk_init()
add_executable(${board}
main.c touch.c button.c rgb.c save.c config.c cli.c commands.c io.c hid.c
mpr121.c usb_descriptors.c)
@ -12,11 +13,6 @@ function(make_firmware board board_def)
pico_generate_pio_header(${board} ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio)
target_compile_options(${board} PRIVATE -Wfatal-errors -O3)
target_include_directories(${board} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(${board} PRIVATE
${BTSTACK_ROOT}/src
${LWIP_ROOT}/src/include)
target_link_libraries(${board} PRIVATE
aic

View File

@ -27,11 +27,11 @@ static void disp_rgb()
printf("[RGB]\n");
printf(" Number per button: %d, number per aux: %d\n",
mai_cfg->rgb.per_button, mai_cfg->rgb.per_aux);
printf(" Key on: %06x, off: %06x\n Level: %d\n",
printf(" Key on: %06lx, off: %06lx\n Level: %d\n",
mai_cfg->color.key_on, mai_cfg->color.key_off, mai_cfg->color.level);
}
static void print_sense_zone(const char *title, const uint8_t *zones, int num)
static void print_sense_zone(const char *title, const int8_t *zones, int num)
{
printf(" %s |", title);
for (int i = 0; i < num; i++) {
@ -276,7 +276,7 @@ static void handle_filter(int argc, char *argv[])
disp_sense();
}
static uint8_t *extract_key(const char *param)
static int8_t *extract_key(const char *param)
{
if (strlen(param) != 2) {
return NULL;
@ -319,7 +319,7 @@ static void handle_sense(int argc, char *argv[])
" >sense +\n"
" >sense -\n"
" >sense A3 +\n"
" >sense C1 -\n";
" >sense C1 -\n"
" >sense * 0\n";
if ((argc < 1) || (argc > 2)) {
printf(usage);
@ -340,7 +340,7 @@ static void handle_sense(int argc, char *argv[])
sense_do_op(&mai_cfg->sense.zones[i], op[0]);
}
} else {
uint8_t *key = extract_key(argv[0]);
int8_t *key = extract_key(argv[0]);
if (!key) {
printf(usage);
return;

View File

@ -47,7 +47,7 @@ static void report_usb_hid()
uint16_t buttons = button_read();
hid_joy.buttons[0] = native_to_io4(buttons);
hid_joy.buttons[1] = native_to_io4(0);
if (last_buttons ^ buttons & (1 << 11)) {
if ((last_buttons ^ buttons) & (1 << 11)) {
if (buttons & (1 << 11)) {
// just pressed coin button
hid_joy.chutes[0] += 0x100;

View File

@ -39,7 +39,6 @@
static void run_lights()
{
uint64_t now = time_us_64();
if (io_is_active() || aime_is_active()) {
return;
}

View File

@ -157,8 +157,8 @@ static bool mpr121_read_many16(uint8_t addr, uint8_t reg, uint16_t *buf, size_t
uint16_t mpr121_touched(uint8_t addr)
{
uint16_t touched;
mpr121_read_many16(addr, MPR121_TOUCH_STATUS_REG, &touched, 2);
uint16_t touched = 0;
mpr121_read_many16(addr, MPR121_TOUCH_STATUS_REG, &touched, 1);
return touched;
}
@ -174,7 +174,7 @@ static uint8_t mpr121_stop(uint8_t addr)
return ecr;
}
static uint8_t mpr121_resume(uint8_t addr, uint8_t ecr)
static void mpr121_resume(uint8_t addr, uint8_t ecr)
{
write_reg(addr, MPR121_ELECTRODE_CONFIG_REG, ecr);
}

View File

@ -9,11 +9,10 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <memory.h>
#include "bsp/board.h"
#include "pico/bootrom.h"
#include "pico/stdio.h"