Indentation fixes
- Fix dir-locals so emacs won't inject occasional tabs to case statements. - Fix stray tab indentation in example programs. (Thx @pfalcon for pointing this out)
This commit is contained in:
parent
a59b1565e4
commit
c09167715e
10 changed files with 234 additions and 226 deletions
|
|
@ -30,27 +30,27 @@ INLINED void gpio_enable(const uint8_t gpio_num, const gpio_direction_t directio
|
|||
|
||||
switch(direction) {
|
||||
case GPIO_INPUT:
|
||||
iomux_flags = 0;
|
||||
ctrl_val = GPIO_SOURCE_GPIO;
|
||||
break;
|
||||
iomux_flags = 0;
|
||||
ctrl_val = GPIO_SOURCE_GPIO;
|
||||
break;
|
||||
case GPIO_OUTPUT:
|
||||
iomux_flags = IOMUX_OE;
|
||||
ctrl_val = GPIO_DRIVE_PUSH_PULL|GPIO_SOURCE_GPIO;
|
||||
break;
|
||||
iomux_flags = IOMUX_OE;
|
||||
ctrl_val = GPIO_DRIVE_PUSH_PULL|GPIO_SOURCE_GPIO;
|
||||
break;
|
||||
case GPIO_OUT_OPEN_DRAIN:
|
||||
iomux_flags = IOMUX_OE;
|
||||
ctrl_val = GPIO_DRIVE_OPEN_DRAIN|GPIO_SOURCE_GPIO;
|
||||
break;
|
||||
iomux_flags = IOMUX_OE;
|
||||
ctrl_val = GPIO_DRIVE_OPEN_DRAIN|GPIO_SOURCE_GPIO;
|
||||
break;
|
||||
case GPIO_INPUT_PULLUP:
|
||||
iomux_flags = IOMUX_PU;
|
||||
ctrl_val = GPIO_SOURCE_GPIO;
|
||||
iomux_flags = IOMUX_PU;
|
||||
ctrl_val = GPIO_SOURCE_GPIO;
|
||||
}
|
||||
iomux_set_gpio_function(gpio_num, iomux_flags);
|
||||
GPIO_CTRL_REG(gpio_num) = (GPIO_CTRL_REG(gpio_num)&GPIO_INT_MASK) | ctrl_val;
|
||||
if(direction == GPIO_OUTPUT)
|
||||
GPIO_DIR_SET = BIT(gpio_num);
|
||||
GPIO_DIR_SET = BIT(gpio_num);
|
||||
else
|
||||
GPIO_DIR_CLEAR = BIT(gpio_num);
|
||||
GPIO_DIR_CLEAR = BIT(gpio_num);
|
||||
}
|
||||
|
||||
/* Disable GPIO on the specified pin, and set it Hi-Z.
|
||||
|
|
@ -71,9 +71,9 @@ INLINED void gpio_disable(const uint8_t gpio_num)
|
|||
INLINED void gpio_write(const uint8_t gpio_num, const uint32_t set)
|
||||
{
|
||||
if(set)
|
||||
GPIO_OUT_SET = BIT(gpio_num);
|
||||
GPIO_OUT_SET = BIT(gpio_num);
|
||||
else
|
||||
GPIO_OUT_CLEAR = BIT(gpio_num);
|
||||
GPIO_OUT_CLEAR = BIT(gpio_num);
|
||||
}
|
||||
|
||||
/* Toggle output of a pin
|
||||
|
|
@ -89,9 +89,9 @@ INLINED void gpio_toggle(const uint8_t gpio_num)
|
|||
task's pins, without needing to disable/enable interrupts.
|
||||
*/
|
||||
if(GPIO_OUT_REG & BIT(gpio_num))
|
||||
GPIO_OUT_CLEAR = BIT(gpio_num);
|
||||
GPIO_OUT_CLEAR = BIT(gpio_num);
|
||||
else
|
||||
GPIO_OUT_SET = BIT(gpio_num);
|
||||
GPIO_OUT_SET = BIT(gpio_num);
|
||||
}
|
||||
|
||||
/* Read input value of a GPIO pin.
|
||||
|
|
@ -120,10 +120,10 @@ extern void gpio_interrupt_handler(void);
|
|||
INLINED void gpio_set_interrupt(const uint8_t gpio_num, const gpio_interrupt_t int_type)
|
||||
{
|
||||
GPIO_CTRL_REG(gpio_num) = (GPIO_CTRL_REG(gpio_num)&~GPIO_INT_MASK)
|
||||
| (int_type & GPIO_INT_MASK);
|
||||
| (int_type & GPIO_INT_MASK);
|
||||
if(int_type != INT_NONE) {
|
||||
_xt_isr_attach(INUM_GPIO, gpio_interrupt_handler);
|
||||
_xt_isr_unmask(1<<INUM_GPIO);
|
||||
_xt_isr_attach(INUM_GPIO, gpio_interrupt_handler);
|
||||
_xt_isr_unmask(1<<INUM_GPIO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Part of esp-open-rtos
|
||||
* Copyright (C) 2015 Superhouse Automation Pty Ltd
|
||||
* BSD Licensed as described in the file LICENSE
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Mapping from register index to GPIO and from GPIO index to register
|
||||
number. DO NOT USE THESE IN YOUR CODE, call gpio_to_iomux(xxx) or
|
||||
|
|
@ -26,22 +26,21 @@ extern const IROM uint32_t IOMUX_TO_GPIO_MAP[];
|
|||
INLINED uint8_t gpio_to_iomux(const uint8_t gpio_number)
|
||||
{
|
||||
if(__builtin_constant_p(gpio_number)) {
|
||||
static const uint8_t _regs[] = _GPIO_TO_IOMUX;
|
||||
return _regs[gpio_number];
|
||||
static const uint8_t _regs[] = _GPIO_TO_IOMUX;
|
||||
return _regs[gpio_number];
|
||||
} else {
|
||||
return GPIO_TO_IOMUX_MAP[gpio_number];
|
||||
return GPIO_TO_IOMUX_MAP[gpio_number];
|
||||
}
|
||||
}
|
||||
|
||||
INLINED uint8_t iomux_to_gpio(const uint8_t iomux_number)
|
||||
{
|
||||
if(__builtin_constant_p(iomux_number)) {
|
||||
static const uint8_t _regs[] = _IOMUX_TO_GPIO;
|
||||
return _regs[iomux_number];
|
||||
static const uint8_t _regs[] = _IOMUX_TO_GPIO;
|
||||
return _regs[iomux_number];
|
||||
} else {
|
||||
return IOMUX_TO_GPIO_MAP[iomux_number];
|
||||
return IOMUX_TO_GPIO_MAP[iomux_number];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue