Add VS Code settings and a small intellisense hack

This commit is contained in:
Martin Jäger
2021-12-12 13:51:49 +01:00
parent 46807deb98
commit 15ee7d8553
9 changed files with 57 additions and 13 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
.pio
.clang_complete
.gcc-flags.json
.vscode/browse.vc.db*
.vscode
.vscode/*
!.vscode/c_cpp_properties.json
.west
html
memory.map
+20
View File
@@ -0,0 +1,20 @@
{
"configurations": [
{
"name": "Zephyr",
"browse": {
"path": [
"${workspaceFolder}/src"
],
"limitSymbolsToIncludedHeaders": true
},
"compileCommands": "${workspaceFolder}/zephyr/build/compile_commands.json",
"cStandard": "c99",
"cppStandard": "c++14",
"forcedInclude": [
"${workspaceFolder}/zephyr/build/zephyr/include/generated/autoconf.h"
]
}
],
"version": 4
}
+2 -2
View File
@@ -11,8 +11,6 @@
#include <drivers/hwinfo.h>
#include <sys/crc.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(data_objects, CONFIG_DATA_OBJECTS_LOG_LEVEL);
#ifdef CONFIG_SOC_FAMILY_STM32
#include <stm32_ll_utils.h>
@@ -28,6 +26,8 @@ LOG_MODULE_REGISTER(data_objects, CONFIG_DATA_OBJECTS_LOG_LEVEL);
#include "thingset.h"
#include "helper.h"
LOG_MODULE_REGISTER(data_objects, CONFIG_DATA_OBJECTS_LOG_LEVEL);
// can be used to configure custom data objects in separate file instead
// (e.g. data_objects_custom.cpp)
#ifndef CONFIG_CUSTOM_DATA_OBJECTS_FILE
+2 -2
View File
@@ -18,10 +18,10 @@
#ifdef CONFIG_SOC_FAMILY_STM32
#include <device.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(nvs, CONFIG_DATA_STORAGE_LOG_LEVEL);
#include <stm32_ll_bus.h>
LOG_MODULE_REGISTER(nvs, CONFIG_DATA_STORAGE_LOG_LEVEL);
K_MUTEX_DEFINE(data_buf_lock);
// Buffer used by store and restore functions (must be word-aligned for hardware CRC calculation)
+2 -3
View File
@@ -11,9 +11,6 @@
#include <device.h>
#include <drivers/gpio.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(dcdc, CONFIG_DCDC_LOG_LEVEL);
#include <math.h> // for fabs function
#include <stdlib.h> // for min/max function
#include <stdio.h>
@@ -24,6 +21,8 @@ LOG_MODULE_REGISTER(dcdc, CONFIG_DCDC_LOG_LEVEL);
#include "data_storage.h"
#include "setup.h"
LOG_MODULE_REGISTER(dcdc, CONFIG_DCDC_LOG_LEVEL);
extern DeviceStatus dev_stat;
#if BOARD_HAS_DCDC
+1 -1
View File
@@ -8,6 +8,7 @@
#include "mcu.h"
#include "load.h"
#include "helper.h"
#include "half_bridge.h"
#include "leds.h"
#include "setup.h"
@@ -21,7 +22,6 @@
#include <power/reboot.h>
#include <drivers/gpio.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(hardware, CONFIG_HW_LOG_LEVEL);
void start_stm32_bootloader()
+22
View File
@@ -17,6 +17,28 @@
#include <stdint.h>
#include <time.h>
#ifdef __INTELLISENSE__
/*
* VS Code intellisense can't cope with all the Zephyr macro layers for logging, so provide it
* with something more simple and make it silent.
*/
#define LOG_DBG(...) printf(__VA_ARGS__)
#define LOG_INF(...) printf(__VA_ARGS__)
#define LOG_WRN(...) printf(__VA_ARGS__)
#define LOG_ERR(...) printf(__VA_ARGS__)
#define LOG_MODULE_REGISTER(...)
#else
#include <logging/log.h>
#endif /* VSCODE_INTELLISENSE_HACK */
#include <zephyr.h>
#ifdef __cplusplus
+2 -3
View File
@@ -8,9 +8,6 @@
#include <zephyr.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(pwm_switch, CONFIG_PWM_LOG_LEVEL);
#include <stdio.h>
#include <time.h>
@@ -19,6 +16,8 @@ LOG_MODULE_REGISTER(pwm_switch, CONFIG_PWM_LOG_LEVEL);
#include "helper.h"
#include "setup.h"
LOG_MODULE_REGISTER(pwm_switch, CONFIG_PWM_LOG_LEVEL);
#if BOARD_HAS_PWM_PORT
#define PWM_CURRENT_MAX (DT_PROP(DT_CHILD(DT_PATH(outputs), pwm_switch), current_max))
+4
View File
@@ -473,5 +473,9 @@ endif
# include custom Kconfig if existing
orsource "../src/custom/Kconfig"
#if 0
#orsource "modules/thingset/zephyr/Kconfig.thingset"
#endif
# include main Zephyr menu entries from Zephyr root directory
source "Kconfig.zephyr"