Zephyr: Added PWM 2420 LUS board
This commit is contained in:
+6
-2
@@ -13,11 +13,15 @@
|
||||
#include "device_status.h"
|
||||
#include "debug.h"
|
||||
|
||||
#ifdef __ZEPHYR__
|
||||
#include <stm32l0xx_ll_system.h>
|
||||
#endif
|
||||
|
||||
extern DeviceStatus dev_stat;
|
||||
|
||||
extern LoadOutput load; // necessary to call emergency stop function
|
||||
|
||||
#if defined(PIN_I_LOAD_COMP) && PIN_LOAD_DIS == PB_2
|
||||
#if defined(__MBED__) && defined(PIN_I_LOAD_COMP) && PIN_LOAD_DIS == PB_2
|
||||
static void lptim_init()
|
||||
{
|
||||
// Enable peripheral clock of GPIOB
|
||||
@@ -69,7 +73,7 @@ static void lptim_init()
|
||||
|
||||
static void short_circuit_comp_init()
|
||||
{
|
||||
#ifdef PIN_I_LOAD_COMP
|
||||
#if defined(__MBED__) && defined(PIN_I_LOAD_COMP)
|
||||
MBED_ASSERT(PIN_I_LOAD_COMP == PB_4);
|
||||
|
||||
// set GPIO pin to analog
|
||||
|
||||
@@ -69,7 +69,7 @@ static const PinName led_pins[NUM_LED_PINS] = {
|
||||
PB_14, PB_13, PB_2, PB_11, PB_10
|
||||
};
|
||||
#elif defined(__ZEPHYR__)
|
||||
// defined in boar definition pinmux.c
|
||||
// defined in board definition pinmux.c
|
||||
extern const char *led_ports[CONFIG_NUM_LED_PINS];
|
||||
extern const int led_pins[CONFIG_NUM_LED_PINS];
|
||||
#endif // MBED or ZEPHYR
|
||||
|
||||
+13
-2
@@ -7,6 +7,12 @@
|
||||
#ifndef PWM_2420_LUS_H
|
||||
#define PWM_2420_LUS_H
|
||||
|
||||
#ifdef __MBED__
|
||||
#include "mbed.h"
|
||||
#elif defined(__ZEPHYR__)
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#define DEVICE_TYPE "PWM-2420-LUS"
|
||||
|
||||
#ifdef CONFIG_BOARD_PWM_2420_LUS_0V2
|
||||
@@ -15,8 +21,6 @@
|
||||
#define HARDWARE_VERSION "v0.3"
|
||||
#endif
|
||||
|
||||
#include "mbed.h"
|
||||
|
||||
// specify features of charge controller
|
||||
#define CONFIG_HAS_DCDC_CONVERTER 0
|
||||
#define CONFIG_HAS_PWM_SWITCH 1
|
||||
@@ -76,10 +80,17 @@ enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT };
|
||||
|
||||
// LED pins and pin state configuration to switch above LEDs on
|
||||
#define NUM_LED_PINS 3
|
||||
|
||||
#ifdef __MBED__
|
||||
static const PinName led_pins[NUM_LED_PINS] = {
|
||||
// A B C
|
||||
PB_13, PB_14, PB_15
|
||||
};
|
||||
#elif defined(__ZEPHYR__)
|
||||
// defined in board definition pinmux.c
|
||||
extern const char *led_ports[CONFIG_NUM_LED_PINS];
|
||||
extern const int led_pins[CONFIG_NUM_LED_PINS];
|
||||
#endif // MBED or ZEPHYR
|
||||
|
||||
#ifndef LEDS_WRONG_POLARITY
|
||||
static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
|
||||
static bool _pwm_active;
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#if defined(__MBED__) && !defined(UNIT_TEST)
|
||||
|
||||
static int _pwm_resolution;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user