Move PCB type and version to DTS
This commit is contained in:
@@ -7,9 +7,6 @@
|
||||
#ifndef MPPT_1210_HUS_0V4_H
|
||||
#define MPPT_1210_HUS_0V4_H
|
||||
|
||||
#define DEVICE_TYPE "MPPT-1210-HUS"
|
||||
#define HARDWARE_VERSION "v0.4"
|
||||
|
||||
#define LOAD_CURRENT_MAX 10 // PCB maximum load switch current
|
||||
|
||||
#define PIN_UEXT_TX PA_2
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
pcb {
|
||||
compatible = "charge-controller";
|
||||
|
||||
type = "MPPT 1210 HUS";
|
||||
version-str = "v0.4";
|
||||
version-num = <4>;
|
||||
|
||||
hs-voltage-max = <40>;
|
||||
ls-voltage-max = <16>;
|
||||
};
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
#ifndef MPPT_1210_HUS_0V7_H
|
||||
#define MPPT_1210_HUS_0V7_H
|
||||
|
||||
#define DEVICE_TYPE "MPPT-1210-HUS"
|
||||
#define HARDWARE_VERSION "v0.7.1"
|
||||
|
||||
#define LOAD_CURRENT_MAX 10 // PCB maximum load switch current
|
||||
|
||||
#define PIN_UEXT_TX PA_2
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
pcb {
|
||||
compatible = "charge-controller";
|
||||
|
||||
type = "MPPT 1210 HUS";
|
||||
version-str = "v0.7.1";
|
||||
version-num = <7>; // minor version .1 includes no HW change
|
||||
|
||||
hs-voltage-max = <40>;
|
||||
ls-voltage-max = <16>;
|
||||
};
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define DEVICE_TYPE "MPPT-2420-HPX"
|
||||
#define HARDWARE_VERSION "v0.1"
|
||||
|
||||
#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current
|
||||
|
||||
#define PIN_UEXT_TX PA_2
|
||||
|
||||
@@ -44,6 +44,11 @@
|
||||
|
||||
pcb {
|
||||
compatible = "charge-controller";
|
||||
|
||||
type = "MPPT 2420 HPX";
|
||||
version-str = "v0.1";
|
||||
version-num = <1>;
|
||||
|
||||
hs-voltage-max = <80>;
|
||||
ls-voltage-max = <32>;
|
||||
};
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
#ifndef MPPT_2420_LC_0V10_H
|
||||
#define MPPT_2420_LC_0V10_H
|
||||
|
||||
#define DEVICE_TYPE "MPPT-2420-LC"
|
||||
#define HARDWARE_VERSION "v0.10"
|
||||
|
||||
#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current
|
||||
|
||||
#define PIN_UEXT_DIS PC_14 // starting from rev. 0.10
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
pcb {
|
||||
compatible = "charge-controller";
|
||||
|
||||
type = "MPPT 2420 LC";
|
||||
version-str = "v0.10";
|
||||
version-num = <10>;
|
||||
|
||||
hs-voltage-max = <55>;
|
||||
ls-voltage-max = <32>;
|
||||
};
|
||||
|
||||
@@ -7,14 +7,6 @@
|
||||
#ifndef PWM_2420_LUS_H
|
||||
#define PWM_2420_LUS_H
|
||||
|
||||
#define DEVICE_TYPE "PWM-2420-LUS"
|
||||
|
||||
#ifdef CONFIG_BOARD_PWM_2420_LUS_0V2
|
||||
#define HARDWARE_VERSION "v0.2"
|
||||
#elif defined(CONFIG_BOARD_PWM_2420_LUS_0V3)
|
||||
#define HARDWARE_VERSION "v0.3"
|
||||
#endif
|
||||
|
||||
#define LOAD_CURRENT_MAX 15 // PCB maximum load switch current
|
||||
|
||||
#define PIN_UEXT_TX PA_2
|
||||
@@ -89,10 +81,10 @@ static const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = {
|
||||
#define ADC_GAIN_V_LOW (132 / 12)
|
||||
#define ADC_GAIN_V_PWM (1 + 120/12 + 120/8.2)
|
||||
|
||||
#ifdef CONFIG_BOARD_PWM_2420_LUS_0V2
|
||||
#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 2
|
||||
// op amp gain: 68/2.2, resistor: 2 mOhm
|
||||
#define ADC_GAIN_I_LOAD (1000 / 2 / (68/2.2))
|
||||
#elif defined(CONFIG_BOARD_PWM_2420_LUS_0V3)
|
||||
#elif DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 3
|
||||
// fix for hardware bug in overcurrent comparator voltage divider wiring
|
||||
#define ADC_GAIN_I_LOAD (1000 / 2 / (68/2.2) * (39+12+8.2) / (12+8.2))
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
pcb {
|
||||
compatible = "charge-controller";
|
||||
|
||||
type = "PWM 2420 LUS";
|
||||
version-str = "v0.3";
|
||||
version-num = <3>;
|
||||
|
||||
hs-voltage-max = <55>;
|
||||
ls-voltage-max = <32>;
|
||||
// The MCU, where internal temperature is measured, is close to the MOSFETs. Tests
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "eeprom.h"
|
||||
|
||||
const char* const manufacturer = "Libre Solar";
|
||||
const char* const device_type = DEVICE_TYPE;
|
||||
const char* const hardware_version = HARDWARE_VERSION;
|
||||
const char* const device_type = DT_CHARGE_CONTROLLER_PCB_TYPE;
|
||||
const char* const hardware_version = DT_CHARGE_CONTROLLER_PCB_VERSION_STR;
|
||||
const char* const firmware_version = "0.1";
|
||||
const char* const firmware_commit = COMMIT_HASH;
|
||||
uint32_t device_id = CONFIG_DEVICE_ID;
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@
|
||||
|
||||
#define CONFIG_DEVICE_ID 12345678
|
||||
|
||||
#define DEVICE_TYPE "PCB-STUB"
|
||||
#define HARDWARE_VERSION "v0.1"
|
||||
#define DT_CHARGE_CONTROLLER_PCB_TYPE "PCB-STUB"
|
||||
#define DT_CHARGE_CONTROLLER_PCB_VERSION_STR "v0.1"
|
||||
|
||||
// specify features of charge controller
|
||||
#define DT_COMPAT_DCDC 1
|
||||
|
||||
@@ -6,6 +6,18 @@ description: Generic charge controller device setup
|
||||
compatible: "charge-controller"
|
||||
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
required: true
|
||||
description: Device type
|
||||
version-str:
|
||||
type: string
|
||||
required: true
|
||||
description: Hardware version number (human-readable)
|
||||
version-num:
|
||||
type: int
|
||||
required: true
|
||||
description: Hardware version number (usable in preprocessor defines)
|
||||
hs-voltage-max:
|
||||
type: int
|
||||
required: true
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2020 Martin Jäger / Libre Solar
|
||||
*/
|
||||
|
||||
/ {
|
||||
pcb {
|
||||
version-str = "v0.2";
|
||||
version-num = <2>;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user