mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-30 21:02:32 +01:00 
			
		
		
		
	[Core] Fix Sensor driver code (#15484)
This commit is contained in:
		
							parent
							
								
									3fa592a402
								
							
						
					
					
						commit
						aed64aaef4
					
				| @ -15,7 +15,7 @@ extern bool touchpad_init; | |||||||
| void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) { | void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) { | ||||||
|     uint8_t cmdByte = READ_MASK | address;  // Form the READ command byte
 |     uint8_t cmdByte = READ_MASK | address;  // Form the READ command byte
 | ||||||
|     if (touchpad_init) { |     if (touchpad_init) { | ||||||
|         if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_TRACKPAD_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) { |         if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) { | ||||||
|             spi_write(cmdByte); |             spi_write(cmdByte); | ||||||
|             spi_read();  // filler
 |             spi_read();  // filler
 | ||||||
|             spi_read();  // filler
 |             spi_read();  // filler
 | ||||||
| @ -27,7 +27,6 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) { | |||||||
|             dprintf("error right touchpad\n"); |             dprintf("error right touchpad\n"); | ||||||
| #endif | #endif | ||||||
|             touchpad_init = false; |             touchpad_init = false; | ||||||
|             j |  | ||||||
|         } |         } | ||||||
|         spi_stop(); |         spi_stop(); | ||||||
|     } |     } | ||||||
| @ -38,7 +37,7 @@ void RAP_Write(uint8_t address, uint8_t data) { | |||||||
|     uint8_t cmdByte = WRITE_MASK | address;  // Form the WRITE command byte
 |     uint8_t cmdByte = WRITE_MASK | address;  // Form the WRITE command byte
 | ||||||
| 
 | 
 | ||||||
|     if (touchpad_init) { |     if (touchpad_init) { | ||||||
|         if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_TRACKPAD_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) { |         if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) { | ||||||
|             spi_write(cmdByte); |             spi_write(cmdByte); | ||||||
|             spi_write(data); |             spi_write(data); | ||||||
|         } else { |         } else { | ||||||
|  | |||||||
| @ -143,7 +143,7 @@ void pmw3360_set_cpi(uint16_t cpi) { | |||||||
| 
 | 
 | ||||||
| uint16_t pmw3360_get_cpi(void) { | uint16_t pmw3360_get_cpi(void) { | ||||||
|     uint8_t cpival = spi_read_adv(REG_Config1); |     uint8_t cpival = spi_read_adv(REG_Config1); | ||||||
|     return (uint16_t)(cpival & 0xFF) * 100; |     return (uint16_t)((cpival + 1) & 0xFF) * 100; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool pmw3360_init(void) { | bool pmw3360_init(void) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Drashna Jaelre
						Drashna Jaelre