Skip to content

Commit b026524

Browse files
Fixed automerge problems.
1 parent 20e6a05 commit b026524

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

targets/TARGET_ONSEMI/TARGET_NCS36510/clock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
#define CLOCK_ENABLE(a) CLOCKREG->PDIS.WORD &= ~(1 << a)
8484
#define CLOCK_DISABLE(a) CLOCKREG->PDIS.WORD |= (uint32_t)(1 << a)
85-
#define CLOCK_IS_ENABLED(a) (((CLOCKREG->PDIS.WORD) >> a) & 1)?0:1
85+
#define CLOCK_IS_ENABLED(a) (((CLOCKREG->PDIS.WORD >> a) & 1)?0:1)
8686

8787
/*************************************************************************************************
8888
* *

targets/TARGET_ONSEMI/TARGET_NCS36510/gpio_api.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ void gpio_init(gpio_t *obj, PinName pin)
109109
/** - Get PAD IO register address for the PAD number */
110110
PadReg_t *PadRegOffset = (PadReg_t*)(PADREG_BASE + (pin * PAD_REG_ADRS_BYTE_SIZE));
111111

112-
/* - Disable the GPIO clock */
113-
CLOCK_DISABLE(CLOCK_GPIO);
114-
115112
/** - Enable the clock for PAD peripheral device */
116113
CLOCK_ENABLE(CLOCK_PAD);
117114

@@ -153,8 +150,6 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
153150
obj->GPIOMEMBASE->W_OUT = obj->gpioMask;
154151
}
155152

156-
/* - Disable the GPIO clock */
157-
CLOCK_DISABLE(CLOCK_GPIO);
158153
}
159154

160155
/** Set the output value
@@ -164,6 +159,7 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
164159
*/
165160
void gpio_write(gpio_t *obj, int value)
166161
{
162+
167163
/* Enable the GPIO clock */
168164
if(!CLOCK_IS_ENABLED(CLOCK_GPIO)) {
169165
CLOCK_ENABLE(CLOCK_GPIO);
@@ -176,8 +172,6 @@ void gpio_write(gpio_t *obj, int value)
176172
obj->GPIOMEMBASE->R_IRQ_W_CLEAR = obj->gpioMask;
177173
}
178174

179-
/* - Disable the GPIO clock */
180-
CLOCK_DISABLE(CLOCK_GPIO);
181175
}
182176

183177
/** Read the input value
@@ -196,8 +190,5 @@ int gpio_read(gpio_t *obj)
196190

197191
ret = (obj->GPIOMEMBASE->R_STATE_W_SET & obj->gpioMask) ? 1: 0;
198192

199-
/* - Disable the GPIO clock */
200-
CLOCK_DISABLE(CLOCK_GPIO);
201-
202193
return ret;
203194
}

targets/TARGET_ONSEMI/TARGET_NCS36510/gpio_irq_api.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void fGpioHandler(void)
8686
{
8787
uint8_t index;
8888
uint32_t active_interrupts = 0;
89-
gpio_irq_event event;
89+
gpio_irq_event event = IRQ_NONE;
9090
GpioReg_pt gpioBase;
9191

9292
/* Enable the GPIO clock */
@@ -108,12 +108,9 @@ void fGpioHandler(void)
108108
if ((gpioBase->IRQ_POLARITY_SET >> index) &0x01) {
109109
/* Edge triggered high */
110110
event = IRQ_RISE;
111-
} else if ((gpioBase->IRQ_POLARITY_CLEAR >> index) &0x01) {
111+
} else {
112112
/* Edge triggered low */
113113
event = IRQ_FALL;
114-
} else {
115-
/* Edge none */
116-
event = IRQ_NONE;
117114
}
118115
}
119116
gpioBase->IRQ_CLEAR = (0x1 << index);
@@ -156,10 +153,6 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
156153
obj->GPIOMEMBASE = GPIOREG;
157154

158155
/* Set default values for the pin interrupt */
159-
/* TODO: Only one DIO line is configured using this function; overrides other DIO line setting
160-
* If mbed layer wants to call this function repeatedly for setting multiple DIO lines as input
161-
* then change this setting to obj->GPIOMEMBASE->W_IN |= obj->pinMask. All parameter setting needs to change from = to |=
162-
*/
163156
obj->GPIOMEMBASE->W_IN = obj->pinMask;
164157
obj->GPIOMEMBASE->IRQ_EDGE = obj->pinMask;
165158
obj->GPIOMEMBASE->IRQ_POLARITY_SET = obj->pinMask;
@@ -185,8 +178,8 @@ void gpio_irq_free(gpio_irq_t *obj)
185178
CLOCK_ENABLE(CLOCK_GPIO);
186179
}
187180

188-
/* Make the pin as output in order to release it */
189-
obj->GPIOMEMBASE->W_OUT = obj->pinMask;
181+
/* Disable IRQs to indicate that it is now free */
182+
obj->GPIOMEMBASE->IRQ_ENABLE_CLEAR = obj->pinMask;
190183
gpioIds[obj->pin] = 0;
191184
}
192185

@@ -198,7 +191,6 @@ void gpio_irq_free(gpio_irq_t *obj)
198191
*/
199192
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
200193
{
201-
202194
/* Enable the GPIO clock */
203195
if(!CLOCK_IS_ENABLED(CLOCK_GPIO)) {
204196
CLOCK_ENABLE(CLOCK_GPIO);
@@ -266,6 +258,7 @@ void gpio_irq_enable(gpio_irq_t *obj)
266258
*/
267259
void gpio_irq_disable(gpio_irq_t *obj)
268260
{
261+
269262
/* Enable the GPIO clock */
270263
if(!CLOCK_IS_ENABLED(CLOCK_GPIO)) {
271264
CLOCK_ENABLE(CLOCK_GPIO);

0 commit comments

Comments
 (0)