Skip to content

Commit

Permalink
Add cpp guard to all c headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Master92 committed Nov 20, 2023
1 parent 9cc8535 commit db381c1
Show file tree
Hide file tree
Showing 80 changed files with 671 additions and 18 deletions.
11 changes: 10 additions & 1 deletion src/bmi270/accel_gyro.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#ifndef _ACCEL_GYRO_H
#define _ACCEL_GYRO_H

#ifdef __cplusplus
extern "C" {
#endif

#include "bmi2_defs.h"

void init_bmi270();
Expand All @@ -16,4 +21,8 @@ float acc_to_g(int16_t val);

float gyr_to_dps(int16_t gyr);

#endif //_ACCEL_GYRO_H
#ifdef __cplusplus
}
#endif

#endif //_ACCEL_GYRO_H
8 changes: 8 additions & 0 deletions src/bmi270/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _COMMON_H
#define _COMMON_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include "bmi2.h"

Expand Down Expand Up @@ -103,4 +107,8 @@ void bmi2_error_codes_print_result(int8_t rslt);
* @return void.
*/

#ifdef __cplusplus
}
#endif

#endif /* _COMMON_H */
8 changes: 8 additions & 0 deletions src/core/MadgwickAHRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#ifndef MadgwickAHRS_h
#define MadgwickAHRS_h

#ifdef __cplusplus
extern "C" {
#endif

#define AHRS_UPDATE_FREQUENCY 100

//---------------------------------------------------------------------------------------------------
Expand All @@ -23,6 +27,10 @@ float getRoll();
float getPitch();
float getYaw();

#ifdef __cplusplus
}
#endif

#endif
//=====================================================================================================
// End of file
Expand Down
10 changes: 9 additions & 1 deletion src/core/app_state.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>

typedef enum {
Expand Down Expand Up @@ -35,4 +39,8 @@ void app_switch_to_menu();
void app_exit_menu();
void app_switch_to_analog(bool is_bay);
void app_switch_to_hdmi_in();
void app_switch_to_hdzero(bool is_default);
void app_switch_to_hdzero(bool is_default);

#ifdef __cplusplus
}
#endif
10 changes: 9 additions & 1 deletion src/core/battery.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>
#include <stdint.h>

Expand All @@ -19,4 +23,8 @@ void battery_update();

bool battery_is_low();
int battery_get_millivolts(bool per_cell);
void battery_get_voltage_str(char* buf);
void battery_get_voltage_str(char* buf);

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions src/core/common.hh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef __COMMON_HH__
#define __COMMON_HH__

#ifdef __cplusplus
extern "C" {
#endif

#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
Expand Down Expand Up @@ -31,4 +35,8 @@ extern atomic_int g_key;
extern atomic_int g_init_done;
extern pthread_mutex_t lvgl_mutex;

#ifdef __cplusplus
}
#endif

#endif //__COMMON_HH__
10 changes: 9 additions & 1 deletion src/core/dvr.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>
#include <stdint.h>

Expand All @@ -17,4 +21,8 @@ void dvr_update_status();
void dvr_select_audio_source(uint8_t audio_source);
void dvr_enable_line_out(bool enable);
void dvr_cmd(osd_dvr_cmd_t cmd);
void dvr_update_vi_conf(video_resolution_t fmt);
void dvr_update_vi_conf(video_resolution_t fmt);

#ifdef __cplusplus
}
#endif
10 changes: 9 additions & 1 deletion src/core/elrs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef __ELRS_H__
#define __ELRS_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>
#include <stdint.h>

Expand Down Expand Up @@ -82,4 +86,8 @@ void msp_cancel_await();
void msp_ht_update(uint16_t pan, uint16_t tilt, uint16_t roll);
void msp_channel_update();

#endif //__ELRS_H__
#ifdef __cplusplus
}
#endif

#endif //__ELRS_H__
10 changes: 9 additions & 1 deletion src/core/esp32_flash.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#ifndef __ESP32_FLASH_H__
#define __ESP32_FLASH_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "serial_io.h"
#include <stdint.h>

