Upgrade to Zephyr 2.4

- Make all struct device * constant
- Add additional argument to PWM nodes in devicetree
- Track customized LibreSolar/zephyr branch in platformio
- Update OLED submodule
This commit is contained in:
Martin Jäger
2020-11-09 20:07:49 +01:00
parent 62d28d9e5e
commit 3d9c4589cd
19 changed files with 42 additions and 29 deletions
+1 -1
View File
@@ -257,7 +257,7 @@ static void adc_init(ADC_TypeDef *adc)
static void adc_setup()
{
#if DT_NODE_EXISTS(DT_PROP(V_HIGH_ENABLE_GPIO, enable_gpios))
struct device *dev = device_get_binding(DT_GPIO_LABEL(V_HIGH_ENABLE_GPIO, enable_gpios));
const struct device *dev = device_get_binding(DT_GPIO_LABEL(V_HIGH_ENABLE_GPIO, enable_gpios));
gpio_pin_configure(dev, DT_GPIO_PIN(V_HIGH_ENABLE_GPIO, enable_gpios),
DT_GPIO_FLAGS(V_HIGH_ENABLE_GPIO, enable_gpios) | GPIO_OUTPUT_ACTIVE);
#endif
+2 -2
View File
@@ -335,7 +335,7 @@ void Dcdc::fuse_destruction()
void Dcdc::output_hvs_enable()
{
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), hv_ext_sense))
struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
const struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
gpio_pin_configure(dev_hv_ext, DT_GPIO_PIN(HV_EXT_SENSE_GPIO, gpios),
DT_GPIO_FLAGS(HV_EXT_SENSE_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
#endif
@@ -344,7 +344,7 @@ void Dcdc::output_hvs_enable()
void Dcdc::output_hvs_disable()
{
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), hv_ext_sense))
struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
const struct device *dev_hv_ext = device_get_binding(DT_GPIO_LABEL(HV_EXT_SENSE_GPIO, gpios));
gpio_pin_configure(dev_hv_ext, DT_GPIO_PIN(HV_EXT_SENSE_GPIO, gpios),
DT_GPIO_FLAGS(HV_EXT_SENSE_GPIO, gpios) | GPIO_OUTPUT_INACTIVE);
#endif
+2 -2
View File
@@ -71,7 +71,7 @@ void eeprom_restore_data()
uint8_t buf_req[300]; // ThingSet request buffer
int err;
struct device *eeprom_dev = device_get_binding("EEPROM_0");
const struct device *eeprom_dev = device_get_binding("EEPROM_0");
// EEPROM header
uint8_t buf_header[EEPROM_HEADER_SIZE] = {}; // initialize to avoid compiler warning
@@ -114,7 +114,7 @@ void eeprom_store_data()
{
uint8_t buf[300];
struct device *eeprom_dev = device_get_binding("EEPROM_0");
const struct device *eeprom_dev = device_get_binding("EEPROM_0");
int len = ts.bin_pub(buf + EEPROM_HEADER_SIZE, sizeof(buf) - EEPROM_HEADER_SIZE, PUB_NVM);
uint32_t crc = _calc_crc(buf + EEPROM_HEADER_SIZE, len);
+2 -2
View File
@@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(ext_can, CONFIG_LOG_DEFAULT_LEVEL);
extern ThingSet ts;
extern uint16_t ts_can_node_id;
struct device *can_dev;
const struct device *can_dev;
#ifdef CONFIG_ISOTP
@@ -127,7 +127,7 @@ void can_pub_thread()
unsigned int can_id;
uint8_t can_data[8];
struct device *can_en_dev = device_get_binding(DT_GPIO_LABEL(CAN_EN_GPIO, gpios));
const struct device *can_en_dev = device_get_binding(DT_GPIO_LABEL(CAN_EN_GPIO, gpios));
gpio_pin_configure(can_en_dev, DT_GPIO_PIN(CAN_EN_GPIO, gpios),
DT_GPIO_FLAGS(CAN_EN_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
+1 -1
View File
@@ -173,7 +173,7 @@ void oled_update()
void oled_thread()
{
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), uext_en))
struct device *dev_uext_en = device_get_binding(DT_GPIO_LABEL(UEXT_EN_GPIO, gpios));
const struct device *dev_uext_en = device_get_binding(DT_GPIO_LABEL(UEXT_EN_GPIO, gpios));
gpio_pin_configure(dev_uext_en, DT_GPIO_PIN(UEXT_EN_GPIO, gpios),
DT_GPIO_FLAGS(UEXT_EN_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
#endif
+2 -2
View File
@@ -26,7 +26,7 @@
#error "No UART for ThingSet serial defined."
#endif
struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
static char buf_resp[CONFIG_THINGSET_SERIAL_TX_BUF_SIZE];
static char buf_req[CONFIG_THINGSET_SERIAL_RX_BUF_SIZE];
@@ -73,7 +73,7 @@ void process_asap()
* Read characters from stream until line end \n detected, signal command available then
* and wait for processing
*/
void process_input(void* user_data)
void process_input(const struct device *dev, void* user_data)
{
uint8_t c;
+2 -2
View File
@@ -43,7 +43,7 @@ struct sw_wdt_channel {
uint32_t timeout; // timeout of corresponding thread for sw_watchdog
};
static struct device *wdt;
static const struct device *wdt;
struct k_timer sw_wdt_timer;
struct sw_wdt_channel sw_wdt_channels[MAX_SW_WDT_CHANNELS];
@@ -124,7 +124,7 @@ void start_stm32_bootloader()
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), boot0))
// pin is connected to BOOT0 via resistor and capacitor
struct device *dev = device_get_binding(DT_GPIO_LABEL(BOOT0_GPIO, gpios));
const struct device *dev = device_get_binding(DT_GPIO_LABEL(BOOT0_GPIO, gpios));
gpio_pin_configure(dev, DT_GPIO_PIN(BOOT0_GPIO, gpios),
DT_GPIO_FLAGS(BOOT0_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
+1 -1
View File
@@ -115,7 +115,7 @@ void leds_update_thread()
unsigned int led_count = 0;
int flicker_count = 0;
bool flicker_state = true;
struct device *led_devs[NUM_LED_PINS];
const struct device *led_devs[NUM_LED_PINS];
int wdt_channel = watchdog_register(1000);
+3 -3
View File
@@ -23,12 +23,12 @@
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), load))
#define LOAD_GPIO DT_CHILD(DT_PATH(outputs), load)
static struct device *dev_load;
static const struct device *dev_load;
#endif
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), usb_pwr))
#define USB_GPIO DT_CHILD(DT_PATH(outputs), usb_pwr)
static struct device *dev_usb;
static const struct device *dev_usb;
#endif
#include "hardware.h"
@@ -229,7 +229,7 @@ void load_cp_enable()
This should do the same using the Zephyr driver, but there seems to be a bug in Zephyr v2.2
so that it doesn't work with advanced timer as TIM8. Keep it here until Zephyr bug was fixed.
struct device *pwm_dev;
const struct device *pwm_dev;
pwm_dev = device_get_binding(DT_OUTPUTS_CHARGE_PUMP_PWMS_CONTROLLER);
if (!pwm_dev) {
LOG_ERR("Cannot find %s!\n", DT_OUTPUTS_CHARGE_PUMP_PWMS_CONTROLLER);