Skip to content

Commit

Permalink
clang-format bot reformatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
sihyung-maxim committed Jan 23, 2024
1 parent a424100 commit f399124
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Libraries/Boards/MAX32572/EvKit_V1/Include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int MXC_Ext_Write(uint32_t address, uint32_t length, uint8_t *buffer);
* @return #EF_E_SUCCESS If function is successful.
* @note make sure to disable SFCC and interrupts; before running this function
*/
int MXC_Ext_Read(int address, uint8_t* buffer, int len);
int MXC_Ext_Read(int address, uint8_t *buffer, int len);

/**
* @brief Erases the sector of external flash at the specified address.
Expand Down
14 changes: 7 additions & 7 deletions Libraries/CMSIS/Include/core_rv32.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,16 @@ typedef struct {
#define NVIC_STIR_INTID_Msk (0x1FFUL << NVIC_STIR_INTID_Pos) /*!< STIR: INTLINESNUM Mask */

/*@} end of group CMSIS_NVIC */

/* For MCUs with extra RISCV core (RISCV1) */
#ifdef __riscv1
#define MXC_BASE_INTR ((uint32_t)0xE5170000UL)
#define MXC_BASE_EVENT ((uint32_t)0xE5170020UL)
#define MXC_BASE_SLEEP ((uint32_t)0xE5170040UL)
#define MXC_BASE_INTR ((uint32_t)0xE5170000UL)
#define MXC_BASE_EVENT ((uint32_t)0xE5170020UL)
#define MXC_BASE_SLEEP ((uint32_t)0xE5170040UL)
#else
#define MXC_BASE_INTR ((uint32_t)0xE5070000UL)
#define MXC_BASE_EVENT ((uint32_t)0xE5070020UL)
#define MXC_BASE_SLEEP ((uint32_t)0xE5070040UL)
#define MXC_BASE_INTR ((uint32_t)0xE5070000UL)
#define MXC_BASE_EVENT ((uint32_t)0xE5070020UL)
#define MXC_BASE_SLEEP ((uint32_t)0xE5070040UL)
#endif