esp_loader_error_t loader_port_init();
void loader_port_close();

#endif //__ESP32_FLASH_H__
#ifdef __cplusplus
}
#endif

#endif //__ESP32_FLASH_H__
10 changes: 9 additions & 1 deletion src/core/ht.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef __HT_C__
#define __HT_C__

#ifdef __cplusplus
extern "C" {
#endif

#define DEG_TO_RAD 0.017453295199
#define RAD_TO_DEG 57.29577951308

Expand Down Expand Up @@ -55,4 +59,8 @@ void ht_set_maxangle(int angle);
void ht_set_center_position();
int16_t *ht_get_channels();

#endif //__HT_C__
#ifdef __cplusplus
}
#endif

#endif //__HT_C__
8 changes: 8 additions & 0 deletions src/core/input_device.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _INPUT_DEVICE_H
#define _INPUT_DEVICE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>

typedef enum {
Expand All @@ -14,4 +18,8 @@ void tune_channel_timer();
void exit_tune_channel();
void rbtn_click(right_button_t click_type);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions src/core/msp_displayport.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef __MSP_DISPLAYPORT_H
#define __MSP_DISPLAYPORT_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

#define SD_HMAX 30
Expand Down Expand Up @@ -76,4 +80,8 @@ extern uint8_t osd_page_buf[HD_VMAX][7];
extern uint16_t last_rcv_seconds0;
extern uint16_t last_rcv_seconds1;

#ifdef __cplusplus
}
#endif

#endif
10 changes: 9 additions & 1 deletion src/core/osd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _OSD_H
#define _OSD_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>

#include <lvgl/lvgl.h>
Expand Down Expand Up @@ -98,4 +102,8 @@ void load_fc_osd_font(uint8_t);
void *thread_osd(void *ptr);
void osd_resource_path(char *buf, const char *fmt, osd_resource_t osd_resource_type, ...);

#endif
#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions src/core/self_test.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

void self_test();

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions src/core/settings.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>
#include <stdint.h>

Expand Down Expand Up @@ -252,3 +256,7 @@ int settings_put_osd_element(const setting_osd_goggle_element_t *element, char *
int settings_put_osd_element_pos_y(const setting_osd_goggle_element_positions_t *pos, char *config_name);
int settings_put_osd_element_pos_x(const setting_osd_goggle_element_positions_t *pos, char *config_name);
int settings_put_osd_element_shown(bool show, char *config_name);

#ifdef __cplusplus
}
#endif
9 changes: 9 additions & 0 deletions src/core/thread.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _THREAD_H
#define _THREAD_H

#ifdef __cplusplus
extern "C" {
#endif

#include <pthread.h>
#include <stdint.h>

Expand All @@ -15,4 +19,9 @@ typedef struct {
} threads_obj_t;

int create_threads();

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions src/driver/TP2825.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _TP2825_H
#define _TP2825_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

void TP2825_close();
Expand All @@ -11,4 +15,8 @@ void TP2825_Switch_Mode(int is_pal);
void TP2825_Switch_CH(uint8_t sel); // 0 = AV in; 1 = Module bay
void TP2825_Set_Clamp(int);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions src/driver/beep.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#define BEEP_VERY_SHORT 1
#define BEEP_SHORT 50
#define BEEP_LONG 200
Expand All @@ -8,3 +12,7 @@

void beep_init(void);
void beep_dur(int ms);

#ifdef __cplusplus
}
#endif
9 changes: 9 additions & 0 deletions src/driver/dm5680.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _DM5680_H
#define _DM5680_H

#ifdef __cplusplus
extern "C" {
#endif

#include "dm6302.h"
#include <pthread.h>
#include <stdatomic.h>
Expand Down Expand Up @@ -56,4 +60,9 @@ void DM5680_get_vldflg(uint8_t sel, uint8_t *payload);
void DM5680_get_regval(uint8_t sel, uint8_t *payload);

void DM5680_OSD_parse(uint8_t *buf, uint8_t len);

#ifdef __cplusplus
}
#endif

#endif
Loading

0 comments on commit db381c1

Please sign in to comment.