Skip to content

Commit

Permalink
fix(CMSIS, PeriphDrivers, Examples): Bug fixes for ME13, ME14 and ME1…
Browse files Browse the repository at this point in the history
…8 found in release testing (#759)
  • Loading branch information
Jacob-Scheiffler authored Oct 6, 2023
1 parent deaeeb8 commit e57fd9f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Examples/MAX32665/ADC/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,20 @@ int main(void)
overflow[3] = (MXC_ADC_GetData(&adc_val[3]) == E_OVERFLOW ? 1 : 0);

/* Display results on OLED display, display asterisk if overflow */
snprintf((char *)fmtstr, sizeof((char *)fmtstr), "0: 0x%04x%s 2: 0x%04x%s", adc_val[0],
snprintf((char *)fmtstr, sizeof(fmtstr), "0: 0x%04x%s 2: 0x%04x%s", adc_val[0],
overflow[0] ? "*" : " ", adc_val[2], overflow[2] ? "*" : " ");
printf("%s\n", fmtstr);

snprintf((char *)fmtstr, sizeof((char *)fmtstr), "1: 0x%04x%s 3: 0x%04x%s", adc_val[1],
snprintf((char *)fmtstr, sizeof(fmtstr), "1: 0x%04x%s 3: 0x%04x%s", adc_val[1],
overflow[1] ? "*" : " ", adc_val[3], overflow[3] ? "*" : " ");
printf("%s\n", fmtstr);
/* Determine if programmable limits on AIN1 were exceeded */
if (MXC_ADC_GetFlags() & (MXC_F_ADC_INTR_LO_LIMIT_IF | MXC_F_ADC_INTR_HI_LIMIT_IF)) {
snprintf((char *)fmtstr, sizeof((char *)fmtstr), " %s Limit on AIN0 ",
snprintf((char *)fmtstr, sizeof(fmtstr), " %s Limit on AIN0 ",
(MXC_ADC_GetFlags() & MXC_F_ADC_INTR_LO_LIMIT_IF) ? "Low" : "High");
MXC_ADC_ClearFlags(MXC_F_ADC_INTR_LO_LIMIT_IF | MXC_F_ADC_INTR_HI_LIMIT_IF);
} else {
snprintf((char *)fmtstr, sizeof((char *)fmtstr), " ");
snprintf((char *)fmtstr, sizeof(fmtstr), " ");
}
printf("%s\n", fmtstr);

Expand Down
11 changes: 11 additions & 0 deletions Examples/MAX32690/USB_CompositeDevice_MSC_HID/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "msc.h"
#include "descriptors.h"
#include "mscmem.h"
#include "nvic_table.h"

/* **** Definitions **** */
#define EVENT_ENUM_COMP MAXUSB_NUM_EVENTS
Expand Down Expand Up @@ -113,15 +114,25 @@ int Hid_SW_Init(void)
}

/******************************************************************************/
void HID_SW_Handler(void)
{
MXC_GPIO_Handler(MXC_GPIO_GET_IDX(hid_sw[0].port));
}

int Hid_SW_RegisterCallback(unsigned int pb, pb_callback callback)
{
if (pb != 0) {
return E_INVALID;
}

if (callback) {
// Register callback
MXC_GPIO_RegisterCallback(&hid_sw[pb], callback, (void *)pb);

// Configure and enable interrupt
MXC_GPIO_IntConfig(&hid_sw[pb], MXC_GPIO_INT_FALLING);
MXC_GPIO_EnableInt(hid_sw[pb].port, hid_sw[pb].mask);
MXC_NVIC_SetVector(MXC_GPIO_GET_IRQ(MXC_GPIO_GET_IDX(hid_sw[pb].port)), HID_SW_Handler);
NVIC_EnableIRQ(MXC_GPIO_GET_IRQ(MXC_GPIO_GET_IDX(hid_sw[pb].port)));
} else { // Disable interrupt and clear callback
MXC_GPIO_DisableInt(hid_sw[pb].port, hid_sw[pb].mask);
Expand Down
11 changes: 11 additions & 0 deletions Examples/MAX32690/USB_HIDKeyboard/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "enumerate.h"
#include "hid_kbd.h"
#include "descriptors.h"
#include "nvic_table.h"

/***** Definitions *****/
#define EVENT_ENUM_COMP MAXUSB_NUM_EVENTS
Expand Down Expand Up @@ -99,15 +100,25 @@ int Hid_SW_Init(void)
}

/******************************************************************************/
void HID_SW_Handler(void)
{
MXC_GPIO_Handler(MXC_GPIO_GET_IDX(hid_sw[0].port));
}

int Hid_SW_RegisterCallback(unsigned int pb, pb_callback callback)
{
if (pb != 0) {
return E_INVALID;
}

if (callback) {
// Register callback
MXC_GPIO_RegisterCallback(&hid_sw[pb], callback, (void *)pb);

// Configure and enable interrupt
MXC_GPIO_IntConfig(&hid_sw[pb], MXC_GPIO_INT_FALLING);
MXC_GPIO_EnableInt(hid_sw[pb].port, hid_sw[pb].mask);
MXC_NVIC_SetVector(MXC_GPIO_GET_IRQ(MXC_GPIO_GET_IDX(hid_sw[pb].port)), HID_SW_Handler);
NVIC_EnableIRQ(MXC_GPIO_GET_IRQ(MXC_GPIO_GET_IDX(hid_sw[pb].port)));
} else { // Disable interrupt and clear callback
MXC_GPIO_DisableInt(hid_sw[pb].port, hid_sw[pb].mask);
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CMSIS/Device/Maxim/MAX32570/Include/owm_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ typedef struct {
#define MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE_POS 4 /**< CTRL_STAT_OD_SPEC_MODE Position */
#define MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE ((uint32_t)(0x1UL << MXC_F_OWM_CTRL_STAT_OD_SPEC_MODE_POS)) /**< CTRL_STAT_OD_SPEC_MODE Mask */

#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS 5 /**< CTRL_STAT_PRESENCE_DETECT Position */
#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS 7 /**< CTRL_STAT_PRESENCE_DETECT Position */
#define MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT ((uint32_t)(0x1UL << MXC_F_OWM_CTRL_STAT_PRESENCE_DETECT_POS)) /**< CTRL_STAT_PRESENCE_DETECT Mask */

/**@} end of group OWM_CTRL_STAT_Register */
Expand Down
2 changes: 1 addition & 1 deletion Libraries/PeriphDrivers/Source/OWM/owm_reva_me13.svd
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<field>
<name>presence_detect</name>
<description>Presence Pulse Detected.</description>
<bitRange>[5:5]</bitRange>
<bitRange>[7:7]</bitRange>
<access>read-only</access>
</field>
</fields>
Expand Down

0 comments on commit e57fd9f

Please sign in to comment.