#define MXC_INTR ((mxc_intr_regs_t *)MXC_BASE_INTR)
Expand Down
4 changes: 2 additions & 2 deletions Libraries/MiscDrivers/ExtMemory/Ext_Flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ extern "C" {
#endif

#ifdef EXT_FLASH_READ_DUMMY
// Deprecated name. Please use EXT_FLASH_READ_DUMMY
#define EXT_FLASH_Read_DUMMY EXT_FLASH_READ_DUMMY
// Deprecated name. Please use EXT_FLASH_READ_DUMMY
#define EXT_FLASH_Read_DUMMY EXT_FLASH_READ_DUMMY
#endif

/**
Expand Down
2 changes: 0 additions & 2 deletions Libraries/MiscDrivers/ExtMemory/is25.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#define IS25_WEL_MASK 0x02 /**< Status Reg-1: Write Enable Latch mask */
#define IS25_QE_MASK 0x40 /**< Status Reg-2: Quad-SPI enable mask */


#define IS25_DEVICE_SIZE 0x1000000
#define IS25_BLOCK_SIZE 0x10000
#define IS25_PAGE_SIZE 256
Expand Down Expand Up @@ -245,7 +244,6 @@ uint32_t Ext_Flash_ID(void)
uint8_t cmd = IS25_CMD_ID;
uint8_t id[IS25_ID_LEN];


// Send the command
if ((err = g_cfg.write(&cmd, 1, 0, Ext_Flash_DataLine_Single)) != EF_E_SUCCESS) {
return err;
Expand Down
22 changes: 13 additions & 9 deletions Libraries/MiscDrivers/Touchscreen/tsc2007.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ int ts_event = false;

uint16_t tsX, tsY, tsZ1;

static uint8_t tsConstructCommand(mxc_ts_cmd_func_t function, mxc_ts_cmd_pdown_t pdown, mxc_ts_cmd_mode_t mode)
static uint8_t tsConstructCommand(mxc_ts_cmd_func_t function, mxc_ts_cmd_pdown_t pdown,
mxc_ts_cmd_mode_t mode)
{
// Bits D7-D4: C3-C0 => converter function select bits
// Bits D3-D2: PD1-PD0 => power-down bits
// Bits D1: M => mode bit
// Bits D0: X => don't care
uint8_t command = (uint8_t) function << 4;
command |= (uint8_t) pdown << 2;
command |= (uint8_t) mode << 1;
uint8_t command = (uint8_t)function << 4;
command |= (uint8_t)pdown << 2;
command |= (uint8_t)mode << 1;
return command;
}

Expand Down Expand Up @@ -111,11 +112,12 @@ static int tsGetXY(uint16_t *x, uint16_t *y)

// Wait Release
do {
TS_I2C_Transmit(tsConstructCommand(TSC_MEASURE_Z1, TSC_ADC_ON_IRQ_DIS_0, TSC_12_BIT), &tsZ1);
TS_I2C_Transmit(tsConstructCommand(TSC_MEASURE_Z1, TSC_ADC_ON_IRQ_DIS_0, TSC_12_BIT),
&tsZ1);
} while (tsZ1 & ADC_Z_THRESHOLD);

*x = (((tsX-ADC_X_MIN) * X_RES_T) / (ADC_X_MAX-ADC_X_MIN));
*y = (((tsY-ADC_Y_MIN) * Y_RES_T) / (ADC_Y_MAX-ADC_Y_MIN));
*x = (((tsX - ADC_X_MIN) * X_RES_T) / (ADC_X_MAX - ADC_X_MIN));
*y = (((tsY - ADC_Y_MIN) * Y_RES_T) / (ADC_Y_MAX - ADC_Y_MIN));

#if (FLIP_SCREEN == 1)
*x = X_RES_T - *x;
Expand Down Expand Up @@ -159,7 +161,8 @@ static void tsHandler(void)
if (pressed_key == 0) { // wait until prev key process
for (i = 0; i < TS_MAX_BUTTONS; i++) {
if (ts_buttons[i].key_code != TS_INVALID_KEY_CODE) {
if (isInBox(g_x, g_y, ts_buttons[i].x0, ts_buttons[i].y0, ts_buttons[i].x1, ts_buttons[i].y1)) {
if (isInBox(g_x, g_y, ts_buttons[i].x0, ts_buttons[i].y0, ts_buttons[i].x1,
ts_buttons[i].y1)) {
// pressed key
pressed_key = ts_buttons[i].key_code;
break;
Expand Down Expand Up @@ -273,7 +276,8 @@ void MXC_TS_RemoveButton(int x0, int y0, int x1, int y1)

for (i = 0; i < TS_MAX_BUTTONS; i++) {
if (ts_buttons[i].key_code != TS_INVALID_KEY_CODE) {
if (isInBox(x0, y0, ts_buttons[i].x0, ts_buttons[i].y0, ts_buttons[i].x1, ts_buttons[i].y1)) {
if (isInBox(x0, y0, ts_buttons[i].x0, ts_buttons[i].y0, ts_buttons[i].x1,
ts_buttons[i].y1)) {
// clear flag
ts_buttons[i].key_code = TS_INVALID_KEY_CODE;
}
Expand Down
38 changes: 16 additions & 22 deletions Libraries/MiscDrivers/Touchscreen/tsc2007.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <i2c.h>
#include <gpio.h>


#ifndef TS_MAX_BUTTONS
#define TS_MAX_BUTTONS 16
#endif
Expand All @@ -34,32 +33,27 @@
#define TSC2007_I2C_TARGET_ADDRESS 0x48

typedef enum {
TSC_MEASURE_TEMP0 = 0b0000,
TSC_MEASURE_AUX = 0b0010,
TSC_MEASURE_TEMP1 = 0b0100,
TSC_ACTIVATE_X_NEGATIVE = 0b1000,
TSC_ACTIVATE_Y_NEGATIVE = 0b1001,
TSC_ACTIVATE_Y_POSITIVE_X_NEGATIVE = 0b1010,
TSC_SETUP_COMMAND = 0b1011,
TSC_MEASURE_X = 0b1100,
TSC_MEASURE_Y = 0b1101,
TSC_MEASURE_Z1 = 0b1110,
TSC_MEASURE_Z2 = 0b1111
TSC_MEASURE_TEMP0 = 0b0000,
TSC_MEASURE_AUX = 0b0010,
TSC_MEASURE_TEMP1 = 0b0100,
TSC_ACTIVATE_X_NEGATIVE = 0b1000,
TSC_ACTIVATE_Y_NEGATIVE = 0b1001,
TSC_ACTIVATE_Y_POSITIVE_X_NEGATIVE = 0b1010,
TSC_SETUP_COMMAND = 0b1011,
TSC_MEASURE_X = 0b1100,
TSC_MEASURE_Y = 0b1101,
TSC_MEASURE_Z1 = 0b1110,
TSC_MEASURE_Z2 = 0b1111
} mxc_ts_cmd_func_t;


typedef enum {
TSC_POWER_DOWN_IRQ_EN = 0b00,
TSC_ADC_ON_IRQ_DIS_0 = 0b01,
TSC_ADC_OFF_IRQ_EN = 0b10,
TSC_ADC_ON_IRQ_DIS_1 = 0b11
TSC_POWER_DOWN_IRQ_EN = 0b00,
TSC_ADC_ON_IRQ_DIS_0 = 0b01,
TSC_ADC_OFF_IRQ_EN = 0b10,
TSC_ADC_ON_IRQ_DIS_1 = 0b11
} mxc_ts_cmd_pdown_t;

typedef enum {
TSC_12_BIT = 0b0,
TSC_8_BIT = 0b1
} mxc_ts_cmd_mode_t;

typedef enum { TSC_12_BIT = 0b0, TSC_8_BIT = 0b1 } mxc_ts_cmd_mode_t;

typedef struct {
mxc_i2c_regs_t *regs; // The I2C instance the touchscreen controller is connected to
Expand Down
3 changes: 2 additions & 1 deletion Libraries/PeriphDrivers/Include/MAX32520/tmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ typedef enum {
MXC_TMR_PRES_512 = MXC_F_TMR_CN_PRES3 | MXC_S_TMR_CN_PRES_DIV2, ///< Divide input clock by 512
MXC_TMR_PRES_1024 = MXC_F_TMR_CN_PRES3 | MXC_S_TMR_CN_PRES_DIV4, ///< Divide input clock by 1024
MXC_TMR_PRES_2048 = MXC_F_TMR_CN_PRES3 | MXC_S_TMR_CN_PRES_DIV8, ///< Divide input clock by 2048
MXC_TMR_PRES_4096 = MXC_F_TMR_CN_PRES3 | MXC_S_TMR_CN_PRES_DIV16, ///< Divide input clock by 4096
MXC_TMR_PRES_4096 = MXC_F_TMR_CN_PRES3 |
MXC_S_TMR_CN_PRES_DIV16, ///< Divide input clock by 4096

// Legacy names
TMR_PRES_1 = MXC_TMR_PRES_1,
Expand Down
14 changes: 7 additions & 7 deletions Libraries/PeriphDrivers/Include/MAX32572/sfcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,32 @@ extern "C" {
* @brief Enumeration type for the Cache ID Register
*/
typedef enum {
SFCC_INFO_RELNUM, ///< Identifies the Release Number
SFCC_INFO_PARTNUM, ///< Specifies the value of Cache ID Part Number
SFCC_INFO_ID ///< Specifies the value of Cache ID
SFCC_INFO_RELNUM, ///< Identifies the Release Number
SFCC_INFO_PARTNUM, ///< Specifies the value of Cache ID Part Number
SFCC_INFO_ID ///< Specifies the value of Cache ID
} mxc_sfcc_info_t;

/**
* @brief Reads the data from the Cache Id Register.
* @param cid Enumeration type for Cache Id Register.
* @retval Returns the contents of Cache Id Register.
*/
int MXC_SFCC_ID (mxc_sfcc_info_t cid);
int MXC_SFCC_ID(mxc_sfcc_info_t cid);

/**
* @brief Enable the instruction cache controller.
*/
void MXC_SFCC_Enable (void);
void MXC_SFCC_Enable(void);

/**
* @brief Disable the instruction cache controller.
*/
void MXC_SFCC_Disable (void);
void MXC_SFCC_Disable(void);

/**
* @brief Flush the instruction cache controller.
*/
void MXC_SFCC_Flush (void);
void MXC_SFCC_Flush(void);

/**@} end of group sfcc */

Expand Down
13 changes: 6 additions & 7 deletions Libraries/PeriphDrivers/Source/SFCC/sfcc_me55.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,29 @@

int MXC_SFCC_ID(mxc_sfcc_info_t cid)
{
return MXC_SFCC_RevA_ID ((mxc_sfcc_reva_regs_t*) MXC_SFCC, cid);
return MXC_SFCC_RevA_ID((mxc_sfcc_reva_regs_t *)MXC_SFCC, cid);
}

void MXC_SFCC_Enable(void)
{
MXC_SFCC_RevA_Enable ((mxc_sfcc_reva_regs_t*) MXC_SFCC);
MXC_SFCC_RevA_Enable((mxc_sfcc_reva_regs_t *)MXC_SFCC);
}

void MXC_SFCC_Disable(void)
{
MXC_SFCC_RevA_Disable ((mxc_sfcc_reva_regs_t*) MXC_SFCC);
MXC_SFCC_RevA_Disable((mxc_sfcc_reva_regs_t *)MXC_SFCC);
}

void MXC_SFCC_Flush(void)
{
{
/* NOTE: MEMPROT authentication bytes are not flushed with the SFCC invalidate bits,
* the GCR SFCC flush is required.
*/
/* Flush all instruction caches */
MXC_GCR->sysctrl |= MXC_F_GCR_SYSCTRL_SFCC_FLUSH;

/* Wait for flush to complete */
while (MXC_GCR->sysctrl & MXC_F_GCR_SYSCTRL_SFCC_FLUSH) {
}
while (MXC_GCR->sysctrl & MXC_F_GCR_SYSCTRL_SFCC_FLUSH) {}

MXC_SFCC_Disable();
MXC_SFCC_Enable();
Expand Down
11 changes: 7 additions & 4 deletions Libraries/PeriphDrivers/Source/SPIXF/spixf_me55.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@
* executing from RAM.
*/
// Non-const version of 'gpio_cfg_spixf' pin set.
mxc_gpio_cfg_t gpio_cfg_spixf_ram = { MXC_GPIO1, (MXC_GPIO_PIN_22 | MXC_GPIO_PIN_23 | MXC_GPIO_PIN_24 |
MXC_GPIO_PIN_25 | MXC_GPIO_PIN_26 | MXC_GPIO_PIN_27), MXC_GPIO_FUNC_ALT1,
MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 };
mxc_gpio_cfg_t gpio_cfg_spixf_ram = { MXC_GPIO1,
(MXC_GPIO_PIN_22 | MXC_GPIO_PIN_23 | MXC_GPIO_PIN_24 |
MXC_GPIO_PIN_25 | MXC_GPIO_PIN_26 | MXC_GPIO_PIN_27),
MXC_GPIO_FUNC_ALT1,
MXC_GPIO_PAD_NONE,
MXC_GPIO_VSSEL_VDDIO,
MXC_GPIO_DRVSTR_0 };

#if IAR_PRAGMAS
#pragma section = ".spix_config"
Expand Down Expand Up @@ -70,7 +74,6 @@ static int MXC_GPIO_Config_SPIXF(mxc_gpio_cfg_t *cfg)
port->ds1 &= ~(cfg->mask);

return E_NO_ERROR;

}
#endif

Expand Down
10 changes: 5 additions & 5 deletions Libraries/PeriphDrivers/Source/SPIXF/spixf_reva.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ static void SPIXFC_TransHandler(mxc_spixfc_reva_regs_t *spixfc,
mxc_spixfc_fifo_reva_regs_t *spixfc_fifo, mxc_spixf_req_t *req);

#if defined(SPIXF_RAM)
static int MXC_GetLock_SPIXF(uint32_t *lock, uint32_t value);
static void MXC_FreeLock_SPIXF(uint32_t *lock);
static int MXC_GetLock_SPIXF(uint32_t *lock, uint32_t value);
static void MXC_FreeLock_SPIXF(uint32_t *lock);
#endif

/******* Globals *******/
Expand Down Expand Up @@ -125,7 +125,8 @@ void MXC_SPIXF_RevA_Shutdown(mxc_spixfc_reva_regs_t *spixfc)
}

void MXC_SPIXF_RevA_IOCtrl(mxc_spixfm_reva_regs_t *spixfm, mxc_spixf_ds_t sclk_ds,
mxc_spixf_ds_t ss_ds, mxc_spixf_ds_t sdio_ds, mxc_spixf_padctrl_t padctrl)
mxc_spixf_ds_t ss_ds, mxc_spixf_ds_t sdio_ds,
mxc_spixf_padctrl_t padctrl)
{
spixfm->io_ctrl = 0;

Expand Down Expand Up @@ -260,7 +261,7 @@ int MXC_SPIXF_RevA_Transaction(mxc_spixfc_reva_regs_t *spixfc,
return E_BUSY;
}
#else
// Lock this SPIXFC
// Lock this SPIXFC
if (MXC_GetLock((uint32_t *)&states.req, 1) != E_NO_ERROR) {
return E_BUSY;
}
Expand Down Expand Up @@ -1507,7 +1508,6 @@ int MXC_GetLock_SPIXF(uint32_t *lock, uint32_t value)
}
#endif


// MXC_FreeLock
#if defined(SPIXF_RAM)
#if IAR_PRAGMAS
Expand Down
8 changes: 6 additions & 2 deletions Libraries/PeriphDrivers/Source/SPIXF/spixf_reva.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ uint8_t MXC_SPIXF_RevA_GetIoctrlSCLKDrive(mxc_spixfm_reva_regs_t *spixfm);
void MXC_SPIXF_RevA_SetIoctrlSSDriveHigh(mxc_spixfm_reva_regs_t *spixfm);
void MXC_SPIXF_RevA_SetIoctrlSSDriveLow(mxc_spixfm_reva_regs_t *spixfm);
uint8_t MXC_SPIXF_RevA_GetIoctrlSSDrive(mxc_spixfm_reva_regs_t *spixfm);
void MXC_SPIXF_RevA_SetPuPdCtrl(mxc_spixfm_reva_regs_t *spixfm, mxc_spixf_padctrl_t pad); // Legacy Name. Will start using SetPadCtrl going forward. 1-23-2023
uint8_t MXC_SPIXF_RevA_GetPuPdCtrl(mxc_spixfm_reva_regs_t *spixfm); // Legacy Name. Will start using GetPadCtrl going forward. 1-23-2023
void MXC_SPIXF_RevA_SetPuPdCtrl(
mxc_spixfm_reva_regs_t *spixfm,
mxc_spixf_padctrl_t pad); // Legacy Name. Will start using SetPadCtrl going forward. 1-23-2023
uint8_t MXC_SPIXF_RevA_GetPuPdCtrl(
mxc_spixfm_reva_regs_t
*spixfm); // Legacy Name. Will start using GetPadCtrl going forward. 1-23-2023
void MXC_SPIXF_RevA_SetPadCtrl(mxc_spixfm_reva_regs_t *spixfm, mxc_spixf_padctrl_t pad);
uint8_t MXC_SPIXF_RevA_GetPadCtrl(mxc_spixfm_reva_regs_t *spixfm);
void MXC_SPIXF_RevA_SetSCKDriveHigh(mxc_spixfc_reva_regs_t *spixfc);
Expand Down

0 comments on commit f399124

Please sign in to comment.