Skip to content

Commit

Permalink
k20dx - Remove superficial read modify write
Browse files Browse the repository at this point in the history
Do not read the GPIO PCOR register before writing to it. This register
always has the value zero. This makes it clear that this operation will
not have side effects aside from clearing the desired bit.
  • Loading branch information
c1728p9 committed Jan 6, 2017
1 parent cb4905b commit 7d6394f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/hic_hal/freescale/k20dx/DAP_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ static inline void PORT_SWD_SETUP(void)
PIN_SWD_NOE_GPIO->PCOR = 1 << PIN_SWD_NOE_BIT;
PIN_nRESET_GPIO->PSOR = 1 << PIN_nRESET_BIT;
PIN_SWD_NOE_GPIO->PDDR = PIN_SWD_NOE_GPIO->PDDR | (1 << PIN_SWD_NOE_BIT);
PIN_SWD_NOE_GPIO->PCOR = PIN_SWD_NOE_GPIO->PCOR | (1 << PIN_SWD_NOE_BIT);
PIN_SWDIO_NOE_GPIO->PCOR = PIN_SWDIO_NOE_GPIO->PCOR | (1 << PIN_SWDIO_NOE_BIT);
PIN_SWD_NOE_GPIO->PCOR = 1 << PIN_SWD_NOE_BIT;
PIN_SWDIO_NOE_GPIO->PCOR = 1 << PIN_SWDIO_NOE_BIT;
PIN_nRESET_GPIO->PSOR = PIN_nRESET;
PIN_nRESET_GPIO->PDDR |= PIN_nRESET; //output
PIN_nRESET_PORT->PCR[PIN_nRESET_BIT] = PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_PFE_MASK | PORT_PCR_MUX(1);
Expand Down
2 changes: 1 addition & 1 deletion source/hic_hal/freescale/k20dx/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void gpio_init(void)
LED_CONNECTED_GPIO->PDOR = 1UL << LED_CONNECTED_BIT;
LED_CONNECTED_GPIO->PDDR = 1UL << LED_CONNECTED_BIT;
// led on
LED_CONNECTED_GPIO->PCOR |= 1UL << LED_CONNECTED_BIT;
LED_CONNECTED_GPIO->PCOR = 1UL << LED_CONNECTED_BIT;
// reset button configured as gpio input
PIN_nRESET_GPIO->PDDR &= ~PIN_nRESET;
PIN_nRESET_PORT->PCR[PIN_nRESET_BIT] = PORT_PCR_MUX(1);
Expand Down

0 comments on commit 7d6394f

Please sign in to comment.