File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ void pinMode(uint8 pin, WiringPinMode mode);
121121 * @param value Either LOW (write a 0) or HIGH (write a 1).
122122 * @see pinMode()
123123 */
124- void digitalWrite (uint8 pin , uint8 value );
124+ void digitalWrite (uint8 pin , uint16 value );
125125
126126/**
127127 * Read a digital value from a pin. The pin must have its mode set to
Original file line number Diff line number Diff line change @@ -60,21 +60,31 @@ static inline afio_exti_port gpio_exti_port(const gpio_dev *dev) {
6060 * @param val If true, set the pin. If false, reset the pin.
6161 */
6262static inline void gpio_write_pin (uint8_t pin , uint16 val ) {
63+ uint16_t bit = BIT (pin & 0x0F );
64+ gpio_reg_map * regs = (PIN_MAP [pin ].gpio_device )-> regs ;
6365 if (val ) {
64- ( PIN_MAP [ pin ]. gpio_device ) -> regs -> BSRRL = BIT ( pin & 0x0F ) ;
66+ regs -> BSRRL = bit ;
6567 } else {
66- ( PIN_MAP [ pin ]. gpio_device ) -> regs -> BSRRH = BIT ( pin & 0x0F ) ;
68+ regs -> BSRRH = bit ;
6769 }
6870}
6971
7072static inline void gpio_set_pin (uint8_t pin ) {
7173 (PIN_MAP [pin ].gpio_device )-> regs -> BSRRL = BIT (pin & 0x0F );
7274}
7375
76+ static inline void gpio_set_dev_bit (const gpio_dev * dev , uint8_t bit ) {
77+ dev -> regs -> BSRRL = BIT (bit );
78+ }
79+
7480static inline void gpio_clear_pin (uint8_t pin ) {
7581 (PIN_MAP [pin ].gpio_device )-> regs -> BSRRH = BIT (pin & 0x0F );
7682}
7783
84+ static inline void gpio_clear_dev_bit (const gpio_dev * dev , uint8_t bit ) {
85+ dev -> regs -> BSRRH = BIT (bit );
86+ }
87+
7888/**
7989 * Determine whether or not a GPIO pin is set.
8090 *
Original file line number Diff line number Diff line change @@ -73,14 +73,14 @@ void pinMode(uint8 pin, WiringPinMode mode) {
7373 }
7474
7575 gpio_set_mode (pin, outputMode);
76-
76+ /*
7777 if (PIN_MAP[pin].timer_device != NULL) {
78- /* Enable/disable timer channels if we're switching into or
79- * out of PWM. */
78+ // Enable/disable timer channels if we're switching into or out of PWM.
8079 timer_set_mode(PIN_MAP[pin].timer_device,
8180 PIN_MAP[pin].timer_channel,
8281 pwm ? TIMER_PWM : TIMER_DISABLED);
8382 }
83+ */
8484}
8585
8686
You can’t perform that action at this time.
0 commit comments