Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
		
							parent
							
								
									5426a7a129
								
							
						
					
					
						commit
						d09a06a1b3
					
				
					 390 changed files with 3912 additions and 3913 deletions
				
			
		| 
						 | 
				
			
			@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
 | 
			
		|||
 | 
			
		||||
static inline void setPinOutput_writeLow(pin_t pin) {
 | 
			
		||||
    ATOMIC_BLOCK_FORCEON {
 | 
			
		||||
        setPinOutput(pin);
 | 
			
		||||
        writePinLow(pin);
 | 
			
		||||
        gpio_set_pin_output(pin);
 | 
			
		||||
        gpio_write_pin_low(pin);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void setPinOutput_writeHigh(pin_t pin) {
 | 
			
		||||
    ATOMIC_BLOCK_FORCEON {
 | 
			
		||||
        setPinOutput(pin);
 | 
			
		||||
        writePinHigh(pin);
 | 
			
		||||
        gpio_set_pin_output(pin);
 | 
			
		||||
        gpio_write_pin_high(pin);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void setPinInputHigh_atomic(pin_t pin) {
 | 
			
		||||
    ATOMIC_BLOCK_FORCEON {
 | 
			
		||||
        setPinInputHigh(pin);
 | 
			
		||||
        gpio_set_pin_input_high(pin);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline uint8_t readMatrixPin(pin_t pin) {
 | 
			
		||||
    if (pin != NO_PIN) {
 | 
			
		||||
        return readPin(pin);
 | 
			
		||||
        return gpio_read_pin(pin);
 | 
			
		||||
    } else {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) {
 | 
			
		|||
        for (uint8_t i = 0; i < 8; i++) {
 | 
			
		||||
            compiler_barrier();
 | 
			
		||||
            if (dataOut & 0x1) {
 | 
			
		||||
                writePinHigh(DATA_PIN);
 | 
			
		||||
                gpio_write_pin_high(DATA_PIN);
 | 
			
		||||
            } else {
 | 
			
		||||
                writePinLow(DATA_PIN);
 | 
			
		||||
                gpio_write_pin_low(DATA_PIN);
 | 
			
		||||
            }
 | 
			
		||||
            dataOut = dataOut >> 1;
 | 
			
		||||
            compiler_barrier();
 | 
			
		||||
            writePinHigh(CLOCK_PIN);
 | 
			
		||||
            gpio_write_pin_high(CLOCK_PIN);
 | 
			
		||||
            small_delay();
 | 
			
		||||
            writePinLow(CLOCK_PIN);
 | 
			
		||||
            gpio_write_pin_low(CLOCK_PIN);
 | 
			
		||||
        }
 | 
			
		||||
        compiler_barrier();
 | 
			
		||||
        writePinHigh(LATCH_PIN);
 | 
			
		||||
        gpio_write_pin_high(LATCH_PIN);
 | 
			
		||||
        small_delay();
 | 
			
		||||
        writePinLow(LATCH_PIN);
 | 
			
		||||
        gpio_write_pin_low(LATCH_PIN);
 | 
			
		||||
        compiler_barrier();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) {
 | 
			
		|||
    ATOMIC_BLOCK_FORCEON {
 | 
			
		||||
        compiler_barrier();
 | 
			
		||||
        if (data & 0x1) {
 | 
			
		||||
            writePinHigh(DATA_PIN);
 | 
			
		||||
            gpio_write_pin_high(DATA_PIN);
 | 
			
		||||
        } else {
 | 
			
		||||
            writePinLow(DATA_PIN);
 | 
			
		||||
            gpio_write_pin_low(DATA_PIN);
 | 
			
		||||
        }
 | 
			
		||||
        compiler_barrier();
 | 
			
		||||
        writePinHigh(CLOCK_PIN);
 | 
			
		||||
        gpio_write_pin_high(CLOCK_PIN);
 | 
			
		||||
        small_delay();
 | 
			
		||||
        writePinLow(CLOCK_PIN);
 | 
			
		||||
        gpio_write_pin_low(CLOCK_PIN);
 | 
			
		||||
        compiler_barrier();
 | 
			
		||||
        writePinHigh(LATCH_PIN);
 | 
			
		||||
        gpio_write_pin_high(LATCH_PIN);
 | 
			
		||||
        small_delay();
 | 
			
		||||
        writePinLow(LATCH_PIN);
 | 
			
		||||
        gpio_write_pin_low(LATCH_PIN);
 | 
			
		||||
        compiler_barrier();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -156,13 +156,13 @@ static void unselect_cols(void) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void matrix_init_pins(void) {
 | 
			
		||||
    setPinOutput(DATA_PIN);
 | 
			
		||||
    setPinOutput(CLOCK_PIN);
 | 
			
		||||
    setPinOutput(LATCH_PIN);
 | 
			
		||||
    gpio_set_pin_output(DATA_PIN);
 | 
			
		||||
    gpio_set_pin_output(CLOCK_PIN);
 | 
			
		||||
    gpio_set_pin_output(LATCH_PIN);
 | 
			
		||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
 | 
			
		||||
    for (uint8_t x = 0; x < MATRIX_COLS; x++) {
 | 
			
		||||
        if (col_pins[x] != NO_PIN) {
 | 
			
		||||
            setPinOutput(col_pins[x]);
 | 
			
		||||
            gpio_set_pin_output(col_pins[x]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue