From bb1f929917cf228e0a539402ba3046ad164d6d65 Mon Sep 17 00:00:00 2001 From: Jeremy Kongs Date: Wed, 2 Oct 2024 15:08:10 -0500 Subject: [PATCH 1/9] fix(CMSIS): Purge MAX32675, MAX32680 Temp Sensor defines, Fix Part ID Address (#1205) --- .../Maxim/MAX32675/Include/afe_adc_one_regs.h | 22 ++------ .../MAX32675/Include/afe_adc_zero_regs.h | 52 +++++++------------ .../Maxim/MAX32680/Include/afe_adc_one_regs.h | 23 ++------ .../MAX32680/Include/afe_adc_zero_regs.h | 23 ++------ .../Source/AFE/afe_adc_one_reva.svd | 26 ---------- .../Source/AFE/afe_adc_zero_reva.svd | 28 +--------- 6 files changed, 30 insertions(+), 144 deletions(-) diff --git a/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_one_regs.h b/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_one_regs.h index 27c4e42333..83955ac348 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_one_regs.h +++ b/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_one_regs.h @@ -7,7 +7,9 @@ /****************************************************************************** * - * Copyright (C) 2024 Analog Devices, Inc. + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by + * Analog Devices, Inc.), + * Copyright (C) 2023-2024 Analog Devices, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -191,7 +193,6 @@ extern "C" { #define MXC_R_AFE_ADC_ONE_ADC_TRIM1 ((uint32_t)0x00F80002UL) /**< Offset from AFE_ADC_ONE Base Address: 0xF80002 */ #define MXC_R_AFE_ADC_ONE_ANA_TRIM ((uint32_t)0x00F90002UL) /**< Offset from AFE_ADC_ONE Base Address: 0xF90002 */ #define MXC_R_AFE_ADC_ONE_SYS_CTRL ((uint32_t)0x00FA0001UL) /**< Offset from AFE_ADC_ONE Base Address: 0xFA0001 */ -#define MXC_R_AFE_ADC_ONE_TS_CTRL ((uint32_t)0x00FC0001UL) /**< Offset from AFE_ADC_ONE Base Address: 0xFC0001 */ /**@} end of group afe_adc_one_registers */ /** @@ -2025,23 +2026,6 @@ extern "C" { /**@} end of group AFE_ADC_ONE_SYS_CTRL_Register */ -/** - * @ingroup afe_adc_one_registers - * @defgroup AFE_ADC_ONE_TS_CTRL AFE_ADC_ONE_TS_CTRL - * @brief Temperature Sensor Control - * @{ - */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_EN_POS 0 /**< TS_CTRL_TS_EN Position */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ONE_TS_CTRL_TS_EN_POS)) /**< TS_CTRL_TS_EN Mask */ - -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_CONV_EN_POS 1 /**< TS_CTRL_TS_CONV_EN Position */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_CONV_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ONE_TS_CTRL_TS_CONV_EN_POS)) /**< TS_CTRL_TS_CONV_EN Mask */ - -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_INTG_RDY_POS 2 /**< TS_CTRL_TS_INTG_RDY Position */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_INTG_RDY ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ONE_TS_CTRL_TS_INTG_RDY_POS)) /**< TS_CTRL_TS_INTG_RDY Mask */ - -/**@} end of group AFE_ADC_ONE_TS_CTRL_Register */ - #ifdef __cplusplus } #endif diff --git a/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_zero_regs.h b/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_zero_regs.h index ab92522de2..81eaedf7b9 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_zero_regs.h +++ b/Libraries/CMSIS/Device/Maxim/MAX32675/Include/afe_adc_zero_regs.h @@ -7,7 +7,9 @@ /****************************************************************************** * - * Copyright (C) 2024 Analog Devices, Inc. + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by + * Analog Devices, Inc.), + * Copyright (C) 2023-2024 Analog Devices, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,6 +93,7 @@ extern "C" { #define MXC_R_AFE_ADC_ZERO_PGA ((uint32_t)0x000E0001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0xE0001 */ #define MXC_R_AFE_ADC_ZERO_WAIT_EXT ((uint32_t)0x000F0001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0xF0001 */ #define MXC_R_AFE_ADC_ZERO_WAIT_START ((uint32_t)0x00100001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x100001 */ +#define MXC_R_AFE_ADC_ZERO_PART_ID ((uint32_t)0x00110003UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x110003 */ #define MXC_R_AFE_ADC_ZERO_SYSC_SEL ((uint32_t)0x00120003UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x120003 */ #define MXC_R_AFE_ADC_ZERO_SYS_OFF_A ((uint32_t)0x00130003UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x130003 */ #define MXC_R_AFE_ADC_ZERO_SYS_OFF_B ((uint32_t)0x00140003UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x140003 */ @@ -190,8 +193,6 @@ extern "C" { #define MXC_R_AFE_ADC_ZERO_ADC_TRIM1 ((uint32_t)0x00780002UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x780002 */ #define MXC_R_AFE_ADC_ZERO_ANA_TRIM ((uint32_t)0x00790002UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x790002 */ #define MXC_R_AFE_ADC_ZERO_SYS_CTRL ((uint32_t)0x007A0001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x7A0001 */ -#define MXC_R_AFE_ADC_ZERO_TS_CTRL ((uint32_t)0x007C0001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x7C0001 */ -#define MXC_R_AFE_ADC_ZERO_PART_ID ((uint32_t)0x00910003UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x910003 */ /**@} end of group afe_adc_zero_registers */ /** @@ -554,6 +555,20 @@ extern "C" { /**@} end of group AFE_ADC_ZERO_WAIT_EXT_Register */ +/** + * @ingroup afe_adc_zero_registers + * @defgroup AFE_ADC_ZERO_PART_ID AFE_ADC_ZERO_PART_ID + * @brief Silicon Revision ID + * @{ + */ +#define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS 0 /**< PART_ID_REV_ID Position */ +#define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID ((uint32_t)(0x1FUL << MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS)) /**< PART_ID_REV_ID Mask */ + +#define MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL_POS 5 /**< PART_ID_ADC_SEL Position */ +#define MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL ((uint32_t)(0x1UL << MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL_POS)) /**< PART_ID_ADC_SEL Mask */ + +/**@} end of group AFE_ADC_ZERO_PART_ID_Register */ + /** * @ingroup afe_adc_zero_registers * @defgroup AFE_ADC_ZERO_SYSC_SEL AFE_ADC_ZERO_SYSC_SEL @@ -2011,37 +2026,6 @@ extern "C" { /**@} end of group AFE_ADC_ZERO_SYS_CTRL_Register */ -/** - * @ingroup afe_adc_zero_registers - * @defgroup AFE_ADC_ZERO_TS_CTRL AFE_ADC_ZERO_TS_CTRL - * @brief Temperature Sensor Control - * @{ - */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_EN_POS 0 /**< TS_CTRL_TS_EN Position */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_EN_POS)) /**< TS_CTRL_TS_EN Mask */ - -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_CONV_EN_POS 1 /**< TS_CTRL_TS_CONV_EN Position */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_CONV_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_CONV_EN_POS)) /**< TS_CTRL_TS_CONV_EN Mask */ - -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_INTG_RDY_POS 2 /**< TS_CTRL_TS_INTG_RDY Position */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_INTG_RDY ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_INTG_RDY_POS)) /**< TS_CTRL_TS_INTG_RDY Mask */ - -/**@} end of group AFE_ADC_ZERO_TS_CTRL_Register */ - -/** - * @ingroup afe_adc_zero_registers - * @defgroup AFE_ADC_ZERO_PART_ID AFE_ADC_ZERO_PART_ID - * @brief Silicon Revision ID - * @{ - */ -#define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS 0 /**< PART_ID_REV_ID Position */ -#define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID ((uint32_t)(0x1FUL << MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS)) /**< PART_ID_REV_ID Mask */ - -#define MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL_POS 5 /**< PART_ID_ADC_SEL Position */ -#define MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL ((uint32_t)(0x1UL << MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL_POS)) /**< PART_ID_ADC_SEL Mask */ - -/**@} end of group AFE_ADC_ZERO_PART_ID_Register */ - #ifdef __cplusplus } #endif diff --git a/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_one_regs.h b/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_one_regs.h index 20fc136b9b..310cfe77b6 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_one_regs.h +++ b/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_one_regs.h @@ -193,7 +193,6 @@ extern "C" { #define MXC_R_AFE_ADC_ONE_ADC_TRIM1 ((uint32_t)0x00F80002UL) /**< Offset from AFE_ADC_ONE Base Address: 0xF80002 */ #define MXC_R_AFE_ADC_ONE_ANA_TRIM ((uint32_t)0x00F90002UL) /**< Offset from AFE_ADC_ONE Base Address: 0xF90002 */ #define MXC_R_AFE_ADC_ONE_SYS_CTRL ((uint32_t)0x00FA0001UL) /**< Offset from AFE_ADC_ONE Base Address: 0xFA0001 */ -#define MXC_R_AFE_ADC_ONE_TS_CTRL ((uint32_t)0x00FC0001UL) /**< Offset from AFE_ADC_ONE Base Address: 0xFC0001 */ /**@} end of group afe_adc_one_registers */ /** @@ -563,7 +562,10 @@ extern "C" { * @{ */ #define MXC_F_AFE_ADC_ONE_PART_ID_REV_ID_POS 0 /**< PART_ID_REV_ID Position */ -#define MXC_F_AFE_ADC_ONE_PART_ID_REV_ID ((uint32_t)(0x7UL << MXC_F_AFE_ADC_ONE_PART_ID_REV_ID_POS)) /**< PART_ID_REV_ID Mask */ +#define MXC_F_AFE_ADC_ONE_PART_ID_REV_ID ((uint32_t)(0x1FUL << MXC_F_AFE_ADC_ONE_PART_ID_REV_ID_POS)) /**< PART_ID_REV_ID Mask */ + +#define MXC_F_AFE_ADC_ONE_PART_ID_ADC_SEL_POS 5 /**< PART_ID_ADC_SEL Position */ +#define MXC_F_AFE_ADC_ONE_PART_ID_ADC_SEL ((uint32_t)(0x1UL << MXC_F_AFE_ADC_ONE_PART_ID_ADC_SEL_POS)) /**< PART_ID_ADC_SEL Mask */ /**@} end of group AFE_ADC_ONE_PART_ID_Register */ @@ -2024,23 +2026,6 @@ extern "C" { /**@} end of group AFE_ADC_ONE_SYS_CTRL_Register */ -/** - * @ingroup afe_adc_one_registers - * @defgroup AFE_ADC_ONE_TS_CTRL AFE_ADC_ONE_TS_CTRL - * @brief Temperature Sensor Control - * @{ - */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_EN_POS 0 /**< TS_CTRL_TS_EN Position */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ONE_TS_CTRL_TS_EN_POS)) /**< TS_CTRL_TS_EN Mask */ - -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_CONV_EN_POS 1 /**< TS_CTRL_TS_CONV_EN Position */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_CONV_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ONE_TS_CTRL_TS_CONV_EN_POS)) /**< TS_CTRL_TS_CONV_EN Mask */ - -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_INTG_RDY_POS 2 /**< TS_CTRL_TS_INTG_RDY Position */ -#define MXC_F_AFE_ADC_ONE_TS_CTRL_TS_INTG_RDY ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ONE_TS_CTRL_TS_INTG_RDY_POS)) /**< TS_CTRL_TS_INTG_RDY Mask */ - -/**@} end of group AFE_ADC_ONE_TS_CTRL_Register */ - #ifdef __cplusplus } #endif diff --git a/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_zero_regs.h b/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_zero_regs.h index 9b3298a5e7..949029fc26 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_zero_regs.h +++ b/Libraries/CMSIS/Device/Maxim/MAX32680/Include/afe_adc_zero_regs.h @@ -193,7 +193,6 @@ extern "C" { #define MXC_R_AFE_ADC_ZERO_ADC_TRIM1 ((uint32_t)0x00780002UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x780002 */ #define MXC_R_AFE_ADC_ZERO_ANA_TRIM ((uint32_t)0x00790002UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x790002 */ #define MXC_R_AFE_ADC_ZERO_SYS_CTRL ((uint32_t)0x007A0001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x7A0001 */ -#define MXC_R_AFE_ADC_ZERO_TS_CTRL ((uint32_t)0x007C0001UL) /**< Offset from AFE_ADC_ZERO Base Address: 0x7C0001 */ /**@} end of group afe_adc_zero_registers */ /** @@ -563,7 +562,10 @@ extern "C" { * @{ */ #define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS 0 /**< PART_ID_REV_ID Position */ -#define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID ((uint32_t)(0x3FUL << MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS)) /**< PART_ID_REV_ID Mask */ +#define MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID ((uint32_t)(0x1FUL << MXC_F_AFE_ADC_ZERO_PART_ID_REV_ID_POS)) /**< PART_ID_REV_ID Mask */ + +#define MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL_POS 5 /**< PART_ID_ADC_SEL Position */ +#define MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL ((uint32_t)(0x1UL << MXC_F_AFE_ADC_ZERO_PART_ID_ADC_SEL_POS)) /**< PART_ID_ADC_SEL Mask */ /**@} end of group AFE_ADC_ZERO_PART_ID_Register */ @@ -2024,23 +2026,6 @@ extern "C" { /**@} end of group AFE_ADC_ZERO_SYS_CTRL_Register */ -/** - * @ingroup afe_adc_zero_registers - * @defgroup AFE_ADC_ZERO_TS_CTRL AFE_ADC_ZERO_TS_CTRL - * @brief Temperature Sensor Control - * @{ - */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_EN_POS 0 /**< TS_CTRL_TS_EN Position */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_EN_POS)) /**< TS_CTRL_TS_EN Mask */ - -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_CONV_EN_POS 1 /**< TS_CTRL_TS_CONV_EN Position */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_CONV_EN ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_CONV_EN_POS)) /**< TS_CTRL_TS_CONV_EN Mask */ - -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_INTG_RDY_POS 2 /**< TS_CTRL_TS_INTG_RDY Position */ -#define MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_INTG_RDY ((uint8_t)(0x1UL << MXC_F_AFE_ADC_ZERO_TS_CTRL_TS_INTG_RDY_POS)) /**< TS_CTRL_TS_INTG_RDY Mask */ - -/**@} end of group AFE_ADC_ZERO_TS_CTRL_Register */ - #ifdef __cplusplus } #endif diff --git a/Libraries/PeriphDrivers/Source/AFE/afe_adc_one_reva.svd b/Libraries/PeriphDrivers/Source/AFE/afe_adc_one_reva.svd index b15783d5fb..526002539d 100644 --- a/Libraries/PeriphDrivers/Source/AFE/afe_adc_one_reva.svd +++ b/Libraries/PeriphDrivers/Source/AFE/afe_adc_one_reva.svd @@ -2789,32 +2789,6 @@ - - TS_CTRL - Temperature Sensor Control - 0x00FC0001 - 8 - - - TS_EN - Description not included - 0 - 1 - - - TS_CONV_EN - Description not included - 1 - 1 - - - TS_INTG_RDY - Description not included - 2 - 1 - - - diff --git a/Libraries/PeriphDrivers/Source/AFE/afe_adc_zero_reva.svd b/Libraries/PeriphDrivers/Source/AFE/afe_adc_zero_reva.svd index e8d6703cb1..403611a845 100644 --- a/Libraries/PeriphDrivers/Source/AFE/afe_adc_zero_reva.svd +++ b/Libraries/PeriphDrivers/Source/AFE/afe_adc_zero_reva.svd @@ -696,7 +696,7 @@ PART_ID Silicon Revision ID - 0x00910003 + 0x00110003 REV_ID @@ -2789,32 +2789,6 @@ - - TS_CTRL - Temperature Sensor Control - 0x007C0001 - 8 - - - TS_EN - Description not included - 0 - 1 - - - TS_CONV_EN - Description not included - 1 - 1 - - - TS_INTG_RDY - Description not included - 2 - 1 - - - From f4649e2f2844c7ff2c7358ddf09d924ede1095de Mon Sep 17 00:00:00 2001 From: abby wolf <124625843+AbbyWolf-ADI@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:53:38 -0500 Subject: [PATCH 2/9] fix(BLE): Backwards compatibility for HCI Vendor-Specific opcodes (#1198) --- .../controller/sources/ble/lhci/lhci_cmd_vs.c | 36 ------------------- .../controller/sources/ble/lhci/lhci_int.h | 20 +++++------ 2 files changed, 9 insertions(+), 47 deletions(-) diff --git a/Libraries/Cordio/controller/sources/ble/lhci/lhci_cmd_vs.c b/Libraries/Cordio/controller/sources/ble/lhci/lhci_cmd_vs.c index a2a901487e..4ab4e9c098 100644 --- a/Libraries/Cordio/controller/sources/ble/lhci/lhci_cmd_vs.c +++ b/Libraries/Cordio/controller/sources/ble/lhci/lhci_cmd_vs.c @@ -233,33 +233,6 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf) evtParamLen += sizeof(BbBlePduFiltStats_t); break; - case LHCI_OPCODE_VS_REG_WRITE: { - uint8_t len; - uint32_t addr; - uint32_t *addrP; - - BSTREAM_TO_UINT8(len, pBuf); - BSTREAM_TO_UINT32(addr, pBuf); - addrP = (uint32_t *)addr; - - LL_TRACE_INFO2("### LlVsRegWrite ### 0x%08X %d bytes", addr, len); - - memcpy(addrP, pBuf, len); - break; - } - - case LHCI_OPCODE_VS_REG_READ: { - uint8_t len; - - BSTREAM_TO_UINT8(len, pBuf); - BSTREAM_TO_UINT32(regReadAddr, pBuf); - - LL_TRACE_INFO2("### LlVsRegRead ### 0x%08X %d bytes", regReadAddr, len); - - evtParamLen += len; - break; - } - case LHCI_OPCODE_VS_TX_TEST: { uint16_t numPackets = pBuf[4] | (pBuf[5] << 8); @@ -374,7 +347,6 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf) case LHCI_OPCODE_VS_GET_RAND_ADDR: case LHCI_OPCODE_VS_SET_TX_TEST_ERR_PATT: case LHCI_OPCODE_VS_SET_SNIFFER_ENABLE: - case LHCI_OPCODE_VS_REG_WRITE: case LHCI_OPCODE_VS_RX_TEST: case LHCI_OPCODE_VS_TX_TEST: case LHCI_OPCODE_VS_RESET_ADV_STATS: @@ -514,14 +486,6 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf) break; } - case LHCI_OPCODE_VS_REG_READ: { - if (regReadAddr != 0) { - uint32_t *regReadP = (uint32_t *)regReadAddr; - memcpy(pBuf, regReadP, (evtParamLen - 1)); - } - break; - } - /* --- default --- */ default: diff --git a/Libraries/Cordio/controller/sources/ble/lhci/lhci_int.h b/Libraries/Cordio/controller/sources/ble/lhci/lhci_int.h index 9ca0050561..0b7b31c1eb 100644 --- a/Libraries/Cordio/controller/sources/ble/lhci/lhci_int.h +++ b/Libraries/Cordio/controller/sources/ble/lhci/lhci_int.h @@ -360,31 +360,29 @@ extern "C" { #define LHCI_OPCODE_VS_SET_CONN_PHY_TX_PWR \ HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x3DD) /*!< Set Connection Phy Tx Power opcode. */ -#define LHCI_OPCODE_VS_REG_WRITE HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x300) /*!< Write data to MCU register or memory space. */ -#define LHCI_OPCODE_VS_REG_READ HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x301) /*!< Read data from MCU register or memory space. */ #define LHCI_OPCODE_VS_RESET_CONN_STATS \ - HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x302) /*!< Reset connection stats. */ + HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x300) /*!< Reset connection stats. */ #define LHCI_OPCODE_VS_TX_TEST \ - HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x303) /*!< Vendor specific TX test that takes numPkt param. */ + HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x301) /*!< Vendor specific TX test that takes numPkt param. */ #define LHCI_OPCODE_VS_RESET_TEST_STATS \ HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \ - 0x304) /*! Date: Fri, 4 Oct 2024 13:54:10 -0500 Subject: [PATCH 3/9] fix(Build): Allow Cordio to Build with Custom BSPs (#1209) Co-authored-by: Jake Carter --- .../platform/targets/maxim/build/cordio_lib.mk | 4 ++-- .../Cordio/platform/targets/maxim/build/libCordio.mk | 9 ++++++--- Libraries/libs.mk | 12 ++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Libraries/Cordio/platform/targets/maxim/build/cordio_lib.mk b/Libraries/Cordio/platform/targets/maxim/build/cordio_lib.mk index bb58990ab7..7e0a3c1223 100644 --- a/Libraries/Cordio/platform/targets/maxim/build/cordio_lib.mk +++ b/Libraries/Cordio/platform/targets/maxim/build/cordio_lib.mk @@ -92,11 +92,11 @@ ${CORDIO_BUILD_DIR}/${CORDIO_LIB}: ${CORDIO_C_FILES} ${PROJECTMK} $(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk lib MAXIM_PATH=${MAXIM_PATH} PROJECT=${CORDIO_LIB} \ CORDIO_LIB_VAR=${CORDIO_LIB_VAR} BUILD_DIR=${CORDIO_BUILD_DIR} MFLOAT_ABI=$(MFLOAT_ABI) \ DUAL_CORE=$(DUAL_CORE) RISCV_CORE=$(RISCV_CORE) TRACE=${TRACE} DEBUG=${DEBUG} RTOS=${RTOS} \ - CFG_DEV="${CFG_DEV}" PROJECTMK=${PROJECTMK} BOARD=${BOARD} MXC_OPTIMIZE_CFLAGS=${CORDIO_OPTIMIZE_CFLAGS} \ + CFG_DEV="${CFG_DEV}" PROJECTMK=${PROJECTMK} MXC_OPTIMIZE_CFLAGS=${CORDIO_OPTIMIZE_CFLAGS} \ BT_VER=${BT_VER} clean.cordio: @$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk BUILD_DIR=${CORDIO_BUILD_DIR} clean query.cordio: - @$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk query QUERY_VAR="${QUERY_VAR}" \ No newline at end of file + @$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk query QUERY_VAR="${QUERY_VAR}" diff --git a/Libraries/Cordio/platform/targets/maxim/build/libCordio.mk b/Libraries/Cordio/platform/targets/maxim/build/libCordio.mk index 8c1341e53a..894f6e4e0b 100644 --- a/Libraries/Cordio/platform/targets/maxim/build/libCordio.mk +++ b/Libraries/Cordio/platform/targets/maxim/build/libCordio.mk @@ -78,11 +78,14 @@ SRCS += $(C_FILES) VPATH += %.c $(sort $(dir $(C_FILES))) IPATH += $(INC_DIRS) -# Add dependencies in the Board library and the PeripheralDrivers + IPATH += ${LIBS_DIR}/MiscDrivers/PushButton IPATH += ${LIBS_DIR}/MiscDrivers/LED -IPATH += ${LIBS_DIR}/Boards/$(TARGET_UC)/$(BOARD)/Include -include ${LIBS_DIR}/PeriphDrivers/periphdriver.mk + +# Add dependencies in the Board library and the PeripheralDrivers +LIB_BOARD = 1 +LIB_PERIPHDRIVERS = 1 +include ${LIBS_DIR}/libs.mk # Use absolute paths if building within eclipse environment. ifeq "$(ECLIPSE)" "1" diff --git a/Libraries/libs.mk b/Libraries/libs.mk index aa29d793d6..bb5428c64d 100644 --- a/Libraries/libs.mk +++ b/Libraries/libs.mk @@ -30,9 +30,21 @@ LIBS_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) # ************************ LIB_BOARD ?= 1 ifeq ($(LIB_BOARD), 1) + +ifeq "$(BOARD)" "" +$(error ERROR: BOARD not set!) +endif + BSP_SEARCH_DIR ?= $(LIBS_DIR)/Boards/$(TARGET_UC) BOARD_DIR := $(BSP_SEARCH_DIR)/$(BOARD) PROJ_CFLAGS += -DLIB_BOARD + +# Export BOARD and BSP_SEARCH_DIR so that all recursive Make sub-calls +# that include libs.mk will use the same BSP. Exports in general should +# be used sparingly since they will override ALL recursive sub-calls, but +# in this case we want to avoid building with mismatched BSPs. +export BOARD +export BSP_SEARCH_DIR include $(BOARD_DIR)/board.mk endif # ************************ From ef6e1115d6edc8e476ab146d5525424ccf94b1fe Mon Sep 17 00:00:00 2001 From: EricB-ADI <122300463+EricB-ADI@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:02:42 -0500 Subject: [PATCH 4/9] fix(Documentation): Update MXC_UART_Init return docstring (#1215) --- Libraries/PeriphDrivers/Include/MAX32665/uart.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/PeriphDrivers/Include/MAX32665/uart.h b/Libraries/PeriphDrivers/Include/MAX32665/uart.h index 34f34bd54f..3aa9abcbe9 100644 --- a/Libraries/PeriphDrivers/Include/MAX32665/uart.h +++ b/Libraries/PeriphDrivers/Include/MAX32665/uart.h @@ -157,7 +157,7 @@ struct _mxc_uart_req_t { * @param map MAP_A or MAP_B uart pins select, Has no effect incase of * MSDK_NO_GPIO_CLK_INIT has been defined. * - * @return If successful, the actual clock frequency is returned. Otherwise, see + * @return E_NO_ERROR if successful, the actual clock frequency is returned. Otherwise, see * \ref MXC_Error_Codes for a list of return codes. */ int MXC_UART_Init(mxc_uart_regs_t *uart, unsigned int baud, sys_map_t map); From 363015232f2c2e4af97a4216863c6c67c7636a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tahsin=20T=C3=BCrker=20Mutlug=C3=BCn?= Date: Tue, 8 Oct 2024 23:12:29 +0300 Subject: [PATCH 5/9] fix(PeriphDrivers): Replace pow() with left shift in MAX32670 and MAX32672 UART drivers (#1217) Signed-off-by: Tahsin Mutlugun --- Libraries/PeriphDrivers/Source/UART/uart_me15.c | 3 +-- Libraries/PeriphDrivers/Source/UART/uart_me16.c | 1 - Libraries/PeriphDrivers/Source/UART/uart_me21.c | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Libraries/PeriphDrivers/Source/UART/uart_me15.c b/Libraries/PeriphDrivers/Source/UART/uart_me15.c index df8b41e80e..c57aa285f5 100644 --- a/Libraries/PeriphDrivers/Source/UART/uart_me15.c +++ b/Libraries/PeriphDrivers/Source/UART/uart_me15.c @@ -18,7 +18,6 @@ * ******************************************************************************/ -#include #include "uart.h" #include "mxc_device.h" #include "mxc_pins.h" @@ -188,7 +187,7 @@ int MXC_UART_SetFrequency(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clo case MXC_UART_AOD_CLK: aon_clk_div = (MXC_GCR->pclkdiv & MXC_F_GCR_PCLKDIV_AON_CLKDIV) >> MXC_F_GCR_PCLKDIV_AON_CLKDIV_POS; - clock_freq = PeripheralClock / (4 * (pow(2, aon_clk_div))); + clock_freq = PeripheralClock / (4 * (1 << aon_clk_div)); break; default: diff --git a/Libraries/PeriphDrivers/Source/UART/uart_me16.c b/Libraries/PeriphDrivers/Source/UART/uart_me16.c index 715a052abd..5d7e058a67 100644 --- a/Libraries/PeriphDrivers/Source/UART/uart_me16.c +++ b/Libraries/PeriphDrivers/Source/UART/uart_me16.c @@ -21,7 +21,6 @@ #pragma diag_suppress 68 // integer conversion resulted in a change of sign #endif -#include #include "uart.h" #include "mxc_device.h" #include "mxc_pins.h" diff --git a/Libraries/PeriphDrivers/Source/UART/uart_me21.c b/Libraries/PeriphDrivers/Source/UART/uart_me21.c index d5f44b2ce3..1d26031563 100644 --- a/Libraries/PeriphDrivers/Source/UART/uart_me21.c +++ b/Libraries/PeriphDrivers/Source/UART/uart_me21.c @@ -18,7 +18,6 @@ * ******************************************************************************/ -#include #include "uart.h" #include "mxc_device.h" #include "mxc_pins.h" @@ -206,7 +205,7 @@ int MXC_UART_SetFrequency(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clo case MXC_UART_AOD_CLK: aon_clk_div = (MXC_GCR->pclkdiv & MXC_F_GCR_PCLKDIV_AON_CLKDIV) >> MXC_F_GCR_PCLKDIV_AON_CLKDIV_POS; - clock_freq = PeripheralClock / (4 * (pow(2, aon_clk_div))); + clock_freq = PeripheralClock / (4 * (1 << aon_clk_div)); break; default: return E_BAD_PARAM; From 6041cc9880d5ee5fa12b17c3dac0c67a224aaf4f Mon Sep 17 00:00:00 2001 From: EricB-ADI <122300463+EricB-ADI@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:13:06 -0500 Subject: [PATCH 6/9] fix(Boards): Configure push buttons with alt function hyper ram to use VDDIO (#1216) --- Libraries/Boards/MAX32690/FTHR/Source/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Boards/MAX32690/FTHR/Source/board.c b/Libraries/Boards/MAX32690/FTHR/Source/board.c index c8c6247492..6ebe35f8b5 100644 --- a/Libraries/Boards/MAX32690/FTHR/Source/board.c +++ b/Libraries/Boards/MAX32690/FTHR/Source/board.c @@ -36,8 +36,8 @@ extern uint32_t SystemCoreClock; // clang-format off const mxc_gpio_cfg_t pb_pin[] = { - { MXC_GPIO1, MXC_GPIO_PIN_14, MXC_GPIO_FUNC_IN, MXC_GPIO_PAD_PULL_UP, MXC_GPIO_VSSEL_VDDIOH, MXC_GPIO_DRVSTR_0 }, - { MXC_GPIO1, MXC_GPIO_PIN_15, MXC_GPIO_FUNC_IN, MXC_GPIO_PAD_PULL_UP, MXC_GPIO_VSSEL_VDDIOH, MXC_GPIO_DRVSTR_0 }, + { MXC_GPIO1, MXC_GPIO_PIN_14, MXC_GPIO_FUNC_IN, MXC_GPIO_PAD_PULL_UP, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, + { MXC_GPIO1, MXC_GPIO_PIN_15, MXC_GPIO_FUNC_IN, MXC_GPIO_PAD_PULL_UP, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, }; const unsigned int num_pbs = (sizeof(pb_pin) / sizeof(mxc_gpio_cfg_t)); From 979f0889bf37e895d80de2f73bbd1334ca1ac2ea Mon Sep 17 00:00:00 2001 From: Jeremy Kongs Date: Tue, 8 Oct 2024 15:13:52 -0500 Subject: [PATCH 7/9] fix(PeriphDrivers): Correct HART UART Driver Transmit Bugs (#1207) --- Libraries/PeriphDrivers/Source/AFE/afe.c | 4 +-- .../PeriphDrivers/Source/AFE/hart_uart.c | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Libraries/PeriphDrivers/Source/AFE/afe.c b/Libraries/PeriphDrivers/Source/AFE/afe.c index 2356519986..d64d3a5c7a 100644 --- a/Libraries/PeriphDrivers/Source/AFE/afe.c +++ b/Libraries/PeriphDrivers/Source/AFE/afe.c @@ -65,7 +65,7 @@ // // Enabling this will use the afe timer to timeout polling of the AFE. -// This avoid any chance of the blocking function afe_spi_transceive from never returning. +// This avoids any chance of the blocking function afe_spi_transceive from never returning. // However, as this low level function can be called several times for even a single // AFE register read, it decreases throughput to and from the AFE. // When running at lower system clock frequencies this can be more of a concern. @@ -524,7 +524,7 @@ static int afe_spi_transceive(uint8_t *data, int byte_length) #else // Not AFE_SPI_TRANSCEIVE_SAFE_BUT_SLOWER // -// This function blocks until transceive is completed, or times out +// This function blocks until transceive is completed // This version does not use the afe timer to interrupt potential infinite polling. // static int afe_spi_transceive(uint8_t *data, int byte_length) diff --git a/Libraries/PeriphDrivers/Source/AFE/hart_uart.c b/Libraries/PeriphDrivers/Source/AFE/hart_uart.c index ed1533ae0d..c1782bae8e 100644 --- a/Libraries/PeriphDrivers/Source/AFE/hart_uart.c +++ b/Libraries/PeriphDrivers/Source/AFE/hart_uart.c @@ -212,6 +212,14 @@ static int hart_uart_init(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clo } // Set RX threshold to 1 byte + // Note, to meet HART TPDLL needs, each received byte must be handled singularly, to verify + // it for (vertical: parity bit) parity, framing errors, and gap error. + // This HART UART driver currently checks parity, and framing errors, but gap must be + // handled by TPDLL or application code. + // + // To increase threshold would require restructuring of the receiver to monitor gaps + // and to parse when and if comm errors occur, as there could be multiple bytes in + // the FIFO, and the errors would only apply to the most recent. retval = MXC_UART_SetRXThreshold(uart, 1); if (retval != E_NO_ERROR) { return retval; @@ -479,7 +487,7 @@ static int hart_uart_pins_external_test_mode_state(void) int retval = 0; mxc_gpio_cfg_t hart_pin; - // RTS Input to AFE, LOW is transmit mode, so Pulling Up + // HART_RTS Input to AFE, LOW is transmit mode, so Pulling Up hart_pin.port = HART_RTS_GPIO_PORT; hart_pin.mask = HART_RTS_GPIO_PIN; hart_pin.pad = MXC_GPIO_PAD_PULL_UP; @@ -490,30 +498,33 @@ static int hart_uart_pins_external_test_mode_state(void) return retval; } - // CD output from AFE, Tristate + // HART_CD output from AFE, Tristate hart_pin.port = HART_CD_GPIO_PORT; hart_pin.mask = HART_CD_GPIO_PIN; hart_pin.pad = MXC_GPIO_PAD_NONE; + hart_pin.func = MXC_GPIO_FUNC_IN; retval = MXC_AFE_GPIO_Config(&hart_pin); if (retval != E_NO_ERROR) { return retval; } - // IN input to AFE, pulling Up + // HART_IN input to AFE, pulling Up hart_pin.port = HART_IN_GPIO_PORT; hart_pin.mask = HART_IN_GPIO_PIN; hart_pin.pad = MXC_GPIO_PAD_PULL_UP; + hart_pin.func = MXC_GPIO_FUNC_IN; retval = MXC_AFE_GPIO_Config(&hart_pin); if (retval != E_NO_ERROR) { return retval; } - // IN output from AFE, Tristate + // HART_OUT output from AFE, Tristate hart_pin.port = HART_OUT_GPIO_PORT; hart_pin.mask = HART_OUT_GPIO_PIN; hart_pin.pad = MXC_GPIO_PAD_NONE; + hart_pin.func = MXC_GPIO_FUNC_IN; retval = MXC_AFE_GPIO_Config(&hart_pin); if (retval != E_NO_ERROR) { @@ -934,7 +945,12 @@ int hart_uart_setup(uint32_t test_mode) } else { hart_rts_receive_mode(); - retval = hart_uart_init(HART_UART_INSTANCE, 1200, MXC_UART_ERFO_CLK); + // + // NOTE: Need to use APB clock here instead of ERFO. + // Otherwise in a case for ERFO clock is faster than the System/Peripheral + // clock UART interrupts will not or only partially work. + // + retval = hart_uart_init(HART_UART_INSTANCE, 1200, MXC_UART_APB_CLK); if (retval != E_NO_ERROR) { return E_COMM_ERR; } @@ -1009,6 +1025,9 @@ int hart_uart_load_tx_fifo(void) return 0; } + // Ensure accurate index, dont allow uart interrupt while we manually load the fifo + MXC_UART_DisableInt(HART_UART_INSTANCE, (MXC_F_UART_INT_FL_TX_HE | MXC_F_UART_INT_FL_TX_OB)); + num_written = MXC_UART_WriteTXFIFO( HART_UART_INSTANCE, (const unsigned char *)(hart_buf + hart_uart_transmission_byte_index), load_num); @@ -1017,6 +1036,9 @@ int hart_uart_load_tx_fifo(void) // This should always equal load_num though. hart_uart_transmission_byte_index += num_written; + // Restore interrupts + MXC_UART_EnableInt(HART_UART_INSTANCE, (MXC_F_UART_INT_FL_TX_HE | MXC_F_UART_INT_FL_TX_OB)); + // Return the number actually written in case someone is interested. return num_written; } From 469f7f71d9fd38fcbbb1f3e7d382e407574dd08b Mon Sep 17 00:00:00 2001 From: Sadik Ozer <46590392+ozersa@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:14:38 +0300 Subject: [PATCH 8/9] feat(PeriphDrivers): Allow info block unlock function be overwritten for MAX32657 (#1213) Signed-off-by: Sadik Ozer --- Libraries/PeriphDrivers/Source/FLC/flc_me30.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/PeriphDrivers/Source/FLC/flc_me30.c b/Libraries/PeriphDrivers/Source/FLC/flc_me30.c index bcd94c65de..eaacb6b8ee 100644 --- a/Libraries/PeriphDrivers/Source/FLC/flc_me30.c +++ b/Libraries/PeriphDrivers/Source/FLC/flc_me30.c @@ -183,9 +183,9 @@ int MXC_FLC_MassErase(void) } //****************************************************************************** -int MXC_FLC_UnlockInfoBlock(uint32_t address) +__weak int MXC_FLC_UnlockInfoBlock(uint32_t address) { - return MXC_FLC_RevA_UnlockInfoBlock((mxc_flc_reva_regs_t *)MXC_FLC, address); + return E_NOT_SUPPORTED; } //****************************************************************************** From 79c0d9ae4d7ae85edd9f72fc3fc80f79931ad6d0 Mon Sep 17 00:00:00 2001 From: Sihyung Woo <75494566+sihyung-maxim@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:33:08 -0500 Subject: [PATCH 9/9] feat(Examples,PeriphDrivers): Add I2C_ADXL343 example to MAX32690, fix double read backs for I2C repeated start condition in ADXL343 drivers, and add minor I2C MasterTransaction Sync fix (#1211) Co-authored-by: lorne-maxim <65424047+lorne-maxim@users.noreply.github.com> Co-authored-by: sihyung-maxim --- .github/workflows/clang-format-run.sh | 2 +- Examples/MAX32690/I2C_ADXL343/.cproject | 81 ++++ Examples/MAX32690/I2C_ADXL343/.project | 26 ++ .../.settings/language.settings.xml | 15 + .../org.eclipse.cdt.codan.core.prefs | 93 +++++ .../.settings/org.eclipse.cdt.core.prefs | 15 + .../MAX32690/I2C_ADXL343/.vscode/README.md | 47 +++ .../I2C_ADXL343/.vscode/c_cpp_properties.json | 53 +++ .../MAX32690/I2C_ADXL343/.vscode/flash.gdb | 17 + .../MAX32690/I2C_ADXL343/.vscode/launch.json | 133 ++++++ .../I2C_ADXL343/.vscode/settings.json | 79 ++++ .../MAX32690/I2C_ADXL343/.vscode/tasks.json | 115 ++++++ .../MAX32690/I2C_ADXL343/I2C_ADXL343.launch | 62 +++ Examples/MAX32690/I2C_ADXL343/Makefile | 382 ++++++++++++++++++ Examples/MAX32690/I2C_ADXL343/README.md | 38 ++ Examples/MAX32690/I2C_ADXL343/adxl343.c | 269 ++++++++++++ Examples/MAX32690/I2C_ADXL343/adxl343.h | 213 ++++++++++ Examples/MAX32690/I2C_ADXL343/main.c | 186 +++++++++ Examples/MAX32690/I2C_ADXL343/project.mk | 10 + .../Boards/MAX32690/EvKit_V1/examples.txt | 1 + Libraries/PeriphDrivers/Source/I2C/i2c_me18.c | 4 +- Libraries/PeriphDrivers/Source/I2C/i2c_reva.c | 2 +- 22 files changed, 1839 insertions(+), 4 deletions(-) create mode 100644 Examples/MAX32690/I2C_ADXL343/.cproject create mode 100644 Examples/MAX32690/I2C_ADXL343/.project create mode 100644 Examples/MAX32690/I2C_ADXL343/.settings/language.settings.xml create mode 100644 Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.core.prefs create mode 100644 Examples/MAX32690/I2C_ADXL343/.vscode/README.md create mode 100644 Examples/MAX32690/I2C_ADXL343/.vscode/c_cpp_properties.json create mode 100644 Examples/MAX32690/I2C_ADXL343/.vscode/flash.gdb create mode 100644 Examples/MAX32690/I2C_ADXL343/.vscode/launch.json create mode 100644 Examples/MAX32690/I2C_ADXL343/.vscode/settings.json create mode 100644 Examples/MAX32690/I2C_ADXL343/.vscode/tasks.json create mode 100644 Examples/MAX32690/I2C_ADXL343/I2C_ADXL343.launch create mode 100644 Examples/MAX32690/I2C_ADXL343/Makefile create mode 100644 Examples/MAX32690/I2C_ADXL343/README.md create mode 100644 Examples/MAX32690/I2C_ADXL343/adxl343.c create mode 100644 Examples/MAX32690/I2C_ADXL343/adxl343.h create mode 100644 Examples/MAX32690/I2C_ADXL343/main.c create mode 100644 Examples/MAX32690/I2C_ADXL343/project.mk diff --git a/.github/workflows/clang-format-run.sh b/.github/workflows/clang-format-run.sh index 4f3a1a0389..dd590f204c 100644 --- a/.github/workflows/clang-format-run.sh +++ b/.github/workflows/clang-format-run.sh @@ -37,7 +37,7 @@ FILES="" if [[ $# -eq 0 ]] then # Find the c files - FILES=$(find . -iname "*.c" -not -name "*cnn.c" -a -not -name "*softmax.c" -a -not -regex ".*/Libraries/MiscDrivers/BarcodeDecoder/.*" -a -not -regex ".*/Examples/.*/Coremark/.*" -a -not -regex ".*/Libraries/\(Cordio\|FCL\|FreeRTOS\|FreeRTOS\-Plus\|LC3\|littlefs\|lwIP\|MAXUSB\|SDHC\|LVGL\|Coremark\|tinyusb\)/.*") + FILES=$(find . -iname "*.c" -not -name "*cnn.c" -a -not -name "*softmax.c" -a -not -regex ".*/Libraries/MiscDrivers/BarcodeDecoder/.*" -a -not -regex ".*/Examples/.*/Coremark/.*" -a -not -regex ".*/Libraries/CMSIS/5.9.0/.*" -a -not -regex ".*/Libraries/\(Cordio\|FCL\|FreeRTOS\|FreeRTOS\-Plus\|LC3\|littlefs\|lwIP\|MAXUSB\|SDHC\|LVGL\|Coremark\|tinyusb\)/.*") # Find the header files FILES=$FILES+$(find . -iname "*.h" -not -name "*regs*" -a -not -name "*weights.h" -a -not -name "*cnn.h" -a -not -name "*sampledata.h" -a -not -name "*sampleoutput.h" -a -not -regex ".*/Libraries/MiscDrivers/BarcodeDecoder/.*" -a -not -regex ".*/Examples/.*/Coremark/.*" -a -not -regex ".*/Libraries/\(Cordio\|FCL\|FreeRTOS\|FreeRTOS\-Plus\|LC3\|littlefs\|lwIP\|MAXUSB\|SDHC\|LVGL\|Coremark\|tinyusb\)/.*") diff --git a/Examples/MAX32690/I2C_ADXL343/.cproject b/Examples/MAX32690/I2C_ADXL343/.cproject new file mode 100644 index 0000000000..27cb529e13 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.cproject @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/MAX32690/I2C_ADXL343/.project b/Examples/MAX32690/I2C_ADXL343/.project new file mode 100644 index 0000000000..ee658b4307 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.project @@ -0,0 +1,26 @@ + + + I2C_ADXL343 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Examples/MAX32690/I2C_ADXL343/.settings/language.settings.xml b/Examples/MAX32690/I2C_ADXL343/.settings/language.settings.xml new file mode 100644 index 0000000000..d32717b6f3 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.settings/language.settings.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.codan.core.prefs b/Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000000..59c0b37ba7 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,93 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.codan.checkers.errnoreturn=Warning +org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false} +org.eclipse.cdt.codan.checkers.errreturnvalue=Error +org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"} +org.eclipse.cdt.codan.checkers.nocommentinside=-Error +org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"} +org.eclipse.cdt.codan.checkers.nolinecomment=-Error +org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"} +org.eclipse.cdt.codan.checkers.noreturn=Error +org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false} +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"} +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"} +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"} +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"} +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"C-Style cast instead of C++ cast\\")"} +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_param\=>false} +org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning +org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"} +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true} +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Lack of copyright information\\")",regex\=>".*Copyright.*"} +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem=Error +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid 'decltype(auto)' specifier\\")"} +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Goto statement used\\")"} +org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error +org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"} +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"} +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"} +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"} +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing cases in switch\\")"} +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing default in switch\\")",defaultWithAllEnums\=>false} +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing reference return value in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing self check in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"} +org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error +org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"} +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"} +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"} +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"} +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"} +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false} +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false} +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")} +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Using directive in header\\")"} +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem=-Error +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Virtual method call in constructor/destructor\\")"} +org.eclipse.cdt.qt.core.qtproblem=Warning +org.eclipse.cdt.qt.core.qtproblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>true,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>null} diff --git a/Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.core.prefs b/Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000000..4a5a3437ad --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/value=EvKit_V1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/value=arm-none-eabi- +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/value=I2C_ADXL343 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/value=MAX32690 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/appendContributed=true diff --git a/Examples/MAX32690/I2C_ADXL343/.vscode/README.md b/Examples/MAX32690/I2C_ADXL343/.vscode/README.md new file mode 100644 index 0000000000..5b355bd51c --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.vscode/README.md @@ -0,0 +1,47 @@ +# VSCode-Maxim + +_(If you're viewing this document from within Visual Studio Code you can press `CTRL+SHIFT+V` to open a Markdown preview window.)_ + +## Quick Links + +* [MSDK User Guide](https://analogdevicesinc.github.io/msdk/USERGUIDE/) +* [VSCode-Maxim Github](https://github.com/analogdevicesinc/VSCode-Maxim) + +## Introduction + +VSCode-Maxim is a set of [Visual Studio Code](https://code.visualstudio.com/) project configurations and utilities for enabling embedded development for [Analog Device's MSDK](https://github.com/analogdevicesinc/msdk) and the [MAX32xxx/MAX78xxx microcontrollers](https://www.analog.com/en/product-category/microcontrollers.html). + +The following features are supported: + +* Code editing with intellisense down to the register level +* Code compilation with the ability to easily re-target a project for different microcontrollers and boards +* Flashing programs +* GUI and command-line debugging + +## Dependencies + +* [Visual Studio Code](https://code.visualstudio.com/) + * [C/C++ VSCode Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) + * [Cortex-Debug Extension](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug) +* [Analog Devices MSDK](https://analogdevicesinc.github.io/msdk/) + +## Installation + +Install the MSDK, then set `"MAXIM_PATH"` in your _user_ VS Code settings. + +See [Getting Started with Visual Studio Code](https://analogdevicesinc.github.io/msdk/USERGUIDE/#getting-started-with-visual-studio-code) in the MSDK User Guide for detailed instructions. + +## Usage + +See the [MSDK User Guide](https://analogdevicesinc.github.io/msdk/USERGUIDE/#visual-studio-code) for detailed usage info. + +## Issue Tracker + +Bug reports, feature requests, and contributions are welcome via the [issues](https://github.com/analogdevicesinc/VSCode-Maxim/issues) tracker on Github. + +New issues should contain _at minimum_ the following information: + +* Visual Studio Code version #s (see `Help -> About`) +* C/C++ Extension version # +* Target microcontroller and evaluation platform +* The projects `.vscode` folder and `Makefile` (where applicable). Standard compression formats such as `.zip`, `.rar`, `.tar.gz`, etc. are all acceptable. diff --git a/Examples/MAX32690/I2C_ADXL343/.vscode/c_cpp_properties.json b/Examples/MAX32690/I2C_ADXL343/.vscode/c_cpp_properties.json new file mode 100644 index 0000000000..dfbed47b58 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.vscode/c_cpp_properties.json @@ -0,0 +1,53 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc.exe", + "browse": { + "path": [ + "${default}" + ] + } + }, + { + "name": "Linux", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc", + "browse": { + "path": [ + "${default}" + ] + } + }, + { + "name": "Mac", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc", + "browse": { + "path": [ + "${default}" + ] + } + } + ], + "version": 4 +} \ No newline at end of file diff --git a/Examples/MAX32690/I2C_ADXL343/.vscode/flash.gdb b/Examples/MAX32690/I2C_ADXL343/.vscode/flash.gdb new file mode 100644 index 0000000000..8f22801a47 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.vscode/flash.gdb @@ -0,0 +1,17 @@ +define flash_m4 + set architecture armv7e-m + set remotetimeout 10 + target remote | openocd -c "gdb_port pipe;log_output flash.log" -s $arg0/scripts -f interface/$arg1 -f target/$arg2 -c "init; reset halt" + load + compare-sections + monitor reset halt +end + +define flash_m4_run + set architecture armv7e-m + set remotetimeout 10 + target remote | openocd -c "gdb_port pipe;log_output flash.log" -s $arg0/scripts -f interface/$arg1 -f target/$arg2 -c "init; reset halt" + load + compare-sections + monitor resume +end diff --git a/Examples/MAX32690/I2C_ADXL343/.vscode/launch.json b/Examples/MAX32690/I2C_ADXL343/.vscode/launch.json new file mode 100644 index 0000000000..01fe519904 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.vscode/launch.json @@ -0,0 +1,133 @@ +{ + "configurations": [ + { + "name": "Debug Arm (Cortex-debug)", + "cwd":"${workspaceRoot}", + "executable": "${workspaceFolder}/build/${config:program_file}", + "loadFiles": ["${workspaceFolder}/build/${config:program_file}"], + "symbolFiles": [{ + "file": "${workspaceFolder}/build/${config:symbol_file}" + }], + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "linux": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "serverpath": "${config:OCD_path}/openocd", + }, + "windows": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb.exe", + "serverpath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "serverpath": "${config:OCD_path}/openocd", + }, + "searchDir": ["${config:OCD_path}/scripts"], + "configFiles": ["interface/${config:M4_OCD_interface_file}", "target/${config:M4_OCD_target_file}"], + "interface": "swd", + "runToEntryPoint": "main", + "svdFile": "${config:MAXIM_PATH}/Libraries/CMSIS/Device/Maxim/${config:target}/Include/${config:target}.svd" + }, + { + "name": "GDB (Arm M4)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/${config:program_file}", + "args": [], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "linux": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "debugServerPath": "${config:OCD_path}/openocd", + }, + "windows": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb.exe", + "debugServerPath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "debugServerPath": "${config:OCD_path}/bin/openocd", + }, + "logging": { + "exceptions": true, + "trace": false, + "traceResponse": false, + "engineLogging": false + }, + "miDebuggerServerAddress": "localhost:3333", + "debugServerArgs": "-s ${config:OCD_path}/scripts -f interface/${config:M4_OCD_interface_file} -f target/${config:M4_OCD_target_file} -c \"init; reset halt\"", + "serverStarted": "Info : Listening on port 3333 for gdb connections", + "filterStderr": true, + "targetArchitecture": "arm", + "customLaunchSetupCommands": [ + {"text":"-list-features"} + ], + "setupCommands": [ + { "text":"set logging overwrite on"}, + { "text":"set logging file debug-arm.log"}, + { "text":"set logging on"}, + { "text":"cd ${workspaceFolder}" }, + { "text":"exec-file build/${config:program_file}" }, + { "text":"symbol-file build/${config:symbol_file}" }, + { "text":"target remote localhost:3333" }, + { "text":"monitor reset halt" }, + { "text":"set $pc=Reset_Handler"}, + { "text":"b main" } + ] + }, + { + "name": "GDB (RISC-V)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/buildrv/${config:program_file}", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "linux": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb", + "debugServerPath": "${config:OCD_path}/openocd", + }, + "windows": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb.exe", + "debugServerPath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb", + "debugServerPath": "${config:OCD_path}/bin/openocd", + }, + "logging": { + "exceptions": true, + "trace": false, + "traceResponse": false, + "engineLogging": false + }, + "miDebuggerServerAddress": "localhost:3334", + "debugServerArgs": "-c \"gdb_port 3334\" -s ${config:OCD_path}/scripts -f interface/${config:RV_OCD_interface_file} -f target/${config:RV_OCD_target_file}", + "serverStarted": "Info : Listening on port 3334 for gdb connections", + "filterStderr": true, + "customLaunchSetupCommands": [ + {"text":"-list-features"} + ], + "targetArchitecture": "arm", + "setupCommands": [ + { "text":"set logging overwrite on"}, + { "text":"set logging file debug-riscv.log"}, + { "text":"set logging on"}, + { "text":"cd ${workspaceFolder}" }, + { "text": "set architecture riscv:rv32", "ignoreFailures": false }, + { "text":"exec-file build/${config:program_file}", "ignoreFailures": false }, + { "text":"symbol-file buildrv/${config:symbol_file}", "ignoreFailures": false }, + { "text":"target remote localhost:3334" }, + { "text":"b main" }, + { "text": "set $pc=Reset_Handler","ignoreFailures": false } + ] + } + ] +} diff --git a/Examples/MAX32690/I2C_ADXL343/.vscode/settings.json b/Examples/MAX32690/I2C_ADXL343/.vscode/settings.json new file mode 100644 index 0000000000..1e2be7ca4b --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.vscode/settings.json @@ -0,0 +1,79 @@ +{ + "terminal.integrated.env.windows": { + "Path":"${config:OCD_path};${config:ARM_GCC_path}/bin;${config:xPack_GCC_path}/bin;${config:MSYS_path}/usr/bin;${config:Make_path};${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + "terminal.integrated.defaultProfile.windows": "Command Prompt", + + "terminal.integrated.env.linux": { + "PATH":"${config:OCD_path}:${config:ARM_GCC_path}/bin:${config:xPack_GCC_path}/bin:${config:Make_path}:${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + "terminal.integrated.env.osx": { + "PATH":"${config:OCD_path}/bin:${config:ARM_GCC_path}/bin:${config:xPack_GCC_path}/bin:${config:Make_path}:${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + + "target":"MAX32690", + "board":"EvKit_V1", + + "project_name":"${workspaceFolderBasename}", + + "program_file":"${config:project_name}.elf", + "symbol_file":"${config:program_file}", + + "M4_OCD_interface_file":"cmsis-dap.cfg", + "M4_OCD_target_file":"${config:target}.cfg", + "RV_OCD_interface_file":"ftdi/olimex-arm-usb-ocd-h.cfg", + "RV_OCD_target_file":"${config:target}_riscv.cfg", + + "v_Arm_GCC":"10.3", + "v_xPack_GCC":"12.2.0-3.1", + + "OCD_path":"${config:MAXIM_PATH}/Tools/OpenOCD", + "ARM_GCC_path":"${config:MAXIM_PATH}/Tools/GNUTools/${config:v_Arm_GCC}", + "xPack_GCC_path":"${config:MAXIM_PATH}/Tools/xPack/riscv-none-elf-gcc/${config:v_xPack_GCC}", + "Make_path":"${config:MAXIM_PATH}/Tools/GNUTools/Make", + "MSYS_path":"${config:MAXIM_PATH}/Tools/MSYS2", + + "C_Cpp.default.includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/**", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/Include", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/${config:board}/Include", + "${config:MAXIM_PATH}/Libraries/CMSIS/Device/Maxim/${config:target}/Include", + "${config:MAXIM_PATH}/Libraries/CMSIS/Include", + "${config:ARM_GCC_path}/arm-none-eabi/include", + "${config:ARM_GCC_path}/lib/gcc/arm-none-eabi/${config:v_Arm_GCC}/include", + "${config:MAXIM_PATH}/Libraries/PeriphDrivers/Include/${config:target}", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Camera", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display/fonts", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/ExtMemory", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/LED", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen" + ], + "C_Cpp.default.browse.path": [ + "${workspaceFolder}", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/Source", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/${config:board}/Source", + "${config:MAXIM_PATH}/Libraries/PeriphDrivers/Source", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Camera", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display/fonts", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/LED", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen", + "${config:MAXIM_PATH}/Libraries/MiscDrivers" + ], + "C_Cpp.default.defines": [ + + ], + "C_Cpp.default.forcedInclude": [ + "${workspaceFolder}/build/project_defines.h" + ] +} + diff --git a/Examples/MAX32690/I2C_ADXL343/.vscode/tasks.json b/Examples/MAX32690/I2C_ADXL343/.vscode/tasks.json new file mode 100644 index 0000000000..e95445e2b3 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/.vscode/tasks.json @@ -0,0 +1,115 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "make -r -j 8 --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -r -j 8 --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean", + "type": "shell", + "command": "make -j 8 clean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -j 8 clean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean-periph", + "type": "shell", + "command": "make -j 8 distclean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -j 8 distclean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "flash", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--cd=\"${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "-x=\"${workspaceFolder}/.vscode/flash.gdb\"", + "--ex=\"flash_m4 ${config:OCD_path} ${config:M4_OCD_interface_file} ${config:M4_OCD_target_file}\"", + "--batch" + ], + "group": "build", + "problemMatcher": [], + "dependsOn":["build"] + }, + { + "label": "flash & run", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--cd=\"${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "-x=\"${workspaceFolder}/.vscode/flash.gdb\"", + "--ex=\"flash_m4_run ${config:OCD_path} ${config:M4_OCD_interface_file} ${config:M4_OCD_target_file}\"", + "--batch" + ], + "group": "build", + "problemMatcher": [], + "dependsOn":["build"] + }, + { + "label": "erase flash", + "type": "shell", + "command": "openocd", + "args": [ + "-s", "${config:OCD_path}/scripts", + "-f", "interface/${config:M4_OCD_interface_file}", + "-f", "target/${config:M4_OCD_target_file}", + "-c", "\"init; reset halt; max32xxx mass_erase 0;\"", + "-c", "exit" + ], + "group":"build", + "problemMatcher": [], + "dependsOn":[] + }, + { + "label": "openocd (m4)", + "type": "shell", + "command": "openocd", + "args": [ + "-s", + "${config:OCD_path}/scripts", + "-f", + "interface/${config:M4_OCD_interface_file}", + "-f", + "target/${config:M4_OCD_target_file}", + "-c", + "\"init; reset halt\"" + ], + "problemMatcher": [], + "dependsOn":[] + }, + { + "label": "gdb (m4)", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--ex=\"cd ${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "--ex=\"target remote localhost:3333\"", + "--ex=\"monitor reset halt\"", + "--ex=\"b main\"", + "--ex=\"c\"" + ], + "problemMatcher": [], + "dependsOn":[] + }, + ] +} \ No newline at end of file diff --git a/Examples/MAX32690/I2C_ADXL343/I2C_ADXL343.launch b/Examples/MAX32690/I2C_ADXL343/I2C_ADXL343.launch new file mode 100644 index 0000000000..be602b18e8 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/I2C_ADXL343.launch @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/MAX32690/I2C_ADXL343/Makefile b/Examples/MAX32690/I2C_ADXL343/Makefile new file mode 100644 index 0000000000..4fbb9a75d5 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/Makefile @@ -0,0 +1,382 @@ +############################################################################### + # + # Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by + # Analog Devices, Inc.), + # Copyright (C) 2023-2024 Analog Devices, Inc. + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # + ############################################################################## + +# ** Readme! ** +# Don't edit this file! This is the core Makefile for a MaximSDK +# project. The available configuration options can be overridden +# in "project.mk", on the command-line, or with system environment +# variables. + +# See https://analogdevicesinc.github.io/msdk/USERGUIDE/#build-system +# for more detailed instructions on how to use this system. + +# The detailed instructions mentioned above are easier to read than +# this file, but the comments found in this file also outline the +# available configuration variables. This file is organized into +# sub-sections, some of which expose config variables. + + +# ******************************************************************************* +# Set the target microcontroller and board to compile for. + +# Every TARGET microcontroller has some Board Support Packages (BSPs) that are +# available for it under the MaximSDK/Libraries/Boards/TARGET folder. The BSP +# that gets selected is MaximSDK/Libraries/Boards/TARGET/BOARD. + +# Configuration Variables: +# - TARGET : Override the default target microcontroller. Ex: TARGET=MAX78000 +# - BOARD : Override the default BSP (case sensitive). Ex: BOARD=EvKit_V1, BOARD=FTHR_RevA + + +ifeq "$(TARGET)" "" +# Default target microcontroller +TARGET := MAX32690 +TARGET_UC := MAX32690 +TARGET_LC := max32690 +else +# "TARGET" has been overridden in the environment or on the command-line. +# We need to calculate an upper and lowercase version of the part number, +# because paths on Linux and MacOS are case-sensitive. +TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET)))) +TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET)))) +endif + +# Default board. +BOARD ?= EvKit_V1 + +# ******************************************************************************* +# Locate the MaximSDK + +# This Makefile needs to know where to find the MaximSDK, and the MAXIM_PATH variable +# should point to the root directory of the MaximSDK installation. Setting this manually +# is usually only required if you're working on the command-line. + +# If MAXIM_PATH is not specified, we assume the project still lives inside of the MaximSDK +# and move up from this project's original location. + +# Configuration Variables: +# - MAXIM_PATH : Tell this Makefile where to find the MaximSDK. Ex: MAXIM_PATH=C:/MaximSDK + + +ifneq "$(MAXIM_PATH)" "" +# Sanitize MAXIM_PATH for backslashes +MAXIM_PATH := $(subst \,/,$(MAXIM_PATH)) +# Locate some other useful paths... +LIBS_DIR := $(abspath $(MAXIM_PATH)/Libraries) +CMSIS_ROOT := $(LIBS_DIR)/CMSIS +endif + +# ******************************************************************************* +# Include project Makefile. We do this after formulating TARGET, BOARD, and MAXIM_PATH +# in case project.mk needs to reference those values. However, we also include +# this as early as possible in the Makefile so that it can append to or override +# the variables below. + + +PROJECTMK ?= $(abspath ./project.mk) +include $(PROJECTMK) +$(info Loaded project.mk) +# PROJECTMK is also used by implicit rules and other libraries to add project.mk as a watch file + +# ******************************************************************************* +# Final path sanitization and re-calculation. No options here. + +ifeq "$(MAXIM_PATH)" "" +# MAXIM_PATH is still not defined... +DEPTH := ../../../ +MAXIM_PATH := $(abspath $(DEPTH)) +$(warning Warning: MAXIM_PATH is not set! Set MAXIM_PATH in your environment or in project.mk to clear this warning.) +$(warning Warning: Attempting to use $(MAXIM_PATH) calculated from relative path) +else +# Sanitize MAXIM_PATH for backslashes +MAXIM_PATH := $(subst \,/,$(MAXIM_PATH)) +endif + +# Final recalculation of LIBS_DIR/CMSIS_ROOT +LIBS_DIR := $(abspath $(MAXIM_PATH)/Libraries) +CMSIS_ROOT := $(LIBS_DIR)/CMSIS + +# One final UC/LC check in case user set TARGET in project.mk +TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET)))) +TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET)))) + +export TARGET +export TARGET_UC +export TARGET_LC +export CMSIS_ROOT +# TODO: Remove dependency on exports for these variables. + +# ******************************************************************************* +# Set up search paths, and auto-detect all source code on those paths. + +# The following paths are searched by default, where "./" is the project directory. +# ./ +# |- *.h +# |- *.c +# |-include (optional) +# |- *.h +# |-src (optional) +# |- *.c + +# Configuration Variables: +# - VPATH : Tell this Makefile to search additional locations for source (.c) files. +# You should use the "+=" operator with this option. +# Ex: VPATH += your/new/path +# - IPATH : Tell this Makefile to search additional locations for header (.h) files. +# You should use the "+=" operator with this option. +# Ex: VPATH += your/new/path +# - SRCS : Tell this Makefile to explicitly add a source (.c) file to the build. +# This is really only useful if you want to add a source file that isn't +# on any VPATH, in which case you can add the full path to the file here. +# You should use the "+=" operator with this option. +# Ex: SRCS += your/specific/source/file.c +# - AUTOSEARCH : Set whether this Makefile should automatically detect .c files on +# VPATH and add them to the build. This is enabled by default. Set +# to 0 to disable. If autosearch is disabled, source files must be +# manually added to SRCS. +# Ex: AUTOSEARCH = 0 + + +# Where to find source files for this project. +VPATH += . +VPATH += src +VPATH := $(VPATH) + +# Where to find header files for this project +IPATH += . +IPATH += include +IPATH := $(IPATH) + +AUTOSEARCH ?= 1 +ifeq ($(AUTOSEARCH), 1) +# Auto-detect all C/C++ source files on VPATH +SRCS += $(wildcard $(addsuffix /*.c, $(VPATH))) +SRCS += $(wildcard $(addsuffix /*.cpp, $(VPATH))) +endif + +# Collapse SRCS before passing them on to the next stage +SRCS := $(SRCS) + +# ******************************************************************************* +# Set the output filename + +# Configuration Variables: +# - PROJECT : Override the default output filename. Ex: PROJECT=MyProject + + +# The default value creates a file named after the target micro. Ex: MAX78000.elf +PROJECT ?= $(TARGET_LC) + +# ******************************************************************************* +# Compiler options + +# Configuration Variables: +# - DEBUG : Set DEBUG=1 to build explicitly for debugging. This adds some additional +# symbols and sets -Og as the default optimization level. +# - MXC_OPTIMIZE_CFLAGS : Override the default compiler optimization level. +# Ex: MXC_OPTIMIZE_CFLAGS = -O2 +# - PROJ_CFLAGS : Add additional compiler flags to the build. +# You should use the "+=" operator with this option. +# Ex: PROJ_CFLAGS += -Wextra +# - MFLOAT_ABI : Set the floating point acceleration level. +# The only options are "hard", "soft", or "softfp". +# Ex: MFLOAT_ABI = hard +# - LINKERFILE : Override the default linkerfile. +# Ex: LINKERFILE = customlinkerfile.ld +# - LINKERPATH : Override the default search location for $(LINKERFILE) +# The default search location is $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC +# If $(LINKERFILE) cannot be found at this path, then the root project +# directory will be used as a fallback. + +# Select 'GCC' or 'IAR' compiler +ifeq "$(COMPILER)" "" +COMPILER := GCC +endif + +# Set default compiler optimization levels +ifeq "$(MAKECMDGOALS)" "release" +# Default optimization level for "release" builds (make release) +MXC_OPTIMIZE_CFLAGS ?= -O2 +DEBUG = 0 +endif + +ifeq ($(DEBUG),1) +# Optimizes for debugging as recommended +# by GNU for code-edit-debug cycles +# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options +MXC_OPTIMIZE_CFLAGS := -Og +endif + +# Default level if not building for release or explicitly for debug +MXC_OPTIMIZE_CFLAGS ?= -Og + +# Set compiler flags +PROJ_CFLAGS += -Wall # Enable warnings +PROJ_CFLAGS += -DMXC_ASSERT_ENABLE + +# Set hardware floating point acceleration. +# Options are: +# - hard +# - soft +# - softfp (default if MFLOAT_ABI is not set) +MFLOAT_ABI ?= softfp +# MFLOAT_ABI must be exported to other Makefiles +export MFLOAT_ABI + +# This path contains system-level intialization files for the target micro. Add to the build. +VPATH += $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source + +# ******************************************************************************* +# Secure Boot Tools (SBT) + +# This section integrates the Secure Boot Tools. It's intended for use with +# microcontrollers that have a secure bootloader. + +# Enabling SBT integration will add some special rules, such as "make sla", "make scpa", etc. + +# Configuration variables: +# SBT : Toggle SBT integration. Set to 1 to enable, or 0 +# to disable +# MAXIM_SBT_DIR : Specify the location of the SBT tool binaries. This defaults to +# Tools/SBT in the MaximSDK. The standalone SBT installer will override +# this via an environment variable. +# TARGET_SEC : Specify the part number to be passed into the SBT. This should match +# the secure variant part #. The default value will depend on TARGET. +# For example, TARGET=MAX32650 will result in TARGET_SEC=MAX32651, and +# the default selection happens in Tools/SBT/SBT-config. +# However, if there are multiple secure part #s for the target +# microcontroller this variable may need to be changed. + +SBT ?= 0 +ifeq ($(SBT), 1) +MAXIM_SBT_DIR ?= $(MAXIM_PATH)/Tools/SBT +MAXIM_SBT_DIR := $(subst \,/,$(MAXIM_SBT_DIR)) +# ^ Must sanitize path for \ on Windows, since this may come from an environment +# variable. + +export MAXIM_SBT_DIR # SBTs must have this environment variable defined to work + +# SBT-config.mk and SBT-rules.mk are included further down this Makefile. + +endif # SBT + +# ******************************************************************************* +# Default goal selection. This section allows you to override the default goal +# that will run if no targets are specified on the command-line. +# (ie. just running 'make' instead of 'make all') + +# Configuration variables: +# .DEFAULT_GOAL : Set the default goal if no targets were specified on the +# command-line +# ** "override" must be used with this variable. ** +# Ex: "override .DEFAULT_GOAL = mygoal" + +ifeq "$(.DEFAULT_GOAL)" "" +ifeq ($(SBT),1) +override .DEFAULT_GOAL := sla +else +override .DEFAULT_GOAL := all +endif +endif + +# Developer note: 'override' is used above for legacy Makefile compatibility. +# gcc.mk/gcc_riscv.mk need to hard-set 'all' internally, so this new system +# uses 'override' to come in over the top without breaking old projects. + +# It's also necessary to explicitly set MAKECMDGOALS... +ifeq "$(MAKECMDGOALS)" "" +MAKECMDGOALS:=$(.DEFAULT_GOAL) +endif + +# Enable colors when --sync-output is used. +# See https://www.gnu.org/software/make/manual/make.html#Terminal-Output (section 13.2) +ifneq ($(MAKE_TERMOUT),) +PROJ_CFLAGS += -fdiagnostics-color=always +endif + +ifneq ($(FORCE_COLOR),) +PROJ_CFLAGS += -fdiagnostics-color=always +endif + +# ******************************************************************************* +# Include SBT config. We need to do this here because it needs to know +# the current MAKECMDGOAL. +ifeq ($(SBT),1) +include $(MAXIM_PATH)/Tools/SBT/SBT-config.mk +endif + +# ******************************************************************************* +# Libraries + +# This section offers "toggle switches" to include or exclude the libraries that +# are available in the MaximSDK. Set a configuration variable to 1 to include the +# library in the build, or 0 to exclude. + +# Each library may also have its own library specific configuration variables. See +# Libraries/libs.mk for more details. + +# Configuration variables: +# - LIB_BOARD : Include the Board-Support Package (BSP) library. (Enabled by default) +# - LIB_PERIPHDRIVERS : Include the peripheral driver library. (Enabled by default) +# - LIB_CMSIS_DSP : Include the CMSIS-DSP library. +# - LIB_CORDIO : Include the Cordio BLE library +# - LIB_FCL : Include the Free Cryptographic Library (FCL) +# - LIB_FREERTOS : Include the FreeRTOS and FreeRTOS-Plus-CLI libraries +# - LIB_LC3 : Include the Low Complexity Communication Codec (LC3) library +# - LIB_LITTLEFS : Include the "little file system" (littleFS) library +# - LIB_LWIP : Include the lwIP library +# - LIB_MAXUSB : Include the MAXUSB library +# - LIB_SDHC : Include the SDHC library + +include $(LIBS_DIR)/libs.mk + + +# ******************************************************************************* +# Rules + +# Include the rules for building for this target. All other makefiles should be +# included before this one. +include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk + +# Include the rules that integrate the SBTs. SBTs are a special case that must be +# include after the core gcc rules to extend them. +ifeq ($(SBT), 1) +include $(MAXIM_PATH)/Tools/SBT/SBT-rules.mk +endif + + +# Get .DEFAULT_GOAL working. +ifeq "$(MAKECMDGOALS)" "" +MAKECMDGOALS:=$(.DEFAULT_GOAL) +endif + + +all: +# Extend the functionality of the "all" recipe here + $(PREFIX)-size --format=berkeley $(BUILD_DIR)/$(PROJECT).elf + +libclean: + $(MAKE) -f ${PERIPH_DRIVER_DIR}/periphdriver.mk clean.periph + +clean: +# Extend the functionality of the "clean" recipe here + +# The rule to clean out all the build products. +distclean: clean libclean diff --git a/Examples/MAX32690/I2C_ADXL343/README.md b/Examples/MAX32690/I2C_ADXL343/README.md new file mode 100644 index 0000000000..c82c37b4f1 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/README.md @@ -0,0 +1,38 @@ +## Description + +This application demonstrates I2C communication between the MAX32690 EV Kit and an ADXL343 Digital MEMS Accelerometer. The application first configures the I2C peripheral instance, probes the I2C bus for the presence of a ADXL343, configures the ADXL343, waits for console input then enters low power mode. The ADXL343 configured to enable Data Ready interrupts on pin INT2. The INT2 signal is used as an external interrupt source capable of waking the MAX32690 from sleep mode. Acceleration data is printed to the console UART on each interrupt. + +## Software + +### Project Usage + +Universal instructions on building, flashing, and debugging this project can be found in the **[MSDK User Guide](https://analogdevicesinc.github.io/msdk/USERGUIDE/)**. + +### Project-Specific Build Notes + +## Setup + +### Prepare Hardware: + +- Connect INT2 of the ADXL343 to GPIO P2.11 of the MAX32690 EV Kit (header J4.7). +- Connect SCL of the ADXL343 to GPIO P2.8/I2C0_SCL of the MAX32690 EV Kit (header J4.8). +- Connect SDA of the ADXL343 to GPIO P2.7/I2C0_SDA of the MAX32690 EV Kit (header J4.9). +- Connect GND of the ADXL343 to GND of the MAX32690 EV Kit(header J4.1). +- Connect VIN of the ADXL343 to V_AUX of the MAX32690 EV Kit(header J4.10). + +### Required Connections: + +- Connect a USB cable between the PC and the MAX32690 EV Kit CN2 (USB/PWR - UART) connector. +- Open a terminal application on the PC and connect to the MAX32690 console UART at 115200, 8-N-1. +- Connect jumper on JP3 and JP4 for the I2C0 pull-up resistorss. +- Connect jumper on JP2 to the VDDIOH setting for the I2C0 pull-up resistors. +- Connect jumper on JP1 to 3V3 to set V_AUX to 3.3V. + +## Expected Output + +The console UART of the MAX32690 EV Kit will output these messages: + +``` +MAX32690 I2C ADXL343 demo. +x:-0.02 y: 0.02 z: 0.99 +``` diff --git a/Examples/MAX32690/I2C_ADXL343/adxl343.c b/Examples/MAX32690/I2C_ADXL343/adxl343.c new file mode 100644 index 0000000000..49285222b3 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/adxl343.c @@ -0,0 +1,269 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by + * Analog Devices, Inc.), + * Copyright (C) 2023-2024 Analog Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/* + adxl343.c + + Analog Devices ADXL343 driver. +*/ + +#include +#include +#include "mxc_device.h" +#include "mxc_delay.h" +#include "i2c.h" +#include "gpio.h" +#include "adxl343.h" +#include "board.h" +#include "led.h" + +// I2C address with pin ALT_ADDRESS/SDO pulled low +#define ADXL343_ADDR 0x53 + +#define DEVID 0xE5 + +#define DEVID_REG 0x00 // Device ID +#define THRESH_TAP_REG 0x1D // Tap threshold +#define OFSX_REG 0x1E // X-axis offset +#define OFSY_REG 0x1F // Y-axis offset +#define OFSZ_REG 0x20 // Z-axis offset +#define DUR_REG 0x21 // Tap duration +#define LATENT_REG 0x22 // Tap latency +#define WINDOW_REG 0x23 // Tap window +#define THRESH_ACT_REG 0x24 // Activity threshold +#define THRESH_INACT_REG 0x25 // Inactivity threshold +#define TIME_INACT_REG 0x26 // Inactivity time +#define ACT_INACT_CTL_REG 0x27 // Axis enable control for activity and inactivity detection +#define THRESH_FF_REG 0x28 // Free-fall threshold +#define TIME_FF_REG 0x29 // Free-fall time +#define TAP_AXES_REG 0x2A // Axis control for single tap/double tap +#define ACT_TAP_STATUS_REG 0x2B // Source of single tap/double tap +#define BW_RATE_REG 0x2C // Data rate and power mode control +#define POWER_CTL_REG 0x2D // Power-saving features control +#define INT_ENABLE_REG 0x2E // Interrupt enable control +#define INT_MAP_REG 0x2F // Interrupt mapping control +#define INT_SOURCE_REG 0x30 // Source of interrupts +#define DATA_FORMAT_REG 0x31 // Data format control +#define DATAX0_REG 0x32 // X-Axis Data 0 +#define DATAX1_REG 0x33 // X-Axis Data 1 +#define DATAY0_REG 0x34 // Y-Axis Data 0 +#define DATAY1_REG 0x35 // Y-Axis Data 1 +#define DATAZ0_REG 0x36 // Z-Axis Data 0 +#define DATAZ1_REG 0x37 // Z-Axis Data 1 +#define FIFO_CTL_REG 0x38 // FIFO control +#define FIFO_STATUS_REG 0x39 // FIFO status + +#define RATE_MASK 0x0F +#define LP_MASK 0x10 +#define RANGE_MASK 0x03 +#define MEASURE_MASK 0x08 +#define FIFO_MODE_MASK 0xC0 + +static mxc_i2c_req_t i2c_save; + +static inline int reg_write(uint8_t reg, uint8_t val) +{ + uint8_t buf[2] = { reg, val }; + mxc_i2c_req_t i2c_req; + + i2c_req.i2c = i2c_save.i2c; + i2c_req.addr = i2c_save.addr; + i2c_req.tx_buf = buf; + i2c_req.tx_len = sizeof(buf); + i2c_req.rx_buf = NULL; + i2c_req.rx_len = 0; + i2c_req.restart = 0; + i2c_req.callback = i2c_save.callback; + + return MXC_I2C_MasterTransaction(&i2c_req); +} + +static inline int reg_read(uint8_t reg, uint8_t *dat) +{ + uint8_t buf[1] = { reg }; + mxc_i2c_req_t i2c_req_wr, i2c_req_rd; + int result; + + // A repeated start condition, one write then one read transaction. + i2c_req_wr.i2c = i2c_save.i2c; + i2c_req_wr.addr = i2c_save.addr; + i2c_req_wr.tx_buf = buf; + i2c_req_wr.tx_len = sizeof(buf); + i2c_req_wr.rx_buf = NULL; + i2c_req_wr.rx_len = 0; + i2c_req_wr.restart = 0; + i2c_req_wr.callback = NULL; // Repeat start condition, callback at end. + + i2c_req_rd.i2c = i2c_save.i2c; + i2c_req_rd.addr = i2c_save.addr; + i2c_req_rd.tx_buf = NULL; + i2c_req_rd.tx_len = 0; + i2c_req_rd.rx_buf = dat; + i2c_req_rd.rx_len = 1; + i2c_req_rd.restart = 0; + i2c_req_rd.callback = i2c_save.callback; + + result = MXC_I2C_MasterTransaction(&i2c_req_wr); + result += MXC_I2C_MasterTransaction(&i2c_req_rd); + + return result; +} + +int adxl343_get_axis_data(int16_t *ptr) +{ + uint8_t buf[1] = { DATAX0_REG }; + mxc_i2c_req_t i2c_req_wr, i2c_req_rd; + int result = 0; + + i2c_req_wr.i2c = i2c_save.i2c; + i2c_req_wr.addr = i2c_save.addr; + i2c_req_wr.tx_buf = buf; + i2c_req_wr.tx_len = sizeof(buf); + i2c_req_wr.rx_buf = NULL; + i2c_req_wr.rx_len = 0; + i2c_req_wr.restart = 0; + i2c_req_wr.callback = NULL; // Repeat start condition, callback at end. + + i2c_req_rd.i2c = i2c_save.i2c; + i2c_req_rd.addr = i2c_save.addr; + i2c_req_rd.tx_buf = NULL; + i2c_req_rd.tx_len = 0; + i2c_req_rd.rx_buf = (uint8_t *)ptr; + i2c_req_rd.rx_len = 6; + i2c_req_rd.restart = 0; + i2c_req_rd.callback = i2c_save.callback; + + result = MXC_I2C_MasterTransaction(&i2c_req_wr); + result += MXC_I2C_MasterTransaction(&i2c_req_rd); + + return result; +} + +int adxl343_set_power_mode(uint8_t mode) +{ + int result; + uint8_t reg; + + if ((result = reg_read(BW_RATE_REG, ®)) != E_NO_ERROR) + return result; + reg &= ~LP_MASK; + reg |= mode; + return reg_write(BW_RATE_REG, reg); +} + +int adxl343_set_data_rate(uint8_t rate) +{ + int result; + uint8_t reg; + + if ((result = reg_read(BW_RATE_REG, ®)) != E_NO_ERROR) + return result; + reg &= ~RATE_MASK; + reg |= rate; + return reg_write(BW_RATE_REG, reg); +} + +int adxl343_set_fifo_mode(uint8_t mode) +{ + int result; + uint8_t reg; + + if ((result = reg_read(FIFO_CTL_REG, ®)) != E_NO_ERROR) + return result; + reg &= ~FIFO_MODE_MASK; + reg |= mode; + return reg_write(FIFO_CTL_REG, reg); +} + +int adxl343_set_range(uint8_t range) +{ + int result; + uint8_t reg; + + if ((result = reg_read(DATA_FORMAT_REG, ®)) != E_NO_ERROR) + return result; + reg &= ~RANGE_MASK; + reg |= range; + return reg_write(DATA_FORMAT_REG, reg); +} + +int adxl343_set_power_control(uint8_t pwr) +{ + int result; + uint8_t reg; + + if ((result = reg_read(POWER_CTL_REG, ®)) != E_NO_ERROR) + return result; + reg &= ~MEASURE_MASK; + reg |= pwr; + return reg_write(POWER_CTL_REG, reg); +} + +int adxl343_set_int_enable(uint8_t srcs) +{ + return reg_write(INT_ENABLE_REG, srcs); +} + +int adxl343_set_int_map(uint8_t map) +{ + return reg_write(INT_MAP_REG, map); +} + +int adxl343_get_int_source(uint8_t *srcs) +{ + return reg_read(INT_SOURCE_REG, srcs); +} + +int adxl343_set_offsets(const int8_t *offs) +{ + uint8_t buf[4] = { OFSX_REG, offs[0], offs[1], offs[2] }; + mxc_i2c_req_t i2c_req; + + i2c_req.i2c = i2c_save.i2c; + i2c_req.addr = i2c_save.addr; + i2c_req.restart = 0; + i2c_req.tx_buf = buf; + i2c_req.tx_len = sizeof(buf); + i2c_req.rx_len = 0; + i2c_req.callback = i2c_save.callback; + + return MXC_I2C_MasterTransaction(&i2c_req); +} + +int adxl343_init(mxc_i2c_regs_t *i2c_inst) +{ + int result; + uint8_t id; + + if (!i2c_inst) + return E_NULL_PTR; + + i2c_save.i2c = i2c_inst; + i2c_save.addr = ADXL343_ADDR; + i2c_save.callback = NULL; + + if ((result = reg_read(DEVID_REG, &id)) != E_NO_ERROR) + return result; + + if (id != DEVID) + return E_NOT_SUPPORTED; + + return E_NO_ERROR; +} diff --git a/Examples/MAX32690/I2C_ADXL343/adxl343.h b/Examples/MAX32690/I2C_ADXL343/adxl343.h new file mode 100644 index 0000000000..0a2bef17fb --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/adxl343.h @@ -0,0 +1,213 @@ +/****************************************************************************** + * + * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by + * Analog Devices, Inc.), + * Copyright (C) 2023-2024 Analog Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/* + adxl343.h + + Analog Devices ADXL343 driver. +*/ + +#ifndef EXAMPLES_MAX32690_I2C_ADXL343_ADXL343_H_ +#define EXAMPLES_MAX32690_I2C_ADXL343_ADXL343_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + Power control +*/ +#define ADXL343_PWRCTL_STANDBY 0x00 +#define ADXL343_PWRCTL_MEASURE 0x08 + +/* + Power mode +*/ +#define ADXL343_PWRMOD_NORMAL 0x00 +#define ADXL343_PWRMOD_LP 0x10 + +/* + Interrupt enable, map and source fields +*/ +#define ADXL343_INT_DATA_READY 0x80 +#define ADXL343_INT_SINGLE_TAP 0x40 +#define ADXL343_INT_DOUBLE_TAP 0x20 +#define ADXL343_INT_ACTIVITY 0x10 +#define ADXL343_INT_INACTIVITY 0x08 +#define ADXL343_INT_FREE_FALL 0x04 +#define ADXL343_INT_WATERMARK 0x02 +#define ADXL343_INT_OVERRUN 0x01 + +/* + Data ranges +*/ +#define ADXL343_RANGE_2G 0x00 +#define ADXL343_RANGE_4G 0x01 +#define ADXL343_RANGE_8G 0x02 +#define ADXL343_RANGE_16G 0x03 + +/* + Data rates +*/ +#define ADXL343_DR_3200HZ 0x0F +#define ADXL343_DR_1600HZ 0x0E +#define ADXL343_DR_800HZ 0x0D +#define ADXL343_DR_400HZ 0x0C +#define ADXL343_DR_200HZ 0x0B +#define ADXL343_DR_100HZ 0x0A +#define ADXL343_DR_50HZ 0x09 +#define ADXL343_DR_25HZ 0x08 +#define ADXL343_DR_12HZ5 0x07 +#define ADXL343_DR_6HZ25 0x06 +#define ADXL343_DR_3HZ13 0x05 +#define ADXL343_DR_1HZ56 0x04 +#define ADXL343_DR_HZ78 0x03 +#define ADXL343_DR_HZ39 0x02 +#define ADXL343_DR_HZ20 0x01 +#define ADXL343_DR_HZ10 0x00 + +/* + FIFO modes +*/ +#define ADXL343_FIFO_BYPASS 0x00 +#define ADXL343_FIFO_FIFO 0x40 +#define ADXL343_FIFO_STREAM 0x80 +#define ADXL343_FIFO_TRIGGER 0xC0 + +/* + Scale factor -- micro g / LSB +*/ +#define ADXL343_SF_FULLRES 0.0039f +#define ADXL343_SF_2G 0.0039f +#define ADXL343_SF_4G 0.0078f +#define ADXL343_SF_8G 0.0156f +#define ADXL343_SF_16G 0.0312f + +/* + Read X, Y and Z axis data. + + PTR parameter must be large enough to accept three int16_t values. + Axis data order is X, Y, Z. + + Returns 0 on success, negative if error. +*/ +int adxl343_get_axis_data(int16_t *ptr); + +/* + Set data output rate. + + RATE parameter is one of the ADXL343_DR_x constants. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_data_rate(uint8_t rate); + +/* + Set g range. + + RANGE parameter is one of the ADXL343_RANGE_x constants. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_range(uint8_t range); + +/* + Set power control. + + PWR parameter is one of the ADXL343_PWRCTL_x constants. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_power_control(uint8_t pwr); + +/* + Set power mode. + + MODE parameter is one of the ADXL343_PWRMOD_x constants. + + Returns 0 on success, negative if error. + */ +int adxl343_set_power_mode(uint8_t mode); + +/* + Set FIFO mode. + + MODE parameter is one of the ADXL343_FIFO_x constants. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_fifo_mode(uint8_t mode); + +/* + Enable interrupt sources. + + SRCS parameter is the bitwise OR of one or more of the ADXL343_INT_x constants. + Specified interrupt sources are enabled; unspecified interrupt sources are disabled. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_int_enable(uint8_t srcs); + +/* + Set interrupt pin mapping. + + MAP parameter is the bitwise OR of one or more of the ADXL343_INT_x constants. + Specified interrupt sources are mapped to INT2 pin; unspecified interrupt sources are mapped to INT1 pin. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_int_map(uint8_t map); + +/* + Read interrupt source register. + + SRCS parameter specifies location to receive interrupt source register value. + Active interrupts read a 1; ADXL343_INT_x constants should be used to identify active sources. + + Returns 0 on success, negative if error. +*/ +int adxl343_get_int_source(uint8_t *srcs); + +/* + Set X, Y and Z axis offsets. + + OFFS parameter specifies location to retrieve three int8_t offsets. + Axis offset order is X, Y, Z. + + Returns 0 on success, negative if error. +*/ +int adxl343_set_offsets(const int8_t *offs); + +/* + Initialize device. + + I2C_INST parameter is pointer to I2C peripheral instance to be used for communication with device. + + Returns 0 on success, negative if error. +*/ +int adxl343_init(mxc_i2c_regs_t *i2c_inst); + +#ifdef __cplusplus +} +#endif + +#endif // EXAMPLES_MAX32690_I2C_ADXL343_ADXL343_H_ diff --git a/Examples/MAX32690/I2C_ADXL343/main.c b/Examples/MAX32690/I2C_ADXL343/main.c new file mode 100644 index 0000000000..8284ed97c1 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/main.c @@ -0,0 +1,186 @@ +/****************************************************************************** + * + * Copyright (C) 2024 Analog Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/* + main.c + + MAX32690 EV Kit I2C example for ADXL343. + + This example continuously prints ADXL343 data. + + The ADXL343 INT2 output is connected to P2.11 of the MAX32690. +*/ + +#include +#include +#include +#include "mxc_device.h" +#include "mxc_delay.h" +#include "i2c.h" +#include "icc.h" +#include "gpio.h" +#include "adxl343.h" +#include "board.h" +#include "led.h" +#include "lp.h" + +// The I2C peripheral the ADXL343 is connected to and the bus speed. +#define I2C_INST MXC_I2C0 +#define I2C_FREQ 100000 + +// The GPIO pin used for ADXL343 interrupt. +#define ADXL343_IRQ_PORT MXC_GPIO0 +#define ADXL343_IRQ_PIN MXC_GPIO_PIN_7 + +void GPIO0_IRQHandler(void) +{ + MXC_GPIO_Handler(MXC_GPIO_GET_IDX(ADXL343_IRQ_PORT)); +} + +static mxc_gpio_cfg_t adxl343_irq_cfg = { .port = ADXL343_IRQ_PORT, + .mask = ADXL343_IRQ_PIN, + .pad = MXC_GPIO_PAD_NONE, + .func = MXC_GPIO_FUNC_IN, + .vssel = MXC_GPIO_VSSEL_VDDIOH }; + +// Flag shared between interrupt handler and differed work service loop +static volatile bool axis_data_ready = false; + +/* + Print message and blink LEDs until reset. +*/ +void blink_halt(char *msg) +{ + puts(msg); + puts("Reset to restart application."); + + for (;;) { + MXC_Delay(MXC_DELAY_MSEC(250)); + LED_Toggle(LED1); + } +} + +/* + ADXL343 interrupt handler. + + Set global data ready flag. +*/ +void adxl343_handler(void *cbdata) +{ + (void)cbdata; + + axis_data_ready = true; +} + +/* + ADXL343 configuration. + + Configures GPIO pin as external interrupt and ADXL343 for continuous operation. +*/ +int adxl343_config(void) +{ + int result; + int16_t tmp[3]; + int8_t axis_offsets[3] = { -2, -2, 7 }; // Device specific offset calibration values + + result = 0; + result |= adxl343_set_power_control(ADXL343_PWRCTL_STANDBY); + result |= adxl343_set_int_enable(0); + result |= adxl343_get_axis_data(tmp); // Unload any unread data + result |= adxl343_set_data_rate(ADXL343_DR_25HZ); + result |= adxl343_set_range(ADXL343_RANGE_2G); + result |= adxl343_set_power_mode(ADXL343_PWRMOD_NORMAL); + result |= adxl343_set_offsets(axis_offsets); + result |= adxl343_set_fifo_mode(ADXL343_FIFO_BYPASS); + result |= adxl343_set_int_map(ADXL343_INT_DATA_READY); + result |= adxl343_set_int_enable(ADXL343_INT_DATA_READY); + result |= adxl343_set_power_control(ADXL343_PWRCTL_MEASURE); + + MXC_GPIO_Config(&adxl343_irq_cfg); + MXC_GPIO_RegisterCallback(&adxl343_irq_cfg, adxl343_handler, NULL); + MXC_GPIO_IntConfig(&adxl343_irq_cfg, MXC_GPIO_INT_RISING); + MXC_GPIO_EnableInt(adxl343_irq_cfg.port, adxl343_irq_cfg.mask); + NVIC_EnableIRQ(MXC_GPIO_GET_IRQ(MXC_GPIO_GET_IDX(ADXL343_IRQ_PORT))); + MXC_LP_EnableGPIOWakeup(&adxl343_irq_cfg); + + return result; +} + +/* + Print message and wait for keypress +*/ +void wait_for_keypress(void) +{ + const char msg[] = "Press Enter or Return to continue ..."; + + printf("%s", msg); + getchar(); + printf("%*s", sizeof(msg) - 1, ""); +} + +int main(void) +{ + int16_t axis_data[3]; + + MXC_ICC_Enable(MXC_ICC0); + MXC_SYS_Clock_Select(MXC_SYS_CLOCK_IPO); + SystemCoreClockUpdate(); + + // Disable stdout buffering + setbuf(stdout, NULL); + printf("\nMAX32690 I2C ADXL343 demo.\n"); + + if (MXC_I2C_Init(I2C_INST, 1, 0) != E_NO_ERROR) { + blink_halt("Trouble initializing I2C instance."); + } + + MXC_I2C_SetFrequency(I2C_INST, I2C_FREQ); + + if (adxl343_init(I2C_INST) != E_NO_ERROR) { + blink_halt("Trouble initializing ADXL343."); + } + + if (adxl343_config() != E_NO_ERROR) { + blink_halt("Trouble configuring ADXL343."); + } + + // Use delay or wait for keypress to allow debugger to attach before entering low power mode +#if !defined(WAIT_FOR_KEYPRESS) + MXC_Delay(MXC_DELAY_SEC(3)); +#else + wait_for_keypress(); +#endif + + while (1) { + if (axis_data_ready) { + axis_data_ready = false; + + if (adxl343_get_axis_data(axis_data) != E_NO_ERROR) { + blink_halt("Trouble reading ADXL343."); + } + + // Add trailing spaces to properly clear any left over digits should the number + // of digits increase/decrease. + printf("\rx:%-2.2f y:%-2.2f z:%-2.2f ", + (double)(axis_data[0] * ADXL343_SF_2G), (double)(axis_data[1] * ADXL343_SF_2G), + (double)(axis_data[2] * ADXL343_SF_2G)); + } + + MXC_LP_EnterSleepMode(); + } +} diff --git a/Examples/MAX32690/I2C_ADXL343/project.mk b/Examples/MAX32690/I2C_ADXL343/project.mk new file mode 100644 index 0000000000..c5bb8a2183 --- /dev/null +++ b/Examples/MAX32690/I2C_ADXL343/project.mk @@ -0,0 +1,10 @@ +# This file can be used to set build configuration +# variables. These variables are defined in a file called +# "Makefile" that is located next to this one. + +# For instructions on how to use this system, see +# https://analogdevicesinc.github.io/msdk/USERGUIDE/#build-system + +# ********************************************************** + +# Add your config here! diff --git a/Libraries/Boards/MAX32690/EvKit_V1/examples.txt b/Libraries/Boards/MAX32690/EvKit_V1/examples.txt index 9db67d9e45..b748dbf709 100644 --- a/Libraries/Boards/MAX32690/EvKit_V1/examples.txt +++ b/Libraries/Boards/MAX32690/EvKit_V1/examples.txt @@ -42,6 +42,7 @@ GPIO HBMC Hello_World I2C +I2C_ADXL343 I2C_MNGR I2C_SCAN I2C_Sensor diff --git a/Libraries/PeriphDrivers/Source/I2C/i2c_me18.c b/Libraries/PeriphDrivers/Source/I2C/i2c_me18.c index b038559ed1..8188b32fed 100644 --- a/Libraries/PeriphDrivers/Source/I2C/i2c_me18.c +++ b/Libraries/PeriphDrivers/Source/I2C/i2c_me18.c @@ -74,10 +74,10 @@ int MXC_I2C_Init(mxc_i2c_regs_t *i2c, int masterMode, unsigned int slaveAddr) #endif } else if (i2c == MXC_I2C2) { MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_I2C2); -#ifndef MAX32690GTK_PACKAGE_TQFN MXC_GPIO_Config(&gpio_cfg_i2c2); -#endif +#ifndef MAX32690GTK_PACKAGE_TQFN MXC_GPIO_Config(&gpio_cfg_i2c2c); +#endif } else { return E_NO_DEVICE; } diff --git a/Libraries/PeriphDrivers/Source/I2C/i2c_reva.c b/Libraries/PeriphDrivers/Source/I2C/i2c_reva.c index d6fa41931d..c28aa3be13 100644 --- a/Libraries/PeriphDrivers/Source/I2C/i2c_reva.c +++ b/Libraries/PeriphDrivers/Source/I2C/i2c_reva.c @@ -994,7 +994,7 @@ int MXC_I2C_RevA_MasterTransaction(mxc_i2c_reva_req_t *req) } else { i2c->mstctrl |= MXC_F_I2C_REVA_MSTCTRL_STOP; - while (!(i2c->intfl0 & MXC_F_I2C_REVA_INTFL0_STOP)) {} + while (!(i2c->mstctrl & MXC_F_I2C_REVA_MSTCTRL_STOP)) {} // Wait for Transaction to finish }