Coding style updated/fixed

Indentations of class definitions and preprocessor statements were not
uniform throughout the code. This commit cleans up indentations as well
as the order of include statements.

Style conventions see: https://github.com/LibreSolar/coding-style
This commit is contained in:
Martin Jaeger
2020-01-28 13:20:01 +01:00
parent c04081fc8a
commit eed8c9114c
22 changed files with 280 additions and 267 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
This repository contains the firmware for the different Libre Solar Charge Controllers. Originally, the firmware was based on [ARM Mbed OS](https://www.mbed.com). The current version also supports using [Zephyr RTOS](https://www.zephyrproject.org/) for some boards.
Coding style is described [here](https://libre.solar/docs/coding_style/).
Coding style is described [here](https://github.com/LibreSolar/coding-style).
**Warning:** This firmware is under active development. Even though we try our best not to break any features that worked before, not every commit is fully tested on every board before including it to the master branch. For stable and tested versions consider using the latest [release](https://github.com/LibreSolar/charge-controller-firmware/releases).
+7 -6
View File
@@ -5,16 +5,17 @@
*/
#include "bat_charger.h"
#include "config.h"
#include "pcb.h"
#include "helper.h"
#include "device_status.h"
extern DeviceStatus dev_stat;
#include <math.h> // for fabs function
#include <stdio.h>
#include "config.h"
#include "pcb.h"
#include "helper.h"
#include "device_status.h"
extern DeviceStatus dev_stat;
void battery_conf_init(BatConf *bat, BatType type, int num_cells, float nominal_capacity)
{
bat->nominal_capacity = nominal_capacity;
+2 -2
View File
@@ -11,10 +11,10 @@
#ifdef BOOTLOADER_ENABLED
#include <cstdint>
#include "config.h"
#include <cstdint>
/** Length of the bootloader name string (including \0 termination) */
const uint8_t BOOTLADER_NAME_LENGTH = 18;
+5 -6
View File
@@ -8,15 +8,12 @@
#if defined(__ZEPHYR__)
#include <zephyr.h>
#include <drivers/adc.h>
#include "pcb.h"
#include "debug.h"
#include <stdint.h>
#include <inttypes.h>
#include <zephyr.h>
#include <drivers/adc.h>
#if defined(CONFIG_SOC_SERIES_STM32L0X)
#include <stm32l0xx_ll_system.h>
#include <stm32l0xx_ll_adc.h>
@@ -29,6 +26,8 @@
#include <stm32g4xx_ll_dma.h>
#endif
#include "pcb.h"
#include "debug.h"
#if !defined(CONFIG_SOC_SERIES_STM32F0X) && !defined(CONFIG_SOC_SERIES_STM32L0X)
// Rank and sequence definitions for STM32G4 from adc_stm32.c Zephyr driver
+2 -1
View File
@@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdio.h>
#include "main.h"
#include "pcb.h"
@@ -17,7 +19,6 @@
#include "hardware.h"
#include "dcdc.h"
#include "eeprom.h"
#include <stdio.h>
const char* const manufacturer = "Libre Solar";
const char* const device_type = DEVICE_TYPE;
+7 -7
View File
@@ -5,18 +5,18 @@
*/
#include "dcdc.h"
#include "pcb.h"
#include "device_status.h"
#include "debug.h"
#include "helper.h"
#include "half_bridge.h"
#include "eeprom.h"
#include <math.h> // for fabs function
#include <stdlib.h> // for min/max function
#include <stdio.h>
#include "pcb.h"
#include "device_status.h"
#include "debug.h"
#include "helper.h"
#include "half_bridge.h"
#include "eeprom.h"
extern DeviceStatus dev_stat;
#if CONFIG_HAS_DCDC_CONVERTER == 0
+5 -5
View File
@@ -5,15 +5,15 @@
*/
#include "device_status.h"
#include "config.h"
#include "pcb.h"
#include "main.h"
#include "helper.h"
#include <math.h> // for fabs function
#include <stdio.h>
#include "config.h"
#include "pcb.h"
#include "main.h"
#include "helper.h"
//----------------------------------------------------------------------------
// must be called exactly once per second, otherwise energy calculation gets wrong
void DeviceStatus::update_energy()
+31 -33
View File
@@ -6,66 +6,63 @@
#ifdef __MBED__
#include "mbed.h"
#include "config.h"
#ifdef CAN_ENABLED
#include "ext.h"
#include "mbed.h"
#include "pcb.h"
#include "thingset.h"
#include "data_objects.h"
#include "can_msg_queue.h"
#ifndef HAS_CAN
#error The hardware does not support CAN, please undefine CAN_ENABLED
#endif
#include "can_msg_queue.h"
//#include "can_iso_tp.h"
#include "thingset.h"
#ifndef CAN_SPEED
#define CAN_SPEED 250000 // 250 kHz
#endif
#include "data_objects.h"
#include "can_msg_queue.h"
#include "ext.h"
class ThingSetCAN: public ExtInterface
{
public:
ThingSetCAN(uint8_t can_node_id, const unsigned int c);
public:
ThingSetCAN(uint8_t can_node_id, const unsigned int c);
void process_asap();
void process_1s();
void process_asap();
void process_1s();
void enable();
void enable();
private:
bool pub_object(const data_object_t& data_obj);
int pub();
void process_outbox();
private:
bool pub_object(const data_object_t& data_obj);
int pub();
void process_outbox();
#if defined(CAN_RECEIVE)
void process_inbox();
void process_input();
void send_object_name(int data_obj_id, uint8_t can_dest_id);
CANMsgQueue rx_queue;
#endif
#if defined(CAN_RECEIVE)
void process_inbox();
void process_input();
void send_object_name(int data_obj_id, uint8_t can_dest_id);
CANMsgQueue rx_queue;
#endif
CANMsgQueue tx_queue;
uint8_t node_id;
const unsigned int channel;
CAN can;
DigitalOut can_disable;
CANMsgQueue tx_queue;
uint8_t node_id;
const unsigned int channel;
CAN can;
DigitalOut can_disable;
};
extern const unsigned int PUB_CHANNEL_CAN;
#ifndef CAN_NODE_ID
#define CAN_NODE_ID 10
#endif
ThingSetCAN ts_can(CAN_NODE_ID, PUB_CHANNEL_CAN);
ThingSetCAN ts_can(CAN_NODE_ID, PUB_CHANNEL_CAN);
class ThingSetCAN_Device
{
@@ -292,6 +289,7 @@ void ThingSetCAN::process_input()
}
}
#endif /* CAN_RECEIVE */
#endif /* CAN_ENABLED */
#endif /* __MBED__ */
+23 -12
View File
@@ -6,55 +6,66 @@
#if defined(__MBED__) && !defined(UNIT_TEST)
#include "ext/can_msg_queue.h"
#include "mbed.h"
#ifdef STM32F0 // STM32L0 does not have CAN
#include "can_msg_queue.h"
bool CANMsgQueue::full() {
bool CANMsgQueue::full()
{
return _length == CAN_QUEUE_SIZE;
}
bool CANMsgQueue::empty() {
bool CANMsgQueue::empty()
{
return _length == 0;
}
void CANMsgQueue::enqueue(CANMessage msg) {
void CANMsgQueue::enqueue(CANMessage msg)
{
if (!full()) {
_queue[(_first + _length) % CAN_QUEUE_SIZE] = msg;
_length++;
}
}
int CANMsgQueue::dequeue() {
int CANMsgQueue::dequeue()
{
if (!empty()) {
_first = (_first + 1) % CAN_QUEUE_SIZE;
_length--;
return 1;
} else {
}
else {
return 0;
}
}
int CANMsgQueue::dequeue(CANMessage& msg) {
int CANMsgQueue::dequeue(CANMessage& msg)
{
if (!empty()) {
msg = _queue[_first];
_first = (_first + 1) % CAN_QUEUE_SIZE;
_length--;
return 1;
} else {
}
else {
return 0;
}
}
int CANMsgQueue::first(CANMessage& msg) {
int CANMsgQueue::first(CANMessage& msg)
{
if (!empty()) {
msg = _queue[_first];
return 1;
} else {
}
else {
return 0;
}
}
#endif /* STM32F0 */
#endif
#endif
+5 -4
View File
@@ -7,13 +7,14 @@
#ifndef CAN_MSG_QUEUE_H
#define CAN_MSG_QUEUE_H
#ifdef STM32F0 // STM32L0 does not have CAN
#include "mbed.h"
#ifdef STM32F0 // STM32L0 does not have CAN
#define CAN_QUEUE_SIZE 30
class CANMsgQueue {
class CANMsgQueue
{
public:
bool full();
bool empty();
@@ -30,4 +31,4 @@ private:
#endif /* STM32F0 */
#endif /* CAN_MSG_QUEUE_H */
#endif /* CAN_MSG_QUEUE_H */
+16 -9
View File
@@ -5,6 +5,7 @@
*/
#include "ext.h"
#include <algorithm>
// we use code to self register objects at construction time.
@@ -16,41 +17,47 @@ std::vector<ExtInterface*>* ExtManager::interfaces;
// run the respective function on all objects in the "devices" list
// use the c++11 lambda expressions here for the for_each loop, keeps things compact
void ExtManager::process_asap() {
void ExtManager::process_asap()
{
for_each(std::begin(*interfaces),std::end(*interfaces), [](ExtInterface* tsif) {
tsif->process_asap();
});
}
void ExtManager::enable_all() {
void ExtManager::enable_all()
{
for_each(std::begin(*interfaces),std::end(*interfaces), [](ExtInterface* tsif) {
tsif->enable();
});
}
void ExtManager::process_1s() {
void ExtManager::process_1s()
{
for_each(std::begin(*interfaces),std::end(*interfaces), [](ExtInterface* tsif) {
tsif->process_1s();
});
}
void ExtManager::check_list() {
if (ExtManager::interfaces == NULL)
{
void ExtManager::check_list()
{
if (ExtManager::interfaces == NULL) {
ExtManager::interfaces = new std::vector<ExtInterface*>;
}
}
void ExtManager::add_ext(ExtInterface* member) {
void ExtManager::add_ext(ExtInterface* member)
{
check_list();
interfaces->push_back(member);
}
ExtManager::ExtManager() {
ExtManager::ExtManager()
{
check_list();
}
ExtInterface::ExtInterface() {
ExtInterface::ExtInterface()
{
ext_mgr.add_ext(this);
}
+37 -37
View File
@@ -16,53 +16,53 @@
class ExtInterface
{
public:
ExtInterface();
virtual void process_asap() {};
virtual void process_1s() {};
virtual void enable() {};
public:
ExtInterface();
virtual void process_asap() {};
virtual void process_1s() {};
virtual void enable() {};
};
class ExtManager
{
public:
ExtManager();
public:
ExtManager();
/** UEXT interface process function
*
* This function is called in each main loop, as soon as all other tasks finished.
*/
virtual void process_asap();
/** UEXT interface process function
*
* This function is called in each main loop, as soon as all other tasks finished.
*/
virtual void process_asap();
/** UEXT interface process function
*
* This function is called every second, if no other task was blocking for a longer time.
* It should be used for state machines, etc.
*/
virtual void process_1s();
/** UEXT interface process function
*
* This function is called every second, if no other task was blocking for a longer time.
* It should be used for state machines, etc.
*/
virtual void process_1s();
/* UEXT interface initialization
*
* This function is called only once at startup.
*/
virtual void enable_all();
/* UEXT interface initialization
*
* This function is called only once at startup.
*/
virtual void enable_all();
/**
* Adds an ExtInterface object to the list of managed extensions,
* automatically called by ExtInterface objects during construction
*/
static void add_ext(ExtInterface*);
/**
* Adds an ExtInterface object to the list of managed extensions,
* automatically called by ExtInterface objects during construction
*/
static void add_ext(ExtInterface*);
private:
/**
* Stores list of all ExtInterface objects
*/
static std::vector<ExtInterface*>* interfaces;
private:
/**
* Stores list of all ExtInterface objects
*/
static std::vector<ExtInterface*>* interfaces;
/**
* Makes sure there is an internal interfacts vector created, does nothing if it exists
*/
static void check_list();
/**
* Makes sure there is an internal interfacts vector created, does nothing if it exists
*/
static void check_list();
};
extern ExtManager ext_mgr;
+6 -6
View File
@@ -10,11 +10,11 @@
#if CONFIG_EXT_OLED_DISPLAY // otherwise don't compile code to reduce firmware size
#include "ext/ext.h"
#include <math.h>
#include <stdio.h>
#include "ext/ext.h"
#include "main.h"
#include "pcb.h"
#include "oled_ssd1306.h"
@@ -22,10 +22,10 @@
// implement specific extension inherited from ExtInterface
class ExtOled: public ExtInterface
{
public:
ExtOled() {};
void enable();
void process_1s();
public:
ExtOled() {};
void enable();
void process_1s();
};
static ExtOled ext_oled; // local instance, will self register itself
+107 -111
View File
@@ -10,136 +10,134 @@
#if CONFIG_EXT_THINGSET_SERIAL // otherwise don't compile code to reduce firmware size
#include "thingset.h"
#include "ext.h"
#ifdef __ZEPHYR__
#define TX_BUF_SIZE CONFIG_EXT_THINGSET_SERIAL_TX_BUF_SIZE
#define RX_BUF_SIZE CONFIG_EXT_THINGSET_SERIAL_RX_BUF_SIZE
#else
#define TX_BUF_SIZE 1000
#define RX_BUF_SIZE 500
#endif
#ifdef __MBED__
#include "mbed.h"
#elif defined(__ZEPHYR__)
#include <zephyr.h>
#include <sys/printk.h>
#include <string.h>
#include <stdio.h>
#include <drivers/uart.h>
#endif /* MBED or ZEPHYR */
#include "thingset.h"
#ifdef __ZEPHYR__
#define TX_BUF_SIZE CONFIG_EXT_THINGSET_SERIAL_TX_BUF_SIZE
#define RX_BUF_SIZE CONFIG_EXT_THINGSET_SERIAL_RX_BUF_SIZE
#define UART_DEVICE_NAME DT_ALIAS_UART_DBG_LABEL
struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
#endif /* MBED or ZEPHYR */
#else
#define TX_BUF_SIZE 1000
#define RX_BUF_SIZE 500
#endif
class ThingSetStream: public ExtInterface
{
public:
#ifdef __MBED__
ThingSetStream(Stream& s, const unsigned int c): channel(c), stream(&s) {};
#elif defined(__ZEPHYR__)
ThingSetStream(const unsigned int c): channel(c){};
#endif
public:
#ifdef __MBED__
ThingSetStream(Stream& s, const unsigned int c): channel(c), stream(&s) {};
#elif defined(__ZEPHYR__)
ThingSetStream(const unsigned int c): channel(c){};
#endif
virtual void process_asap();
virtual void process_1s();
virtual void process_asap();
virtual void process_1s();
protected:
#ifdef __MBED__
virtual void process_input(); // this is called from the ISR typically
#elif defined (__ZEPHYR__)
static void process_input(void*);
#endif
protected:
#ifdef __MBED__
virtual void process_input(); // this is called from the ISR typically
#elif defined (__ZEPHYR__)
static void process_input(void*);
#endif
const unsigned int channel;
const unsigned int channel;
#ifdef __MBED__
virtual bool readable()
{
return stream->readable();
#ifdef __MBED__
virtual bool readable()
{
return stream->readable();
}
#elif defined (__ZEPHYR__)
static bool readable()
{
// Start processing interrupts in ISR.
// This function should be called the first thing in the ISR.
if (!uart_irq_update(uart_dev)) {
// The function output should always be 1.
return false;
}
// Check if data is available to read.
return uart_irq_rx_ready(uart_dev);
}
#elif defined (__ZEPHYR__)
static bool readable()
{
// Start processing interrupts in ISR.
// This function should be called the first thing in the ISR.
if (!uart_irq_update(uart_dev)) {
// The function output should always be 1.
return false;
}
// Check if data is available to read.
return uart_irq_rx_ready(uart_dev);
}
typedef struct {
char *buf_req_ptr;
size_t *req_pos_ptr;
bool *command_flag_ptr;
} DataStreamStruct;
typedef struct {
char *buf_req_ptr;
size_t *req_pos_ptr;
bool *command_flag_ptr;
} DataStreamStruct;
// Data structure used to pass member variables into a static callback ISR.
// Callback registration requires the function to be static.
// But static functions dont have access to the class members.
// Hence these members are passed as a structure of pointers.
DataStreamStruct data_stream = {buf_req, &req_pos, &command_flag};
#endif /* MBED */
// Data structure used to pass member variables into a static callback ISR.
// Callback registration requires the function to be static.
// But static functions dont have access to the class members.
// Hence these members are passed as a structure of pointers.
DataStreamStruct data_stream = {buf_req, &req_pos, &command_flag};
#endif /* MBED */
private:
#ifdef __MBED__
Stream* stream;
#endif /* MBED */
private:
#ifdef __MBED__
Stream* stream;
#endif /* MBED */
char buf_resp[TX_BUF_SIZE];
char buf_req[RX_BUF_SIZE];
size_t req_pos = 0;
bool command_flag = false;
char buf_resp[TX_BUF_SIZE];
char buf_req[RX_BUF_SIZE];
size_t req_pos = 0;
bool command_flag = false;
};
#ifdef __MBED__
template<typename T> class ThingSetSerial: public ThingSetStream
{
public:
ThingSetSerial(T& s, const unsigned int c): ThingSetStream(s,c), ser(s) {}
public:
ThingSetSerial(T& s, const unsigned int c): ThingSetStream(s,c), ser(s) {}
void enable() {
Callback<void()> cb([this]() -> void { this->process_input();});
ser.attach(cb);
}
void enable() {
Callback<void()> cb([this]() -> void { this->process_input();});
ser.attach(cb);
}
private:
bool readable()
{
return ser.readable();
}
private:
bool readable()
{
return ser.readable();
}
private:
T& ser;
private:
T& ser;
};
#elif defined(__ZEPHYR__)
class ThingSetSerial: public ThingSetStream
{
public:
ThingSetSerial(const int c): ThingSetStream(c){}
public:
ThingSetSerial(const int c): ThingSetStream(c){}
void enable() {
/* Configure UART ISR: Configure a Callback function */
// Callback function to be given access to the class members using the below API.
// These members are accessed by the ISR using a pointer to the data structure.
uart_irq_callback_user_data_set(uart_dev, process_input, (void*)&data_stream);
void enable() {
/* Configure UART ISR: Configure a Callback function */
// Callback function to be given access to the class members using the below API.
// These members are accessed by the ISR using a pointer to the data structure.
uart_irq_callback_user_data_set(uart_dev, process_input, (void*)&data_stream);
/* Enable Rx interrupt in the IER */
uart_irq_rx_enable(uart_dev);
}
/* Enable Rx interrupt in the IER */
uart_irq_rx_enable(uart_dev);
}
};
#endif /* MBED or ZEPHYR*/
/*
@@ -149,14 +147,15 @@ class ThingSetSerial: public ThingSetStream
*/
#ifdef CONFIG_EXT_THINGSET_SERIAL
extern const int pub_channel_serial;
#ifdef __MBED__
extern Serial serial;
ThingSetSerial ts_uart(serial, pub_channel_serial);
#elif defined(__ZEPHYR__)
ThingSetSerial ts_uart(pub_channel_serial);
#endif /* MBED or ZEPHYR */
extern const int pub_channel_serial;
#ifdef __MBED__
extern Serial serial;
ThingSetSerial ts_uart(serial, pub_channel_serial);
#elif defined(__ZEPHYR__)
ThingSetSerial ts_uart(pub_channel_serial);
#endif /* MBED or ZEPHYR */
#endif /* CONFIG_EXT_THINGSET_SERIAL */
@@ -165,19 +164,17 @@ extern ThingSet ts;
void ThingSetStream::process_1s()
{
if (ts.get_pub_channel(channel)->enabled) {
#ifdef __MBED__
#ifdef __MBED__
ts.pub_msg_json(buf_resp, sizeof(buf_resp), channel);
stream->puts(buf_resp);
stream->putc('\n');
#elif defined(__ZEPHYR__)
#elif defined(__ZEPHYR__)
int len = ts.pub_msg_json(buf_resp, sizeof(buf_resp), channel);
for (int i = 0; i < len; i++) {
uart_poll_out(uart_dev, buf_resp[i]);
}
uart_poll_out(uart_dev, '\n');
#endif /* MBED or ZREPHYR */
#endif /* MBED or ZREPHYR */
}
}
@@ -186,21 +183,20 @@ void ThingSetStream::process_asap()
if (command_flag) {
// commands must have 2 or more characters
if (req_pos > 1) {
#ifdef __MBED__
#ifdef __MBED__
stream->printf("Received Request (%d bytes): %s\n", strlen(buf_req), buf_req);
ts.process((uint8_t *)buf_req, strlen(buf_req), (uint8_t *)buf_resp, sizeof(buf_resp));
stream->puts(buf_resp);
stream->putc('\n');
fflush(*stream);
#elif defined(__ZEPHYR__)
#elif defined(__ZEPHYR__)
printf("Received Request (%d bytes): %s\n", strlen(buf_req), buf_req);
int len = ts.process((uint8_t *)buf_req, strlen(buf_req), (uint8_t *)buf_resp, sizeof(buf_resp));
for (int i = 0; i < len; i++) {
uart_poll_out(uart_dev, buf_resp[i]);
}
uart_poll_out(uart_dev, '\n');
#endif /* MBED or ZEPHYR */
#endif /* MBED or ZEPHYR */
}
// start listening for new commands
@@ -219,20 +215,20 @@ void ThingSetStream::process_input()
void ThingSetStream::process_input(void* user_data)
#endif /* MBED or ZEPHYR */
{
#ifdef __ZEPHYR__
#ifdef __ZEPHYR__
u8_t c;
DataStreamStruct *data_stream_ptr = (DataStreamStruct *)user_data;
bool command_flag = *(data_stream_ptr->command_flag_ptr);
char *buf_req = data_stream_ptr->buf_req_ptr;
size_t req_pos = *(data_stream_ptr->req_pos_ptr);
#endif /* __ZEPHYR__ */
#endif /* __ZEPHYR__ */
while (readable() && command_flag == false) {
#ifdef __MBED__
#ifdef __MBED__
int c = stream->getc();
#elif defined(__ZEPHYR__)
#elif defined(__ZEPHYR__)
uart_fifo_read(uart_dev, &c, 1);
#endif /* MBED */
#endif /* MBED */
// \r\n and \n are markers for line end, i.e. command end
// we accept this at any time, even if the buffer is 'full', since
@@ -261,10 +257,10 @@ void ThingSetStream::process_input(void* user_data)
buf_req[req_pos++] = c;
}
#ifdef __ZEPHYR__
#ifdef __ZEPHYR__
*(data_stream_ptr->command_flag_ptr) = command_flag;
*(data_stream_ptr->req_pos_ptr) = req_pos;
#endif
#endif
}
}
+6 -6
View File
@@ -15,16 +15,16 @@
*/
// Only compile if this EXT interface is enabled in config.h
#ifdef EXT_TEMPLATE_ENABLED
#ifdef CONFIG_EXT_TEMPLATE_ENABLED
// implement specific extension inherited from ExtInterface
class ExtTemplate: public ExtInterface
{
public:
ExtTemplate();
void enable();
void process_asap();
void process_1s();
public:
ExtTemplate();
void enable();
void process_asap();
void process_1s();
};
static ExtTemplate ext_template; // local instance, will self register itself
+2 -3
View File
@@ -10,12 +10,11 @@
#ifdef WIFI_ENABLED
#include "load.h"
#include "thingset.h"
#include <inttypes.h>
#include "load.h"
#include "thingset.h"
#include "pcb.h"
#include "ESP32.h"
UARTSerial uext_serial(PIN_UEXT_TX, PIN_UEXT_RX, 115200);
+2 -2
View File
@@ -6,12 +6,12 @@
#include "half_bridge.h"
#include <stdio.h>
#include "mcu.h"
#include "pcb.h"
#include "config.h"
#include <stdio.h>
static int _pwm_resolution;
static float _min_duty;
static float _max_duty;
-1
View File
@@ -14,7 +14,6 @@
#include "pcb.h"
#include "load.h"
#include "half_bridge.h"
//#include "us_ticker_data.h"
#include "leds.h"
extern LoadOutput load;
+2 -2
View File
@@ -6,14 +6,14 @@
#include "helper.h"
#include <time.h>
#ifdef __MBED__
#include "mbed.h"
#elif defined(__ZEPHYR__)
#include <zephyr.h>
#endif
#include <time.h>
uint32_t uptime()
{
#ifdef __ZEPHYR__
+1
View File
@@ -5,6 +5,7 @@
*/
#include "leds.h"
#include "pcb.h"
static int led_states[NUM_LEDS]; // must be one of enum LedState
+7 -7
View File
@@ -6,13 +6,6 @@
#include "load.h"
#include "pcb.h"
#include "config.h"
#include "hardware.h"
#include "leds.h"
#include "device_status.h"
#include "debug.h"
#if defined(__ZEPHYR__)
#include <zephyr.h>
@@ -27,6 +20,13 @@
#endif // __ZEPHYR__
#include "pcb.h"
#include "config.h"
#include "hardware.h"
#include "leds.h"
#include "device_status.h"
#include "debug.h"
extern LoadOutput load; // necessary to call emergency stop function
#if defined(PIN_I_LOAD_COMP) && PIN_LOAD_DIS == PB_2
+6 -6
View File
@@ -5,16 +5,16 @@
*/
#include "pwm_switch.h"
#include "config.h"
#include "pcb.h"
#include "daq.h"
#include "debug.h"
#include "helper.h"
#include <stdio.h>
#include <time.h>
#include "config.h"
#include "pcb.h"
#include "daq.h"
#include "debug.h"
#include "helper.h"
#if CONFIG_HAS_PWM_SWITCH
static bool _pwm_active;