Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PeriphDrivers): Fix -wstrict-prototype and other Misc. MAX78002 Warnings #1077

Merged
merged 6 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Examples/MAX78002/ADC/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ void temperature_average(float temperature)

if (temp_samples == SAMPLE_AVG) {
average = sum / SAMPLE_AVG;
printf("Average = %0.2fC\n", average);
printf("Average = %0.2fC\n", (double)average);

for (loop_counter = 0; loop_counter < SAMPLE_AVG; loop_counter++) {
printf("%0.2fC ", TEMP_SAMPLES[loop_counter]);
printf("%0.2fC ", (double)TEMP_SAMPLES[loop_counter]);
if (loop_counter == 15) {
printf("\n");
}
Expand Down
6 changes: 3 additions & 3 deletions Examples/MAX78002/CNN/facial_recognition/include/record.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#define SHOW_START_X (TFT_WIDTH - HEIGHT_ID) / 2
#define SHOW_START_Y (TFT_HEIGHT - WIDTH_ID) / 2

int record();
void show_keyboard();
void init_cnn_from_flash();
int record(void);
void show_keyboard(void);
void init_cnn_from_flash(void);

#endif // _RECORD_H_
14 changes: 7 additions & 7 deletions Examples/MAX78002/CNN/facial_recognition/src/record.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,17 @@ static int font = (int)&Liberation_Sans16x16[0];
void get_status(Person *p);
int update_status(Person *p);
int update_info_field(Person *p);
void FLC0_IRQHandler();
int init_db();
int init_status();
void FLC0_IRQHandler(void);
int init_db(void);
int init_status(void);
int add_person(Person *p);
void flash_to_cnn(Person *p, uint32_t cnn_location);
void setup_irqs();
void setup_irqs(void);
void read_db(Person *p);
bool check_db();
void show_keyboard();
bool check_db(void);
void show_keyboard(void);
void get_name(Person *p);
void show_face();
void show_face(void);

/***** Functions *****/

Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78002/CNN/kws20_demo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ uint8_t check_inference(q15_t *ml_soft, int32_t *ml_data, int16_t *out_class, do
else
TFT_Print(buff, 20, 30, font_2,
snprintf(buff, sizeof(buff), "%s (%0.1f%%)", keywords[max_index],
(double)100.0 * max / 32768.0));
(double)(100.0 * max / 32768.0)));
//TFT_Print(buff, 1, 80, font_1, snprintf(buff, sizeof(buff), "Top classes:"));
} else {
/* uncomment to show the next 4 top classes */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

/***** Functions *****/

bool camera_init();
bool camera_init(void);
void camera_capture(void);
void camera_capture_and_load_cnn(void);
void camera_display_last_image(void);
Expand Down
20 changes: 5 additions & 15 deletions Examples/MAX78002/CNN/pascalvoc-retinanetv7_3/src/cnn/nms.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@ uint32_t utils_get_time_ms(void)
return ms;
}

static uint8_t signed_to_unsigned(int8_t val)
{
uint8_t value;
if (val < 0) {
value = ~val + 1;
return (128 - value);
}
return val + 128;
}

int get_prior_idx(int os_idx, int ar_idx, int scale_idx, int rel_idx)
{
int prior_idx = 0;
Expand Down Expand Up @@ -170,7 +160,7 @@ void calc_softmax(int32_t *prior_cls_vals, int prior_idx)

for (ch = 0; ch < (NUM_CLASSES); ++ch) {
prior_cls_softmax[prior_idx * NUM_CLASSES + ch] =
(uint8_t)(256. * exp(prior_cls_vals[ch] / fp_scale) / sum);
(uint8_t)((double)256. * exp(prior_cls_vals[ch] / fp_scale) / sum);
}
}

Expand Down Expand Up @@ -318,8 +308,8 @@ void get_cxcy(float *cxcy, int prior_idx)
cx = rel_idx % dims_x[scale_idx];
cxcy[0] = (float)((float)(cx + 0.5) / dims_x[scale_idx]);
cxcy[1] = (float)((float)(cy + 0.5) / dims_y[scale_idx]);
cxcy[2] = obj_scales[os_idx] * scales[scale_idx] * sqrt(ars[ar_idx]);
cxcy[3] = obj_scales[os_idx] * scales[scale_idx] / sqrt(ars[ar_idx]);
cxcy[2] = obj_scales[os_idx] * scales[scale_idx] * (float)sqrt(ars[ar_idx]);
cxcy[3] = obj_scales[os_idx] * scales[scale_idx] / (float)sqrt(ars[ar_idx]);

