digital IO write optimizations for 16bit parallel display types
- digitalWrite value increased to 16 bit width - added IO device bit access functions - removed PWM enable/disable from pinMode()
This commit is contained in:
parent
b8afde026a
commit
04cf037a1d
|
@ -121,7 +121,7 @@ void pinMode(uint8 pin, WiringPinMode mode);
|
|||
* @param value Either LOW (write a 0) or HIGH (write a 1).
|
||||
* @see pinMode()
|
||||
*/
|
||||
void digitalWrite(uint8 pin, uint8 value);
|
||||
void digitalWrite(uint8 pin, uint16 value);
|
||||
|
||||
/**
|
||||
* Read a digital value from a pin. The pin must have its mode set to
|
||||
|
|
|
@ -60,10 +60,12 @@ static inline afio_exti_port gpio_exti_port(const gpio_dev *dev) {
|
|||
* @param val If true, set the pin. If false, reset the pin.
|
||||
*/
|
||||
static inline void gpio_write_pin(uint8_t pin, uint16 val) {
|
||||
uint16_t bit = BIT(pin&0x0F);
|
||||
gpio_reg_map *regs = (PIN_MAP[pin].gpio_device)->regs;
|
||||
if (val) {
|
||||
(PIN_MAP[pin].gpio_device)->regs->BSRRL = BIT(pin&0x0F);
|
||||
regs->BSRRL = bit;
|
||||
} else {
|
||||
(PIN_MAP[pin].gpio_device)->regs->BSRRH = BIT(pin&0x0F);
|
||||
regs->BSRRH = bit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,10 +73,18 @@ static inline void gpio_set_pin(uint8_t pin) {
|
|||
(PIN_MAP[pin].gpio_device)->regs->BSRRL = BIT(pin&0x0F);
|
||||
}
|
||||
|
||||
static inline void gpio_set_dev_bit(const gpio_dev * dev, uint8_t bit) {
|
||||
dev->regs->BSRRL = BIT(bit);
|
||||
}
|
||||
|
||||
static inline void gpio_clear_pin(uint8_t pin) {
|
||||
(PIN_MAP[pin].gpio_device)->regs->BSRRH = BIT(pin&0x0F);
|
||||
}
|
||||
|
||||
static inline void gpio_clear_dev_bit(const gpio_dev * dev, uint8_t bit) {
|
||||
dev->regs->BSRRH = BIT(bit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not a GPIO pin is set.
|
||||
*
|
||||
|
|
|
@ -73,14 +73,14 @@ void pinMode(uint8 pin, WiringPinMode mode) {
|
|||
}
|
||||
|
||||
gpio_set_mode(pin, outputMode);
|
||||
|
||||
/*
|
||||
if (PIN_MAP[pin].timer_device != NULL) {
|
||||
/* Enable/disable timer channels if we're switching into or
|
||||
* out of PWM. */
|
||||
// Enable/disable timer channels if we're switching into or out of PWM.
|
||||
timer_set_mode(PIN_MAP[pin].timer_device,
|
||||
PIN_MAP[pin].timer_channel,
|
||||
pwm ? TIMER_PWM : TIMER_DISABLED);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue