aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
diff options
context:
space:
mode:
authorIvan Zorin <[email protected]>2023-07-16 08:25:30 +0300
committerGitHub <[email protected]>2023-07-16 15:25:30 +1000
commitd95af7d1a0ddd5a93a0827d08294c5504c9e9a94 (patch)
treedfaa79b391b32332f4860464ea8f8c38f9a0849c /source
parentca79638a74fbf34228a9442928c4a906a61103d6 (diff)
downloadIronOS-d95af7d1a0ddd5a93a0827d08294c5504c9e9a94.tar.gz
IronOS-d95af7d1a0ddd5a93a0827d08294c5504c9e9a94.zip
clang-format implementation (#1740)
* Testing clang-format style check using github CI * github/push: implement check-style for clang-format as a separate build step * github/push: add missing packages for check-style/clang-format build step * source/Makefile: check-style - reduce files of interest; update .clang-format to keep enums init * source/Makefile: empty lines, spaces & tabs refactoring to unify style - part 1 out of N * source/Makefile: fix formatting for multi-line variables * source/Makefile: update formatting for multi-line variables * source/Makefile: remove spaces on vars assignments to unify style * source/Makefile: remove unused target style * source/Makefile: implement exclude vars for clang-format related files * source/Makefile: exclude configuration.h from clang-format check * Dockerfile: add diffutils in a container to make check-style target using advanced version of diff to get more advanced output to parse & navigate log more easily * source/Makefile: implement parser for clang-format inside check-style target to make output compatible with gcc-like error compilation format for compatibility with IDEs/editors for easy navigation over files to fix style errors * source/Makefile: probably final touches on unifying style * source/Makefile: implement check-style-list target to only list affected file names with wrong code style for debug purposes * source/Makefile: fix missed spaces * deploy.sh: add helper routine to deal with clang-format error output logging from makefile * gitignore: add clang-format log explicitly * Refactoring for clang-format compiance * Dockerfile: add sed * Dockerfile: false alarm - remove sed since busybox-sed seems fine * source/Makefile: reduce calls of clang-format & make error log more clean, clear, and tidy * deploy.sh:check_style() - add removal of DOS EOLs for generated log * source/Makefile:check-style: add more empty lines between blocks with errors for readability when suggestion is too long & heavy * source/Makefile: add STOP var to check-style for exit on first failed file * source/Makefile: check-style: make log looks more like traditional diff/patch output * source/Core/BSP/Pinecilv2/MemMang/heap_5.c: clang-format refactoring using reasonable advises ... and then disable it in Makefile from scanning by clang-format * Return headers include order * clang-format config: disable warnings about non-alphabetic include order * clang-format refactoring * clang-format refactoring, part 2 * clang-format refactoring, part 3 * settingsGUI.cpp: refactoring, part 1 * settingsGUI.cpp: refactoring, part 2 * settingsGUI.cpp: refactoring, part 3 * settingsGUI.cpp: refactoring, part 4 * clang-format should be happy now * workflows/push: put readme check into separate build step & update style * clang-format: giving SortIncludes option second chance by tweaking a couple of headers a bit * source/Makefile: check-style: add homebrew parser to check for { } in conditional blocks * homebrew-format: add { } for if/else, while, and for & unify some comments style; left two errors intentionally to debug & improve parser * source/Makefile: homebrew-format: fix false negative trigger for multi-line condition in if-s * Sleep.cpp: unify style & comments * source/Makefile: remove unused debug target
Diffstat (limited to 'source')
-rw-r--r--source/.clang-format1
-rw-r--r--source/Core/BSP/MHP30/Setup.c12
-rw-r--r--source/Core/BSP/MHP30/flash.c4
-rw-r--r--source/Core/BSP/Miniware/Setup.cpp6
-rw-r--r--source/Core/BSP/Miniware/flash.c1
-rw-r--r--source/Core/BSP/Miniware/port.c4
-rw-r--r--source/Core/BSP/Miniware/preRTOS.cpp1
-rw-r--r--source/Core/BSP/Pinecil/Debug.cpp14
-rw-r--r--source/Core/BSP/Pinecil/I2C_Wrapper.cpp5
-rw-r--r--source/Core/BSP/Pinecilv2/I2C_Wrapper.cpp11
-rw-r--r--source/Core/BSP/Pinecilv2/MemMang/heap_5.c689
-rw-r--r--source/Core/BSP/Pinecilv2/ble.c97
-rw-r--r--source/Core/BSP/Pinecilv2/ble_handlers.cpp3
-rw-r--r--source/Core/BSP/Pinecilv2/ble_peripheral.c4
-rw-r--r--source/Core/BSP/Pinecilv2/ble_peripheral.h1
-rw-r--r--source/Core/BSP/Sequre_S60/Setup.cpp6
-rw-r--r--source/Core/BSP/Sequre_S60/flash.c5
-rw-r--r--source/Core/BSP/Sequre_S60/port.c50
-rw-r--r--source/Core/Src/FreeRTOSHooks.c3
-rw-r--r--source/Core/Src/QC3.cpp27
-rw-r--r--source/Core/Src/Settings.cpp5
-rw-r--r--source/Core/Src/settingsGUI.cpp434
-rw-r--r--source/Core/Threads/OperatingModes/CJC.cpp3
-rw-r--r--source/Core/Threads/OperatingModes/DebugMenu.cpp12
-rw-r--r--source/Core/Threads/OperatingModes/HomeScreen.cpp19
-rw-r--r--source/Core/Threads/OperatingModes/Sleep.cpp22
-rw-r--r--source/Core/Threads/OperatingModes/Soldering.cpp9
-rw-r--r--source/Core/Threads/OperatingModes/SolderingProfile.cpp102
-rw-r--r--source/Core/Threads/OperatingModes/TemperatureAdjust.cpp33
-rw-r--r--source/Core/Threads/OperatingModes/USBPDDebug_FUSB.cpp5
-rw-r--r--source/Core/Threads/OperatingModes/USBPDDebug_HUSB238.cpp5
-rw-r--r--source/Core/Threads/OperatingModes/utils/DrawTipTemperature.cpp12
-rw-r--r--source/Core/Threads/OperatingModes/utils/SolderingCommon.cpp38
-rw-r--r--source/Core/Threads/OperatingModes/utils/drawPowerSourceIcon.cpp13
-rw-r--r--source/Core/Threads/OperatingModes/utils/getSleepTimeout.cpp7
-rw-r--r--source/Core/Threads/OperatingModes/utils/min.cpp7
-rw-r--r--source/Core/Threads/OperatingModes/utils/shouldDeviceSleep.cpp5
-rw-r--r--source/Core/Threads/POWThread.cpp1
-rw-r--r--source/Makefile1119
39 files changed, 1469 insertions, 1326 deletions
diff --git a/source/.clang-format b/source/.clang-format
index e5a3be22..a737f88c 100644
--- a/source/.clang-format
+++ b/source/.clang-format
@@ -19,6 +19,7 @@ AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
+AllowShortEnumsOnASingleLine: false ### <<< Keeps enums as is
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
diff --git a/source/Core/BSP/MHP30/Setup.c b/source/Core/BSP/MHP30/Setup.c
index 6e994463..79f49626 100644
--- a/source/Core/BSP/MHP30/Setup.c
+++ b/source/Core/BSP/MHP30/Setup.c
@@ -47,9 +47,9 @@ void Setup_HAL() {
MX_IWDG_Init();
HAL_ADC_Start(&hadc2);
HAL_ADCEx_MultiModeStart_DMA(&hadc1, ADCReadings,
- (ADC_SAMPLES * ADC_CHANNELS)); // start DMA of normal readings
- // HAL_ADCEx_InjectedStart(&hadc1); // enable injected readings
- // HAL_ADCEx_InjectedStart(&hadc2); // enable injected readings
+ (ADC_SAMPLES * ADC_CHANNELS)); // start DMA of normal readings
+ // HAL_ADCEx_InjectedStart(&hadc1); // enable injected readings
+ // HAL_ADCEx_InjectedStart(&hadc2); // enable injected readings
}
// channel 0 -> temperature sensor, 1-> VIN, 2-> tip
@@ -154,8 +154,9 @@ static void MX_ADC1_Init(void) {
SET_BIT(hadc1.Instance->CR1, (ADC_CR1_EOSIE)); // Enable end of Normal
// Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK)
+ while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) {
;
+ }
}
/* ADC2 init function */
@@ -191,8 +192,9 @@ static void MX_ADC2_Init(void) {
HAL_ADC_ConfigChannel(&hadc2, &sConfig);
// Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
+ while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) {
;
+ }
}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
diff --git a/source/Core/BSP/MHP30/flash.c b/source/Core/BSP/MHP30/flash.c
index 756e7fb4..7df30992 100644
--- a/source/Core/BSP/MHP30/flash.c
+++ b/source/Core/BSP/MHP30/flash.c
@@ -30,9 +30,9 @@ void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
HAL_FLASH_Unlock();
for (uint16_t i = 0; i < (length / 2); i++) {
resetWatchdog();
- HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint16_t)), data[i]);
+ HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE + (i * sizeof(uint16_t)), data[i]);
}
HAL_FLASH_Lock();
}
-void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
+void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t *)SETTINGS_START_PAGE, length); }
diff --git a/source/Core/BSP/Miniware/Setup.cpp b/source/Core/BSP/Miniware/Setup.cpp
index 27b3b1e8..cd3f81c3 100644
--- a/source/Core/BSP/Miniware/Setup.cpp
+++ b/source/Core/BSP/Miniware/Setup.cpp
@@ -229,8 +229,9 @@ static void MX_ADC1_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
SET_BIT(hadc1.Instance->CR1, (ADC_CR1_JEOCIE)); // Enable end of injected conv irq
// Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK)
+ while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) {
;
+ }
}
/* ADC2 init function */
@@ -272,8 +273,9 @@ static void MX_ADC2_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
// Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
+ while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) {
;
+ }
}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
diff --git a/source/Core/BSP/Miniware/flash.c b/source/Core/BSP/Miniware/flash.c
index ab29e67a..7df30992 100644
--- a/source/Core/BSP/Miniware/flash.c
+++ b/source/Core/BSP/Miniware/flash.c
@@ -10,7 +10,6 @@
#include "stm32f1xx_hal.h"
#include "string.h"
-
void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
FLASH_EraseInitTypeDef pEraseInit;
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
diff --git a/source/Core/BSP/Miniware/port.c b/source/Core/BSP/Miniware/port.c
index 125b29f5..a79eab6f 100644
--- a/source/Core/BSP/Miniware/port.c
+++ b/source/Core/BSP/Miniware/port.c
@@ -208,9 +208,7 @@ static void prvTaskExitError(void) {
// therefore not output an 'unreachable code' warning for code that appears
// after it. */
// }
- for(;;){
-
- }
+ for (;;) {}
}
/*-----------------------------------------------------------*/
diff --git a/source/Core/BSP/Miniware/preRTOS.cpp b/source/Core/BSP/Miniware/preRTOS.cpp
index 290b2a67..2dbfa8b3 100644
--- a/source/Core/BSP/Miniware/preRTOS.cpp
+++ b/source/Core/BSP/Miniware/preRTOS.cpp
@@ -13,7 +13,6 @@
#include "configuration.h"
#include <I2C_Wrapper.hpp>
-
void preRToSInit() {
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
*/
diff --git a/source/Core/BSP/Pinecil/Debug.cpp b/source/Core/BSP/Pinecil/Debug.cpp
index c9d5d3bf..ad44c1aa 100644
--- a/source/Core/BSP/Pinecil/Debug.cpp
+++ b/source/Core/BSP/Pinecil/Debug.cpp
@@ -23,13 +23,13 @@ void log_system_state(int32_t PWMWattsx10) {
// Tip_Temp_C,Handle_Temp_C,Output_Power_Wattx10,PWM,Tip_Raw\r\n
// 3+1+3+1+3+1+3+1+5+2 = 23, so sizing at 32 for now
- outputLength = snprintf(uartOutputBuffer, uartOutputBufferLength, "%lu,%u,%li,%u,%lu\r\n", //
- TipThermoModel::getTipInC(false), // Tip temp in C
- getHandleTemperature(0), // Handle temp in C X10
- PWMWattsx10, // Output Wattage
- pendingPWM, // PWM
- TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true) // Tip temp in uV
- );
+ outputLength = snprintf(uartOutputBuffer, uartOutputBufferLength, "%lu,%u,%li,%u,%lu\r\n",
+ TipThermoModel::getTipInC(false), // Tip temp in C
+ getHandleTemperature(0), // Handle temp in C X10
+ PWMWattsx10, // Output Wattage
+ pendingPWM, // PWM
+ TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true) // Tip temp in uV
+ );
// Now print this out the uart via IRQ (DMA cant be used as oled has it)
currentOutputPos = 0;
diff --git a/source/Core/BSP/Pinecil/I2C_Wrapper.cpp b/source/Core/BSP/Pinecil/I2C_Wrapper.cpp
index f54e0a42..46f33436 100644
--- a/source/Core/BSP/Pinecil/I2C_Wrapper.cpp
+++ b/source/Core/BSP/Pinecil/I2C_Wrapper.cpp
@@ -40,18 +40,19 @@ enum class i2c_step {
Wait_stop, // Wait for stop to send and we are done
Done, // Finished
Error_occured, // Error occured on the bus
-
};
+
struct i2c_state {
i2c_step currentStep;
bool isMemoryWrite;
bool wakePart;
uint8_t deviceAddress;
uint8_t memoryAddress;
- uint8_t * buffer;
+ uint8_t *buffer;
uint16_t numberOfBytes;
dma_parameter_struct dma_init_struct;
};
+
i2c_state currentState;
void perform_i2c_step() {
diff --git a/source/Core/BSP/Pinecilv2/I2C_Wrapper.cpp b/source/Core/BSP/Pinecilv2/I2C_Wrapper.cpp
index e3112b05..93d11ae5 100644
--- a/source/Core/BSP/Pinecilv2/I2C_Wrapper.cpp
+++ b/source/Core/BSP/Pinecilv2/I2C_Wrapper.cpp
@@ -40,8 +40,9 @@ bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_b
i2cCfg.data = p_buffer;
i2cCfg.subAddrSize = 1; // one byte address
-taskENTER_CRITICAL();
- err = I2C_MasterReceiveBlocking(I2C0_ID, &i2cCfg);
+ taskENTER_CRITICAL();
+ /* --------------- */
+ err = I2C_MasterReceiveBlocking(I2C0_ID, &i2cCfg);
taskEXIT_CRITICAL();
bool res = err == SUCCESS;
if (!res) {
@@ -63,8 +64,10 @@ bool FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint8_t *p_bu
i2cCfg.dataSize = number_of_byte;
i2cCfg.data = p_buffer;
i2cCfg.subAddrSize = 1; // one byte address
-taskENTER_CRITICAL();
- err = I2C_MasterSendBlocking(I2C0_ID, &i2cCfg);
+
+ taskENTER_CRITICAL();
+ /* --------------- */
+ err = I2C_MasterSendBlocking(I2C0_ID, &i2cCfg);
taskEXIT_CRITICAL();
bool res = err == SUCCESS;
if (!res) {
diff --git a/source/Core/BSP/Pinecilv2/MemMang/heap_5.c b/source/Core/BSP/Pinecilv2/MemMang/heap_5.c
index aab4f8f4..3ee2639b 100644
--- a/source/Core/BSP/Pinecilv2/MemMang/heap_5.c
+++ b/source/Core/BSP/Pinecilv2/MemMang/heap_5.c
@@ -80,21 +80,20 @@
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
- #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
+#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
#endif
/* Block sizes must not get too small. */
-#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize << 1 ) )
+#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize << 1 ) )
/* Assumes 8bit bytes! */
-#define heapBITS_PER_BYTE ( ( size_t ) 8 )
+#define heapBITS_PER_BYTE ( ( size_t ) 8 )
/* Define the linked list structure. This is used to link free blocks in order
* of their memory address. */
-typedef struct A_BLOCK_LINK
-{
- struct A_BLOCK_LINK * pxNextFreeBlock; /*<< The next free block in the list. */
- size_t xBlockSize; /*<< The size of the free block. */
+typedef struct A_BLOCK_LINK {
+ struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */
+ size_t xBlockSize; /*<< The size of the free block. */
} BlockLink_t;
/*-----------------------------------------------------------*/
@@ -105,7 +104,7 @@ typedef struct A_BLOCK_LINK
* the block in front it and/or the block behind it if the memory blocks are
* adjacent to each other.
*/
-static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert );
+static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert );
/*-----------------------------------------------------------*/
@@ -114,14 +113,14 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert );
static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
/* Create a couple of list links to mark the start and end of the list. */
-static BlockLink_t xStart, * pxEnd = NULL;
+static BlockLink_t xStart, *pxEnd = NULL;
/* Keeps track of the number of calls to allocate and free memory as well as the
* number of free bytes remaining, but says nothing about fragmentation. */
-static size_t xFreeBytesRemaining = 0U;
+static size_t xFreeBytesRemaining = 0U;
static size_t xMinimumEverFreeBytesRemaining = 0U;
static size_t xNumberOfSuccessfulAllocations = 0;
-static size_t xNumberOfSuccessfulFrees = 0;
+static size_t xNumberOfSuccessfulFrees = 0;
/* Gets set to the top bit of an size_t type. When this bit in the xBlockSize
* member of an BlockLink_t structure is set then the block belongs to the
@@ -131,420 +130,354 @@ static size_t xBlockAllocatedBit = 0;
/*-----------------------------------------------------------*/
-void * pvPortMalloc( size_t xWantedSize )
-{
- BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink;
- void * pvReturn = NULL;
-
- /* The heap must be initialised before the first call to
- * prvPortMalloc(). */
- configASSERT( pxEnd );
-
- vTaskSuspendAll();
- {
- /* Check the requested block size is not so large that the top bit is
- * set. The top bit of the block size member of the BlockLink_t structure
- * is used to determine who owns the block - the application or the
- * kernel, so it must be free. */
- if( ( xWantedSize & xBlockAllocatedBit ) == 0 )
- {
- /* The wanted size is increased so it can contain a BlockLink_t
- * structure in addition to the requested amount of bytes. */
- if( xWantedSize > 0 )
- {
- xWantedSize += xHeapStructSize;
-
- /* Ensure that blocks are always aligned to the required number
- * of bytes. */
- if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
- {
- /* Byte alignment required. */
- xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
-
- if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
- {
- /* Traverse the list from the start (lowest address) block until
- * one of adequate size is found. */
- pxPreviousBlock = &xStart;
- pxBlock = xStart.pxNextFreeBlock;
-
- while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) )
- {
- pxPreviousBlock = pxBlock;
- pxBlock = pxBlock->pxNextFreeBlock;
- }
-
- /* If the end marker was reached then a block of adequate size
- * was not found. */
- if( pxBlock != pxEnd )
- {
- /* Return the memory space pointed to - jumping over the
- * BlockLink_t structure at its start. */
- pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + xHeapStructSize );
-
- /* This block is being returned for use so must be taken out
- * of the list of free blocks. */
- pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock;
-
- /* If the block is larger than required it can be split into
- * two. */
- if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE )
- {
- /* This block is to be split into two. Create a new
- * block following the number of bytes requested. The void
- * cast is used to prevent byte alignment warnings from the
- * compiler. */
- pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize );
-
- /* Calculate the sizes of two blocks split from the
- * single block. */
- pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;
- pxBlock->xBlockSize = xWantedSize;
-
- /* Insert the new block into the list of free blocks. */
- prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
-
- xFreeBytesRemaining -= pxBlock->xBlockSize;
-
- if( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining )
- {
- xMinimumEverFreeBytesRemaining = xFreeBytesRemaining;
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
-
- /* The block is being returned - it is allocated and owned
- * by the application and has no "next" block. */
- pxBlock->xBlockSize |= xBlockAllocatedBit;
- pxBlock->pxNextFreeBlock = NULL;
- xNumberOfSuccessfulAllocations++;
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
+void *pvPortMalloc( size_t xWantedSize ) {
+ BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
+ void *pvReturn = NULL;
+
+ /* The heap must be initialised before the first call to
+ * prvPortMalloc(). */
+ configASSERT( pxEnd );
+
+ vTaskSuspendAll();
+ {
+ /* Check the requested block size is not so large that the top bit is
+ * set. The top bit of the block size member of the BlockLink_t structure
+ * is used to determine who owns the block - the application or the
+ * kernel, so it must be free. */
+ if ( ( xWantedSize & xBlockAllocatedBit ) == 0 ) {
+ /* The wanted size is increased so it can contain a BlockLink_t
+ * structure in addition to the requested amount of bytes. */
+ if ( xWantedSize > 0 ) {
+ xWantedSize += xHeapStructSize;
+
+ /* Ensure that blocks are always aligned to the required number
+ * of bytes. */
+ if ( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 ) {
+ /* Byte alignment required. */
+ xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
+ } else {
+ mtCOVERAGE_TEST_MARKER();
}
+ } else {
+ mtCOVERAGE_TEST_MARKER();
+ }
- traceMALLOC( pvReturn, xWantedSize );
- }
- ( void ) xTaskResumeAll();
+ if ( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) ) {
+ /* Traverse the list from the start (lowest address) block until
+ * one of adequate size is found. */
+ pxPreviousBlock = &xStart;
+ pxBlock = xStart.pxNextFreeBlock;
- #if ( configUSE_MALLOC_FAILED_HOOK == 1 )
- {
- if( pvReturn == NULL )
- {
- extern void vApplicationMallocFailedHook( void );
- vApplicationMallocFailedHook();
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
+ while ( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) {
+ pxPreviousBlock = pxBlock;
+ pxBlock = pxBlock->pxNextFreeBlock;
}
- #endif /* if ( configUSE_MALLOC_FAILED_HOOK == 1 ) */
- return pvReturn;
-}
-/*-----------------------------------------------------------*/
-
-void vPortFree( void * pv )
-{
- uint8_t * puc = ( uint8_t * ) pv;
- BlockLink_t * pxLink;
-
- if( pv != NULL )
- {
- /* The memory being freed will have an BlockLink_t structure immediately
- * before it. */
- puc -= xHeapStructSize;
-
- /* This casting is to keep the compiler from issuing warnings. */
- pxLink = ( void * ) puc;
+ /* If the end marker was reached then a block of adequate size
+ * was not found. */
+ if ( pxBlock != pxEnd ) {
+ /* Return the memory space pointed to - jumping over the
+ * BlockLink_t structure at its start. */
+ pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + xHeapStructSize );
+
+ /* This block is being returned for use so must be taken out
+ * of the list of free blocks. */
+ pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock;
+
+ /* If the block is larger than required it can be split into
+ * two. */
+ if ( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) {
+ /* This block is to be split into two. Create a new
+ * block following the number of bytes requested. The void
+ * cast is used to prevent byte alignment warnings from the
+ * compiler. */
+ pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize );
+
+ /* Calculate the sizes of two blocks split from the
+ * single block. */
+ pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;
+ pxBlock->xBlockSize = xWantedSize;
+
+ /* Insert the new block into the list of free blocks. */
+ prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
+ } else {
+ mtCOVERAGE_TEST_MARKER();
+ }
- /* Check the block is actually allocated. */
- configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
- configASSERT( pxLink->pxNextFreeBlock == NULL );
+ xFreeBytesRemaining -= pxBlock->xBlockSize;
- if( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 )
- {
- if( pxLink->pxNextFreeBlock == NULL )
- {
- /* The block is being returned to the heap - it is no longer
- * allocated. */
- pxLink->xBlockSize &= ~xBlockAllocatedBit;
-
- vTaskSuspendAll();
- {
- /* Add this block to the list of free blocks. */
- xFreeBytesRemaining += pxLink->xBlockSize;
- traceFREE( pv, pxLink->xBlockSize );
- prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) );
- xNumberOfSuccessfulFrees++;
- }
- ( void ) xTaskResumeAll();
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
- }
- else
- {
+ if ( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining ) {
+ xMinimumEverFreeBytesRemaining = xFreeBytesRemaining;
+ } else {
mtCOVERAGE_TEST_MARKER();
+ }
+
+ /* The block is being returned - it is allocated and owned
+ * by the application and has no "next" block. */
+ pxBlock->xBlockSize |= xBlockAllocatedBit;
+ pxBlock->pxNextFreeBlock = NULL;
+ xNumberOfSuccessfulAllocations++;
+ } else {
+ mtCOVERAGE_TEST_MARKER();
}
+ } else {
+ mtCOVERAGE_TEST_MARKER();
+ }
+ } else {
+ mtCOVERAGE_TEST_MARKER();
}
-}
-/*-----------------------------------------------------------*/
-size_t xPortGetFreeHeapSize( void )
-{
- return xFreeBytesRemaining;
-}
-/*-----------------------------------------------------------*/
+ traceMALLOC( pvReturn, xWantedSize );
+ }
+ ( void ) xTaskResumeAll();
+
+#if ( configUSE_MALLOC_FAILED_HOOK == 1 )
+ {
+ if ( pvReturn == NULL ) {
+ extern void vApplicationMallocFailedHook( void );
+ vApplicationMallocFailedHook();
+ } else {
+ mtCOVERAGE_TEST_MARKER();
+ }
+ }
+#endif /* if ( configUSE_MALLOC_FAILED_HOOK == 1 ) */
-size_t xPortGetMinimumEverFreeHeapSize( void )
-{
- return xMinimumEverFreeBytesRemaining;
+ return pvReturn;
}
/*-----------------------------------------------------------*/
-static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
-{
- BlockLink_t * pxIterator;
- uint8_t * puc;
+void vPortFree( void *pv ) {
+ uint8_t *puc = ( uint8_t * ) pv;
+ BlockLink_t *pxLink;
- /* Iterate through the list until a block is found that has a higher address
- * than the block being inserted. */
- for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock )
- {
- /* Nothing to do here, just iterate to the right position. */
- }
+ if ( pv != NULL ) {
+ /* The memory being freed will have an BlockLink_t structure immediately
+ * before it. */
+ puc -= xHeapStructSize;
- /* Do the block being inserted, and the block it is being inserted after
- * make a contiguous block of memory? */
- puc = ( uint8_t * ) pxIterator;
+ /* This casting is to keep the compiler from issuing warnings. */
+ pxLink = ( void * ) puc;
- if( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert )
- {
- pxIterator->xBlockSize += pxBlockToInsert->xBlockSize;
- pxBlockToInsert = pxIterator;
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
+ /* Check the block is actually allocated. */
+ configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
+ configASSERT( pxLink->pxNextFreeBlock == NULL );
- /* Do the block being inserted, and the block it is being inserted before
- * make a contiguous block of memory? */
- puc = ( uint8_t * ) pxBlockToInsert;
+ if ( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ) {
+ if ( pxLink->pxNextFreeBlock == NULL ) {
+ /* The block is being returned to the heap - it is no longer
+ * allocated. */
+ pxLink->xBlockSize &= ~xBlockAllocatedBit;
- if( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock )
- {
- if( pxIterator->pxNextFreeBlock != pxEnd )
+ vTaskSuspendAll();
{
- /* Form one big block from the two blocks. */
- pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize;
- pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock;
+ /* Add this block to the list of free blocks. */
+ xFreeBytesRemaining += pxLink->xBlockSize;
+ traceFREE( pv, pxLink->xBlockSize );
+ prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) );
+ xNumberOfSuccessfulFrees++;
}
- else
- {
- pxBlockToInsert->pxNextFreeBlock = pxEnd;
- }
- }
- else
- {
- pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
- }
-
- /* If the block being inserted plugged a gab, so was merged with the block
- * before and the block after, then it's pxNextFreeBlock pointer will have
- * already been set, and should not be set here as that would make it point
- * to itself. */
- if( pxIterator != pxBlockToInsert )
- {
- pxIterator->pxNextFreeBlock = pxBlockToInsert;
- }
- else
- {
+ ( void ) xTaskResumeAll();
+ } else {
mtCOVERAGE_TEST_MARKER();
+ }
+ } else {
+ mtCOVERAGE_TEST_MARKER();
}
+ }
}
/*-----------------------------------------------------------*/
-void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
-{
- BlockLink_t * pxFirstFreeBlockInRegion = NULL, * pxPreviousFreeBlock;
- size_t xAlignedHeap;
- size_t xTotalRegionSize, xTotalHeapSize = 0;
- BaseType_t xDefinedRegions = 0;
- size_t xAddress;
- const HeapRegion_t * pxHeapRegion;
+size_t xPortGetFreeHeapSize( void ) { return xFreeBytesRemaining; }
+/*-----------------------------------------------------------*/
- /* Can only call once! */
- configASSERT( pxEnd == NULL );
+size_t xPortGetMinimumEverFreeHeapSize( void ) { return xMinimumEverFreeBytesRemaining; }
+/*-----------------------------------------------------------*/
- pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
+static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ) {
+ BlockLink_t *pxIterator;
+ uint8_t *puc;
+
+ /* Iterate through the list until a block is found that has a higher address
+ * than the block being inserted. */
+ for ( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock ) {
+ /* Nothing to do here, just iterate to the right position. */
+ }
+
+ /* Do the block being inserted, and the block it is being inserted after
+ * make a contiguous block of memory? */
+ puc = ( uint8_t * ) pxIterator;
+
+ if ( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert ) {
+ pxIterator->xBlockSize += pxBlockToInsert->xBlockSize;
+ pxBlockToInsert = pxIterator;
+ } else {
+ mtCOVERAGE_TEST_MARKER();
+ }
+
+ /* Do the block being inserted, and the block it is being inserted before
+ * make a contiguous block of memory? */
+ puc = ( uint8_t * ) pxBlockToInsert;
+
+ if ( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock ) {
+ if ( pxIterator->pxNextFreeBlock != pxEnd ) {
+ /* Form one big block from the two blocks. */
+ pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize;
+ pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock;
+ } else {
+ pxBlockToInsert->pxNextFreeBlock = pxEnd;
+ }
+ } else {
+ pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
+ }
+
+ /* If the block being inserted plugged a gab, so was merged with the block
+ * before and the block after, then it's pxNextFreeBlock pointer will have
+ * already been set, and should not be set here as that would make it point
+ * to itself. */
+ if ( pxIterator != pxBlockToInsert ) {
+ pxIterator->pxNextFreeBlock = pxBlockToInsert;
+ } else {
+ mtCOVERAGE_TEST_MARKER();
+ }
+}
+/*-----------------------------------------------------------*/
- while( pxHeapRegion->xSizeInBytes > 0 )
- {
- xTotalRegionSize = pxHeapRegion->xSizeInBytes;
+void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) {
+ BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
+ size_t xAlignedHeap;
+ size_t xTotalRegionSize, xTotalHeapSize = 0;
+ BaseType_t xDefinedRegions = 0;
+ size_t xAddress;
+ const HeapRegion_t *pxHeapRegion;
- /* Ensure the heap region starts on a correctly aligned boundary. */
- xAddress = ( size_t ) pxHeapRegion->pucStartAddress;
+ /* Can only call once! */
+ configASSERT( pxEnd == NULL );
- if( ( xAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
- {
- xAddress += ( portBYTE_ALIGNMENT - 1 );
- xAddress &= ~portBYTE_ALIGNMENT_MASK;
+ pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
- /* Adjust the size for the bytes lost to alignment. */
- xTotalRegionSize -= xAddress - ( size_t ) pxHeapRegion->pucStartAddress;
- }
+ while ( pxHeapRegion->xSizeInBytes > 0 ) {
+ xTotalRegionSize = pxHeapRegion->xSizeInBytes;
- xAlignedHeap = xAddress;
+ /* Ensure the heap region starts on a correctly aligned boundary. */
+ xAddress = ( size_t ) pxHeapRegion->pucStartAddress;
- /* Set xStart if it has not already been set. */
- if( xDefinedRegions == 0 )
- {
- /* xStart is used to hold a pointer to the first item in the list of
- * free blocks. The void cast is used to prevent compiler warnings. */
- xStart.pxNextFreeBlock = ( BlockLink_t * ) xAlignedHeap;
- xStart.xBlockSize = ( size_t ) 0;
- }
- else
- {
- /* Should only get here if one region has already been added to the
- * heap. */
- configASSERT( pxEnd != NULL );
+ if ( ( xAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) {
+ xAddress += ( portBYTE_ALIGNMENT - 1 );
+ xAddress &= ~portBYTE_ALIGNMENT_MASK;
- /* Check blocks are passed in with increasing start addresses. */
- configASSERT( xAddress > ( size_t ) pxEnd );
- }
-
- /* Remember the location of the end marker in the previous region, if
- * any. */
- pxPreviousFreeBlock = pxEnd;
-
- /* pxEnd is used to mark the end of the list of free blocks and is
- * inserted at the end of the region space. */
- xAddress = xAlignedHeap + xTotalRegionSize;
- xAddress -= xHeapStructSize;
- xAddress &= ~portBYTE_ALIGNMENT_MASK;
- pxEnd = ( BlockLink_t * ) xAddress;
- pxEnd->xBlockSize = 0;
- pxEnd->pxNextFreeBlock = NULL;
-
- /* To start with there is a single free block in this region that is
- * sized to take up the entire heap region minus the space taken by the
- * free block structure. */
- pxFirstFreeBlockInRegion = ( BlockLink_t * ) xAlignedHeap;
- pxFirstFreeBlockInRegion->xBlockSize = xAddress - ( size_t ) pxFirstFreeBlockInRegion;
- pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd;
-
- /* If this is not the first region that makes up the entire heap space
- * then link the previous region to this region. */
- if( pxPreviousFreeBlock != NULL )
- {
- pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion;
- }
+ /* Adjust the size for the bytes lost to alignment. */
+ xTotalRegionSize -= xAddress - ( size_t ) pxHeapRegion->pucStartAddress;
+ }
- xTotalHeapSize += pxFirstFreeBlockInRegion->xBlockSize;
+ xAlignedHeap = xAddress;
+
+ /* Set xStart if it has not already been set. */
+ if ( xDefinedRegions == 0 ) {
+ /* xStart is used to hold a pointer to the first item in the list of
+ * free blocks. The void cast is used to prevent compiler warnings. */
+ xStart.pxNextFreeBlock = ( BlockLink_t * ) xAlignedHeap;
+ xStart.xBlockSize = ( size_t ) 0;
+ } else {
+ /* Should only get here if one region has already been added to the
+ * heap. */
+ configASSERT( pxEnd != NULL );
+
+ /* Check blocks are passed in with increasing start addresses. */
+ configASSERT( xAddress > ( size_t ) pxEnd );
+ }
- /* Move onto the next HeapRegion_t structure. */
- xDefinedRegions++;
- pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
+ /* Remember the location of the end marker in the previous region, if
+ * any. */
+ pxPreviousFreeBlock = pxEnd;
+
+ /* pxEnd is used to mark the end of the list of free blocks and is
+ * inserted at the end of the region space. */
+ xAddress = xAlignedHeap + xTotalRegionSize;
+ xAddress -= xHeapStructSize;
+ xAddress &= ~portBYTE_ALIGNMENT_MASK;
+
+ pxEnd = ( BlockLink_t * ) xAddress;
+ pxEnd->xBlockSize = 0;
+ pxEnd->pxNextFreeBlock = NULL;
+
+ /* To start with there is a single free block in this region that is
+ * sized to take up the entire heap region minus the space taken by the
+ * free block structure. */
+ pxFirstFreeBlockInRegion = ( BlockLink_t * ) xAlignedHeap;
+ pxFirstFreeBlockInRegion->xBlockSize = xAddress - ( size_t ) pxFirstFreeBlockInRegion;
+ pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd;
+
+ /* If this is not the first region that makes up the entire heap space
+ * then link the previous region to this region. */
+ if ( pxPreviousFreeBlock != NULL ) {
+ pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion;
}
- xMinimumEverFreeBytesRemaining = xTotalHeapSize;
- xFreeBytesRemaining = xTotalHeapSize;
+ xTotalHeapSize += pxFirstFreeBlockInRegion->xBlockSize;
+
+ /* Move onto the next HeapRegion_t structure. */
+ xDefinedRegions++;
+ pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
+ }
+
+ xMinimumEverFreeBytesRemaining = xTotalHeapSize;
+ xFreeBytesRemaining = xTotalHeapSize;
- /* Check something was actually defined before it is accessed. */
- configASSERT( xTotalHeapSize );
+ /* Check something was actually defined before it is accessed. */
+ configASSERT( xTotalHeapSize );
- /* Work out the position of the top bit in a size_t variable. */
- xBlockAllocatedBit = ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 );
+ /* Work out the position of the top bit in a size_t variable. */
+ xBlockAllocatedBit = ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 );
}
/*-----------------------------------------------------------*/
-void vPortGetHeapStats( HeapStats_t * pxHeapStats )
-{
- BlockLink_t * pxBlock;
- size_t xBlocks = 0, xMaxSize = 0, xMinSize = portMAX_DELAY; /* portMAX_DELAY used as a portable way of getting the maximum value. */
+void vPortGetHeapStats( HeapStats_t *pxHeapStats ) {
+ BlockLink_t *pxBlock;
+ size_t xBlocks = 0, xMaxSize = 0, xMinSize = portMAX_DELAY; /* portMAX_DELAY used as a portable way of getting the maximum value. */
- vTaskSuspendAll();
- {
- pxBlock = xStart.pxNextFreeBlock;
+ vTaskSuspendAll();
+ {
+ pxBlock = xStart.pxNextFreeBlock;
- /* pxBlock will be NULL if the heap has not been initialised. The heap
- * is initialised automatically when the first allocation is made. */
- if( pxBlock != NULL )
- {
- do
- {
- /* Increment the number of blocks and record the largest block seen
- * so far. */
- xBlocks++;
-
- if( pxBlock->xBlockSize > xMaxSize )
- {
- xMaxSize = pxBlock->xBlockSize;
- }
-
- /* Heap five will have a zero sized block at the end of each
- * each region - the block is only used to link to the next
- * heap region so it not a real block. */
- if( pxBlock->xBlockSize != 0 )
- {
- if( pxBlock->xBlockSize < xMinSize )
- {
- xMinSize = pxBlock->xBlockSize;
- }
- }
-
- /* Move to the next block in the chain until the last block is
- * reached. */
- pxBlock = pxBlock->pxNextFreeBlock;
- } while( pxBlock != pxEnd );
+ /* pxBlock will be NULL if the heap has not been initialised. The heap
+ * is initialised automatically when the first allocation is made. */
+ if ( pxBlock != NULL ) {
+ do {
+ /* Increment the number of blocks and record the largest block seen
+ * so far. */
+ xBlocks++;
+
+ if ( pxBlock->xBlockSize > xMaxSize ) {
+ xMaxSize = pxBlock->xBlockSize;
}
+
+ /* Heap five will have a zero sized block at the end of each
+ * each region - the block is only used to link to the next
+ * heap region so it not a real block. */
+ if ( pxBlock->xBlockSize != 0 ) {
+ if ( pxBlock->xBlockSize < xMinSize ) {
+ xMinSize = pxBlock->xBlockSize;
+ }
+ }
+
+ /* Move to the next block in the chain until the last block is
+ * reached. */
+ pxBlock = pxBlock->pxNextFreeBlock;
+ } while ( pxBlock != pxEnd );
}
- ( void ) xTaskResumeAll();
-
- pxHeapStats->xSizeOfLargestFreeBlockInBytes = xMaxSize;
- pxHeapStats->xSizeOfSmallestFreeBlockInBytes = xMinSize;
- pxHeapStats->xNumberOfFreeBlocks = xBlocks;
-
- taskENTER_CRITICAL();
- {
- pxHeapStats->xAvailableHeapSpaceInBytes = xFreeBytesRemaining;
- pxHeapStats->xNumberOfSuccessfulAllocations = xNumberOfSuccessfulAllocations;
- pxHeapStats->xNumberOfSuccessfulFrees = xNumberOfSuccessfulFrees;
- pxHeapStats->xMinimumEverFreeBytesRemaining = xMinimumEverFreeBytesRemaining;
- }
- taskEXIT_CRITICAL();
+ }
+ ( void ) xTaskResumeAll();
+
+ pxHeapStats->xSizeOfLargestFreeBlockInBytes = xMaxSize;
+ pxHeapStats->xSizeOfSmallestFreeBlockInBytes = xMinSize;
+ pxHeapStats->xNumberOfFreeBlocks = xBlocks;
+
+ taskENTER_CRITICAL();
+ {
+ pxHeapStats->xAvailableHeapSpaceInBytes = xFreeBytesRemaining;
+ pxHeapStats->xNumberOfSuccessfulAllocations = xNumberOfSuccessfulAllocations;
+ pxHeapStats->xNumberOfSuccessfulFrees = xNumberOfSuccessfulFrees;
+ pxHeapStats->xMinimumEverFreeBytesRemaining = xMinimumEverFreeBytesRemaining;
+ }
+ taskEXIT_CRITICAL();
}
diff --git a/source/Core/BSP/Pinecilv2/ble.c b/source/Core/BSP/Pinecilv2/ble.c
index b8b3f5c1..5206d6af 100644
--- a/source/Core/BSP/Pinecilv2/ble.c
+++ b/source/Core/BSP/Pinecilv2/ble.c
@@ -1,70 +1,61 @@
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <FreeRTOS.h>
-#include "bflb_platform.h"
-#include <task.h>
+#include "ble.h"
#include "BSP.h"
+#include "bflb_platform.h"
+#include "bl702_glb.h"
+#include "ble_characteristics.h"
+#include "ble_peripheral.h"
#include "bluetooth.h"
#include "conn.h"
#include "gatt.h"
+#include "hal_clock.h"
#include "hci_core.h"
-#include "uuid.h"
-#include "ble_peripheral.h"
#include "log.h"
-#include "bl702_glb.h"
-#include "ble_characteristics.h"
-#include "hal_clock.h"
-#include "ble.h"
-
-
-
+#include "uuid.h"
+#include <FreeRTOS.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <task.h>
-void ble_stack_start(void)
-{
- MSG("BLE Starting\n");
- GLB_Set_EM_Sel(GLB_EM_8KB);
- ble_controller_init(configMAX_PRIORITIES - 1);
+void ble_stack_start(void) {
+ MSG("BLE Starting\n");
+ GLB_Set_EM_Sel(GLB_EM_8KB);
+ ble_controller_init(configMAX_PRIORITIES - 1);
- // // Initialize BLE Host stack
- hci_driver_init();
+ // Initialize BLE Host stack
+ hci_driver_init();
- bt_enable(bt_enable_cb);
- MSG("BLE Starting...Done\n");
+ bt_enable(bt_enable_cb);
+ MSG("BLE Starting...Done\n");
}
-
-
/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
-void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize)
-{
- /* If the buffers to be provided to the Timer task are declared inside this
- function then they must be declared static - otherwise they will be allocated on
- the stack and so not exists after this function exits. */
- static StaticTask_t xTimerTaskTCB;
- static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH];
-
- /* Pass out a pointer to the StaticTask_t structure in which the Timer
- task's state will be stored. */
- *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
-
- /* Pass out the array that will be used as the Timer task's stack. */
- *ppxTimerTaskStackBuffer = uxTimerTaskStack;
-
- /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
- Note that, as the array is necessarily of type StackType_t,
- configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
- *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
+void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) {
+ /* If the buffers to be provided to the Timer task are declared inside this
+ function then they must be declared static - otherwise they will be allocated on
+ the stack and so not exists after this function exits. */
+ static StaticTask_t xTimerTaskTCB;
+ static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH];
+
+ /* Pass out a pointer to the StaticTask_t structure in which the Timer
+ task's state will be stored. */
+ *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
+
+ /* Pass out the array that will be used as the Timer task's stack. */
+ *ppxTimerTaskStackBuffer = uxTimerTaskStack;
+
+ /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
+ Note that, as the array is necessarily of type StackType_t,
+ configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}
+void vApplicationMallocFailedHook(void) {
+ MSG("vApplicationMallocFailedHook\r\n");
-
-void vApplicationMallocFailedHook(void)
-{
- MSG("vApplicationMallocFailedHook\r\n");
-
- while (1)
- ;
-} \ No newline at end of file
+ while (1) {
+ ;
+ }
+}
diff --git a/source/Core/BSP/Pinecilv2/ble_handlers.cpp b/source/Core/BSP/Pinecilv2/ble_handlers.cpp
index f4e407c1..b2319819 100644
--- a/source/Core/BSP/Pinecilv2/ble_handlers.cpp
+++ b/source/Core/BSP/Pinecilv2/ble_handlers.cpp
@@ -113,8 +113,9 @@ int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_att
// hall sensor
{
int16_t hallEffectStrength = getRawHallEffect();
- if (hallEffectStrength < 0)
+ if (hallEffectStrength < 0) {
hallEffectStrength = -hallEffectStrength;
+ }
temp = hallEffectStrength;
memcpy(buf, &temp, sizeof(temp));
return sizeof(temp);
diff --git a/source/Core/BSP/Pinecilv2/ble_peripheral.c b/source/Core/BSP/Pinecilv2/ble_peripheral.c
index cc3a030f..1cbf4ba1 100644
--- a/source/Core/BSP/Pinecilv2/ble_peripheral.c
+++ b/source/Core/BSP/Pinecilv2/ble_peripheral.c
@@ -258,7 +258,9 @@ static struct bt_gatt_attr ble_attrs_declaration[] = {
NAME
get_attr
*/
-struct bt_gatt_attr *get_attr(u8_t index) { return &ble_attrs_declaration[index]; }
+struct bt_gatt_attr *get_attr(u8_t index) {
+ return &ble_attrs_declaration[index];
+}
static struct bt_gatt_service ble_tp_server = BT_GATT_SERVICE(ble_attrs_declaration);
diff --git a/source/Core/BSP/Pinecilv2/ble_peripheral.h b/source/Core/BSP/Pinecilv2/ble_peripheral.h
index 6679e372..3d45290d 100644
--- a/source/Core/BSP/Pinecilv2/ble_peripheral.h
+++ b/source/Core/BSP/Pinecilv2/ble_peripheral.h
@@ -10,6 +10,7 @@ NOTES
#ifndef _BLE_TP_SVC_H_
#define _BLE_TP_SVC_H_
+#include "types.h"
#include "ble_config.h"
// read value handle offset 2
diff --git a/source/Core/BSP/Sequre_S60/Setup.cpp b/source/Core/BSP/Sequre_S60/Setup.cpp
index 353d1d01..562ee223 100644
--- a/source/Core/BSP/Sequre_S60/Setup.cpp
+++ b/source/Core/BSP/Sequre_S60/Setup.cpp
@@ -206,8 +206,9 @@ static void MX_ADC1_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
SET_BIT(hadc1.Instance->CR1, (ADC_CR1_JEOCIE)); // Enable end of injected conv irq
// Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK)
+ while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) {
;
+ }
}
/* ADC2 init function */
@@ -244,8 +245,9 @@ static void MX_ADC2_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
// Run ADC internal calibration
- while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
+ while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) {
;
+ }
}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
diff --git a/source/Core/BSP/Sequre_S60/flash.c b/source/Core/BSP/Sequre_S60/flash.c
index c6a8793e..7df30992 100644
--- a/source/Core/BSP/Sequre_S60/flash.c
+++ b/source/Core/BSP/Sequre_S60/flash.c
@@ -30,10 +30,9 @@ void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
HAL_FLASH_Unlock();
for (uint16_t i = 0; i < (length / 2); i++) {
resetWatchdog();
- HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint16_t)), data[i]);
+ HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE + (i * sizeof(uint16_t)), data[i]);
}
HAL_FLASH_Lock();
-
}
-void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
+void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t *)SETTINGS_START_PAGE, length); }
diff --git a/source/Core/BSP/Sequre_S60/port.c b/source/Core/BSP/Sequre_S60/port.c
index 125b29f5..1b641778 100644
--- a/source/Core/BSP/Sequre_S60/port.c
+++ b/source/Core/BSP/Sequre_S60/port.c
@@ -208,40 +208,38 @@ static void prvTaskExitError(void) {
// therefore not output an 'unreachable code' warning for code that appears
// after it. */
// }
- for(;;){
-
- }
+ for (;;) {}
}
/*-----------------------------------------------------------*/
void vPortSVCHandler(void) {
- __asm volatile(" ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */
- " ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
- " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
- " ldmia r0!, {r4-r11} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */
- " msr psp, r0 \n" /* Restore the task stack pointer. */
- " isb \n"
- " mov r0, #0 \n"
- " msr basepri, r0 \n"
- " orr r14, #0xd \n"
- " bx r14 \n"
- " \n"
- " .align 4 \n"
- "pxCurrentTCBConst2: .word pxCurrentTCB \n");
+ __asm volatile(" ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */
+ " ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
+ " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
+ " ldmia r0!, {r4-r11} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */
+ " msr psp, r0 \n" /* Restore the task stack pointer. */
+ " isb \n"
+ " mov r0, #0 \n"
+ " msr basepri, r0 \n"
+ " orr r14, #0xd \n"
+ " bx r14 \n"
+ " \n"
+ " .align 4 \n"
+ "pxCurrentTCBConst2: .word pxCurrentTCB \n");
}
/*-----------------------------------------------------------*/
static void prvPortStartFirstTask(void) {
- __asm volatile(" ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
- " ldr r0, [r0] \n"
- " ldr r0, [r0] \n"
- " msr msp, r0 \n" /* Set the msp back to the start of the stack. */
- " cpsie i \n" /* Globally enable interrupts. */
- " cpsie f \n"
- " dsb \n"
- " isb \n"
- " svc 0 \n" /* System call to start first task. */
- " nop \n");
+ __asm volatile(" ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
+ " ldr r0, [r0] \n"
+ " ldr r0, [r0] \n"
+ " msr msp, r0 \n" /* Set the msp back to the start of the stack. */
+ " cpsie i \n" /* Globally enable interrupts. */
+ " cpsie f \n"
+ " dsb \n"
+ " isb \n"
+ " svc 0 \n" /* System call to start first task. */
+ " nop \n");
}
/*-----------------------------------------------------------*/
diff --git a/source/Core/Src/FreeRTOSHooks.c b/source/Core/Src/FreeRTOSHooks.c
index dce6771c..47435082 100644
--- a/source/Core/Src/FreeRTOSHooks.c
+++ b/source/Core/Src/FreeRTOSHooks.c
@@ -20,8 +20,7 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackTyp
/* place for user code */
}
-void vApplicationStackOverflowHook( TaskHandle_t xTask,
- char * pcTaskName ) {
+void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) {
(void)xTask;
(void)pcTaskName;
diff --git a/source/Core/Src/QC3.cpp b/source/Core/Src/QC3.cpp
index e1b7c8c1..f5e2977f 100644
--- a/source/Core/Src/QC3.cpp
+++ b/source/Core/Src/QC3.cpp
@@ -11,29 +11,34 @@
#include "cmsis_os.h"
#include "configuration.h"
#include "stdint.h"
+
enum QCState {
NOT_STARTED = 0, // Have not checked
QC_3 = 1,
QC_2 = 2,
NO_QC = 3,
-
};
+
void QC_Seek9V() {
QC_DNegZero_Six();
QC_DPlusThree_Three();
}
+
void QC_Seek12V() {
QC_DNegZero_Six();
QC_DPlusZero_Six();
}
+
void QC_Seek20V() {
QC_DNegThree_Three();
QC_DPlusThree_Three();
}
+
void QC_SeekContMode() {
QC_DNegThree_Three();
QC_DPlusZero_Six();
}
+
void QC_SeekContPlus() {
QC_SeekContMode();
osDelay(30);
@@ -41,6 +46,7 @@ void QC_SeekContPlus() {
osDelay(10);
QC_SeekContMode();
}
+
void QC_SeekContNeg() {
QC_SeekContMode();
osDelay(30);
@@ -48,17 +54,21 @@ void QC_SeekContNeg() {
osDelay(10);
QC_SeekContMode();
}
+
QCState QCMode = QCState::NOT_STARTED;
uint8_t QCTries = 0;
void seekQC(int16_t Vx10, uint16_t divisor) {
- if (QCMode == QCState::NOT_STARTED)
+ if (QCMode == QCState::NOT_STARTED) {
startQC(divisor);
+ }
- if (Vx10 < 40) // Bail out if less than 4V
+ if (Vx10 < 40) { // Bail out if less than 4V
return;
+ }
- if (xTaskGetTickCount() < TICKS_SECOND)
+ if (xTaskGetTickCount() < TICKS_SECOND) {
return;
+ }
// Seek the QC to the Voltage given if this adapter supports continuous mode
// try and step towards the wanted value
@@ -87,8 +97,9 @@ void seekQC(int16_t Vx10, uint16_t divisor) {
// Re-measure
/* Disabled due to nothing to test and code space of around 1k*/
steps = vStart - getInputVoltageX10(divisor, 0);
- if (steps < 0)
+ if (steps < 0) {
steps = -steps;
+ }
if (steps > 4) {
// No continuous mode, so QC2
QCMode = QCState::QC_2;
@@ -104,8 +115,9 @@ void seekQC(int16_t Vx10, uint16_t divisor) {
QC_Seek9V();
}
}
-#endif
+#endif /* ENABLE_QC2 */
}
+
// Must be called after FreeRToS Starts
void startQC(uint16_t divisor) {
// Pre check that the input could be >5V already, and if so, dont both
@@ -143,7 +155,9 @@ void startQC(uint16_t divisor) {
}
}
}
+
QC_DM_No_PullDown();
+
if (enteredQC) {
// We have a QC capable charger
QC_Seek9V();
@@ -161,7 +175,6 @@ void startQC(uint16_t divisor) {
}
QCMode = QCState::NOT_STARTED;
QCTries++;
-
} else {
// no QC
QCTries++;
diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp
index 00f33c54..db6ec0a0 100644
--- a/source/Core/Src/Settings.cpp
+++ b/source/Core/Src/Settings.cpp
@@ -261,8 +261,9 @@ uint16_t lookupHallEffectThreshold() {
uint8_t lookupVoltageLevel() {
auto minVoltageOnCell = getSettingValue(SettingsOptions::MinDCVoltageCells);
auto minVoltageCellCount = getSettingValue(SettingsOptions::MinVoltageCells);
- if (minVoltageOnCell == 0)
+ if (minVoltageOnCell == 0) {
return 90; // 9V since iron does not function effectively below this
- else
+ } else {
return (minVoltageOnCell * minVoltageCellCount) + (minVoltageCellCount * 2);
+ }
}
diff --git a/source/Core/Src/settingsGUI.cpp b/source/Core/Src/settingsGUI.cpp
index 636e5bb4..7dbfafb3 100644
--- a/source/Core/Src/settingsGUI.cpp
+++ b/source/Core/Src/settingsGUI.cpp
@@ -175,7 +175,7 @@ static bool enterAdvancedMenu(void);
* Display Orientation
* Cooldown Blink
* Scrolling Speed
- * Swap Temp Change Buttons + -
+ * Swap Temp Change Buttons +/-
* Animation Speed
* -Animation Loop
* OLED Brightness
@@ -196,6 +196,14 @@ static bool enterAdvancedMenu(void);
*
*/
+/* vvv !!!DISABLE CLANG-FORMAT for menuitems initialization!!! vvv */
+
+/* clang-format off */
+
+/* A lot of suggestions by clang-format can be useful
+ * but not when dealing with such menuitems declarations.
+ */
+
const menuitem rootSettingsMenu[] {
/*
* Power Menu
@@ -207,177 +215,233 @@ const menuitem rootSettingsMenu[] {
* Exit
*/
#if defined(POW_DC) || defined(POW_QC)
- {0, enterPowerMenu, displayPowerMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Power*/
-#endif /* POW_DC or POW_QC */
- {0, enterSolderingMenu, displaySolderingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Soldering*/
- {0, enterPowerSavingMenu, displayPowerSavingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Sleep Options Menu*/
- {0, enterUIMenu, displayUIMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*UI Menu*/
- {0, enterAdvancedMenu, displayAdvancedMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Advanced Menu*/
- {0, settings_setLanguageSwitch, settings_displayLanguageSwitch, settings_showLanguageSwitch, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Language Switch*/
- {
- 0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0
- } // end of menu marker. DO NOT REMOVE
+ /* Power */
+ {0, enterPowerMenu, displayPowerMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
+#endif
+ /* Soldering */
+ {0, enterSolderingMenu, displaySolderingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
+ /* Sleep Options Menu */
+ {0, enterPowerSavingMenu, displayPowerSavingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
+ /* UI Menu */
+ {0, enterUIMenu, displayUIMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
+ /* Advanced Menu */
+ {0, enterAdvancedMenu, displayAdvancedMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
+ /* Language Switch */
+ {0, settings_setLanguageSwitch, settings_displayLanguageSwitch, settings_showLanguageSwitch, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
+ /* vvvv end of menu marker. DO NOT REMOVE vvvv */
+ {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
+ /* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
};
#if defined(POW_DC) || defined(POW_QC) || defined(POW_PD)
const menuitem powerMenu[] = {
-/*
- * Power Source
- * -Minimum Voltage
- * QC Voltage
- * PD Timeout
- * PDVpdo
- */
+ /*
+ * Power Source
+ * -Minimum Voltage
+ * QC Voltage
+ * PD Timeout
+ * PDVpdo
+ */
#ifdef POW_DC
- {SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, displayInputVRange, nullptr, SettingsOptions::MinDCVoltageCells, SettingsItemIndex::DCInCutoff, 6}, /*Voltage input*/
- {SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, displayInputMinVRange, showInputVOptions, SettingsOptions::MinVoltageCells, SettingsItemIndex::MinVolCell, 5}, /*Minimum voltage input*/
-#endif /* POW_DC */
+ /* Voltage input */
+ {SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, displayInputVRange, nullptr, SettingsOptions::MinDCVoltageCells, SettingsItemIndex::DCInCutoff, 6},
+ /* Minimum voltage input */
+ {SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, displayInputMinVRange, showInputVOptions, SettingsOptions::MinVoltageCells, SettingsItemIndex::MinVolCell, 5},
+#endif
#ifdef POW_QC
- {SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, displayQCInputV, nullptr, SettingsOptions::QCIdealVoltage, SettingsItemIndex::QCMaxVoltage, 4}, /*Voltage input*/
-#endif /* POW_QC */
+ /* Voltage input */
+ {SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, displayQCInputV, nullptr, SettingsOptions::QCIdealVoltage, SettingsItemIndex::QCMaxVoltage, 4},
+#endif
#ifdef POW_PD
- {SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout, SettingsItemIndex::PDNegTimeout, 5}, /*PD timeout setup*/
- {SETTINGS_DESC(SettingsItemIndex::PDVpdo), nullptr, displayPDVpdo, nullptr, SettingsOptions::PDVpdo, SettingsItemIndex::PDVpdo, 7 }, /*Toggle PPS & EPR*/
-#endif /* POW_PD */
- {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
+ /* PD timeout setup */
+ {SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout, SettingsItemIndex::PDNegTimeout, 5},
+ /* Toggle PPS & EPR */
+ {SETTINGS_DESC(SettingsItemIndex::PDVpdo), nullptr, displayPDVpdo, nullptr, SettingsOptions::PDVpdo, SettingsItemIndex::PDVpdo, 7},
+#endif
+ /* vvvv end of menu marker. DO NOT REMOVE vvvv */
+ {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
+ /* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
};
#endif /* POW_DC or POW_QC or POW_PD */
const menuitem solderingMenu[] = {
- /*
- * Boost Mode Temp
- * Auto Start
- * Temp Change Short Step
- * Temp Change Long Step
- * Locking Mode
- * Profile Phases
- * Profile Preheat Temperature
- * Profile Preheat Max Temperature Change Per Second
- * Profile Phase 1 Temperature
- * Profile Phase 1 Duration (s)
- * Profile Phase 2 Temperature
- * Profile Phase 2 Duration (s)
- * Profile Phase 3 Temperature
- * Profile Phase 3 Duration (s)
- * Profile Phase 4 Temperature
- * Profile Phase 4 Duration (s)
- * Profile Phase 5 Temperature
- * Profile Phase 5 Duration (s)
- * Profile Cooldown Max Temperature Change Per Second
- */
- {SETTINGS_DESC(SettingsItemIndex::BoostTemperature), setBoostTemp, displayBoostTemp, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::BoostTemperature, 5}, /*Boost Temp*/
- {SETTINGS_DESC(SettingsItemIndex::AutoStart), nullptr, displayAutomaticStartMode, nullptr, SettingsOptions::AutoStartMode, SettingsItemIndex::AutoStart, 7}, /*Auto start*/
- {SETTINGS_DESC(SettingsItemIndex::TempChangeShortStep), nullptr, displayTempChangeShortStep, nullptr, SettingsOptions::TempChangeShortStep, SettingsItemIndex::TempChangeShortStep,
- 6}, /*Temp change short step*/
- {SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, displayTempChangeLongStep, nullptr, SettingsOptions::TempChangeLongStep, SettingsItemIndex::TempChangeLongStep,
- 6}, /*Temp change long step*/
- {SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, displayLockingMode, nullptr, SettingsOptions::LockingMode, SettingsItemIndex::LockingMode, 7}, /*Locking Mode*/
+ /*
+ * Boost Mode Temp
+ * Auto Start
+ * Temp Change Short Step
+ * Temp Change Long Step
+ * Locking Mode
+ * Profile Phases
+ * Profile Preheat Temperature
+ * Profile Preheat Max Temperature Change Per Second
+ * Profile Phase 1 Temperature
+ * Profile Phase 1 Duration (s)
+ * Profile Phase 2 Temperature
+ * Profile Phase 2 Duration (s)
+ * Profile Phase 3 Temperature
+ * Profile Phase 3 Duration (s)
+ * Profile Phase 4 Temperature
+ * Profile Phase 4 Duration (s)
+ * Profile Phase 5 Temperature
+ * Profile Phase 5 Duration (s)
+ * Profile Cooldown Max Temperature Change Per Second
+ */
+ /* Boost Temp */
+ {SETTINGS_DESC(SettingsItemIndex::BoostTemperature), setBoostTemp, displayBoostTemp, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::BoostTemperature, 5},
+ /* Auto start */
+ {SETTINGS_DESC(SettingsItemIndex::AutoStart), nullptr, displayAutomaticStartMode, nullptr, SettingsOptions::AutoStartMode, SettingsItemIndex::AutoStart, 7},
+ /* Temp change short step */
+ {SETTINGS_DESC(SettingsItemIndex::TempChangeShortStep), nullptr, displayTempChangeShortStep, nullptr, SettingsOptions::TempChangeShortStep, SettingsItemIndex::TempChangeShortStep, 6},
+ /* Temp change long step */
+ {SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, displayTempChangeLongStep, nullptr, SettingsOptions::TempChangeLongStep, SettingsItemIndex::TempChangeLongStep, 6},
+ /* Locking Mode */
+ {SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, displayLockingMode, nullptr, SettingsOptions::LockingMode, SettingsItemIndex::LockingMode, 7},
#ifdef PROFILE_SUPPORT
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhases), nullptr, displayProfilePhases, nullptr, SettingsOptions::ProfilePhases, SettingsItemIndex::ProfilePhases, 7}, /*Profile Phases*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePreheatTemp), setProfilePreheatTemp, displayProfilePreheatTemp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePreheatTemp, 5}, /*Profile Preheat Temp*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePreheatSpeed), nullptr, displayProfilePreheatSpeed, showProfileOptions, SettingsOptions::ProfilePreheatSpeed, SettingsItemIndex::ProfilePreheatSpeed, 5}, /*Profile Preheat Speed*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase1Temp, displayProfilePhase1Temp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase1Temp, 5}, /*Phase 1 Temp*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase1Duration, showProfileOptions, SettingsOptions::ProfilePhase1Duration, SettingsItemIndex::ProfilePhase1Duration, 5}, /*Phase 1 Duration*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase2Temp, displayProfilePhase2Temp, showProfilePhase2Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase2Temp, 5}, /*Phase 2 Temp*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase2Duration, showProfilePhase2Options, SettingsOptions::ProfilePhase2Duration, SettingsItemIndex::ProfilePhase2Duration, 5}, /*Phase 2 Duration*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase3Temp, displayProfilePhase3Temp, showProfilePhase3Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase3Temp, 5}, /*Phase 3 Temp*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase3Duration, showProfilePhase3Options, SettingsOptions::ProfilePhase3Duration, SettingsItemIndex::ProfilePhase3Duration, 5}, /*Phase 3 Duration*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase4Temp, displayProfilePhase4Temp, showProfilePhase4Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase4Temp, 5}, /*Phase 4 Temp*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase4Duration, showProfilePhase4Options, SettingsOptions::ProfilePhase4Duration, SettingsItemIndex::ProfilePhase4Duration, 5}, /*Phase 4 Duration*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase5Temp, displayProfilePhase5Temp, showProfilePhase5Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase5Temp, 5}, /*Phase 5 Temp*/
- {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase5Duration, showProfilePhase5Options, SettingsOptions::ProfilePhase5Duration, SettingsItemIndex::ProfilePhase5Duration, 5}, /*Phase 5 Duration*/
- {SETTINGS_DESC(SettingsItemIndex::ProfileCooldownSpeed), nullptr, displayProfileCooldownSpeed, showProfileOptions, SettingsOptions::ProfileCooldownSpeed, SettingsItemIndex::ProfileCooldownSpeed, 5}, /*Profile Cooldown Speed*/
+ /* Profile Phases */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhases), nullptr, displayProfilePhases, nullptr, SettingsOptions::ProfilePhases, SettingsItemIndex::ProfilePhases, 7},
+ /* Profile Preheat Temp */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePreheatTemp), setProfilePreheatTemp, displayProfilePreheatTemp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePreheatTemp, 5},
+ /* Profile Preheat Speed */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePreheatSpeed), nullptr, displayProfilePreheatSpeed, showProfileOptions, SettingsOptions::ProfilePreheatSpeed, SettingsItemIndex::ProfilePreheatSpeed, 5},
+ /* Phase 1 Temp */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase1Temp, displayProfilePhase1Temp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase1Temp, 5},
+ /* Phase 1 Duration */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase1Duration, showProfileOptions, SettingsOptions::ProfilePhase1Duration, SettingsItemIndex::ProfilePhase1Duration, 5},
+ /* Phase 2 Temp */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase2Temp, displayProfilePhase2Temp, showProfilePhase2Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase2Temp, 5},
+ /* Phase 2 Duration */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase2Duration, showProfilePhase2Options, SettingsOptions::ProfilePhase2Duration, SettingsItemIndex::ProfilePhase2Duration, 5},
+ /* Phase 3 Temp */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase3Temp, displayProfilePhase3Temp, showProfilePhase3Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase3Temp, 5},
+ /* Phase 3 Duration */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase3Duration, showProfilePhase3Options, SettingsOptions::ProfilePhase3Duration, SettingsItemIndex::ProfilePhase3Duration, 5},
+ /* Phase 4 Temp */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase4Temp, displayProfilePhase4Temp, showProfilePhase4Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase4Temp, 5},
+ /* Phase 4 Duration */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase4Duration, showProfilePhase4Options, SettingsOptions::ProfilePhase4Duration, SettingsItemIndex::ProfilePhase4Duration, 5},
+ /* Phase 5 Temp */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase5Temp, displayProfilePhase5Temp, showProfilePhase5Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase5Temp, 5},
+ /* Phase 5 Duration */
+ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase5Duration, showProfilePhase5Options, SettingsOptions::ProfilePhase5Duration, SettingsItemIndex::ProfilePhase5Duration, 5},
+ /* Profile Cooldown Speed */
+ {SETTINGS_DESC(SettingsItemIndex::ProfileCooldownSpeed), nullptr, displayProfileCooldownSpeed, showProfileOptions, SettingsOptions::ProfileCooldownSpeed, SettingsItemIndex::ProfileCooldownSpeed, 5},
#endif /* PROFILE_SUPPORT */
- {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
+ /* vvvv end of menu marker. DO NOT REMOVE vvvv */
+ {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
+ /* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
};
const menuitem PowerSavingMenu[] = {
- /*
- * Motion Sensitivity
- * -Sleep Temp
- * -Sleep Time
- * -Shutdown Time
- * Hall Sensor Sensitivity
- */
- {SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, displaySensitivity, nullptr, SettingsOptions::Sensitivity, SettingsItemIndex::MotionSensitivity, 7}, /* Motion Sensitivity*/
+ /*
+ * Motion Sensitivity
+ * -Sleep Temp
+ * -Sleep Time
+ * -Shutdown Time
+ * Hall Sensor Sensitivity
+ */
+ /* Motion Sensitivity */
+ {SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, displaySensitivity, nullptr, SettingsOptions::Sensitivity, SettingsItemIndex::MotionSensitivity, 7},
#ifndef NO_SLEEP_MODE
- {SETTINGS_DESC(SettingsItemIndex::SleepTemperature), setSleepTemp, displaySleepTemp, showSleepOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SleepTemperature,
- 5}, /*Sleep Temp*/
- {SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, displaySleepTime, showSleepOptions, SettingsOptions::SleepTime, SettingsItemIndex::SleepTimeout, 5}, /*Sleep Time*/
+ /* Sleep Temp */
+ {SETTINGS_DESC(SettingsItemIndex::SleepTemperature), setSleepTemp, displaySleepTemp, showSleepOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SleepTemperature, 5},
+ /* Sleep Time */
+ {SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, displaySleepTime, showSleepOptions, SettingsOptions::SleepTime, SettingsItemIndex::SleepTimeout, 5},
#endif /* *not* NO_SLEEP_MODE */
- {SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, displayShutdownTime, showSleepOptions, SettingsOptions::ShutdownTime, SettingsItemIndex::ShutdownTimeout, 5}, /*Shutdown Time*/
+ /* Shutdown Time */
+ {SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, displayShutdownTime, showSleepOptions, SettingsOptions::ShutdownTime, SettingsItemIndex::ShutdownTimeout, 5},
#ifdef HALL_SENSOR
- {SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, displayHallEffect, showHallEffect, SettingsOptions::HallEffectSensitivity, SettingsItemIndex::HallEffSensitivity,
- 7}, /* HallEffect Sensitivity*/
+ /* Hall Effect Sensitivity */
+ {SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, displayHallEffect, showHallEffect, SettingsOptions::HallEffectSensitivity, SettingsItemIndex::HallEffSensitivity, 7},
#endif /* HALL_SENSOR */
- {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
+ /* vvvv end of menu marker. DO NOT REMOVE vvvv */
+ {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
+ /* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
};
const menuitem UIMenu[] = {
- /*
- * Temperature Unit
- * Display Orientation
- * Cooldown Blink
- * Scrolling Speed
- * Swap Temp Change Buttons + -
- * Animation Speed
- * -Animation Loop
- * OLED Brightness
- * Invert Screen
- * Logo Timeout
- * Detailed IDLE
- * Detailed Soldering
- */
- {SETTINGS_DESC(SettingsItemIndex::TemperatureUnit), setTempF, displayTempF, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::TemperatureUnit,
- 7}, /* Temperature units, this has to be the first element in the array to work with the logic in enterUIMenu() */
+ /*
+ * Temperature Unit
+ * Display Orientation
+ * Cooldown Blink
+ * Scrolling Speed
+ * Swap Temp Change Buttons +/-
+ * Animation Speed
+ * -Animation Loop
+ * OLED Brightness
+ * Invert Screen
+ * Logo Timeout
+ * Detailed IDLE
+ * Detailed Soldering
+ */
+ /* Temperature units, this has to be the first element in the array to work with the logic in enterUIMenu() */
+ {SETTINGS_DESC(SettingsItemIndex::TemperatureUnit), setTempF, displayTempF, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::TemperatureUnit, 7},
#ifndef NO_DISPLAY_ROTATE
- {SETTINGS_DESC(SettingsItemIndex::DisplayRotation), setDisplayRotation, displayDisplayRotation, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::DisplayRotation,
- 7}, /*Display Rotation*/
+ /* Display Rotation */
+ {SETTINGS_DESC(SettingsItemIndex::DisplayRotation), setDisplayRotation, displayDisplayRotation, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::DisplayRotation, 7},
#endif /* *not* NO_DISPLAY_ROTATE */
- {SETTINGS_DESC(SettingsItemIndex::CooldownBlink), nullptr, displayCoolingBlinkEnabled, nullptr, SettingsOptions::CoolingTempBlink, SettingsItemIndex::CooldownBlink, 7}, /*Cooling blink warning*/
- {SETTINGS_DESC(SettingsItemIndex::ScrollingSpeed), nullptr, displayScrollSpeed, nullptr, SettingsOptions::DescriptionScrollSpeed, SettingsItemIndex::ScrollingSpeed,
- 7}, /*Scroll Speed for descriptions*/
- {SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, displayReverseButtonTempChangeEnabled, nullptr, SettingsOptions::ReverseButtonTempChangeEnabled,
- SettingsItemIndex::ReverseButtonTempChange, 7}, /*Reverse Temp change buttons + - */
- {SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed, SettingsItemIndex::AnimSpeed, 7}, /*Animation Speed adjustment */
- {SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, displayAnimationLoop, displayAnimationOptions, SettingsOptions::AnimationLoop, SettingsItemIndex::AnimLoop, 7}, /*Animation Loop switch */
- {SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, displayBrightnessLevel, nullptr, SettingsOptions::OLEDBrightness, SettingsItemIndex::Brightness, 7}, /*Brightness Level*/
- {SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, displayInvertColor, nullptr, SettingsOptions::OLEDInversion, SettingsItemIndex::ColourInversion, 7}, /*Invert screen colour*/
- {SETTINGS_DESC(SettingsItemIndex::LOGOTime), nullptr, displayLogoTime, nullptr, SettingsOptions::LOGOTime, SettingsItemIndex::LOGOTime, 5}, /*Set logo duration*/
- {SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, displayAdvancedIDLEScreens, nullptr, SettingsOptions::DetailedIDLE, SettingsItemIndex::AdvancedIdle, 7}, /*Advanced idle screen*/
- {SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, displayAdvancedSolderingScreens, nullptr, SettingsOptions::DetailedSoldering, SettingsItemIndex::AdvancedSoldering,
- 7}, /*Advanced soldering screen*/
- {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
+ /* Cooling blink warning */
+ {SETTINGS_DESC(SettingsItemIndex::CooldownBlink), nullptr, displayCoolingBlinkEnabled, nullptr, SettingsOptions::CoolingTempBlink, SettingsItemIndex::CooldownBlink, 7},
+ /* Scroll Speed for descriptions */
+ {SETTINGS_DESC(SettingsItemIndex::ScrollingSpeed), nullptr, displayScrollSpeed, nullptr, SettingsOptions::DescriptionScrollSpeed, SettingsItemIndex::ScrollingSpeed, 7},
+ /* Reverse Temp change buttons +/- */
+ {SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, displayReverseButtonTempChangeEnabled, nullptr, SettingsOptions::ReverseButtonTempChangeEnabled, SettingsItemIndex::ReverseButtonTempChange, 7},
+ /* Animation Speed adjustment */
+ {SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed, SettingsItemIndex::AnimSpeed, 7},
+ /* Animation Loop switch */
+ {SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, displayAnimationLoop, displayAnimationOptions, SettingsOptions::AnimationLoop, SettingsItemIndex::AnimLoop, 7},
+ /* Brightness Level */
+ {SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, displayBrightnessLevel, nullptr, SettingsOptions::OLEDBrightness, SettingsItemIndex::Brightness, 7},
+ /* Invert screen colour */
+ {SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, displayInvertColor, nullptr, SettingsOptions::OLEDInversion, SettingsItemIndex::ColourInversion, 7},
+ /* Set logo duration */
+ {SETTINGS_DESC(SettingsItemIndex::LOGOTime), nullptr, displayLogoTime, nullptr, SettingsOptions::LOGOTime, SettingsItemIndex::LOGOTime, 5},
+ /* Advanced idle screen */
+ {SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, displayAdvancedIDLEScreens, nullptr, SettingsOptions::DetailedIDLE, SettingsItemIndex::AdvancedIdle, 7},
+ /* Advanced soldering screen */
+ {SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, displayAdvancedSolderingScreens, nullptr, SettingsOptions::DetailedSoldering, SettingsItemIndex::AdvancedSoldering, 7},
+ /* vvvv end of menu marker. DO NOT REMOVE vvvv */
+ {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
+ /* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
};
const menuitem advancedMenu[] = {
-/*
- * BluetoothLE
- * Power Limit
- * Calibrate CJC At Next Boot
- * Calibrate Input V
- * Power Pulse
- * -Power Pulse Delay
- * -Power Pulse Duration
- * Factory Reset
- */
+ /*
+ * BluetoothLE
+ * Power Limit
+ * Calibrate CJC At Next Boot
+ * Calibrate Input V
+ * Power Pulse
+ * -Power Pulse Delay
+ * -Power Pulse Duration
+ * Factory Reset
+ */
#ifdef BLE_ENABLED
- {SETTINGS_DESC(SettingsItemIndex::BluetoothLE), nullptr, displayBluetoothLE, nullptr, SettingsOptions::BluetoothLE, SettingsItemIndex::BluetoothLE, 7}, /*Toggle BLE*/
+ /* Toggle BLE */
+ {SETTINGS_DESC(SettingsItemIndex::BluetoothLE), nullptr, displayBluetoothLE, nullptr, SettingsOptions::BluetoothLE, SettingsItemIndex::BluetoothLE, 7},
#endif /* BLE_ENABLED */
- {SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, displayPowerLimit, nullptr, SettingsOptions::PowerLimit, SettingsItemIndex::PowerLimit, 4}, /*Power limit*/
- {SETTINGS_DESC(SettingsItemIndex::CalibrateCJC), setCalibrate, displayCalibrate, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::CalibrateCJC,
- 7}, /*Calibrate Cold Junktion Compensation at next boot*/
- {SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), setCalibrateVIN, displayCalibrateVIN, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::VoltageCalibration,
- 5}, /*Voltage input cal*/
- {SETTINGS_DESC(SettingsItemIndex::PowerPulsePower), nullptr, displayPowerPulse, nullptr, SettingsOptions::KeepAwakePulse, SettingsItemIndex::PowerPulsePower, 5}, /*Power Pulse adjustment */
- {SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, displayPowerPulseWait, showPowerPulseOptions, SettingsOptions::KeepAwakePulseWait, SettingsItemIndex::PowerPulseWait,
- 7}, /*Power Pulse Wait adjustment*/
- {SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, displayPowerPulseDuration, showPowerPulseOptions, SettingsOptions::KeepAwakePulseDuration, SettingsItemIndex::PowerPulseDuration,
- 7}, /*Power Pulse Duration adjustment*/
- {SETTINGS_DESC(SettingsItemIndex::SettingsReset), setResetSettings, displayResetSettings, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SettingsReset, 7}, /*Resets settings*/
- {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
+ /* Power limit */
+ {SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, displayPowerLimit, nullptr, SettingsOptions::PowerLimit, SettingsItemIndex::PowerLimit, 4},
+ /* Calibrate Cold Junktion Compensation at next boot */
+ {SETTINGS_DESC(SettingsItemIndex::CalibrateCJC), setCalibrate, displayCalibrate, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::CalibrateCJC, 7},
+ /* Voltage input cal */
+ {SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), setCalibrateVIN, displayCalibrateVIN, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::VoltageCalibration, 5},
+ /* Power Pulse adjustment */
+ {SETTINGS_DESC(SettingsItemIndex::PowerPulsePower), nullptr, displayPowerPulse, nullptr, SettingsOptions::KeepAwakePulse, SettingsItemIndex::PowerPulsePower, 5},
+ /* Power Pulse Wait adjustment */
+ {SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, displayPowerPulseWait, showPowerPulseOptions, SettingsOptions::KeepAwakePulseWait, SettingsItemIndex::PowerPulseWait, 7},
+ /* Power Pulse Duration adjustment */
+ {SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, displayPowerPulseDuration, showPowerPulseOptions, SettingsOptions::KeepAwakePulseDuration, SettingsItemIndex::PowerPulseDuration, 7},
+ /* Resets settings */
+ {SETTINGS_DESC(SettingsItemIndex::SettingsReset), setResetSettings, displayResetSettings, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SettingsReset, 7},
+ /* vvvv end of menu marker. DO NOT REMOVE vvvv */
+ {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
+ /* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
};
+/* clang-format on */
+
+/* ^^^ !!!ENABLE CLANG-FORMAT back!!! ^^^ */
+
/**
* Prints two small lines (or one line for CJK) of short description for
* setting items and prepares cursor after it.
@@ -552,26 +616,26 @@ static void displayLockingMode(void) {
#ifdef PROFILE_SUPPORT
-static void displayProfilePhases(void) {
- OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhases), 1, FontStyle::LARGE);
-}
+static void displayProfilePhases(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhases), 1, FontStyle::LARGE); }
static bool setProfileTemp(const enum SettingsOptions option) {
- // If in C, 5 deg, if in F 10 deg
- uint16_t temp = getSettingValue(option);
- if (getSettingValue(SettingsOptions::TemperatureInF)) {
- temp += 10;
- if (temp > MAX_TEMP_F)
- temp = MIN_TEMP_F;
- setSettingValue(option, temp);
- return temp == MAX_TEMP_F;
- } else {
- temp += 5;
- if (temp > MAX_TEMP_C)
- temp = MIN_TEMP_C;
- setSettingValue(option, temp);
- return temp == MAX_TEMP_C;
+ // If in C, 5 deg, if in F 10 deg
+ uint16_t temp = getSettingValue(option);
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
+ temp += 10;
+ if (temp > MAX_TEMP_F) {
+ temp = MIN_TEMP_F;
+ }
+ setSettingValue(option, temp);
+ return temp == MAX_TEMP_F;
+ } else {
+ temp += 5;
+ if (temp > MAX_TEMP_C) {
+ temp = MIN_TEMP_C;
}
+ setSettingValue(option, temp);
+ return temp == MAX_TEMP_C;
+ }
}
static bool setProfilePreheatTemp(void) { return setProfileTemp(SettingsOptions::ProfilePreheatTemp); }
@@ -613,14 +677,16 @@ static bool setSleepTemp(void) {
uint16_t temp = getSettingValue(SettingsOptions::SleepTemp);
if (getSettingValue(SettingsOptions::TemperatureInF)) {
temp += 20;
- if (temp > 580)
+ if (temp > 580) {
temp = 60;
+ }
setSettingValue(SettingsOptions::SleepTemp, temp);
return temp == 580;
} else {
temp += 10;
- if (temp > 300)
+ if (temp > 300) {
temp = 10;
+ }
setSettingValue(SettingsOptions::SleepTemp, temp);
return temp == 300;
}
@@ -657,20 +723,20 @@ static bool showHallEffect(void) { return getHallSensorFitted(); }
#endif /* HALL_SENSOR */
static void setTempF(const enum SettingsOptions option) {
- uint16_t Temp = getSettingValue(option);
- if (getSettingValue(SettingsOptions::TemperatureInF)) {
- // Change temp to the F equiv
- // C to F == F= ( (C*9) +160)/5
- Temp = ((Temp * 9) + 160) / 5;
- } else {
- // Change temp to the C equiv
- // F->C == C = ((F-32)*5)/9
- Temp = ((Temp - 32) * 5) / 9;
- }
- // Rescale to be multiples of 10
- Temp = BoostTemp / 10;
- Temp *= 10;
- setSettingValue(option, Temp);
+ uint16_t Temp = getSettingValue(option);
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
+ // Change temp to the F equiv
+ // C to F == F= ( (C*9) +160)/5
+ Temp = ((Temp * 9) + 160) / 5;
+ } else {
+ // Change temp to the C equiv
+ // F->C == C = ((F-32)*5)/9
+ Temp = ((Temp - 32) * 5) / 9;
+ }
+ // Rescale to be multiples of 10
+ Temp = BoostTemp / 10;
+ Temp *= 10;
+ setSettingValue(option, Temp);
}
static bool setTempF(void) {
@@ -1057,10 +1123,12 @@ void gui_Menu(const menuitem *menu) {
menu[currentScreen].draw();
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
uint8_t position = OLED_HEIGHT * (currentScreen - screensSkipped) / scrollContentSize;
- if (lastValue)
+ if (lastValue) {
scrollBlink = !scrollBlink;
- if (!lastValue || !scrollBlink)
+ }
+ if (!lastValue || !scrollBlink) {
OLED::drawScrollIndicator(position, indicatorHeight);
+ }
} else {
// Draw description
const char *description = translatedString(Tr->SettingsDescriptions[menu[currentScreen].description - 1]);
@@ -1107,29 +1175,28 @@ void gui_Menu(const menuitem *menu) {
// increment
if (scrollMessage.isReset()) {
lastValue = callIncrementHandler();
- } else
+ } else {
scrollMessage.reset();
+ }
break;
case BUTTON_B_SHORT:
if (scrollMessage.isReset()) {
currentScreen++;
navState = NavState::ScrollingDown;
lastValue = false;
- } else
+ } else {
scrollMessage.reset();
+ }
break;
case BUTTON_F_LONG:
if (xTaskGetTickCount() + autoRepeatAcceleration > autoRepeatTimer + PRESS_ACCEL_INTERVAL_MAX) {
-
- if ((lastValue = callIncrementHandler()))
+ if ((lastValue = callIncrementHandler())) {
autoRepeatTimer = 1000;
- else
+ } else {
autoRepeatTimer = 0;
-
+ }
autoRepeatTimer += xTaskGetTickCount();
-
scrollMessage.reset();
-
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
@@ -1139,7 +1206,6 @@ void gui_Menu(const menuitem *menu) {
navState = NavState::ScrollingDown;
autoRepeatTimer = xTaskGetTickCount();
scrollMessage.reset();
-
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
diff --git a/source/Core/Threads/OperatingModes/CJC.cpp b/source/Core/Threads/OperatingModes/CJC.cpp
index 50d8ed57..25fef8d8 100644
--- a/source/Core/Threads/OperatingModes/CJC.cpp
+++ b/source/Core/Threads/OperatingModes/CJC.cpp
@@ -20,8 +20,9 @@ void performCJCC(void) {
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
OLED::setCursor(0, 8);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
- for (uint8_t x = 0; x < (i / 4); x++)
+ for (uint8_t x = 0; x < (i / 4); x++) {
OLED::print(SmallSymbolDot, FontStyle::SMALL);
+ }
OLED::refresh();
osDelay(100);
}
diff --git a/source/Core/Threads/OperatingModes/DebugMenu.cpp b/source/Core/Threads/OperatingModes/DebugMenu.cpp
index ff215a13..adf03ddd 100644
--- a/source/Core/Threads/OperatingModes/DebugMenu.cpp
+++ b/source/Core/Threads/OperatingModes/DebugMenu.cpp
@@ -57,8 +57,8 @@ void showDebugMenu(void) {
case 9: // Movement Timestamp
OLED::printNumber(lastMovementTime / TICKS_100MS, 8, FontStyle::SMALL);
break;
- case 10: // Tip Resistance in Ω
- OLED::printNumber(getTipResistanceX10() / 10, 6, FontStyle::SMALL); // large to pad over so that we cover ID left overs
+ case 10: // Tip Resistance in Ω large to pad over so that we cover ID left overs
+ OLED::printNumber(getTipResistanceX10() / 10, 6, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(getTipResistanceX10() % 10, 1, FontStyle::SMALL);
break;
@@ -82,8 +82,9 @@ void showDebugMenu(void) {
case 16: // Raw Hall Effect Value
{
int16_t hallEffectStrength = getRawHallEffect();
- if (hallEffectStrength < 0)
+ if (hallEffectStrength < 0) {
hallEffectStrength = -hallEffectStrength;
+ }
OLED::printNumber(hallEffectStrength, 6, FontStyle::SMALL);
} break;
#endif
@@ -94,9 +95,9 @@ void showDebugMenu(void) {
OLED::refresh();
b = getButtonState();
- if (b == BUTTON_B_SHORT)
+ if (b == BUTTON_B_SHORT) {
return;
- else if (b == BUTTON_F_SHORT) {
+ } else if (b == BUTTON_F_SHORT) {
screen++;
#ifdef HALL_SENSOR
screen = screen % 17;
@@ -104,6 +105,7 @@ void showDebugMenu(void) {
screen = screen % 16;
#endif
}
+
GUIDelay();
}
}
diff --git a/source/Core/Threads/OperatingModes/HomeScreen.cpp b/source/Core/Threads/OperatingModes/HomeScreen.cpp
index a24dd727..fd92539c 100644
--- a/source/Core/Threads/OperatingModes/HomeScreen.cpp
+++ b/source/Core/Threads/OperatingModes/HomeScreen.cpp
@@ -103,21 +103,24 @@ void drawDetailedHomeScreen(uint32_t tipTemp) {
}
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else {
- if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (tipTemp > 55) && (xTaskGetTickCount() % 1000 < 300)))
+ if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (tipTemp > 55) && (xTaskGetTickCount() % 1000 < 300))) {
// Blink temp if setting enable and temp < 55°
// 1000 tick/sec
// OFF 300ms ON 700ms
gui_drawTipTemp(true, FontStyle::LARGE); // draw in the temp
+ }
if (OLED::getRotation()) {
OLED::setCursor(6, 0);
} else {
OLED::setCursor(73, 0); // top right
}
- OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::SMALL); // draw set temp
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ // draw set temp
+ OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::SMALL);
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
- else
+ } else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
+ }
if (OLED::getRotation()) {
OLED::setCursor(0, 8);
} else {
@@ -142,10 +145,11 @@ void drawSimplifiedHomeScreen(uint32_t tipTemp) {
gui_drawBatteryIcon();
}
tipDisconnectedDisplay = false;
- if (tipTemp > 55)
+ if (tipTemp > 55) {
tempOnDisplay = true;
- else if (tipTemp < 45)
+ } else if (tipTemp < 45) {
tempOnDisplay = false;
+ }
if (isTipDisconnected()) {
tempOnDisplay = false;
tipDisconnectedDisplay = true;
@@ -164,8 +168,9 @@ void drawSimplifiedHomeScreen(uint32_t tipTemp) {
// If we have a tip connected draw the temp, if not we leave it blank
if (!tipDisconnectedDisplay) {
// draw in the temp
- if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300)))
+ if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
gui_drawTipTemp(false, FontStyle::LARGE); // draw in the temp
+ }
} else {
// Draw in missing tip symbol
diff --git a/source/Core/Threads/OperatingModes/Sleep.cpp b/source/Core/Threads/OperatingModes/Sleep.cpp
index ef6c78d8..ed5fd335 100644
--- a/source/Core/Threads/OperatingModes/Sleep.cpp
+++ b/source/Core/Threads/OperatingModes/Sleep.cpp
@@ -12,14 +12,18 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
// If in the first two seconds we disable this to let accelerometer warm up
#ifdef POW_DC
- if (checkForUnderVoltage())
- return 1; // return non-zero on error
+ if (checkForUnderVoltage()) {
+ // return non-zero on error
+ return 1;
+ }
#endif
+
if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp)));
} else {
currentTempTargetDegC = stayOff ? 0 : min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp));
}
+
// draw the lcd
uint16_t tipTemp = getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC();
@@ -30,9 +34,10 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
- if (getSettingValue(SettingsOptions::TemperatureInF))
+
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
- else {
+ } else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
@@ -42,9 +47,10 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
} else {
OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE);
OLED::printNumber(tipTemp, 3, FontStyle::LARGE);
- if (getSettingValue(SettingsOptions::TemperatureInF))
+
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::drawSymbol(0);
- else {
+ } else {
OLED::drawSymbol(1);
}
}
@@ -59,9 +65,11 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
if (shouldShutdown()) {
// shutdown
currentTempTargetDegC = 0;
- return 1; // we want to exit soldering mode
+ // we want to exit soldering mode
+ return 1;
}
}
#endif
+
return 0;
}
diff --git a/source/Core/Threads/OperatingModes/Soldering.cpp b/source/Core/Threads/OperatingModes/Soldering.cpp
index 459b9842..d923871e 100644
--- a/source/Core/Threads/OperatingModes/Soldering.cpp
+++ b/source/Core/Threads/OperatingModes/Soldering.cpp
@@ -147,15 +147,15 @@ void gui_solderingMode(uint8_t jumpToSleep) {
OLED::refresh();
// Update the setpoints for the temperature
if (boostModeOn) {
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::BoostTemp));
- else {
+ } else {
currentTempTargetDegC = (getSettingValue(SettingsOptions::BoostTemp));
}
} else {
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::SolderingTemp));
- else {
+ } else {
currentTempTargetDegC = (getSettingValue(SettingsOptions::SolderingTemp));
}
}
@@ -187,4 +187,3 @@ void gui_solderingMode(uint8_t jumpToSleep) {
GUIDelay();
}
}
-
diff --git a/source/Core/Threads/OperatingModes/SolderingProfile.cpp b/source/Core/Threads/OperatingModes/SolderingProfile.cpp
index 70c206a4..84be660a 100644
--- a/source/Core/Threads/OperatingModes/SolderingProfile.cpp
+++ b/source/Core/Threads/OperatingModes/SolderingProfile.cpp
@@ -12,15 +12,15 @@ void gui_solderingProfileMode() {
* --> Long hold back button to exit
* --> Double button to exit
*/
- currentMode = OperatingMode::soldering;
+ currentMode = OperatingMode::soldering;
TickType_t buzzerEnd = 0;
- bool waitForRelease = true;
- TickType_t phaseStartTime = xTaskGetTickCount();
+ bool waitForRelease = true;
+ TickType_t phaseStartTime = xTaskGetTickCount();
- uint16_t tipTemp = 0;
- uint8_t profilePhase = 0;
+ uint16_t tipTemp = 0;
+ uint8_t profilePhase = 0;
uint16_t phaseElapsedSeconds = 0;
uint16_t phaseTotalSeconds = 0;
@@ -32,24 +32,26 @@ void gui_solderingProfileMode() {
for (;;) {
ButtonState buttons = getButtonState();
if (buttons) {
- if (waitForRelease) buttons = BUTTON_NONE;
+ if (waitForRelease) {
+ buttons = BUTTON_NONE;
+ }
} else {
waitForRelease = false;
}
switch (buttons) {
- case BUTTON_NONE:
- break;
- case BUTTON_BOTH:
- case BUTTON_B_LONG:
- return; // exit on back long hold
- case BUTTON_F_LONG:
- case BUTTON_F_SHORT:
- case BUTTON_B_SHORT:
- // Not used yet
- break;
- default:
- break;
+ case BUTTON_NONE:
+ break;
+ case BUTTON_BOTH:
+ case BUTTON_B_LONG:
+ return; // exit on back long hold
+ case BUTTON_F_LONG:
+ case BUTTON_F_SHORT:
+ case BUTTON_B_SHORT:
+ // Not used yet
+ break;
+ default:
+ break;
}
if (getSettingValue(SettingsOptions::TemperatureInF)) {
@@ -73,39 +75,41 @@ void gui_solderingProfileMode() {
// have we finished this phase?
if (phaseElapsedSeconds >= phaseTotalSeconds && tipTemp == phaseEndTemp) {
profilePhase++;
- phaseStartTemp = phaseEndTemp;
- phaseStartTime = xTaskGetTickCount();
+
+ phaseStartTemp = phaseEndTemp;
+ phaseStartTime = xTaskGetTickCount();
phaseElapsedSeconds = 0;
+
if (profilePhase > getSettingValue(SettingsOptions::ProfilePhases)) {
// done with all phases, lets go to cooldown
- phaseTotalSeconds = 0;
- phaseEndTemp = 0;
+ phaseTotalSeconds = 0;
+ phaseEndTemp = 0;
phaseTicksPerDegree = TICKS_SECOND / getSettingValue(SettingsOptions::ProfileCooldownSpeed);
} else {
// set up next phase
- switch(profilePhase) {
- case 1:
- phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase1Duration);
- phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase1Temp);
- break;
- case 2:
- phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase2Duration);
- phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase2Temp);
- break;
- case 3:
- phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase3Duration);
- phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase3Temp);
- break;
- case 4:
- phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase4Duration);
- phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase4Temp);
- break;
- case 5:
- phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase5Duration);
- phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase5Temp);
- break;
- default:
- break;
+ switch (profilePhase) {
+ case 1:
+ phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase1Duration);
+ phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase1Temp);
+ break;
+ case 2:
+ phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase2Duration);
+ phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase2Temp);
+ break;
+ case 3:
+ phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase3Duration);
+ phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase3Temp);
+ break;
+ case 4:
+ phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase4Duration);
+ phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase4Temp);
+ break;
+ case 5:
+ phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase5Duration);
+ phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase5Temp);
+ break;
+ default:
+ break;
}
if (phaseStartTemp < phaseEndTemp) {
phaseTicksPerDegree = (phaseTotalSeconds * TICKS_SECOND) / (phaseEndTemp - phaseStartTemp);
@@ -152,10 +156,11 @@ void gui_solderingProfileMode() {
OLED::print(SmallSymbolSlash, FontStyle::SMALL);
OLED::printNumber(profileCurrentTargetTemp, 3, FontStyle::SMALL);
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
- else
+ } else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
+ }
// print phase
if (profilePhase > 0 && profilePhase <= getSettingValue(SettingsOptions::ProfilePhases)) {
@@ -186,7 +191,7 @@ void gui_solderingProfileMode() {
OLED::print(SmallSymbolSlash, FontStyle::SMALL);
// blink if we can't keep up with the time goal
- if (phaseElapsedSeconds < phaseTotalSeconds+2 || (xTaskGetTickCount() / TICKS_SECOND) % 2 == 0) {
+ if (phaseElapsedSeconds < phaseTotalSeconds + 2 || (xTaskGetTickCount() / TICKS_SECOND) % 2 == 0) {
OLED::printNumber(phaseTotalSeconds / 60, 1, FontStyle::SMALL);
OLED::print(SmallSymbolColon, FontStyle::SMALL);
OLED::printNumber(phaseTotalSeconds % 60, 2, FontStyle::SMALL, false);
@@ -225,4 +230,3 @@ void gui_solderingProfileMode() {
GUIDelay();
}
}
-
diff --git a/source/Core/Threads/OperatingModes/TemperatureAdjust.cpp b/source/Core/Threads/OperatingModes/TemperatureAdjust.cpp
index 5c05a520..06c41da5 100644
--- a/source/Core/Threads/OperatingModes/TemperatureAdjust.cpp
+++ b/source/Core/Threads/OperatingModes/TemperatureAdjust.cpp
@@ -1,12 +1,12 @@
#include "OperatingModes.h"
void gui_solderingTempAdjust(void) {
- TickType_t lastChange = xTaskGetTickCount();
- currentTempTargetDegC = 0; // Turn off heater while adjusting temp
- TickType_t autoRepeatTimer = 0;
- uint8_t autoRepeatAcceleration = 0;
+ TickType_t lastChange = xTaskGetTickCount();
+ currentTempTargetDegC = 0; // Turn off heater while adjusting temp
+ TickType_t autoRepeatTimer = 0;
+ uint8_t autoRepeatAcceleration = 0;
#ifndef PROFILE_SUPPORT
- bool waitForRelease = false;
- ButtonState buttons = getButtonState();
+ bool waitForRelease = false;
+ ButtonState buttons = getButtonState();
if (buttons != BUTTON_NONE) {
// Temp adjust entered by long-pressing F button.
@@ -79,20 +79,25 @@ void gui_solderingTempAdjust(void) {
newTemp = (newTemp / delta) * delta;
if (getSettingValue(SettingsOptions::TemperatureInF)) {
- if (newTemp > MAX_TEMP_F)
+ if (newTemp > MAX_TEMP_F) {
newTemp = MAX_TEMP_F;
- if (newTemp < MIN_TEMP_F)
+ }
+ if (newTemp < MIN_TEMP_F) {
newTemp = MIN_TEMP_F;
+ }
} else {
- if (newTemp > MAX_TEMP_C)
+ if (newTemp > MAX_TEMP_C) {
newTemp = MAX_TEMP_C;
- if (newTemp < MIN_TEMP_C)
+ }
+ if (newTemp < MIN_TEMP_C) {
newTemp = MIN_TEMP_C;
+ }
}
setSettingValue(SettingsOptions::SolderingTemp, (uint16_t)newTemp);
}
- if (xTaskGetTickCount() - lastChange > (TICKS_SECOND * 2))
+ if (xTaskGetTickCount() - lastChange > (TICKS_SECOND * 2)) {
return; // exit if user just doesn't press anything for a bit
+ }
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE);
@@ -102,9 +107,9 @@ void gui_solderingTempAdjust(void) {
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::LARGE);
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::drawSymbol(0);
- else {
+ } else {
OLED::drawSymbol(1);
}
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
@@ -116,4 +121,4 @@ void gui_solderingTempAdjust(void) {
OLED::refresh();
GUIDelay();
}
-} \ No newline at end of file
+}
diff --git a/source/Core/Threads/OperatingModes/USBPDDebug_FUSB.cpp b/source/Core/Threads/OperatingModes/USBPDDebug_FUSB.cpp
index cd2bf4b7..65776970 100644
--- a/source/Core/Threads/OperatingModes/USBPDDebug_FUSB.cpp
+++ b/source/Core/Threads/OperatingModes/USBPDDebug_FUSB.cpp
@@ -81,11 +81,12 @@ void showPDDebug(void) {
OLED::refresh();
b = getButtonState();
- if (b == BUTTON_B_SHORT)
+ if (b == BUTTON_B_SHORT) {
return;
- else if (b == BUTTON_F_SHORT) {
+ } else if (b == BUTTON_F_SHORT) {
screen++;
}
+
GUIDelay();
}
}
diff --git a/source/Core/Threads/OperatingModes/USBPDDebug_HUSB238.cpp b/source/Core/Threads/OperatingModes/USBPDDebug_HUSB238.cpp
index 94288f08..5841e47c 100644
--- a/source/Core/Threads/OperatingModes/USBPDDebug_HUSB238.cpp
+++ b/source/Core/Threads/OperatingModes/USBPDDebug_HUSB238.cpp
@@ -43,11 +43,12 @@ void showPDDebug(void) {
OLED::refresh();
b = getButtonState();
- if (b == BUTTON_B_SHORT)
+ if (b == BUTTON_B_SHORT) {
return;
- else if (b == BUTTON_F_SHORT) {
+ } else if (b == BUTTON_F_SHORT) {
screen++;
}
+
GUIDelay();
}
}
diff --git a/source/Core/Threads/OperatingModes/utils/DrawTipTemperature.cpp b/source/Core/Threads/OperatingModes/utils/DrawTipTemperature.cpp
index b8ffbd65..d65a71da 100644
--- a/source/Core/Threads/OperatingModes/utils/DrawTipTemperature.cpp
+++ b/source/Core/Threads/OperatingModes/utils/DrawTipTemperature.cpp
@@ -14,16 +14,18 @@ void gui_drawTipTemp(bool symbol, const FontStyle font) {
if (symbol) {
if (font == FontStyle::LARGE) {
// Big font, can draw nice symbols
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::drawSymbol(0);
- else
+ } else {
OLED::drawSymbol(1);
+ }
} else {
// Otherwise fall back to chars
- if (getSettingValue(SettingsOptions::TemperatureInF))
+ if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
- else
+ } else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
+ }
}
}
-} \ No newline at end of file
+}
diff --git a/source/Core/Threads/OperatingModes/utils/SolderingCommon.cpp b/source/Core/Threads/OperatingModes/utils/SolderingCommon.cpp
index af50ccad..c96fbc8d 100644
--- a/source/Core/Threads/OperatingModes/utils/SolderingCommon.cpp
+++ b/source/Core/Threads/OperatingModes/utils/SolderingCommon.cpp
@@ -2,8 +2,8 @@
// Created by laura on 24.04.23.
//
-#include "OperatingModes.h"
#include "SolderingCommon.h"
+#include "OperatingModes.h"
extern bool heaterThermalRunaway;
@@ -16,7 +16,8 @@ void detailedPowerStatus() {
// Print wattage
{
uint32_t x10Watt = x10WattHistory.average();
- if (x10Watt > 999) { // If we exceed 99.9W we drop the decimal place to keep it all fitting
+ if (x10Watt > 999) {
+ // If we exceed 99.9W we drop the decimal place to keep it all fitting
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
OLED::printNumber(x10WattHistory.average() / 10, 3, FontStyle::SMALL);
} else {
@@ -42,30 +43,35 @@ void basicSolderingStatus(bool boostModeOn) {
if (OLED::getRotation()) {
// battery
gui_drawBatteryIcon();
- OLED::print(LargeSymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
- gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
-
- // We draw boost arrow if boosting, or else gap temp <-> heat
- // indicator
- if (boostModeOn)
+ // Space out gap between battery <-> temp
+ OLED::print(LargeSymbolSpace, FontStyle::LARGE);
+ // Draw current tip temp
+ gui_drawTipTemp(true, FontStyle::LARGE);
+
+ // We draw boost arrow if boosting,
+ // or else gap temp <-> heat indicator
+ if (boostModeOn) {
OLED::drawSymbol(2);
- else
+ } else {
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
+ }
// Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
} else {
// Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
- // We draw boost arrow if boosting, or else gap temp <-> heat
- // indicator
- if (boostModeOn)
+ // We draw boost arrow if boosting,
+ // or else gap temp <-> heat indicator
+ if (boostModeOn) {
OLED::drawSymbol(2);
- else
+ } else {
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
- gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
-
- OLED::print(LargeSymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
+ }
+ // Draw current tip temp
+ gui_drawTipTemp(true, FontStyle::LARGE);
+ // Space out gap between battery <-> temp
+ OLED::print(LargeSymbolSpace, FontStyle::LARGE);
gui_drawBatteryIcon();
}
diff --git a/source/Core/Threads/OperatingModes/utils/drawPowerSourceIcon.cpp b/source/Core/Threads/OperatingModes/utils/drawPowerSourceIcon.cpp
index fd378743..c296b533 100644
--- a/source/Core/Threads/OperatingModes/utils/drawPowerSourceIcon.cpp
+++ b/source/Core/Threads/OperatingModes/utils/drawPowerSourceIcon.cpp
@@ -6,10 +6,11 @@ void gui_drawBatteryIcon(void) {
// On non-DC inputs we replace this symbol with the voltage we are operating on
// If <9V then show single digit, if not show dual small ones vertically stacked
uint16_t V = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
- if (V % 10 >= 5)
+ if (V % 10 >= 5) {
V = (V / 10) + 1; // round up
- else
+ } else {
V = V / 10;
+ }
if (V > 9) {
int16_t xPos = OLED::getCursorX();
OLED::printNumber(V / 10, 1, FontStyle::SMALL);
@@ -30,14 +31,16 @@ void gui_drawBatteryIcon(void) {
uint32_t cellV = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0) / cellCount;
// Should give us approx cell voltage X10
// Range is 42 -> Minimum voltage setting (systemSettings.minVoltageCells) = 9 steps therefore we will use battery 0-9
- if (cellV < getSettingValue(SettingsOptions::MinVoltageCells))
+ if (cellV < getSettingValue(SettingsOptions::MinVoltageCells)) {
cellV = getSettingValue(SettingsOptions::MinVoltageCells);
+ }
cellV -= getSettingValue(SettingsOptions::MinVoltageCells); // Should leave us a number of 0-9
- if (cellV > 9)
+ if (cellV > 9) {
cellV = 9;
+ }
OLED::drawBattery(cellV + 1);
} else {
OLED::drawSymbol(15); // Draw the DC Logo
}
#endif
-} \ No newline at end of file
+}
diff --git a/source/Core/Threads/OperatingModes/utils/getSleepTimeout.cpp b/source/Core/Threads/OperatingModes/utils/getSleepTimeout.cpp
index b6c0d1e1..b91c134e 100644
--- a/source/Core/Threads/OperatingModes/utils/getSleepTimeout.cpp
+++ b/source/Core/Threads/OperatingModes/utils/getSleepTimeout.cpp
@@ -7,12 +7,13 @@ uint32_t getSleepTimeout(void) {
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
uint32_t sleepThres = 0;
- if (getSettingValue(SettingsOptions::SleepTime) < 6)
+ if (getSettingValue(SettingsOptions::SleepTime) < 6) {
sleepThres = getSettingValue(SettingsOptions::SleepTime) * 10 * 1000;
- else
+ } else {
sleepThres = (getSettingValue(SettingsOptions::SleepTime) - 5) * 60 * 1000;
+ }
return sleepThres;
}
return 0;
}
-#endif \ No newline at end of file
+#endif
diff --git a/source/Core/Threads/OperatingModes/utils/min.cpp b/source/Core/Threads/OperatingModes/utils/min.cpp
index 15829579..a7e9c0bb 100644
--- a/source/Core/Threads/OperatingModes/utils/min.cpp
+++ b/source/Core/Threads/OperatingModes/utils/min.cpp
@@ -3,8 +3,9 @@
#include "OperatingModeUtilities.h"
#include <stdint.h>
uint16_t min(uint16_t a, uint16_t b) {
- if (a > b)
+ if (a > b) {
return b;
- else
+ } else {
return a;
-} \ No newline at end of file
+ }
+}
diff --git a/source/Core/Threads/OperatingModes/utils/shouldDeviceSleep.cpp b/source/Core/Threads/OperatingModes/utils/shouldDeviceSleep.cpp
index b28b451e..92a99fc9 100644
--- a/source/Core/Threads/OperatingModes/utils/shouldDeviceSleep.cpp
+++ b/source/Core/Threads/OperatingModes/utils/shouldDeviceSleep.cpp
@@ -26,8 +26,9 @@ bool shouldBeSleeping(bool inAutoStart) {
// threshold, and if so then we force sleep
if (getHallSensorFitted() && lookupHallEffectThreshold()) {
int16_t hallEffectStrength = getRawHallEffect();
- if (hallEffectStrength < 0)
+ if (hallEffectStrength < 0) {
hallEffectStrength = -hallEffectStrength;
+ }
// Have absolute value of measure of magnetic field strength
if (hallEffectStrength > lookupHallEffectThreshold()) {
if (lastHallEffectSleepStart == 0) {
@@ -43,4 +44,4 @@ bool shouldBeSleeping(bool inAutoStart) {
#endif
#endif
return false;
-} \ No newline at end of file
+}
diff --git a/source/Core/Threads/POWThread.cpp b/source/Core/Threads/POWThread.cpp
index e4e3165f..bb816ad7 100644
--- a/source/Core/Threads/POWThread.cpp
+++ b/source/Core/Threads/POWThread.cpp
@@ -17,7 +17,6 @@
#include "stdlib.h"
#include "task.h"
-
// Small worker thread to handle power (PD + QC) related steps
void startPOWTask(void const *argument __unused) {
diff --git a/source/Makefile b/source/Makefile
index ddbf4ed8..32f8aa86 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -8,13 +8,15 @@ ALL_PINECIL_V2_MODELS=Pinecilv2
ALL_MHP30_MODELS=MHP30
ALL_SEQURE_MODELS=S60
ALL_MODELS=$(ALL_MINIWARE_MODELS) $(ALL_PINECIL_MODELS) $(ALL_MHP30_MODELS) $(ALL_PINECIL_V2_MODELS) $(ALL_SEQURE_MODELS)
+
ifneq ($(model),$(filter $(model),$(ALL_MODELS)))
$(error Invalid model '$(model)', valid options are: $(ALL_MODELS))
endif
-# output folder
+# Output folder
HEXFILE_DIR=Hexfile
-# temporary objects folder
+
+# Temporary objects folder
OUTPUT_DIR_BASE=Objects
OUTPUT_DIR=Objects/$(model)
@@ -24,7 +26,7 @@ LANGUAGE_GROUP_CJK_LANGS=EN JA_JP YUE_HK ZH_TW ZH_CN
LANGUAGE_GROUP_CJK_NAME=Chinese+Japanese
ifdef custom_multi_langs
-RUN_SHELL_CMD := $(shell rm -Rf {Core/Gen,$(OUTPUT_DIR)/Core/Gen,$(HEXFILE_DIR)/*_Custom.*})
+RUN_SHELL_CMD:=$(shell rm -Rf {Core/Gen,$(OUTPUT_DIR)/Core/Gen,$(HEXFILE_DIR)/*_Custom.*})
LANGUAGE_GROUP_CUSTOM_LANGS=$(custom_multi_langs)
LANGUAGE_GROUP_CUSTOM_NAME=Custom
endif
@@ -37,7 +39,6 @@ LANGUAGE_GROUP_EUR_NAME=European
LANGUAGE_GROUPS=CUSTOM CJK CYRILLIC EUR
-
# Define for host Python
ifndef HOST_PYTHON
HOST_PYTHON:=python3
@@ -45,150 +46,177 @@ endif
# Defines for host tools
ifeq ($(HOST_CC),)
-HOST_CC := gcc
+HOST_CC:=gcc
endif
+
HOST_OUTPUT_DIR=Objects/host
# DFU packing address to use
DEVICE_DFU_ADDRESS=0x08000000
DEVICE_DFU_VID_PID=0x28E9:0x0189
-# Enumerate all of the include directories
-APP_INC_DIR = ./Core/Inc
-BRIEFLZ_INC_DIR = ./Core/brieflz
-MINIWARE_INC_CMSIS_DEVICE = ./Core/BSP/Miniware/Vendor/CMSIS/Device/ST/STM32F1xx/Include
-MINIWARE_CMSIS_CORE_INC_DIR = ./Core/BSP/Miniware/Vendor/CMSIS/Include
-MINIWARE_HAL_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
-MINIWARE_HAL_LEGACY_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
-MINIWARE_STARTUP_DIR = ./Startup
-MINIWARE_INC_DIR = ./Core/BSP/Miniware
-MINIWARE_LD_FILE = ./Core/BSP/Miniware/stm32f103.ld
-
-S60_INC_CMSIS_DEVICE = ./Core/BSP/Sequre_S60/Vendor/CMSIS/Device/ST/STM32F1xx/Include
-S60_CMSIS_CORE_INC_DIR = ./Core/BSP/Sequre_S60/Vendor/CMSIS/Include
-S60_HAL_INC_DIR = ./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc
-S60_HAL_LEGACY_INC_DIR = ./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
-S60_STARTUP_DIR = ./Startup
-S60_INC_DIR = ./Core/BSP/Sequre_S60
-S60_LD_FILE = ./Core/BSP/Sequre_S60/stm32f103.ld
-
-MHP30_INC_CMSIS_DEVICE = ./Core/BSP/MHP30/Vendor/CMSIS/Device/ST/STM32F1xx/Include
-MHP30_CMSIS_CORE_INC_DIR = ./Core/BSP/MHP30/Vendor/CMSIS/Include
-MHP30_HAL_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc
-MHP30_HAL_LEGACY_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
-MHP30_STARTUP_DIR = ./Startup
-MHP30_INC_DIR = ./Core/BSP/MHP30
-MHP30_LD_FILE = ./Core/BSP/MHP30/stm32f103.ld
-
-PINE_INC_DIR = ./Core/BSP/Pinecil
-PINE_VENDOR_INC_DIR = ./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include
-PINE_VENDOR_USB_INC_DIR = ./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include/Usb
-PINE_NMSIS_INC_DIR = ./Core/BSP/Pinecil/Vendor/NMSIS/Core/Include
-PINE_FREERTOS_PORT_INC_DIR = ./Core/BSP/Pinecil/Vendor/OS/FreeRTOS/Source/portable/GCC
-
-PINECILV2_DIR = ./Core/BSP/Pinecilv2
-PINECILV2_SDK_DIR = $(PINECILV2_DIR)/bl_mcu_sdk
-
-PINECILV2_VENDOR_BSP_DIR = $(PINECILV2_SDK_DIR)/bsp
-PINECILV2_VENDOR_BSP_COMMON_DIR = $(PINECILV2_VENDOR_BSP_DIR)/bsp_common
-PINECILV2_VENDOR_BSP_BOARD_DIR = $(PINECILV2_VENDOR_BSP_DIR)/board
-PINECILV2_VENDOR_BSP_PLATFORM_DIR = $(PINECILV2_VENDOR_BSP_COMMON_DIR)/platform
-PINECILV2_VENDOR_BSP_USB_DIR = $(PINECILV2_VENDOR_BSP_COMMON_DIR)/usb
-
-
-PINECILV2_COMMON_DIR = $(PINECILV2_SDK_DIR)/common
-PINECILV2_COMMON_BL_MATH_DIR = $(PINECILV2_COMMON_DIR)/bl_math
-PINECILV2_COMMON_DEVICE_DIR = $(PINECILV2_COMMON_DIR)/device
-PINECILV2_COMMON_LIST_DIR = $(PINECILV2_COMMON_DIR)/list
-PINECILV2_COMMON_MISC_DIR = $(PINECILV2_COMMON_DIR)/misc
-PINECILV2_COMMON_PARTITION_DIR = $(PINECILV2_COMMON_DIR)/partition
-PINECILV2_COMMON_PID_DIR = $(PINECILV2_COMMON_DIR)/pid
-PINECILV2_COMMON_RING_BUFFERDIR = $(PINECILV2_COMMON_DIR)/ring_buffer
-PINECILV2_COMMON_SOFT_CRC_DIR = $(PINECILV2_COMMON_DIR)/soft_crc
-PINECILV2_COMMON_TIMESTAMP_DIR = $(PINECILV2_COMMON_DIR)/timestamp
-PINECILV2_COMPONENTS_DIR = $(PINECILV2_SDK_DIR)/components
-
-
-PINECILV2_COMPONENTS_FREERTOS_DIR = $(PINECILV2_COMPONENTS_DIR)/freertos
-PINECILV2_COMPONENTS_FREERTOS_BL602_DIR = $(PINECILV2_COMPONENTS_FREERTOS_DIR)/portable/gcc/risc-v/bl702
-
-PINECILV2_COMPONENTS_BLE_STACK_PORT_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/port/include
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_BLUETOOTH_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers/bluetooth
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_BLUETOOTH_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/bluetooth
-PINECILV2_COMPONENTS_BLE_STACK_COMMON_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common
-PINECILV2_COMPONENTS_BLE_STACK_COMMON_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_MISC_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/misc
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_ZEPHYR_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/zephyr
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_NET_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/net
-PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/toolchain
-PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include
-PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include/tinycrypt
-PINECILV2_COMPONENTS_BLE_STACK_HOST_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/host
-PINECILV2_COMPONENTS_BLE_STACK_BL_HCI_WRAPPER_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/bl_hci_wrapper
-PINECILV2_COMPONENTS_BLE_CONTROLLER_BLE_INC_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/ble_inc
-PINECILV2_COMPONENTS_BLE_STACK_BC_DEC_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/sbc/dec
-
-
-#Binary blobs suck and they should be ashamed
+
+# Enumerate all of the include directories (HAL source dirs are used for clang-format only)
+APP_INC_DIR=./Core/Inc
+BRIEFLZ_INC_DIR=./Core/brieflz
+MINIWARE_INC_CMSIS_DEVICE=./Core/BSP/Miniware/Vendor/CMSIS/Device/ST/STM32F1xx/Include
+MINIWARE_CMSIS_CORE_INC_DIR=./Core/BSP/Miniware/Vendor/CMSIS/Include
+MINIWARE_HAL_SRC_DIR= ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver
+MINIWARE_HAL_INC_DIR=./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
+MINIWARE_HAL_LEGACY_INC_DIR=./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
+MINIWARE_STARTUP_DIR=./Startup
+MINIWARE_INC_DIR=./Core/BSP/Miniware
+MINIWARE_LD_FILE=./Core/BSP/Miniware/stm32f103.ld
+
+S60_INC_CMSIS_DEVICE=./Core/BSP/Sequre_S60/Vendor/CMSIS/Device/ST/STM32F1xx/Include
+S60_CMSIS_CORE_INC_DIR=./Core/BSP/Sequre_S60/Vendor/CMSIS/Include
+S60_HAL_SRC_DIR=./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver
+S60_HAL_INC_DIR=./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc
+S60_HAL_LEGACY_INC_DIR=./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
+S60_STARTUP_DIR=./Startup
+S60_INC_DIR=./Core/BSP/Sequre_S60
+S60_LD_FILE=./Core/BSP/Sequre_S60/stm32f103.ld
+
+MHP30_INC_CMSIS_DEVICE=./Core/BSP/MHP30/Vendor/CMSIS/Device/ST/STM32F1xx/Include
+MHP30_CMSIS_CORE_INC_DIR=./Core/BSP/MHP30/Vendor/CMSIS/Include
+MHP30_HAL_SRC_DIR=./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver
+MHP30_HAL_INC_DIR=./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc
+MHP30_HAL_LEGACY_INC_DIR=./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
+MHP30_STARTUP_DIR=./Startup
+MHP30_INC_DIR=./Core/BSP/MHP30
+MHP30_LD_FILE=./Core/BSP/MHP30/stm32f103.ld
+
+PINE_INC_DIR=./Core/BSP/Pinecil
+PINE_VENDOR_SRC_DIR=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Source
+PINE_VENDOR_INC_DIR=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include
+PINE_VENDOR_USB_INC_DIR=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include/Usb
+PINE_NMSIS_INC_DIR=./Core/BSP/Pinecil/Vendor/NMSIS/Core/Include
+PINE_FREERTOS_PORT_INC_DIR=./Core/BSP/Pinecil/Vendor/OS/FreeRTOS/Source/portable/GCC
+
+PINECILV2_DIR=./Core/BSP/Pinecilv2
+PINECILV2_MEM_DIR=$(PINECILV2_DIR)/MemMang
+PINECILV2_SDK_DIR=$(PINECILV2_DIR)/bl_mcu_sdk
+
+PINECILV2_VENDOR_BSP_DIR=$(PINECILV2_SDK_DIR)/bsp
+PINECILV2_VENDOR_BSP_COMMON_DIR=$(PINECILV2_VENDOR_BSP_DIR)/bsp_common
+PINECILV2_VENDOR_BSP_BOARD_DIR=$(PINECILV2_VENDOR_BSP_DIR)/board
+PINECILV2_VENDOR_BSP_PLATFORM_DIR=$(PINECILV2_VENDOR_BSP_COMMON_DIR)/platform
+PINECILV2_VENDOR_BSP_USB_DIR=$(PINECILV2_VENDOR_BSP_COMMON_DIR)/usb
+
+PINECILV2_COMMON_DIR=$(PINECILV2_SDK_DIR)/common
+PINECILV2_COMMON_BL_MATH_DIR=$(PINECILV2_COMMON_DIR)/bl_math
+PINECILV2_COMMON_DEVICE_DIR=$(PINECILV2_COMMON_DIR)/device
+PINECILV2_COMMON_LIST_DIR=$(PINECILV2_COMMON_DIR)/list
+PINECILV2_COMMON_MISC_DIR=$(PINECILV2_COMMON_DIR)/misc
+PINECILV2_COMMON_PARTITION_DIR=$(PINECILV2_COMMON_DIR)/partition
+PINECILV2_COMMON_PID_DIR=$(PINECILV2_COMMON_DIR)/pid
+PINECILV2_COMMON_RING_BUFFERDIR=$(PINECILV2_COMMON_DIR)/ring_buffer
+PINECILV2_COMMON_SOFT_CRC_DIR=$(PINECILV2_COMMON_DIR)/soft_crc
+PINECILV2_COMMON_TIMESTAMP_DIR=$(PINECILV2_COMMON_DIR)/timestamp
+
+PINECILV2_COMPONENTS_DIR=$(PINECILV2_SDK_DIR)/components
+PINECILV2_COMPONENTS_FREERTOS_DIR=$(PINECILV2_COMPONENTS_DIR)/freertos
+PINECILV2_COMPONENTS_FREERTOS_BL602_DIR=$(PINECILV2_COMPONENTS_FREERTOS_DIR)/portable/gcc/risc-v/bl702
+
+PINECILV2_COMPONENTS_BLE_STACK_PORT_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/port/include
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_BLUETOOTH_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers/bluetooth
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_BLUETOOTH_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/bluetooth
+PINECILV2_COMPONENTS_BLE_STACK_COMMON_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common
+PINECILV2_COMPONENTS_BLE_STACK_COMMON_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_MISC_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/misc
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_ZEPHYR_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/zephyr
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_NET_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/net
+PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/toolchain
+PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include
+PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include/tinycrypt
+PINECILV2_COMPONENTS_BLE_STACK_HOST_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/host
+PINECILV2_COMPONENTS_BLE_STACK_BL_HCI_WRAPPER_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/bl_hci_wrapper
+PINECILV2_COMPONENTS_BLE_CONTROLLER_BLE_INC_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/ble_inc
+PINECILV2_COMPONENTS_BLE_STACK_BC_DEC_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/sbc/dec
+
+# Binary blobs suck and they should be ashamed
PINECILV2_BLE_CRAPWARE_BLOB_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/lib
PINECILV2_RF_CRAPWARE_BLOB_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/bl702_rf/lib
-
-PINECILV2_COMPONENTS_NMSIS_DIR = $(PINECILV2_COMPONENTS_DIR)/nmsis
-PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR = $(PINECILV2_COMPONENTS_NMSIS_DIR)/core/inc
-
-PINECILV2_COMPONENTS_USB_STACK_DIR = $(PINECILV2_COMPONENTS_DIR)/usb_stack
-PINECILV2_COMPONENTS_USB_STACK_COMMON_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/common
-PINECILV2_COMPONENTS_USB_STACK_CORE_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/core
-PINECILV2_COMPONENTS_USB_STACK_CDC_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/cdc
-PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/winusb
-
-PINECILV2_DRIVERS_DIR = $(PINECILV2_SDK_DIR)/drivers/bl702_driver
-PINECILV2_DRIVERS_HAL_DRV_INC_DIR = $(PINECILV2_DRIVERS_DIR)/hal_drv/inc
-PINECILV2_DRIVERS_HAL_DRV_DEF_DIR = $(PINECILV2_DRIVERS_DIR)/hal_drv/default_config
-PINECILV2_DRIVERS_REGS_DIR = $(PINECILV2_DRIVERS_DIR)/regs
-PINECILV2_DRIVERS_RISCV_DIR = $(PINECILV2_DRIVERS_DIR)/risc-v
-PINECILV2_DRIVERS_STARTUP_DIR = $(PINECILV2_DRIVERS_DIR)/startup
-PINECILV2_DRIVERS_STD_DRV_DIR = $(PINECILV2_DRIVERS_DIR)/std_drv/inc
-
-
-
-
-SOURCE_MIDDLEWARES_DIR = ./Middlewares
-FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
-FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
-DRIVER_INC_DIR =./Core/Drivers
-BSP_INC_DIR = ./Core/BSP
-THREADS_INC_DIR = ./Core/Threads
-THREADS_OP_MODES_INC_DIR = ./Core/Threads/OperatingModes
-THREADS_OP_MODES_TOOLS_INC_DIR = ./Core/Threads/OperatingModes/utils
-
-SOURCE_THREADS_DIR = ./Core/Threads
-SOURCE_CORE_DIR = ./Core/Src
-SOURCE_BRIEFLZ_DIR = ./Core/brieflz
-SOURCE_DRIVERS_DIR = ./Core/Drivers
-INC_PD_DRIVERS_DIR = ./Core/Drivers/usb-pd/include
-PD_DRIVER_TESTS_DIR = ./Core/Drivers/usb-pd/tests
-PD_DRIVER_DIR = ./Core/Drivers/usb-pd
-
+PINECILV2_COMPONENTS_NMSIS_DIR=$(PINECILV2_COMPONENTS_DIR)/nmsis
+PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR=$(PINECILV2_COMPONENTS_NMSIS_DIR)/core/inc
+
+PINECILV2_COMPONENTS_USB_STACK_DIR=$(PINECILV2_COMPONENTS_DIR)/usb_stack
+PINECILV2_COMPONENTS_USB_STACK_COMMON_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/common
+PINECILV2_COMPONENTS_USB_STACK_CORE_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/core
+PINECILV2_COMPONENTS_USB_STACK_CDC_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/cdc
+PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/winusb
+
+PINECILV2_DRIVERS_DIR=$(PINECILV2_SDK_DIR)/drivers/bl702_driver
+PINECILV2_DRIVERS_HAL_DRV_INC_DIR=$(PINECILV2_DRIVERS_DIR)/hal_drv/inc
+PINECILV2_DRIVERS_HAL_DRV_DEF_DIR=$(PINECILV2_DRIVERS_DIR)/hal_drv/default_config
+PINECILV2_DRIVERS_REGS_DIR=$(PINECILV2_DRIVERS_DIR)/regs
+PINECILV2_DRIVERS_RISCV_DIR=$(PINECILV2_DRIVERS_DIR)/risc-v
+PINECILV2_DRIVERS_STARTUP_DIR=$(PINECILV2_DRIVERS_DIR)/startup
+PINECILV2_DRIVERS_STD_DRV_DIR=$(PINECILV2_DRIVERS_DIR)/std_drv/inc
+
+SOURCE_MIDDLEWARES_DIR=./Middlewares
+FRTOS_CMIS_INC_DIR=./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
+FRTOS_INC_DIR=./Middlewares/Third_Party/FreeRTOS/Source/include
+DRIVER_INC_DIR=./Core/Drivers
+BSP_INC_DIR=./Core/BSP
+THREADS_INC_DIR=./Core/Threads
+THREADS_OP_MODES_INC_DIR=./Core/Threads/OperatingModes
+THREADS_OP_MODES_TOOLS_INC_DIR=./Core/Threads/OperatingModes/utils
+
+SOURCE_THREADS_DIR=./Core/Threads
+SOURCE_CORE_DIR=./Core/Src
+SOURCE_BRIEFLZ_DIR=./Core/brieflz
+SOURCE_DRIVERS_DIR=./Core/Drivers
+INC_PD_DRIVERS_DIR=./Core/Drivers/usb-pd/include
+PD_DRIVER_TESTS_DIR=./Core/Drivers/usb-pd/tests
+PD_DRIVER_DIR=./Core/Drivers/usb-pd
+
+# Excludes for clang-format
+
+ALL_INCLUDES_EXCEPT:=-path $(BRIEFLZ_INC_DIR) \
+ -o -path $(PD_DRIVER_DIR) \
+ -o -path $(PINECILV2_SDK_DIR) \
+ -o -path $(DRIVER_INC_DIR) \
+ -o -path $(MINIWARE_HAL_INC_DIR) \
+ -o -path $(S60_HAL_INC_DIR) \
+ -o -path $(MHP30_HAL_INC_DIR) \
+ -o -path $(PINE_VENDOR_INC_DIR) \
+ -o -path $(MINIWARE_CMSIS_CORE_INC_DIR) \
+ -o -path $(S60_CMSIS_CORE_INC_DIR) \
+ -o -path $(MINIWARE_INC_CMSIS_DEVICE) \
+ -o -path $(S60_INC_CMSIS_DEVICE) \
+ -o -path $(MHP30_INC_CMSIS_DEVICE) \
+ -o -not -name "configuration.h"
+
+ALL_SOURCE_EXCEPT:=-path $(SOURCE_BRIEFLZ_DIR) \
+ -o -path $(PD_DRIVER_DIR) \
+ -o -path $(PINECILV2_SDK_DIR) \
+ -o -path $(SOURCE_DRIVERS_DIR) \
+ -o -path $(MINIWARE_HAL_SRC_DIR) \
+ -o -path $(S60_HAL_SRC_DIR) \
+ -o -path $(MHP30_HAL_SRC_DIR) \
+ -o -path $(PINE_VENDOR_SRC_DIR) \
+ -o -path $(PINECILV2_MEM_DIR)
# Find-all's used for formatting; have to exclude external modules
-
-ALL_INCLUDES = $(shell find ./Core -type d \( -path $(BRIEFLZ_INC_DIR) -o -path $(PD_DRIVER_DIR) -o -path $(PINECILV2_SDK_DIR) \) -prune -false -o \( -type f \( -name '*.h' -o -name '*.hpp' \) \) )
-ALL_SOURCE = $(shell find ./Core -type d \( -path $(SOURCE_BRIEFLZ_DIR) -o -path $(PD_DRIVER_DIR) -o -path $(PINECILV2_SDK_DIR) \) -prune -false -o \( -type f \( -name '*.c' -o -name '*.cpp' \) \) )
+ALL_INCLUDES=$(shell find ./Core -type d \( $(ALL_INCLUDES_EXCEPT) \) -prune -false -o \( -type f \( -name '*.h' -o -name '*.hpp' \) \) )
+ALL_SOURCE=$(shell find ./Core -type d \( $(ALL_SOURCE_EXCEPT) \) -prune -false -o \( -type f \( -name '*.c' -o -name '*.cpp' \) \) )
# Device dependent settings
ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS)))
$(info Building for Miniware )
-DEVICE_INCLUDES = -I$(MINIWARE_INC_DIR) \
- -I$(MINIWARE_INC_CMSIS_DEVICE)\
- -I$(MINIWARE_CMSIS_CORE_INC_DIR) \
- -I$(MINIWARE_HAL_INC_DIR) \
- -I$(MINIWARE_HAL_LEGACY_INC_DIR)
-DEVICE_BSP_DIR = ./Core/BSP/Miniware
-S_SRCS := $(shell find $(MINIWARE_STARTUP_DIR) -type f -name '*.S')
+DEVICE_INCLUDES=-I$(MINIWARE_INC_DIR) \
+ -I$(MINIWARE_INC_CMSIS_DEVICE) \
+ -I$(MINIWARE_CMSIS_CORE_INC_DIR) \
+ -I$(MINIWARE_HAL_INC_DIR) \
+ -I$(MINIWARE_HAL_LEGACY_INC_DIR)
+
+DEVICE_BSP_DIR=./Core/BSP/Miniware
+S_SRCS:=$(shell find $(MINIWARE_STARTUP_DIR) -type f -name '*.S')
LDSCRIPT=$(MINIWARE_LD_FILE)
+
ifeq ($(model),$(filter $(model),TS101))
flash_size=126k
bootldr_size=0x8000
@@ -199,270 +227,331 @@ bootldr_size=0x4000
DEVICE_DFU_ADDRESS=0x08004000
endif
-DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
- -D ARM_MATH_CM3 \
- -D STM32F10X_MD -finline-limit=9999999
-DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning
+DEV_GLOBAL_DEFS=-D STM32F103T8Ux \
+ -D STM32F1 \
+ -D STM32 \
+ -D USE_HAL_DRIVER \
+ -D STM32F103xB \
+ -D USE_RTOS_SYSTICK \
+ -D GCC_ARMCM3 \
+ -D ARM_MATH_CM3 \
+ -D STM32F10X_MD \
+ -finline-limit=9999999
+
+DEV_LDFLAGS=-Wl,--wrap=printf -Wl,--no-wchar-size-warning
DEV_AFLAGS=
-DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
-DEV_CXXFLAGS=
-CPUFLAGS= -mcpu=cortex-m3 \
- -mthumb \
- -mfloat-abi=soft
+DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
+DEV_CXXFLAGS=
+CPUFLAGS=-mcpu=cortex-m3 \
+ -mthumb \
+ -mfloat-abi=soft
+
DEVICE_DFU_VID_PID=0x1209:0xDB42
-endif
+endif # ALL_MINIWARE_MODELS
+
ifeq ($(model),$(filter $(model),$(ALL_SEQURE_MODELS)))
$(info Building for Sequre )
-DEVICE_INCLUDES = -I$(S60_INC_DIR) \
- -I$(S60_INC_CMSIS_DEVICE)\
- -I$(S60_CMSIS_CORE_INC_DIR) \
- -I$(S60_HAL_INC_DIR) \
- -I$(S60_HAL_LEGACY_INC_DIR)
-DEVICE_BSP_DIR = ./Core/BSP/Sequre_S60
-S_SRCS := $(shell find $(S60_STARTUP_DIR) -type f -name '*.S')
+DEVICE_INCLUDES=-I$(S60_INC_DIR) \
+ -I$(S60_INC_CMSIS_DEVICE) \
+ -I$(S60_CMSIS_CORE_INC_DIR) \
+ -I$(S60_HAL_INC_DIR) \
+ -I$(S60_HAL_LEGACY_INC_DIR)
+
+DEVICE_BSP_DIR=./Core/BSP/Sequre_S60
+S_SRCS:=$(shell find $(S60_STARTUP_DIR) -type f -name '*.S')
LDSCRIPT=$(S60_LD_FILE)
-DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
- -D ARM_MATH_CM3 \
- -D STM32F10X_MD -finline-limit=9999999
-DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning
+DEV_GLOBAL_DEFS=-D STM32F103T8Ux \
+ -D STM32F1 \
+ -D STM32 \
+ -D USE_HAL_DRIVER \
+ -D STM32F103xB \
+ -D USE_RTOS_SYSTICK \
+ -D GCC_ARMCM3 \
+ -D ARM_MATH_CM3 \
+ -D STM32F10X_MD \
+ -finline-limit=9999999
+
+DEV_LDFLAGS=-Wl,--wrap=printf -Wl,--no-wchar-size-warning
DEV_AFLAGS=
-DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
-DEV_CXXFLAGS=
-CPUFLAGS= -mcpu=cortex-m3 \
- -mthumb \
- -mfloat-abi=soft
+DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
+DEV_CXXFLAGS=
+CPUFLAGS=-mcpu=cortex-m3 \
+ -mthumb \
+ -mfloat-abi=soft
+
flash_size=62k
bootldr_size=0x4400
DEVICE_DFU_ADDRESS=0x08004400
DEVICE_DFU_VID_PID=0x1209:0xDB42
-endif
+endif # ALL_SEQURE_MODELS
ifeq ($(model),$(filter $(model),$(ALL_MHP30_MODELS)))
$(info Building for MHP30 )
-DEVICE_INCLUDES = -I$(MHP30_INC_DIR) \
- -I$(MHP30_INC_CMSIS_DEVICE)\
- -I$(MHP30_CMSIS_CORE_INC_DIR) \
- -I$(MHP30_HAL_INC_DIR) \
- -I$(MHP30_HAL_LEGACY_INC_DIR)
-DEVICE_BSP_DIR = ./Core/BSP/MHP30
-S_SRCS := $(shell find $(MHP30_STARTUP_DIR) -type f -name '*.S')
+DEVICE_INCLUDES=-I$(MHP30_INC_DIR) \
+ -I$(MHP30_INC_CMSIS_DEVICE) \
+ -I$(MHP30_CMSIS_CORE_INC_DIR) \
+ -I$(MHP30_HAL_INC_DIR) \
+ -I$(MHP30_HAL_LEGACY_INC_DIR)
+
+DEVICE_BSP_DIR=./Core/BSP/MHP30
+S_SRCS:=$(shell find $(MHP30_STARTUP_DIR) -type f -name '*.S')
LDSCRIPT=$(MHP30_LD_FILE)
-DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
- -D ARM_MATH_CM3 \
- -D STM32F10X_MD
-DEV_LDFLAGS=
+DEV_GLOBAL_DEFS=-D STM32F103T8Ux \
+ -D STM32F1 \
+ -D STM32 \
+ -D USE_HAL_DRIVER \
+ -D STM32F103xB \
+ -D USE_RTOS_SYSTICK \
+ -D GCC_ARMCM3 \
+ -D ARM_MATH_CM3 \
+ -D STM32F10X_MD
+
+DEV_LDFLAGS=
DEV_AFLAGS=
-DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
-DEV_CXXFLAGS=
-CPUFLAGS= -mcpu=cortex-m3 \
- -mthumb \
- -mfloat-abi=soft
+DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
+DEV_CXXFLAGS=
+CPUFLAGS=-mcpu=cortex-m3 \
+ -mthumb \
+ -mfloat-abi=soft
+
flash_size=126k
bootldr_size=32k
DEVICE_DFU_ADDRESS=0x08008000
DEVICE_DFU_VID_PID=0x1209:0xDB42
-endif
-
+endif # ALL_MHP30_MODELS
ifeq ($(model),$(ALL_PINECIL_MODELS))
$(info Building for Pine64 Pinecilv1)
-DEVICE_INCLUDES = -I$(PINE_INC_DIR) \
--I$(PINE_VENDOR_INC_DIR) \
--I$(PINE_VENDOR_USB_INC_DIR) \
--I$(PINE_NMSIS_INC_DIR) \
--I$(PINE_FREERTOS_PORT_INC_DIR)
-
-DEVICE_BSP_DIR = ./Core/BSP/Pinecil
-S_SRCS := $(shell find $(PINE_INC_DIR) -type f -name '*.S') $(info $(S_SRCS) )
-ASM_INC = -I$(PINE_RISCV_INC_DIR)
+DEVICE_INCLUDES=-I$(PINE_INC_DIR) \
+ -I$(PINE_VENDOR_INC_DIR) \
+ -I$(PINE_VENDOR_USB_INC_DIR) \
+ -I$(PINE_NMSIS_INC_DIR) \
+ -I$(PINE_FREERTOS_PORT_INC_DIR)
+
+DEVICE_BSP_DIR=./Core/BSP/Pinecil
+S_SRCS:=$(shell find $(PINE_INC_DIR) -type f -name '*.S') $(info $(S_SRCS) )
+ASM_INC=-I$(PINE_RISCV_INC_DIR)
LDSCRIPT=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Board/pinecil/Source/GCC/gcc_gd32vf103_flashxip.ld
flash_size=128k
bootldr_size=0x0
+
# Flags
-CPUFLAGS= -march=rv32imac \
- -mabi=ilp32 \
- -mcmodel=medany -fsigned-char -fno-builtin -nostartfiles
-DEV_LDFLAGS=-nostartfiles
-DEV_AFLAGS=
-DEV_GLOBAL_DEFS= -DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
-DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
+CPUFLAGS=-march=rv32imac \
+ -mabi=ilp32 \
+ -mcmodel=medany \
+ -fsigned-char \
+ -fno-builtin \
+ -nostartfiles
+
+DEV_LDFLAGS=-nostartfiles
+DEV_AFLAGS=
+DEV_GLOBAL_DEFS=-DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
+DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
DEV_CXXFLAGS=
-endif
-
-
-
+endif # ALL_PINECIL_MODELS
ifeq ($(model),$(ALL_PINECIL_V2_MODELS))
$(info Building for Pine64 Pinecilv2 )
-
-
-DEVICE_INCLUDES = -I$(PINECILV2_DIR) \
- -I$(PINECILV2_SDK_DIR) \
- -I$(PINECILV2_VENDOR_BSP_COMMON_DIR) \
- -I$(PINECILV2_VENDOR_BSP_PLATFORM_DIR) \
- -I$(PINECILV2_COMMON_DIR) \
- -I$(PINECILV2_COMMON_BL_MATH_DIR) \
- -I$(PINECILV2_COMMON_DEVICE_DIR) \
- -I$(PINECILV2_COMMON_LIST_DIR) \
- -I$(PINECILV2_COMMON_MISC_DIR) \
- -I$(PINECILV2_COMMON_PARTITION_DIR) \
- -I$(PINECILV2_COMMON_PID_DIR) \
- -I$(PINECILV2_COMMON_RING_BUFFERDIR) \
- -I$(PINECILV2_COMMON_SOFT_CRC_DIR) \
- -I$(PINECILV2_COMMON_TIMESTAMP_DIR) \
- -I$(PINECILV2_COMPONENTS_DIR) \
- -I$(PINECILV2_COMPONENTS_FREERTOS_DIR) \
- -I$(PINECILV2_COMPONENTS_FREERTOS_BL602_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_BLUETOOTH_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_PORT_INCLUDE_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_BLUETOOTH_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_COMMON_INCLUDE_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_COMMON_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_MISC_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_ZEPHYR_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_NET_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_INCLUDE_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_HOST_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_BL_HCI_WRAPPER_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_CONTROLLER_BLE_INC_DIR) \
- -I$(PINECILV2_COMPONENTS_BLE_STACK_BC_DEC_DIR) \
- -I$(PINECILV2_COMPONENTS_NMSIS_DIR) \
- -I$(PINECILV2_COMPONENTS_USB_STACK_DIR) \
- -I$(PINECILV2_DRIVERS_DIR) \
- -I$(PINECILV2_DRIVERS_HAL_DRV_INC_DIR) \
- -I$(PINECILV2_DRIVERS_HAL_DRV_DEF_DIR) \
- -I$(PINECILV2_DRIVERS_REGS_DIR) \
- -I$(PINECILV2_DRIVERS_RISCV_DIR) \
- -I$(PINECILV2_DRIVERS_STARTUP_DIR) \
- -I$(PINECILV2_DRIVERS_STD_DRV_DIR) \
- -I$(PINECILV2_VENDOR_BSP_PLATFORM_DIR) \
- -I$(PINECILV2_VENDOR_BSP_USB_DIR) \
- -I$(PINECILV2_COMPONENTS_USB_STACK_COMMON_DIR) \
- -I$(PINECILV2_COMPONENTS_USB_STACK_CORE_DIR) \
- -I$(PINECILV2_COMPONENTS_USB_STACK_CDC_DIR) \
- -I$(PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR) \
- -I$(PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR)
-
-DEVICE_BSP_DIR = ./Core/BSP/Pinecilv2
-S_SRCS := $(shell find $(PINECILV2_DIR) -type d \( -path $(PINECILV2_VENDOR_BSP_COMMON_DIR) \) -prune -false -o -type f -name '*.S') $(info $(S_SRCS) )
-ASM_INC = $(DEVICE_INCLUDES)
+DEVICE_INCLUDES=-I$(PINECILV2_DIR) \
+ -I$(PINECILV2_SDK_DIR) \
+ -I$(PINECILV2_VENDOR_BSP_COMMON_DIR) \
+ -I$(PINECILV2_VENDOR_BSP_PLATFORM_DIR) \
+ -I$(PINECILV2_COMMON_DIR) \
+ -I$(PINECILV2_COMMON_BL_MATH_DIR) \
+ -I$(PINECILV2_COMMON_DEVICE_DIR) \
+ -I$(PINECILV2_COMMON_LIST_DIR) \
+ -I$(PINECILV2_COMMON_MISC_DIR) \
+ -I$(PINECILV2_COMMON_PARTITION_DIR) \
+ -I$(PINECILV2_COMMON_PID_DIR) \
+ -I$(PINECILV2_COMMON_RING_BUFFERDIR) \
+ -I$(PINECILV2_COMMON_SOFT_CRC_DIR) \
+ -I$(PINECILV2_COMMON_TIMESTAMP_DIR) \
+ -I$(PINECILV2_COMPONENTS_DIR) \
+ -I$(PINECILV2_COMPONENTS_FREERTOS_DIR) \
+ -I$(PINECILV2_COMPONENTS_FREERTOS_BL602_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_BLUETOOTH_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_PORT_INCLUDE_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_BLUETOOTH_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_COMMON_INCLUDE_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_COMMON_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_MISC_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_ZEPHYR_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_NET_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_INCLUDE_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_HOST_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_BL_HCI_WRAPPER_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_CONTROLLER_BLE_INC_DIR) \
+ -I$(PINECILV2_COMPONENTS_BLE_STACK_BC_DEC_DIR) \
+ -I$(PINECILV2_COMPONENTS_NMSIS_DIR) \
+ -I$(PINECILV2_COMPONENTS_USB_STACK_DIR) \
+ -I$(PINECILV2_DRIVERS_DIR) \
+ -I$(PINECILV2_DRIVERS_HAL_DRV_INC_DIR) \
+ -I$(PINECILV2_DRIVERS_HAL_DRV_DEF_DIR) \
+ -I$(PINECILV2_DRIVERS_REGS_DIR) \
+ -I$(PINECILV2_DRIVERS_RISCV_DIR) \
+ -I$(PINECILV2_DRIVERS_STARTUP_DIR) \
+ -I$(PINECILV2_DRIVERS_STD_DRV_DIR) \
+ -I$(PINECILV2_VENDOR_BSP_PLATFORM_DIR) \
+ -I$(PINECILV2_VENDOR_BSP_USB_DIR) \
+ -I$(PINECILV2_COMPONENTS_USB_STACK_COMMON_DIR) \
+ -I$(PINECILV2_COMPONENTS_USB_STACK_CORE_DIR) \
+ -I$(PINECILV2_COMPONENTS_USB_STACK_CDC_DIR) \
+ -I$(PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR) \
+ -I$(PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR)
+
+DEVICE_BSP_DIR=./Core/BSP/Pinecilv2
+S_SRCS:=$(shell find $(PINECILV2_DIR) -type d \( -path $(PINECILV2_VENDOR_BSP_COMMON_DIR) \) -prune -false -o -type f -name '*.S') $(info $(S_SRCS) )
+ASM_INC=$(DEVICE_INCLUDES)
LDSCRIPT=./Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
# Flags
-CPUFLAGS= -march=rv32imafc \
- -mabi=ilp32f \
- -mcmodel=medany -fsigned-char -fno-builtin -nostartfiles \
- -DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler -DARCH_RISCV -D__RISCV_FEATURE_MVE=0 -DBL702 -DBFLB_USE_ROM_DRIVER=1
-DEV_LDFLAGS=-nostartfiles -L $(PINECILV2_BLE_CRAPWARE_BLOB_DIR) -L $(PINECILV2_RF_CRAPWARE_BLOB_DIR) -l blecontroller_702_m0s1s -l bl702_rf
-DEV_AFLAGS=
-DEV_GLOBAL_DEFS= -DCFG_FREERTOS \
--DARCH_RISCV \
--DBL702 \
--DCFG_BLE_ENABLE \
--DBFLB_BLE \
--DCFG_BLE \
--DOPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER \
--DBL_MCU_SDK \
--DCFG_CON=2 \
--DCFG_BLE_TX_BUFF_DATA=2 \
--DCONFIG_BT_PERIPHERAL \
--DCONFIG_BT_L2CAP_DYNAMIC_CHANNEL \
--DCONFIG_BT_GATT_CLIENT \
--DCONFIG_BT_CONN \
--DCONFIG_BT_GATT_DIS_PNP \
--DCONFIG_BT_GATT_DIS_SERIAL_NUMBER \
--DCONFIG_BT_GATT_DIS_FW_REV \
--DCONFIG_BT_GATT_DIS_HW_REV \
--DCONFIG_BT_GATT_DIS_SW_REV \
--DCONFIG_BT_ECC \
--DCONFIG_BT_GATT_DYNAMIC_DB \
--DCONFIG_BT_GATT_SERVICE_CHANGED \
--DCONFIG_BT_KEYS_OVERWRITE_OLDEST \
--DCONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING \
--DCONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS \
--DCONFIG_BT_BONDABLE \
--DCONFIG_BT_HCI_VS_EVT_USER \
--DCONFIG_BT_ASSERT \
--DCONFIG_BT_SIGNING \
--DCONFIG_BT_SETTINGS_CCC_LAZY_LOADING \
--DCONFIG_BT_SETTINGS_USE_PRINTK \
--DCFG_SLEEP \
--DCONFIG_BT_ALLROLES \
--DCONFIG_BT_CENTRAL \
--DCONFIG_BT_OBSERVER \
--DCONFIG_BT_BROADCASTER \
--DCFG_BLE_STACK_DBG_PRINT \
--DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler \
--DCONFIG_BT_DEVICE_NAME=\"Pinecil\" \
--DCONFIG_BT_DEVICE_APPEARANCE=0x06C1
-# -DBFLB_USE_HAL_DRIVER
-# -DCONFIG_BT_SMP \
-
-
-#Required to be turned off due to their drivers tripping warnings
+CPUFLAGS=-march=rv32imafc \
+ -mabi=ilp32f \
+ -mcmodel=medany \
+ -fsigned-char \
+ -fno-builtin \
+ -nostartfiles \
+ -DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler \
+ -DARCH_RISCV \
+ -D__RISCV_FEATURE_MVE=0 \
+ -DBL702 \
+ -DBFLB_USE_ROM_DRIVER=1 \
+
+DEV_LDFLAGS=-nostartfiles \
+ -L $(PINECILV2_BLE_CRAPWARE_BLOB_DIR) \
+ -L $(PINECILV2_RF_CRAPWARE_BLOB_DIR) \
+ -l blecontroller_702_m0s1s \
+ -l bl702_rf
+
+DEV_AFLAGS=
+DEV_GLOBAL_DEFS=-DCFG_FREERTOS \
+ -DARCH_RISCV \
+ -DBL702 \
+ -DCFG_BLE_ENABLE \
+ -DBFLB_BLE \
+ -DCFG_BLE \
+ -DOPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER \
+ -DBL_MCU_SDK \
+ -DCFG_CON=2 \
+ -DCFG_BLE_TX_BUFF_DATA=2 \
+ -DCONFIG_BT_PERIPHERAL \
+ -DCONFIG_BT_L2CAP_DYNAMIC_CHANNEL \
+ -DCONFIG_BT_GATT_CLIENT \
+ -DCONFIG_BT_CONN \
+ -DCONFIG_BT_GATT_DIS_PNP \
+ -DCONFIG_BT_GATT_DIS_SERIAL_NUMBER \
+ -DCONFIG_BT_GATT_DIS_FW_REV \
+ -DCONFIG_BT_GATT_DIS_HW_REV \
+ -DCONFIG_BT_GATT_DIS_SW_REV \
+ -DCONFIG_BT_ECC \
+ -DCONFIG_BT_GATT_DYNAMIC_DB \
+ -DCONFIG_BT_GATT_SERVICE_CHANGED \
+ -DCONFIG_BT_KEYS_OVERWRITE_OLDEST \
+ -DCONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING \
+ -DCONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS \
+ -DCONFIG_BT_BONDABLE \
+ -DCONFIG_BT_HCI_VS_EVT_USER \
+ -DCONFIG_BT_ASSERT \
+ -DCONFIG_BT_SIGNING \
+ -DCONFIG_BT_SETTINGS_CCC_LAZY_LOADING \
+ -DCONFIG_BT_SETTINGS_USE_PRINTK \
+ -DCFG_SLEEP \
+ -DCONFIG_BT_ALLROLES \
+ -DCONFIG_BT_CENTRAL \
+ -DCONFIG_BT_OBSERVER \
+ -DCONFIG_BT_BROADCASTER \
+ -DCFG_BLE_STACK_DBG_PRINT \
+ -DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler \
+ -DCONFIG_BT_DEVICE_NAME=\"Pinecil\" \
+ -DCONFIG_BT_DEVICE_APPEARANCE=0x06C1
+# -DBFLB_USE_HAL_DRIVER \
+# -DCONFIG_BT_SMP
+
+# Required to be turned off due to their drivers tripping warnings
DEV_CFLAGS= -Wno-error=enum-conversion -Wno-type-limits -Wno-implicit-fallthrough
DEV_CXXFLAGS= $(DEV_CFLAGS)
flash_size=128k
bootldr_size=0x0
-endif
+endif # ALL_PINECIL_V2_MODELS
+
+INCLUDES=-I$(APP_INC_DIR) \
+ -I$(BRIEFLZ_INC_DIR) \
+ -I$(FRTOS_CMIS_INC_DIR) \
+ -I$(FRTOS_INC_DIR) \
+ -I$(DRIVER_INC_DIR) \
+ -I$(BSP_INC_DIR) \
+ -I$(THREADS_INC_DIR) \
+ -I$(THREADS_OP_MODES_INC_DIR) \
+ -I$(THREADS_OP_MODES_TOOLS_INC_DIR) \
+ -I$(INC_PD_DRIVERS_DIR) \
+ $(DEVICE_INCLUDES)
+
+EXCLUDED_DIRS:=-path $(PINECILV2_VENDOR_BSP_ES8388_DIR) \
+ -o -path $(PINECILV2_VENDOR_BSP_IMAGE_SENSOR_DIR) \
+ -o -path $(PINECILV2_VENDOR_BSP_LVGL_DIR) \
+ -o -path $(PINECILV2_VENDOR_BSP_MCU_LCD_DIR) \
+ -o -path $(PINECILV2_VENDOR_BSP_BOARD_DIR) \
+ -o -path $(PINECILV2_VENDOR_BSP_USB_DIR)
+
+SOURCE:=$(shell find $(SOURCE_THREADS_DIR) -type f -name '*.c') \
+ $(shell find $(SOURCE_CORE_DIR) -type f -name '*.c') \
+ $(shell find $(SOURCE_DRIVERS_DIR) -type f -name '*.c') \
+ $(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.c') \
+ $(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.c') \
+ $(SOURCE_BRIEFLZ_DIR)/depack.c
-INCLUDES = -I$(APP_INC_DIR) \
- -I$(BRIEFLZ_INC_DIR) \
- -I$(FRTOS_CMIS_INC_DIR) \
- -I$(FRTOS_INC_DIR) \
- -I$(DRIVER_INC_DIR) \
- -I$(BSP_INC_DIR) \
- -I$(THREADS_INC_DIR) \
- -I$(THREADS_OP_MODES_INC_DIR) \
- -I$(THREADS_OP_MODES_TOOLS_INC_DIR) \
- -I$(INC_PD_DRIVERS_DIR) \
- $(DEVICE_INCLUDES)
-
-EXCLUDED_DIRS := -path $(PINECILV2_VENDOR_BSP_ES8388_DIR) \
--o -path $(PINECILV2_VENDOR_BSP_IMAGE_SENSOR_DIR) \
--o -path $(PINECILV2_VENDOR_BSP_LVGL_DIR) \
--o -path $(PINECILV2_VENDOR_BSP_MCU_LCD_DIR) \
--o -path $(PINECILV2_VENDOR_BSP_BOARD_DIR) \
--o -path $(PINECILV2_VENDOR_BSP_USB_DIR) \
-
-SOURCE := $(shell find $(SOURCE_THREADS_DIR) -type f -name '*.c') \
-$(shell find $(SOURCE_CORE_DIR) -type f -name '*.c') \
-$(shell find $(SOURCE_DRIVERS_DIR) -type f -name '*.c') \
-$(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.c')\
-$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.c') \
-$(SOURCE_BRIEFLZ_DIR)/depack.c
# We exclude the USB-PD stack tests $(PD_DRIVER_TESTS_DIR)
-SOURCE_CPP := $(shell find $(SOURCE_THREADS_DIR) -type f -name '*.cpp') \
-$(shell find $(SOURCE_CORE_DIR) -type f -name '*.cpp') \
-$(shell find $(SOURCE_DRIVERS_DIR) -path $(PD_DRIVER_TESTS_DIR) -prune -false -o -type f -name '*.cpp') \
-$(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.cpp') \
-$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
-
-# code optimisation ------------------------------------------------------------
-OPTIM=-Os -fno-jump-tables -foptimize-strlen -faggressive-loop-optimizations -fdevirtualize-at-ltrans -fmerge-all-constants -fshort-wchar -flto -finline-small-functions -finline-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common -fno-math-errno -ffast-math -ffinite-math-only -fno-signed-zeros -fsingle-precision-constant
-
-# global defines ---------------------------------------------------------------
-GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
+SOURCE_CPP:=$(shell find $(SOURCE_THREADS_DIR) -type f -name '*.cpp') \
+ $(shell find $(SOURCE_CORE_DIR) -type f -name '*.cpp') \
+ $(shell find $(SOURCE_DRIVERS_DIR) -path $(PD_DRIVER_TESTS_DIR) -prune -false -o -type f -name '*.cpp') \
+ $(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.cpp') \
+ $(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
+
+# Code optimisation ------------------------------------------------------------
+OPTIM=-Os \
+ -fno-jump-tables \
+ -foptimize-strlen \
+ -faggressive-loop-optimizations \
+ -fdevirtualize-at-ltrans \
+ -fmerge-all-constants \
+ -fshort-wchar \
+ -flto \
+ -finline-small-functions \
+ -finline-functions \
+ -findirect-inlining \
+ -fdiagnostics-color \
+ -ffunction-sections \
+ -fdata-sections \
+ -fshort-enums \
+ -fsingle-precision-constant \
+ -fno-common \
+ -fno-math-errno \
+ -ffast-math \
+ -ffinite-math-only \
+ -fno-signed-zeros \
+ -fsingle-precision-constant
+
+# Global defines ---------------------------------------------------------------
+GLOBAL_DEFINES+=$(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
ifdef swd_enable
- GLOBAL_DEFINES += -DSWD_ENABLE
+GLOBAL_DEFINES+=-DSWD_ENABLE
endif
-
-
-# libs -------------------------------------------------------------------------
+# Libs -------------------------------------------------------------------------
LIBS=
-# ------------------------------------------------------------------------------
+# Compilers --------------------------------------------------------------------
COMPILER=gcc
-# arm-none-eabi is the general ARM compiler,
+
+# arm-none-eabi is the general ARM compiler
# riscv-none-embed is the riscv compiler
# riscv-nuclei-elf is the nuclei tuned one for their cores
ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS) $(ALL_MHP30_MODELS)))
@@ -475,175 +564,157 @@ ifeq ($(model),$(filter $(model),$(ALL_PINECIL_MODELS) $(ALL_PINECIL_V2_MODELS))
COMPILER_PREFIX=riscv-none-elf
endif
-# programs ---------------------------------------------------------------------
+# Programs ---------------------------------------------------------------------
CC=$(COMPILER_PREFIX)-gcc
CPP=$(COMPILER_PREFIX)-g++
OBJCOPY=$(COMPILER_PREFIX)-objcopy
SIZE=$(COMPILER_PREFIX)-size
OBJDUMP=$(COMPILER_PREFIX)-objdump
-# use gcc in assembler mode so we can use defines etc in assembly
-AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp
-
-# linker flags -----------------------------------------------------------------
-LINKER_FLAGS= -Wl,--gc-sections \
- -Wl,--wrap=malloc \
- -Wl,--wrap=free \
- -Wl,--undefined=vTaskSwitchContext \
- -Wl,--undefined=pxCurrentTCB \
- -Wl,--defsym=__FLASH_SIZE__=$(flash_size) \
- -Wl,--defsym=__BOOTLDR_SIZE__=$(bootldr_size) \
- -Wl,--print-memory-usage \
- --specs=nosys.specs \
- --specs=nano.specs \
- $(DEV_LDFLAGS)
-
-# compiler flags ---------------------------------------------------------------
-
-
-CHECKOPTIONS=-Wtrigraphs \
- -Wuninitialized \
- -Wmissing-braces \
- -Wfloat-equal \
- -Wunreachable-code \
- -Wswitch-default \
- -Wreturn-type \
- -Wundef \
- -Wparentheses \
- -Wnonnull \
- -Winit-self \
- -Wmissing-include-dirs \
- -Wsequence-point \
- -Wswitch \
- -Wformat \
- -Wsign-compare \
- -Waddress \
- -Waggregate-return \
- -Wmissing-field-initializers \
- -Wshadow \
- -Wno-unused-parameter \
- -Wdouble-promotion
-
-
-
-
-CHECKOPTIONS_C= $(CHECKOPTIONS) -Wbad-function-cast
-
-
-CXXFLAGS=$(DEV_CXXFLAGS) \
- $(CPUFLAGS) \
- $(INCLUDES) \
- $(GLOBAL_DEFINES) \
- -D${COMPILER} \
- -MMD \
- $(CHECKOPTIONS) \
- -std=c++17 \
- $(OPTIM) \
- -fno-rtti \
- -fno-exceptions \
- -fno-non-call-exceptions \
- -fno-use-cxa-atexit \
- -fno-strict-aliasing \
- -fno-threadsafe-statics \
- -T$(LDSCRIPT)
-
-
-CFLAGS=$(DEV_CFLAGS) \
- $(CPUFLAGS) \
- $(INCLUDES) \
- $(CHECKOPTIONS_C) \
- $(GLOBAL_DEFINES) \
- -D${COMPILER} \
- -MMD \
- -std=gnu11 \
- $(OPTIM) \
- -T$(LDSCRIPT) \
- -c
-
-
-
-AFLAGS= $(CPUFLAGS) \
- $(DEV_AFLAGS) \
- $(GLOBAL_DEFINES) \
- $(OPTIM) \
- $(ASM_INC) \
- $(INCLUDES)
-
-
-
-
-OBJS = $(SOURCE:.c=.o)
-OBJS_CPP = $(SOURCE_CPP:.cpp=.o)
-OBJS_S = $(S_SRCS:.S=.o)
+# Use gcc in assembler mode so we can use defines etc in assembly
+AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp
+# Linker flags -----------------------------------------------------------------
+LINKER_FLAGS=-Wl,--gc-sections \
+ -Wl,--wrap=malloc \
+ -Wl,--wrap=free \
+ -Wl,--undefined=vTaskSwitchContext \
+ -Wl,--undefined=pxCurrentTCB \
+ -Wl,--defsym=__FLASH_SIZE__=$(flash_size) \
+ -Wl,--defsym=__BOOTLDR_SIZE__=$(bootldr_size) \
+ -Wl,--print-memory-usage \
+ --specs=nosys.specs \
+ --specs=nano.specs \
+ $(DEV_LDFLAGS)
+
+# Compiler flags ---------------------------------------------------------------
+CHECKOPTIONS=-Wtrigraphs \
+ -Wuninitialized \
+ -Wmissing-braces \
+ -Wfloat-equal \
+ -Wunreachable-code \
+ -Wswitch-default \
+ -Wreturn-type \
+ -Wundef \
+ -Wparentheses \
+ -Wnonnull \
+ -Winit-self \
+ -Wmissing-include-dirs \
+ -Wsequence-point \
+ -Wswitch \
+ -Wformat \
+ -Wsign-compare \
+ -Waddress \
+ -Waggregate-return \
+ -Wmissing-field-initializers \
+ -Wshadow \
+ -Wno-unused-parameter \
+ -Wdouble-promotion
+
+CHECKOPTIONS_C=$(CHECKOPTIONS) -Wbad-function-cast
+
+CXXFLAGS=$(DEV_CXXFLAGS) \
+ $(CPUFLAGS) \
+ $(INCLUDES) \
+ $(GLOBAL_DEFINES) \
+ -D${COMPILER} \
+ -MMD \
+ $(CHECKOPTIONS) \
+ -std=c++17 \
+ $(OPTIM) \
+ -fno-rtti \
+ -fno-exceptions \
+ -fno-non-call-exceptions \
+ -fno-use-cxa-atexit \
+ -fno-strict-aliasing \
+ -fno-threadsafe-statics \
+ -T$(LDSCRIPT)
+
+CFLAGS=$(DEV_CFLAGS) \
+ $(CPUFLAGS) \
+ $(INCLUDES) \
+ $(CHECKOPTIONS_C) \
+ $(GLOBAL_DEFINES) \
+ -D${COMPILER} \
+ -MMD \
+ -std=gnu11 \
+ $(OPTIM) \
+ -T$(LDSCRIPT) \
+ -c
+
+AFLAGS=$(CPUFLAGS) \
+ $(DEV_AFLAGS) \
+ $(GLOBAL_DEFINES) \
+ $(OPTIM) \
+ $(ASM_INC) \
+ $(INCLUDES)
+
+OBJS=$(SOURCE:.c=.o)
+OBJS_CPP=$(SOURCE_CPP:.cpp=.o)
+OBJS_S=$(S_SRCS:.S=.o)
OUT_OBJS=$(addprefix $(OUTPUT_DIR)/,$(OBJS))
OUT_OBJS_CPP=$(addprefix $(OUTPUT_DIR)/,$(OBJS_CPP))
OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S))
-
-default : firmware-EN
+default: firmware-EN
firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFILE_DIR)/$(model)_%.dfu
@true
+# Targets for binary files
-#
-# The rule to create the target directory
-#
-
-# Create hexfile
-%.hex : %.elf Makefile
+%.hex: %.elf Makefile
$(OBJCOPY) $< -O ihex $@
-%.bin : %.elf Makefile
+%.bin: %.elf Makefile
$(OBJCOPY) $< -O binary $@
$(SIZE) $<
-%.dfu : %.bin Makefile
+%.dfu: %.bin Makefile
$(HOST_PYTHON) dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
-$(HEXFILE_DIR)/$(model)_%.elf : \
- $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
- $(OUTPUT_DIR)/Core/Gen/Translation.%.o \
+$(HEXFILE_DIR)/$(model)_%.elf: \
+ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
+ $(OUTPUT_DIR)/Core/Gen/Translation.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
- $(OUTPUT_DIR)/Core/Gen/Translation.$*.o \
+ $(OUTPUT_DIR)/Core/Gen/Translation.$*.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,[email protected]
-$(HEXFILE_DIR)/$(model)_string_compressed_%.elf : \
- $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
+$(HEXFILE_DIR)/$(model)_string_compressed_%.elf: \
+ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.%.o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.$*.o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,[email protected]
-$(HEXFILE_DIR)/$(model)_font_compressed_%.elf : \
- $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
+$(HEXFILE_DIR)/$(model)_font_compressed_%.elf: \
+ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
- $(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.$*.o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
+ $(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.$*.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,[email protected]
-$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
+$(OUT_OBJS): $(OUTPUT_DIR)/%.o: %.c Makefile
@test -d $(@D) || mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $< -o $@
-$(OUTPUT_DIR)/%.o : %.cpp Makefile
+$(OUTPUT_DIR)/%.o: %.cpp Makefile
@test -d $(@D) || mkdir -p $(@D)
@$(CPP) -c $(CXXFLAGS) $< -o $@
@@ -653,17 +724,17 @@ $(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.S Makefile
@$(AS) -c $(AFLAGS) $< -o $@
Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle: ../Translations/translation_%.json \
- ../Translations/make_translation.py \
+ ../Translations/make_translation.py \
../Translations/translations_definitions.json \
- ../Translations/font_tables.py \
+ ../Translations/font_tables.py \
Makefile ../Translations/wqy-bitmapsong/wenquanyi_9pt.bdf \
Core/Gen/macros.txt
@test -d Core/Gen || mkdir -p Core/Gen
@test -d $(OUTPUT_DIR)/Core/Gen/translation.files || mkdir -p $(OUTPUT_DIR)/Core/Gen/translation.files
@echo 'Generating translations for language $*'
@$(HOST_PYTHON) ../Translations/make_translation.py \
- --macros $(CURDIR)/Core/Gen/macros.txt \
- -o $(CURDIR)/Core/Gen/Translation.$*.cpp \
+ --macros $(CURDIR)/Core/Gen/macros.txt \
+ -o $(CURDIR)/Core/Gen/Translation.$*.cpp \
--output-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
$*
@@ -671,10 +742,7 @@ Core/Gen/macros.txt: Makefile
@test -d $(CURDIR)/Core/Gen || mkdir -p $(CURDIR)/Core/Gen
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF $(CURDIR)/Core/Gen/macros.tmp - > $(CURDIR)/Core/Gen/macros.txt
-
-#
-# The recipes to produce compressed translation data:
-#
+# The recipes to produce compressed translation data
$(OUTPUT_DIR)/Core/Gen/translation.files/%.o: Core/Gen/Translation.%.cpp
@test -d $(@D) || mkdir -p $(@D)
@@ -695,64 +763,62 @@ Core/Gen/Translation_brieflz.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.o
@test -d $(@D) || mkdir -p $(@D)
@echo Generating BriefLZ compressed translation for $*
@OBJCOPY=$(OBJCOPY) $(HOST_PYTHON) ../Translations/make_translation.py \
- --macros $(PWD)/Core/Gen/macros.txt \
+ --macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_brieflz.$*.cpp \
--input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
- --strings-obj $(OUTPUT_DIR)/Core/Gen/translation.files/$*.o \
+ --strings-obj $(OUTPUT_DIR)/Core/Gen/translation.files/$*.o \
$*
Core/Gen/Translation_brieflz_font.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle $(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so Core/Gen/macros.txt
@test -d $(@D) || mkdir -p $(@D)
@echo Generating BriefLZ compressed translation for $*
- @$(HOST_PYTHON) ../Translations/make_translation.py \
- --macros $(PWD)/Core/Gen/macros.txt \
+ @$(HOST_PYTHON) ../Translations/make_translation.py \
+ --macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_brieflz_font.$*.cpp \
--input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
--compress-font \
$*
-#
# The recipes to produce multi-language firmwares:
-#
# Usage: $(eval $(call multi_lang_rule,$(1)=group_code,$(2)=group_name,$(3)=lang_codes))
define multi_lang_rule
-$(HEXFILE_DIR)/$(model)_multi_$(2).elf : \
- $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
+$(HEXFILE_DIR)/$(model)_multi_$(2).elf: \
+ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
Makefile $(LDSCRIPT)
@test -d $$(@D) || mkdir -p $$(@D)
@echo Linking $$@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
- $(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
+ $(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(LIBS) $(LINKER_FLAGS) -o$$@ -Wl,[email protected]
-$(HEXFILE_DIR)/$(model)_multi_compressed_$(2).elf : \
- $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
+$(HEXFILE_DIR)/$(model)_multi_compressed_$(2).elf: \
+ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_multi.$(1).o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
Makefile $(LDSCRIPT)
@test -d $$(@D) || mkdir -p $$(@D)
@echo Linking $$@
- @$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
+ @$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_multi.$(1).o \
- $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
+ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(LIBS) $(LINKER_FLAGS) -o$$@ -Wl,[email protected]
Core/Gen/Translation_multi.$(1).cpp: $(patsubst %,../Translations/translation_%.json,$(3)) \
- ../Translations/make_translation.py \
+ ../Translations/make_translation.py \
../Translations/translations_definitions.json \
- ../Translations/font_tables.py \
+ ../Translations/font_tables.py \
Makefile ../Translations/wqy-bitmapsong/wenquanyi_9pt.bdf \
Core/Gen/macros.txt
@test -d Core/Gen || mkdir -p Core/Gen
@test -d $(OUTPUT_DIR)/Core/Gen/translation.files || mkdir -p $(OUTPUT_DIR)/Core/Gen/translation.files
@echo 'Generating translations for multi-language $(2)'
- @$(HOST_PYTHON) ../Translations/make_translation.py \
- --macros $(PWD)/Core/Gen/macros.txt \
+ @$(HOST_PYTHON) ../Translations/make_translation.py \
+ --macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_multi.$(1).cpp \
--output-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle \
$(3)
@@ -763,19 +829,19 @@ Core/Gen/Translation_brieflz_multi.$(1).cpp: $(OUTPUT_DIR)/Core/Gen/translation.
@test -d $$(@D) || mkdir -p $$(@D)
@echo Generating BriefLZ compressed translation for multi-language $(2)
@OBJCOPY=$(OBJCOPY) $(HOST_PYTHON) ../Translations/make_translation.py \
- --macros $(PWD)/Core/Gen/macros.txt \
+ --macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_brieflz_multi.$(1).cpp \
--input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle \
- --strings-obj $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).o \
+ --strings-obj $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).o \
--compress-font \
$(3)
endef # multi_lang_rule
-
# Add multi-language firmware rules:
$(foreach group_code,$(LANGUAGE_GROUPS),$(eval $(call multi_lang_rule,$(group_code),$(LANGUAGE_GROUP_$(group_code)_NAME),$(LANGUAGE_GROUP_$(group_code)_LANGS))))
+# Clean up targets
clean:
rm -Rf Core/Gen
@@ -786,28 +852,55 @@ clean:
clean-all: clean
rm -Rf $(HEXFILE_DIR)
-style:
- @for src in $(ALL_SOURCE) $(ALL_INCLUDES); do \
- echo "Formatting $$src..." ; \
- clang-format -i "$$src" ; \
- done
- @echo "Done"
+# Code style checks using clang-format
+# Show only list of affected files for debug purposes
+check-style-list:
+ @ret=0; for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
+ var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \
+ if [ $$var -ne 0 ] ; then \
+ echo "$$src" ; \
+ ret=1; test -n "$(STOP)" && break; \
+ fi ; \
+ grep -H -n -e "^ .*if .*)$$" -e "^ .*else$$" -e "^ .* do$$" -e "^ .*while .*)$$" -e "^ .*for .*)$$" "$$src" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -q -e "^.*$$" ; \
+ if [ "$$?" -ne 1 ]; then \
+ echo "$$src" ; \
+ ret=1; test -n "$(STOP)" && break; \
+ fi ; \
+ done ; \
+ if [ $$ret -eq 0 ] ; then \
+ echo "Style check: PASS" && exit 0 ; \
+ else \
+ echo "Style check: FAIL!" && echo "Please, check the log above for the details." && exit 1 ; \
+ fi ;
+
+# Show output in gcc-like error compatible format for IDEs/editors; call `make check-style STOP=1` to exit after first failed file
+# NOTICE:
+# - clang-format has neat option for { } in condition blocks but it's available only since version 15:
+# * https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertbraces
+# - grep block in the middle used to trace missing { and } for if/else BUT IT'S VERY SPECULATIVE, very-very hacky & dirty
check-style:
- @for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
+ @ret=0; for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \
if [ $$var -ne 0 ] ; then \
- echo "$$src does not respect the coding style (diff: $$var lines)" ; \
- clang-format "$$src" | diff "$$src" -; \
- exit 1 ; \
+ clang-format "$$src" | diff "$$src" - | sed 's/^---/-------------------------------------------------------------------------------/; s/^< /--- /; s/^> /+++ /; /^[0-9].*/ s/[acd,].*$$/ERROR1/; /^[0-9].*/ s,^,\n\n\n\n'"$$src"':,; /ERROR1$$/ s,ERROR1$$,:1: error: clang-format code style mismatch:,; ' ; \
+ ret=1; test -n "$(STOP)" && break; \
+ fi ; \
+ grep -H -n -e "^ .*if .*)$$" -e "^ .*else$$" -e "^ .* do$$" -e "^ .*while .*)$$" -e "^ .*for .*)$$" "$$src" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -e "^.*$$" ; \
+ if [ "$$?" -ne 1 ]; then \
+ ret=1; test -n "$(STOP)" && break; \
fi ; \
- done
- @echo "Style check passed"
-
-.PHONY: style all clean default clean-all
+ done ; \
+ if [ $$ret -eq 0 ] ; then \
+ echo "Style check: PASS" && exit 0 ; \
+ else \
+ echo "Style check: FAIL!" && echo "Please, check the log above for the details." && exit 1 ; \
+ fi ;
+
+.PHONY: check-style-list check-style all clean default clean-all
.SECONDARY:
-# pull in dependency info for *existing* .o files
+# Pull in dependency info for *existing* .o files
-include $(OUT_OBJS:.o=.d)
-include $(OUT_OBJS_CPP:.o=.d)
-include $(OUTPUT_DIR)/Core/Gen/Translation.*.d