for (i = 0; i < 4; ++i) {
cxcy[i] = MAX(0.0, cxcy[i]);
Expand All @@ -336,8 +326,8 @@ void gcxgcy_to_cxcy(float *cxcy, int prior_idx, float *priors_cxcy)

cxcy[0] = priors_cxcy[0] + gcxgcy[0] * priors_cxcy[2] / 10;
cxcy[1] = priors_cxcy[1] + gcxgcy[1] * priors_cxcy[3] / 10;
cxcy[2] = exp(gcxgcy[2] / 5) * priors_cxcy[2];
cxcy[3] = exp(gcxgcy[3] / 5) * priors_cxcy[3];
cxcy[2] = (float)exp(gcxgcy[2] / 5) * priors_cxcy[2];
cxcy[3] = (float)exp(gcxgcy[3] / 5) * priors_cxcy[3];
}

void cxcy_to_xy(float *xy, float *cxcy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int _transmit_spi_header(uint8_t cmd, uint32_t address)
return err;
}

int ram_init()
int ram_init(void)
{
int err = E_NO_ERROR;
err = spi_init();
Expand All @@ -66,7 +66,7 @@ int ram_init()
return err;
}

int ram_reset()
int ram_reset(void)
{
int err = E_NO_ERROR;
uint8_t data[2] = { 0x66, 0x99 };
Expand All @@ -77,7 +77,7 @@ int ram_reset()
return err;
}

int ram_enter_quadmode()
int ram_enter_quadmode(void)
{
int err = E_NO_ERROR;
uint8_t tx_data = 0x35;
Expand All @@ -91,7 +91,7 @@ int ram_enter_quadmode()
return err;
}

int ram_exit_quadmode()
int ram_exit_quadmode(void)
{
int err = E_NO_ERROR;
uint8_t tx_data = 0xF5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ typedef struct {
int EID;
} ram_id_t;

int ram_init();
int ram_init(void);

int ram_reset();
int ram_reset(void);

int ram_enter_quadmode();
int ram_enter_quadmode(void);

int ram_exit_quadmode();
int ram_exit_quadmode(void);

int ram_read_id(ram_id_t *out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void processSPI(void)
}
}

void SPI_IRQHandler()
void SPI_IRQHandler(void)
{
uint32_t status = SPI->intfl;

Expand All @@ -133,7 +133,7 @@ void SPI_IRQHandler()
}
}

int dma_init()
int dma_init(void)
{
if (g_dma_initialized)
return E_NO_ERROR;
Expand Down
8 changes: 4 additions & 4 deletions Examples/MAX78002/CSI2/src/sram/aps6404.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int _transmit_spi_header(uint8_t cmd, uint32_t address)
return err;
}

int ram_init()
int ram_init(void)
{
int err = E_NO_ERROR;
err = spi_init();
Expand All @@ -66,7 +66,7 @@ int ram_init()
return err;
}

int ram_reset()
int ram_reset(void)
{
int err = E_NO_ERROR;
uint8_t data[2] = { 0x66, 0x99 };
Expand All @@ -77,7 +77,7 @@ int ram_reset()
return err;
}

int ram_enter_quadmode()
int ram_enter_quadmode(void)
{
int err = E_NO_ERROR;
uint8_t tx_data = 0x35;
Expand All @@ -91,7 +91,7 @@ int ram_enter_quadmode()
return err;
}

int ram_exit_quadmode()
int ram_exit_quadmode(void)
{
int err = E_NO_ERROR;
uint8_t tx_data = 0xF5;
Expand Down
8 changes: 4 additions & 4 deletions Examples/MAX78002/CSI2/src/sram/aps6404.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ typedef struct {
int EID;
} ram_id_t;

int ram_init();
int ram_init(void);

int ram_reset();
int ram_reset(void);

int ram_enter_quadmode();
int ram_enter_quadmode(void);

int ram_exit_quadmode();
int ram_exit_quadmode(void);

int ram_read_id(ram_id_t *out);

Expand Down
4 changes: 2 additions & 2 deletions Examples/MAX78002/CSI2/src/sram/fastspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void processSPI(void)
}
}

void SPI_IRQHandler()
void SPI_IRQHandler(void)
{
uint32_t status = SPI->intfl;

Expand All @@ -133,7 +133,7 @@ void SPI_IRQHandler()
}
}

int dma_init()
int dma_init(void)
{
if (g_dma_initialized)
return E_NO_ERROR;
Expand Down
8 changes: 4 additions & 4 deletions Examples/MAX78002/QSPI/aps6404.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ typedef struct {
int EID;
} ram_id_t;

int ram_init();
int ram_init(void);

int ram_reset();
int ram_reset(void);

int ram_enter_quadmode();
int ram_enter_quadmode(void);

int ram_exit_quadmode();
int ram_exit_quadmode(void);

int ram_read_id(ram_id_t *out);

Expand Down
4 changes: 2 additions & 2 deletions Examples/MAX78002/QSPI/fastspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void processSPI(void)
}
}

void SPI_IRQHandler()
void SPI_IRQHandler(void)
{
uint32_t status = SPI->intfl;

Expand All @@ -130,7 +130,7 @@ void SPI_IRQHandler()
}
}

int dma_init()
int dma_init(void)
{
int err = MXC_DMA_Init();
if (err)
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78002/QSPI/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ int main(void)

if (fail_count > 0) {
printf("\nFailed with %i mismatches (%.2f%%)!\n", fail_count,
100 * (((float)fail_count) / (TEST_SIZE * TEST_COUNT)));
(double)(100 * (((float)fail_count) / (TEST_SIZE * TEST_COUNT))));
return E_FAIL;
}

Expand Down
4 changes: 2 additions & 2 deletions Examples/MAX78002/Watchdog/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void MXC_WDT_Setup(void)
MXC_WDT_Enable(MXC_WDT0);
}

void SW1_Callback(void)
void SW1_Callback(void *pb)
{
printf("\nEnabling Timeout Interrupt...\n");
MXC_WDT_Disable(MXC_WDT0);
Expand All @@ -105,7 +105,7 @@ void SW1_Callback(void)
PB_RegisterCallback(0, NULL);
}

void SW2_Callback(void)
void SW2_Callback(void *pb)
{
printf("What happens if the watchdog is reset too early?\n");
sw2_pressed = 1;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/MiscDrivers/Camera/mipi_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ int mipi_camera_sleep(int sleep)
return camera.sleep(sleep);
}

int mipi_camera_capture()
int mipi_camera_capture(void)
{
return MXC_CSI2_CaptureFrameDMA();
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/MiscDrivers/Camera/mipi_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int mipi_camera_sleep(int sleep);
* the received data in time for each new row.
* @return 0 (E_NO_ERROR) on a successful capture of a full frame, non-zero @ref MXC_Error_Codes on failure.
*/
int mipi_camera_capture();
int mipi_camera_capture(void);

/**
* @brief Retrieve the current camera settings
Expand Down
10 changes: 6 additions & 4 deletions Libraries/PeriphDrivers/Include/MAX78002/csi2.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,19 @@ int MXC_CSI2_Stop(void);

/**
* @brief Capture an image frame using DMA. Same as MXC_CSI2_CaptureFrameDMA.
* @param num_data_lanes Number of data lanes used.
* @note API changed on 7-8-2024 to remove 'num_data_lanes' as an argument. Set
* 'num_lanes' in @ref mxc_csi2_ctrl_cfg_t instead, which is passed to
* @ref MXC_CSI2_Init
* @return #E_NO_ERROR if everything is successful.
*/
int MXC_CSI2_CaptureFrame(int num_data_lanes);
int MXC_CSI2_CaptureFrame(void);

/**
* @brief Capture an image frame using DMA.
* @param num_data_lanes Number of data lanes used.
* @return #E_NO_ERROR if everything is successful.
*/
int MXC_CSI2_CaptureFrameDMA();
int MXC_CSI2_CaptureFrameDMA(void);

/**
* @brief Select Lane Control Source for D0-D4 and C0.
Expand Down Expand Up @@ -588,7 +590,7 @@ int MXC_CSI2_PPI_Stop(void);

bool MXC_CSI2_DMA_Frame_Complete(void);

mxc_csi2_capture_stats_t MXC_CSI2_GetCaptureStats();
mxc_csi2_capture_stats_t MXC_CSI2_GetCaptureStats(void);

/**
* @brief Clears the interrupt flags for PPI.
Expand Down
6 changes: 3 additions & 3 deletions Libraries/PeriphDrivers/Source/CSI2/csi2_ai87.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ int MXC_CSI2_Stop(void)
return MXC_CSI2_RevA_Stop((mxc_csi2_reva_regs_t *)MXC_CSI2);
}

int MXC_CSI2_CaptureFrame(int num_data_lanes)
int MXC_CSI2_CaptureFrame(void)
{
return MXC_CSI2_RevA_CaptureFrameDMA(num_data_lanes);
return MXC_CSI2_RevA_CaptureFrameDMA();
}

int MXC_CSI2_CaptureFrameDMA()
int MXC_CSI2_CaptureFrameDMA(void)
{
return MXC_CSI2_RevA_CaptureFrameDMA();
}
Expand Down
Loading
Loading