Format code according to conventions (#16322)
This commit is contained in:
		
							parent
							
								
									afcdd7079c
								
							
						
					
					
						commit
						63646e8906
					
				
					 345 changed files with 4916 additions and 3229 deletions
				
			
		| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef BLUEFRUIT_LE_SCK_DIVISOR
 | 
			
		||||
#    define BLUEFRUIT_LE_SCK_DIVISOR 2  // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE
 | 
			
		||||
#    define BLUEFRUIT_LE_SCK_DIVISOR 2 // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define SAMPLE_BATTERY
 | 
			
		||||
| 
						 | 
				
			
			@ -77,10 +77,10 @@ struct sdep_msg {
 | 
			
		|||
// information here.
 | 
			
		||||
 | 
			
		||||
enum queue_type {
 | 
			
		||||
    QTKeyReport,  // 1-byte modifier + 6-byte key report
 | 
			
		||||
    QTConsumer,   // 16-bit key code
 | 
			
		||||
    QTKeyReport, // 1-byte modifier + 6-byte key report
 | 
			
		||||
    QTConsumer,  // 16-bit key code
 | 
			
		||||
#ifdef MOUSE_ENABLE
 | 
			
		||||
    QTMouseMove,  // 4-byte mouse report
 | 
			
		||||
    QTMouseMove, // 4-byte mouse report
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -115,8 +115,8 @@ enum sdep_type {
 | 
			
		|||
    SdepResponse      = 0x20,
 | 
			
		||||
    SdepAlert         = 0x40,
 | 
			
		||||
    SdepError         = 0x80,
 | 
			
		||||
    SdepSlaveNotReady = 0xFE,  // Try again later
 | 
			
		||||
    SdepSlaveOverflow = 0xFF,  // You read more data than is available
 | 
			
		||||
    SdepSlaveNotReady = 0xFE, // Try again later
 | 
			
		||||
    SdepSlaveOverflow = 0xFF, // You read more data than is available
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum ble_cmd {
 | 
			
		||||
| 
						 | 
				
			
			@ -306,13 +306,15 @@ static bool ble_init(void) {
 | 
			
		|||
    wait_ms(10);
 | 
			
		||||
    writePinHigh(BLUEFRUIT_LE_RST_PIN);
 | 
			
		||||
 | 
			
		||||
    wait_ms(1000);  // Give it a second to initialize
 | 
			
		||||
    wait_ms(1000); // Give it a second to initialize
 | 
			
		||||
 | 
			
		||||
    state.initialized = true;
 | 
			
		||||
    return state.initialized;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline uint8_t min(uint8_t a, uint8_t b) { return a < b ? a : b; }
 | 
			
		||||
static inline uint8_t min(uint8_t a, uint8_t b) {
 | 
			
		||||
    return a < b ? a : b;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool read_response(char *resp, uint16_t resplen, bool verbose) {
 | 
			
		||||
    char *dest = resp;
 | 
			
		||||
| 
						 | 
				
			
			@ -424,7 +426,9 @@ bool at_command_P(const char *cmd, char *resp, uint16_t resplen, bool verbose) {
 | 
			
		|||
    return at_command(cmdbuf, resp, resplen, verbose);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool bluefruit_le_is_connected(void) { return state.is_connected; }
 | 
			
		||||
bool bluefruit_le_is_connected(void) {
 | 
			
		||||
    return state.is_connected;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool bluefruit_le_enable_keyboard(void) {
 | 
			
		||||
    char resbuf[128];
 | 
			
		||||
| 
						 | 
				
			
			@ -671,7 +675,9 @@ void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan,
 | 
			
		|||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
uint32_t bluefruit_le_read_battery_voltage(void) { return state.vbat; }
 | 
			
		||||
uint32_t bluefruit_le_read_battery_voltage(void) {
 | 
			
		||||
    return state.vbat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool bluefruit_le_set_mode_leds(bool on) {
 | 
			
		||||
    if (!state.configured) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ uint8_t auto_detect_output(void) {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef BLUETOOTH_ENABLE
 | 
			
		||||
    return OUTPUT_BLUETOOTH;  // should check if BT is connected here
 | 
			
		||||
    return OUTPUT_BLUETOOTH; // should check if BT is connected here
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    return OUTPUT_NONE;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,9 @@ static inline uint16_t rn42_consumer_usage_to_bitmap(uint16_t usage) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rn42_init(void) { uart_init(RN42_BAUD_RATE); }
 | 
			
		||||
void rn42_init(void) {
 | 
			
		||||
    uart_init(RN42_BAUD_RATE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rn42_send_keyboard(report_keyboard_t *report) {
 | 
			
		||||
    uart_write(0xFD);
 | 
			
		||||
| 
						 | 
				
			
			@ -81,8 +83,8 @@ void rn42_send_mouse(report_mouse_t *report) {
 | 
			
		|||
    uart_write(report->buttons);
 | 
			
		||||
    uart_write(report->x);
 | 
			
		||||
    uart_write(report->y);
 | 
			
		||||
    uart_write(report->v);  // should try sending the wheel v here
 | 
			
		||||
    uart_write(report->h);  // should try sending the wheel h here
 | 
			
		||||
    uart_write(report->v); // should try sending the wheel v here
 | 
			
		||||
    uart_write(report->h); // should try sending the wheel h here
 | 
			
		||||
    uart_write(0x00);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,11 +37,17 @@ uint32_t eeprom_read_dword(const uint32_t *addr) {
 | 
			
		|||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_write_byte(uint8_t *addr, uint8_t value) { eeprom_write_block(&value, addr, 1); }
 | 
			
		||||
void eeprom_write_byte(uint8_t *addr, uint8_t value) {
 | 
			
		||||
    eeprom_write_block(&value, addr, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_write_word(uint16_t *addr, uint16_t value) { eeprom_write_block(&value, addr, 2); }
 | 
			
		||||
void eeprom_write_word(uint16_t *addr, uint16_t value) {
 | 
			
		||||
    eeprom_write_block(&value, addr, 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_write_dword(uint32_t *addr, uint32_t value) { eeprom_write_block(&value, addr, 4); }
 | 
			
		||||
void eeprom_write_dword(uint32_t *addr, uint32_t value) {
 | 
			
		||||
    eeprom_write_block(&value, addr, 4);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_update_block(const void *buf, void *addr, size_t len) {
 | 
			
		||||
    uint8_t read_buf[len];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@
 | 
			
		|||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
 | 
			
		||||
#    include "timer.h"
 | 
			
		||||
#    include "debug.h"
 | 
			
		||||
#endif  // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
#endif // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
 | 
			
		||||
static inline void fill_target_address(uint8_t *buffer, const void *addr) {
 | 
			
		||||
    uintptr_t p = (uintptr_t)addr;
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
 | 
			
		|||
        dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
 | 
			
		||||
    }
 | 
			
		||||
    dprintf("\n");
 | 
			
		||||
#endif  // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
#endif // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
 | 
			
		|||
            dprintf(" %02X", (int)(read_buf[i]));
 | 
			
		||||
        }
 | 
			
		||||
        dprintf("\n");
 | 
			
		||||
#endif  // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
#endif // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
 | 
			
		||||
        i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((uintptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE + write_length, 100);
 | 
			
		||||
        wait_ms(EXTERNAL_EEPROM_WRITE_TIME);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,9 @@
 | 
			
		|||
#    define EXTERNAL_EEPROM_SPI_TIMEOUT 100
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static bool spi_eeprom_start(void) { return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR); }
 | 
			
		||||
static bool spi_eeprom_start(void) {
 | 
			
		||||
    return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static spi_status_t spi_eeprom_wait_while_busy(int timeout) {
 | 
			
		||||
    uint32_t     deadline = timer_read32() + timeout;
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +82,9 @@ static void spi_eeprom_transmit_address(uintptr_t addr) {
 | 
			
		|||
 | 
			
		||||
//----------------------------------------------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
void eeprom_driver_init(void) { spi_init(); }
 | 
			
		||||
void eeprom_driver_init(void) {
 | 
			
		||||
    spi_init();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_driver_erase(void) {
 | 
			
		||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +139,7 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
 | 
			
		|||
        dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
 | 
			
		||||
    }
 | 
			
		||||
    dprintf("\n");
 | 
			
		||||
#endif  // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
#endif // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
 | 
			
		||||
    spi_stop();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -192,7 +196,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
 | 
			
		|||
            dprintf(" %02X", (int)(uint8_t)(read_buf[i]));
 | 
			
		||||
        }
 | 
			
		||||
        dprintf("\n");
 | 
			
		||||
#endif  // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
#endif // DEBUG_EEPROM_OUTPUT
 | 
			
		||||
 | 
			
		||||
        spi_write(CMD_WRITE);
 | 
			
		||||
        spi_eeprom_transmit_address(target_addr);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,9 +30,13 @@ size_t clamp_length(intptr_t offset, size_t len) {
 | 
			
		|||
    return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_driver_init(void) { eeprom_driver_erase(); }
 | 
			
		||||
void eeprom_driver_init(void) {
 | 
			
		||||
    eeprom_driver_erase();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_driver_erase(void) { memset(transientBuffer, 0x00, TRANSIENT_EEPROM_SIZE); }
 | 
			
		||||
void eeprom_driver_erase(void) {
 | 
			
		||||
    memset(transientBuffer, 0x00, TRANSIENT_EEPROM_SIZE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
 | 
			
		||||
    intptr_t offset = (intptr_t)addr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,5 +21,5 @@
 | 
			
		|||
*/
 | 
			
		||||
#ifndef TRANSIENT_EEPROM_SIZE
 | 
			
		||||
#    include "eeconfig.h"
 | 
			
		||||
#    define TRANSIENT_EEPROM_SIZE (((EECONFIG_SIZE + 3) / 4) * 4)  // based off eeconfig's current usage, aligned to 4-byte sizes, to deal with LTO
 | 
			
		||||
#    define TRANSIENT_EEPROM_SIZE (((EECONFIG_SIZE + 3) / 4) * 4) // based off eeconfig's current usage, aligned to 4-byte sizes, to deal with LTO
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,7 +65,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
// #define DEBUG_FLASH_SPI_OUTPUT
 | 
			
		||||
 | 
			
		||||
static bool spi_flash_start(void) { return spi_start(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN, EXTERNAL_FLASH_SPI_LSBFIRST, EXTERNAL_FLASH_SPI_MODE, EXTERNAL_FLASH_SPI_CLOCK_DIVISOR); }
 | 
			
		||||
static bool spi_flash_start(void) {
 | 
			
		||||
    return spi_start(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN, EXTERNAL_FLASH_SPI_LSBFIRST, EXTERNAL_FLASH_SPI_MODE, EXTERNAL_FLASH_SPI_CLOCK_DIVISOR);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static flash_status_t spi_flash_wait_while_busy(void) {
 | 
			
		||||
    uint32_t       deadline = timer_read32() + EXTERNAL_FLASH_SPI_TIMEOUT;
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +162,9 @@ static flash_status_t spi_flash_transaction(uint8_t cmd, uint32_t addr, uint8_t
 | 
			
		|||
    return response;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void flash_init(void) { spi_init(); }
 | 
			
		||||
void flash_init(void) {
 | 
			
		||||
    spi_init();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
flash_status_t flash_erase_chip(void) {
 | 
			
		||||
    flash_status_t response = FLASH_STATUS_SUCCESS;
 | 
			
		||||
| 
						 | 
				
			
			@ -304,7 +308,7 @@ flash_status_t flash_read_block(uint32_t addr, void *buf, size_t len) {
 | 
			
		|||
        dprintf(" %02X", (int)(((uint8_t *)read_buf)[i]));
 | 
			
		||||
    }
 | 
			
		||||
    dprintf("\n");
 | 
			
		||||
#endif  // DEBUG_FLASH_SPI_OUTPUT
 | 
			
		||||
#endif // DEBUG_FLASH_SPI_OUTPUT
 | 
			
		||||
 | 
			
		||||
    return response;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +344,7 @@ flash_status_t flash_write_block(uint32_t addr, const void *buf, size_t len) {
 | 
			
		|||
            dprintf(" %02X", (int)(uint8_t)(write_buf[i]));
 | 
			
		||||
        }
 | 
			
		||||
        dprintf("\n");
 | 
			
		||||
#endif  // DEBUG_FLASH_SPI_OUTPUT
 | 
			
		||||
#endif // DEBUG_FLASH_SPI_OUTPUT
 | 
			
		||||
 | 
			
		||||
        /* Perform the write. */
 | 
			
		||||
        response = spi_flash_transaction(FLASH_CMD_PP, addr, write_buf, write_length);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,11 +10,11 @@
 | 
			
		|||
#define TIMEOUT 100
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
    CMD_IODIRA = 0x00,  // i/o direction register
 | 
			
		||||
    CMD_IODIRA = 0x00, // i/o direction register
 | 
			
		||||
    CMD_IODIRB = 0x01,
 | 
			
		||||
    CMD_GPPUA  = 0x0C,  // GPIO pull-up resistor register
 | 
			
		||||
    CMD_GPPUA  = 0x0C, // GPIO pull-up resistor register
 | 
			
		||||
    CMD_GPPUB  = 0x0D,
 | 
			
		||||
    CMD_GPIOA  = 0x12,  // general purpose i/o port register (write modifies OLAT)
 | 
			
		||||
    CMD_GPIOA  = 0x12, // general purpose i/o port register (write modifies OLAT)
 | 
			
		||||
    CMD_GPIOB  = 0x13,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,12 +106,14 @@ void DRV_init(void) {
 | 
			
		|||
 | 
			
		||||
void DRV_rtp_init(void) {
 | 
			
		||||
    DRV_write(DRV_GO, 0x00);
 | 
			
		||||
    DRV_write(DRV_RTP_INPUT, 20);  // 20 is the lowest value I've found where haptics can still be felt.
 | 
			
		||||
    DRV_write(DRV_RTP_INPUT, 20); // 20 is the lowest value I've found where haptics can still be felt.
 | 
			
		||||
    DRV_write(DRV_MODE, 0x05);
 | 
			
		||||
    DRV_write(DRV_GO, 0x01);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DRV_amplitude(uint8_t amplitude) { DRV_write(DRV_RTP_INPUT, amplitude); }
 | 
			
		||||
void DRV_amplitude(uint8_t amplitude) {
 | 
			
		||||
    DRV_write(DRV_RTP_INPUT, amplitude);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DRV_pulse(uint8_t sequence) {
 | 
			
		||||
    DRV_write(DRV_GO, 0x00);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,13 +28,21 @@ uint8_t  solenoid_dwell   = SOLENOID_DEFAULT_DWELL;
 | 
			
		|||
 | 
			
		||||
extern haptic_config_t haptic_config;
 | 
			
		||||
 | 
			
		||||
void solenoid_buzz_on(void) { haptic_set_buzz(1); }
 | 
			
		||||
void solenoid_buzz_on(void) {
 | 
			
		||||
    haptic_set_buzz(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void solenoid_buzz_off(void) { haptic_set_buzz(0); }
 | 
			
		||||
void solenoid_buzz_off(void) {
 | 
			
		||||
    haptic_set_buzz(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void solenoid_set_buzz(int buzz) { haptic_set_buzz(buzz); }
 | 
			
		||||
void solenoid_set_buzz(int buzz) {
 | 
			
		||||
    haptic_set_buzz(buzz);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void solenoid_set_dwell(uint8_t dwell) { solenoid_dwell = dwell; }
 | 
			
		||||
void solenoid_set_dwell(uint8_t dwell) {
 | 
			
		||||
    solenoid_dwell = dwell;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void solenoid_stop(void) {
 | 
			
		||||
    SOLENOID_PIN_WRITE_INACTIVE();
 | 
			
		||||
| 
						 | 
				
			
			@ -89,4 +97,6 @@ void solenoid_setup(void) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void solenoid_shutdown(void) { SOLENOID_PIN_WRITE_INACTIVE(); }
 | 
			
		||||
void solenoid_shutdown(void) {
 | 
			
		||||
    SOLENOID_PIN_WRITE_INACTIVE();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
// Addressing Setting Commands
 | 
			
		||||
#define PAM_SETCOLUMN_LSB 0x00
 | 
			
		||||
#define PAM_SETCOLUMN_MSB 0x10
 | 
			
		||||
#define PAM_PAGE_ADDR 0xB0  // 0xb0 -- 0xb7
 | 
			
		||||
#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
 | 
			
		||||
 | 
			
		||||
// Hardware Configuration Commands
 | 
			
		||||
#define DISPLAY_START_LINE 0x40
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +138,9 @@ bool st7565_init(display_rotation_t rotation) {
 | 
			
		|||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) { return rotation; }
 | 
			
		||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) {
 | 
			
		||||
    return rotation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void st7565_clear(void) {
 | 
			
		||||
    memset(st7565_buffer, 0, sizeof(st7565_buffer));
 | 
			
		||||
| 
						 | 
				
			
			@ -212,7 +214,8 @@ void st7565_advance_page(bool clearPageRemainder) {
 | 
			
		|||
        remaining = remaining / ST7565_FONT_WIDTH;
 | 
			
		||||
 | 
			
		||||
        // Write empty character until next line
 | 
			
		||||
        while (remaining--) st7565_write_char(' ', false);
 | 
			
		||||
        while (remaining--)
 | 
			
		||||
            st7565_write_char(' ', false);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Next page index out of bounds?
 | 
			
		||||
        if (index + remaining >= ST7565_MATRIX_SIZE) {
 | 
			
		||||
| 
						 | 
				
			
			@ -263,7 +266,7 @@ void st7565_write_char(const char data, bool invert) {
 | 
			
		|||
    _Static_assert(sizeof(font) >= ((ST7565_FONT_END + 1 - ST7565_FONT_START) * ST7565_FONT_WIDTH), "ST7565_FONT_END references outside array");
 | 
			
		||||
 | 
			
		||||
    // set the reder buffer data
 | 
			
		||||
    uint8_t cast_data = (uint8_t)data;  // font based on unsigned type for index
 | 
			
		||||
    uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
 | 
			
		||||
    if (cast_data < ST7565_FONT_START || cast_data > ST7565_FONT_END) {
 | 
			
		||||
        memset(st7565_cursor, 0x00, ST7565_FONT_WIDTH);
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -389,7 +392,7 @@ void st7565_write_raw_P(const char *data, uint16_t size) {
 | 
			
		|||
        st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif  // defined(__AVR__)
 | 
			
		||||
#endif // defined(__AVR__)
 | 
			
		||||
 | 
			
		||||
bool st7565_on(void) {
 | 
			
		||||
    if (!st7565_initialized) {
 | 
			
		||||
| 
						 | 
				
			
			@ -429,7 +432,9 @@ bool st7565_off(void) {
 | 
			
		|||
 | 
			
		||||
__attribute__((weak)) void st7565_off_user(void) {}
 | 
			
		||||
 | 
			
		||||
bool st7565_is_on(void) { return st7565_active; }
 | 
			
		||||
bool st7565_is_on(void) {
 | 
			
		||||
    return st7565_active;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool st7565_invert(bool invert) {
 | 
			
		||||
    if (!st7565_initialized) {
 | 
			
		||||
| 
						 | 
				
			
			@ -445,9 +450,13 @@ bool st7565_invert(bool invert) {
 | 
			
		|||
    return st7565_inverted;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t st7565_max_chars(void) { return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH; }
 | 
			
		||||
uint8_t st7565_max_chars(void) {
 | 
			
		||||
    return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t st7565_max_lines(void) { return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT; }
 | 
			
		||||
uint8_t st7565_max_lines(void) {
 | 
			
		||||
    return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void st7565_task(void) {
 | 
			
		||||
    if (!st7565_initialized) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,16 +29,16 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#    define ST7565_DISPLAY_HEIGHT 32
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ST7565_MATRIX_SIZE
 | 
			
		||||
#    define ST7565_MATRIX_SIZE (ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH)  // 1024 (compile time mathed)
 | 
			
		||||
#    define ST7565_MATRIX_SIZE (ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH) // 1024 (compile time mathed)
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ST7565_BLOCK_TYPE
 | 
			
		||||
#    define ST7565_BLOCK_TYPE uint16_t
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ST7565_BLOCK_COUNT
 | 
			
		||||
#    define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8)  // 32 (compile time mathed)
 | 
			
		||||
#    define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8) // 32 (compile time mathed)
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ST7565_BLOCK_SIZE
 | 
			
		||||
#    define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT)  // 32 (compile time mathed)
 | 
			
		||||
#    define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT) // 32 (compile time mathed)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// the column address corresponding to the first column in the display hardware
 | 
			
		||||
| 
						 | 
				
			
			@ -174,7 +174,7 @@ void st7565_write_raw_P(const char *data, uint16_t size);
 | 
			
		|||
#    define st7565_write_P(data, invert) st7565_write(data, invert)
 | 
			
		||||
#    define st7565_write_ln_P(data, invert) st7565_write_ln(data, invert)
 | 
			
		||||
#    define st7565_write_raw_P(data, size) st7565_write_raw(data, size)
 | 
			
		||||
#endif  // defined(__AVR__)
 | 
			
		||||
#endif // defined(__AVR__)
 | 
			
		||||
 | 
			
		||||
// Can be used to manually turn on the screen if it is off
 | 
			
		||||
// Returns true if the screen was on or turns on
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,15 +20,15 @@
 | 
			
		|||
 | 
			
		||||
#ifndef APA102_NOPS
 | 
			
		||||
#    if defined(__AVR__)
 | 
			
		||||
#        define APA102_NOPS 0  // AVR at 16 MHz already spends 62.5 ns per clock, so no extra delay is needed
 | 
			
		||||
#        define APA102_NOPS 0 // AVR at 16 MHz already spends 62.5 ns per clock, so no extra delay is needed
 | 
			
		||||
#    elif defined(PROTOCOL_CHIBIOS)
 | 
			
		||||
 | 
			
		||||
#        include "hal.h"
 | 
			
		||||
#        if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(GD32VF103)
 | 
			
		||||
#            define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4)))  // This calculates how many loops of 4 nops to run to delay 100 ns
 | 
			
		||||
#            define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4))) // This calculates how many loops of 4 nops to run to delay 100 ns
 | 
			
		||||
#        else
 | 
			
		||||
#            error("APA102_NOPS configuration required")
 | 
			
		||||
#            define APA102_NOPS 0  // this just pleases the compile so the above error is easier to spot
 | 
			
		||||
#            define APA102_NOPS 0 // this just pleases the compile so the above error is easier to spot
 | 
			
		||||
#        endif
 | 
			
		||||
#    endif
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,9 @@ void apa102_setleds(LED_TYPE *start_led, uint16_t num_leds) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// Overwrite the default rgblight_call_driver to use apa102 driver
 | 
			
		||||
void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { apa102_setleds(start_led, num_leds); }
 | 
			
		||||
void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) {
 | 
			
		||||
    apa102_setleds(start_led, num_leds);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void static apa102_init(void) {
 | 
			
		||||
    setPinOutput(RGB_DI_PIN);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,17 +23,17 @@
 | 
			
		|||
 */
 | 
			
		||||
#define AWINIC_ID 0b1010 << 4
 | 
			
		||||
 | 
			
		||||
#define AW_PAGE_FUNCTION 0x00 << 1    // PG0, Function registers
 | 
			
		||||
#define AW_PAGE_PWM 0x01 << 1         // PG1, LED PWM control
 | 
			
		||||
#define AW_PAGE_SCALING 0x02 << 1     // PG2, LED current scaling control
 | 
			
		||||
#define AW_PAGE_PATCHOICE 0x03 << 1   // PG3, Pattern choice?
 | 
			
		||||
#define AW_PAGE_PWMSCALING 0x04 << 1  // PG4, LED PWM + Scaling control?
 | 
			
		||||
#define AW_PAGE_FUNCTION 0x00 << 1   // PG0, Function registers
 | 
			
		||||
#define AW_PAGE_PWM 0x01 << 1        // PG1, LED PWM control
 | 
			
		||||
#define AW_PAGE_SCALING 0x02 << 1    // PG2, LED current scaling control
 | 
			
		||||
#define AW_PAGE_PATCHOICE 0x03 << 1  // PG3, Pattern choice?
 | 
			
		||||
#define AW_PAGE_PWMSCALING 0x04 << 1 // PG4, LED PWM + Scaling control?
 | 
			
		||||
 | 
			
		||||
#define AW_WRITE 0
 | 
			
		||||
#define AW_READ 1
 | 
			
		||||
 | 
			
		||||
#define AW_REG_CONFIGURATION 0x00  // PG0
 | 
			
		||||
#define AW_REG_GLOBALCURRENT 0x01  // PG0
 | 
			
		||||
#define AW_REG_CONFIGURATION 0x00 // PG0
 | 
			
		||||
#define AW_REG_GLOBALCURRENT 0x01 // PG0
 | 
			
		||||
 | 
			
		||||
// Default value of AW_REG_CONFIGURATION
 | 
			
		||||
// D7:D4 = 1011, SWSEL (SW1~SW12 active)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,13 +42,13 @@
 | 
			
		|||
#define ISSI_REG_PICTUREFRAME 0x01
 | 
			
		||||
 | 
			
		||||
// Not defined in the datasheet -- See AN for IC
 | 
			
		||||
#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2  // Set bit 4 to enable de-ghosting
 | 
			
		||||
#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2 // Set bit 4 to enable de-ghosting
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_SHUTDOWN 0x0A
 | 
			
		||||
#define ISSI_REG_AUDIOSYNC 0x06
 | 
			
		||||
 | 
			
		||||
#define ISSI_COMMANDREGISTER 0xFD
 | 
			
		||||
#define ISSI_BANK_FUNCTIONREG 0x0B  // helpfully called 'page nine'
 | 
			
		||||
#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			@ -148,7 +148,7 @@ void IS31FL3731_init(uint8_t addr) {
 | 
			
		|||
 | 
			
		||||
    // enable software shutdown
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
 | 
			
		||||
#ifdef ISSI_3731_DEGHOST  // set to enable de-ghosting of the array
 | 
			
		||||
#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,13 +41,13 @@
 | 
			
		|||
#define ISSI_REG_PICTUREFRAME 0x01
 | 
			
		||||
 | 
			
		||||
// Not defined in the datasheet -- See AN for IC
 | 
			
		||||
#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2  // Set bit 4 to enable de-ghosting
 | 
			
		||||
#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2 // Set bit 4 to enable de-ghosting
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_SHUTDOWN 0x0A
 | 
			
		||||
#define ISSI_REG_AUDIOSYNC 0x06
 | 
			
		||||
 | 
			
		||||
#define ISSI_COMMANDREGISTER 0xFD
 | 
			
		||||
#define ISSI_BANK_FUNCTIONREG 0x0B  // helpfully called 'page nine'
 | 
			
		||||
#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +136,7 @@ void IS31FL3731_init(uint8_t addr) {
 | 
			
		|||
 | 
			
		||||
    // enable software shutdown
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
 | 
			
		||||
#ifdef ISSI_3731_DEGHOST  // set to enable de-ghosting of the array
 | 
			
		||||
#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,16 +39,16 @@
 | 
			
		|||
#define ISSI_INTERRUPTMASKREGISTER 0xF0
 | 
			
		||||
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
 | 
			
		||||
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00  // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01         // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02  // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03    // PG3
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01        // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03   // PG3
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00  // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01  // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11          // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F       // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10       // PG3
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00 // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11         // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F      // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10      // PG3
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +59,7 @@
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_PWM_FREQUENCY
 | 
			
		||||
#    define ISSI_PWM_FREQUENCY 0b000  // PFS - IS31FL3733B only
 | 
			
		||||
#    define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_SWPULLUP
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,13 +47,13 @@ void IS31FL3733_set_led_control_register(uint8_t index, bool value);
 | 
			
		|||
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
 | 
			
		||||
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x02  // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_3KR 0x03   // 3.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor on all the time
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_0R 0x00   // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_3KR 0x03  // 3.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_4KR 0x04  // 4.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_8KR 0x05  // 8.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_16KR 0x06 // 16k Ohm resistor on all the time
 | 
			
		||||
#define PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x01
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,16 +38,16 @@
 | 
			
		|||
#define ISSI_INTERRUPTMASKREGISTER 0xF0
 | 
			
		||||
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
 | 
			
		||||
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00  // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01         // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02  // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03    // PG3
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01        // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03   // PG3
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00  // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01  // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11          // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F       // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10       // PG3
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00 // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11         // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F      // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10      // PG3
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_PWM_FREQUENCY
 | 
			
		||||
#    define ISSI_PWM_FREQUENCY 0b000  // PFS - IS31FL3733B only
 | 
			
		||||
#    define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_SWPULLUP
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,13 +48,13 @@ void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bo
 | 
			
		|||
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
 | 
			
		||||
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x02  // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_3KR 0x03   // 3.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor on all the time
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_0R 0x00   // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_3KR 0x03  // 3.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_4KR 0x04  // 4.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_8KR 0x05  // 8.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_16KR 0x06 // 16k Ohm resistor on all the time
 | 
			
		||||
#define PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x01
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,16 +36,16 @@
 | 
			
		|||
#define ISSI_INTERRUPTMASKREGISTER 0xF0
 | 
			
		||||
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
 | 
			
		||||
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00  // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01         // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02  // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03    // PG3
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01        // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03   // PG3
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00  // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01  // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11          // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F       // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10       // PG3
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00 // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11         // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F      // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10      // PG3
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,14 +61,14 @@ void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
 | 
			
		|||
void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01  // 0.5k Ohm resistor
 | 
			
		||||
#define PUR_1KR 0x02   // 1.0k Ohm resistor
 | 
			
		||||
#define PUR_2KR 0x03   // 2.0k Ohm resistor
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor
 | 
			
		||||
#define PUR_0R 0x00   // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01 // 0.5k Ohm resistor
 | 
			
		||||
#define PUR_1KR 0x02  // 1.0k Ohm resistor
 | 
			
		||||
#define PUR_2KR 0x03  // 2.0k Ohm resistor
 | 
			
		||||
#define PUR_4KR 0x04  // 4.0k Ohm resistor
 | 
			
		||||
#define PUR_8KR 0x05  // 8.0k Ohm resistor
 | 
			
		||||
#define PUR_16KR 0x06 // 16k Ohm resistor
 | 
			
		||||
#define PUR_32KR 0x07 // 32k Ohm resistor
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x02
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,16 +38,16 @@
 | 
			
		|||
#define ISSI_INTERRUPTMASKREGISTER 0xF0
 | 
			
		||||
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
 | 
			
		||||
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00  // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01         // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02  // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03    // PG3
 | 
			
		||||
#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM 0x01        // PG1
 | 
			
		||||
#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x03   // PG3
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00  // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01  // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11          // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F       // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10       // PG3
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00 // PG3
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
 | 
			
		||||
#define ISSI_REG_RESET 0x11         // PG3
 | 
			
		||||
#define ISSI_REG_SWPULLUP 0x0F      // PG3
 | 
			
		||||
#define ISSI_REG_CSPULLUP 0x10      // PG3
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,14 +48,14 @@ void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bo
 | 
			
		|||
void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01  // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_1KR 0x02   // 1.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_2KR 0x03   // 2.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_0R 0x00   // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01 // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_1KR 0x02  // 1.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_2KR 0x03  // 2.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_4KR 0x04  // 4.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_8KR 0x05  // 8.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_16KR 0x06 // 16k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x01
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,16 +42,16 @@
 | 
			
		|||
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
 | 
			
		||||
#define ISSI_IDREGISTER 0xFC
 | 
			
		||||
 | 
			
		||||
#define ISSI_PAGE_PWM0 0x00       // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM1 0x01       // PG1
 | 
			
		||||
#define ISSI_PAGE_SCALING_0 0x02  // PG2
 | 
			
		||||
#define ISSI_PAGE_SCALING_1 0x03  // PG3
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x04   // PG4
 | 
			
		||||
#define ISSI_PAGE_PWM0 0x00      // PG0
 | 
			
		||||
#define ISSI_PAGE_PWM1 0x01      // PG1
 | 
			
		||||
#define ISSI_PAGE_SCALING_0 0x02 // PG2
 | 
			
		||||
#define ISSI_PAGE_SCALING_1 0x03 // PG3
 | 
			
		||||
#define ISSI_PAGE_FUNCTION 0x04  // PG4
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00  // PG4
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01  // PG4
 | 
			
		||||
#define ISSI_REG_PULLDOWNUP 0x02     // PG4
 | 
			
		||||
#define ISSI_REG_RESET 0x3F          // PG4
 | 
			
		||||
#define ISSI_REG_CONFIGURATION 0x00 // PG4
 | 
			
		||||
#define ISSI_REG_GLOBALCURRENT 0x01 // PG4
 | 
			
		||||
#define ISSI_REG_PULLDOWNUP 0x02    // PG4
 | 
			
		||||
#define ISSI_REG_RESET 0x3F         // PG4
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
#    define ISSI_TIMEOUT 100
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,14 +51,14 @@ void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t
 | 
			
		|||
 | 
			
		||||
void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01  // 0.5k Ohm resistor
 | 
			
		||||
#define PUR_1KR 0x02   // 1.0k Ohm resistor
 | 
			
		||||
#define PUR_2KR 0x03   // 2.0k Ohm resistor
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor
 | 
			
		||||
#define PUR_0R 0x00   // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01 // 0.5k Ohm resistor
 | 
			
		||||
#define PUR_1KR 0x02  // 1.0k Ohm resistor
 | 
			
		||||
#define PUR_2KR 0x03  // 2.0k Ohm resistor
 | 
			
		||||
#define PUR_4KR 0x04  // 4.0k Ohm resistor
 | 
			
		||||
#define PUR_8KR 0x05  // 8.0k Ohm resistor
 | 
			
		||||
#define PUR_16KR 0x06 // 16k Ohm resistor
 | 
			
		||||
#define PUR_32KR 0x07 // 32k Ohm resistor
 | 
			
		||||
 | 
			
		||||
#define CS1_SW1 0x00
 | 
			
		||||
#define CS2_SW1 0x01
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,16 +34,16 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#        define OLED_DISPLAY_HEIGHT 64
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_MATRIX_SIZE
 | 
			
		||||
#        define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)  // 1024 (compile time mathed)
 | 
			
		||||
#        define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed)
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_BLOCK_TYPE
 | 
			
		||||
#        define OLED_BLOCK_TYPE uint16_t
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_BLOCK_COUNT
 | 
			
		||||
#        define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8)  // 32 (compile time mathed)
 | 
			
		||||
#        define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed)
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_BLOCK_SIZE
 | 
			
		||||
#        define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)  // 32 (compile time mathed)
 | 
			
		||||
#        define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_COM_PINS
 | 
			
		||||
#        define OLED_COM_PINS COM_PINS_ALT
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
// If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
 | 
			
		||||
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }
 | 
			
		||||
// #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 }
 | 
			
		||||
#else  // defined(OLED_DISPLAY_128X64)
 | 
			
		||||
#else // defined(OLED_DISPLAY_128X64)
 | 
			
		||||
// Default 128x32
 | 
			
		||||
#    ifndef OLED_DISPLAY_WIDTH
 | 
			
		||||
#        define OLED_DISPLAY_WIDTH 128
 | 
			
		||||
| 
						 | 
				
			
			@ -77,16 +77,16 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#        define OLED_DISPLAY_HEIGHT 32
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_MATRIX_SIZE
 | 
			
		||||
#        define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)  // 512 (compile time mathed)
 | 
			
		||||
#        define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_BLOCK_TYPE
 | 
			
		||||
#        define OLED_BLOCK_TYPE uint16_t  // Type to use for segmenting the oled display for smart rendering, use unsigned types only
 | 
			
		||||
#        define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_BLOCK_COUNT
 | 
			
		||||
#        define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8)  // 16 (compile time mathed)
 | 
			
		||||
#        define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed)
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_BLOCK_SIZE
 | 
			
		||||
#        define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)  // 32 (compile time mathed)
 | 
			
		||||
#        define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifndef OLED_COM_PINS
 | 
			
		||||
#        define OLED_COM_PINS COM_PINS_SEQ
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
// If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
 | 
			
		||||
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
 | 
			
		||||
// #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 }
 | 
			
		||||
#endif  // defined(OLED_DISPLAY_CUSTOM)
 | 
			
		||||
#endif // defined(OLED_DISPLAY_CUSTOM)
 | 
			
		||||
 | 
			
		||||
#if !defined(OLED_IC)
 | 
			
		||||
#    define OLED_IC OLED_IC_SSD1306
 | 
			
		||||
| 
						 | 
				
			
			@ -180,7 +180,7 @@ typedef enum {
 | 
			
		|||
    OLED_ROTATION_0   = 0,
 | 
			
		||||
    OLED_ROTATION_90  = 1,
 | 
			
		||||
    OLED_ROTATION_180 = 2,
 | 
			
		||||
    OLED_ROTATION_270 = 3,  // OLED_ROTATION_90 | OLED_ROTATION_180
 | 
			
		||||
    OLED_ROTATION_270 = 3, // OLED_ROTATION_90 | OLED_ROTATION_180
 | 
			
		||||
} oled_rotation_t;
 | 
			
		||||
 | 
			
		||||
// Initialize the oled display, rotating the rendered output based on the define passed in.
 | 
			
		||||
| 
						 | 
				
			
			@ -262,7 +262,7 @@ void oled_write_raw_P(const char *data, uint16_t size);
 | 
			
		|||
#    define oled_write_P(data, invert) oled_write(data, invert)
 | 
			
		||||
#    define oled_write_ln_P(data, invert) oled_write(data, invert)
 | 
			
		||||
#    define oled_write_raw_P(data, size) oled_write_raw(data, size)
 | 
			
		||||
#endif  // defined(__AVR__)
 | 
			
		||||
#endif // defined(__AVR__)
 | 
			
		||||
 | 
			
		||||
// Can be used to manually turn on the screen if it is off
 | 
			
		||||
// Returns true if the screen was on or turns on
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,7 +53,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#define PAGE_ADDR 0x22
 | 
			
		||||
#define PAM_SETCOLUMN_LSB 0x00
 | 
			
		||||
#define PAM_SETCOLUMN_MSB 0x10
 | 
			
		||||
#define PAM_PAGE_ADDR 0xB0  // 0xb0 -- 0xb7
 | 
			
		||||
#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
 | 
			
		||||
 | 
			
		||||
// Hardware Configuration Commands
 | 
			
		||||
#define DISPLAY_START_LINE 0x40
 | 
			
		||||
| 
						 | 
				
			
			@ -97,9 +97,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#define I2C_DATA 0x40
 | 
			
		||||
#if defined(__AVR__)
 | 
			
		||||
#    define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
 | 
			
		||||
#else  // defined(__AVR__)
 | 
			
		||||
#else // defined(__AVR__)
 | 
			
		||||
#    define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
 | 
			
		||||
#endif  // defined(__AVR__)
 | 
			
		||||
#endif // defined(__AVR__)
 | 
			
		||||
#define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
 | 
			
		||||
#define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, OLED_I2C_TIMEOUT)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +119,7 @@ bool            oled_inverted       = false;
 | 
			
		|||
uint8_t         oled_brightness     = OLED_BRIGHTNESS;
 | 
			
		||||
oled_rotation_t oled_rotation       = 0;
 | 
			
		||||
uint8_t         oled_rotation_width = 0;
 | 
			
		||||
uint8_t         oled_scroll_speed   = 0;  // this holds the speed after being remapped to ssd1306 internal values
 | 
			
		||||
uint8_t         oled_scroll_speed   = 0; // this holds the speed after being remapped to ssd1306 internal values
 | 
			
		||||
uint8_t         oled_scroll_start   = 0;
 | 
			
		||||
uint8_t         oled_scroll_end     = 7;
 | 
			
		||||
#if OLED_TIMEOUT > 0
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +190,7 @@ bool oled_init(oled_rotation_t rotation) {
 | 
			
		|||
#if (OLED_IC != OLED_IC_SH1106)
 | 
			
		||||
        // MEMORY_MODE is unsupported on SH1106 (Page Addressing only)
 | 
			
		||||
        MEMORY_MODE,
 | 
			
		||||
        0x00,  // Horizontal addressing mode
 | 
			
		||||
        0x00, // Horizontal addressing mode
 | 
			
		||||
#endif
 | 
			
		||||
    };
 | 
			
		||||
    if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) {
 | 
			
		||||
| 
						 | 
				
			
			@ -232,8 +232,12 @@ bool oled_init(oled_rotation_t rotation) {
 | 
			
		|||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return rotation; }
 | 
			
		||||
__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; }
 | 
			
		||||
__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
 | 
			
		||||
    return rotation;
 | 
			
		||||
}
 | 
			
		||||
__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) {
 | 
			
		||||
    return rotation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void oled_clear(void) {
 | 
			
		||||
    memset(oled_buffer, 0, sizeof(oled_buffer));
 | 
			
		||||
| 
						 | 
				
			
			@ -306,9 +310,9 @@ void oled_render(void) {
 | 
			
		|||
    // Set column & page position
 | 
			
		||||
    static uint8_t display_start[] = {I2C_CMD, COLUMN_ADDR, 0, OLED_DISPLAY_WIDTH - 1, PAGE_ADDR, 0, OLED_DISPLAY_HEIGHT / 8 - 1};
 | 
			
		||||
    if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
 | 
			
		||||
        calc_bounds(update_start, &display_start[1]);  // Offset from I2C_CMD byte at the start
 | 
			
		||||
        calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
 | 
			
		||||
    } else {
 | 
			
		||||
        calc_bounds_90(update_start, &display_start[1]);  // Offset from I2C_CMD byte at the start
 | 
			
		||||
        calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Send column & page position
 | 
			
		||||
| 
						 | 
				
			
			@ -368,7 +372,8 @@ void oled_advance_page(bool clearPageRemainder) {
 | 
			
		|||
        remaining = remaining / OLED_FONT_WIDTH;
 | 
			
		||||
 | 
			
		||||
        // Write empty character until next line
 | 
			
		||||
        while (remaining--) oled_write_char(' ', false);
 | 
			
		||||
        while (remaining--)
 | 
			
		||||
            oled_write_char(' ', false);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Next page index out of bounds?
 | 
			
		||||
        if (index + remaining >= OLED_MATRIX_SIZE) {
 | 
			
		||||
| 
						 | 
				
			
			@ -419,7 +424,7 @@ void oled_write_char(const char data, bool invert) {
 | 
			
		|||
    _Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
 | 
			
		||||
 | 
			
		||||
    // set the reder buffer data
 | 
			
		||||
    uint8_t cast_data = (uint8_t)data;  // font based on unsigned type for index
 | 
			
		||||
    uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
 | 
			
		||||
    if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) {
 | 
			
		||||
        memset(oled_cursor, 0x00, OLED_FONT_WIDTH);
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -545,7 +550,7 @@ void oled_write_raw_P(const char *data, uint16_t size) {
 | 
			
		|||
        oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif  // defined(__AVR__)
 | 
			
		||||
#endif // defined(__AVR__)
 | 
			
		||||
 | 
			
		||||
bool oled_on(void) {
 | 
			
		||||
    if (!oled_initialized) {
 | 
			
		||||
| 
						 | 
				
			
			@ -595,7 +600,9 @@ bool oled_off(void) {
 | 
			
		|||
    return !oled_active;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool is_oled_on(void) { return oled_active; }
 | 
			
		||||
bool is_oled_on(void) {
 | 
			
		||||
    return oled_active;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t oled_set_brightness(uint8_t level) {
 | 
			
		||||
    if (!oled_initialized) {
 | 
			
		||||
| 
						 | 
				
			
			@ -613,7 +620,9 @@ uint8_t oled_set_brightness(uint8_t level) {
 | 
			
		|||
    return oled_brightness;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t oled_get_brightness(void) { return oled_brightness; }
 | 
			
		||||
uint8_t oled_get_brightness(void) {
 | 
			
		||||
    return oled_brightness;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Set the specific 8 lines rows of the screen to scroll.
 | 
			
		||||
// 0 is the default for start, and 7 for end, which is the entire
 | 
			
		||||
| 
						 | 
				
			
			@ -693,7 +702,9 @@ bool oled_scroll_off(void) {
 | 
			
		|||
    return !oled_scrolling;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool is_oled_scrolling(void) { return oled_scrolling; }
 | 
			
		||||
bool is_oled_scrolling(void) {
 | 
			
		||||
    return oled_scrolling;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool oled_invert(bool invert) {
 | 
			
		||||
    if (!oled_initialized) {
 | 
			
		||||
| 
						 | 
				
			
			@ -777,5 +788,9 @@ void oled_task(void) {
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) bool oled_task_kb(void) { return oled_task_user(); }
 | 
			
		||||
__attribute__((weak)) bool oled_task_user(void) { return true; }
 | 
			
		||||
__attribute__((weak)) bool oled_task_kb(void) {
 | 
			
		||||
    return oled_task_user();
 | 
			
		||||
}
 | 
			
		||||
__attribute__((weak)) bool oled_task_user(void) {
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,12 +71,12 @@ uint8_t ps2_host_send(uint8_t data) {
 | 
			
		|||
 | 
			
		||||
    /* terminate a transmission if we have */
 | 
			
		||||
    inhibit();
 | 
			
		||||
    wait_us(100);  // 100us [4]p.13, [5]p.50
 | 
			
		||||
    wait_us(100); // 100us [4]p.13, [5]p.50
 | 
			
		||||
 | 
			
		||||
    /* 'Request to Send' and Start bit */
 | 
			
		||||
    data_lo();
 | 
			
		||||
    clock_hi();
 | 
			
		||||
    WAIT(clock_lo, 10000, 10);  // 10ms [5]p.50
 | 
			
		||||
    WAIT(clock_lo, 10000, 10); // 10ms [5]p.50
 | 
			
		||||
 | 
			
		||||
    /* Data bit */
 | 
			
		||||
    for (uint8_t i = 0; i < 8; i++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ uint8_t ps2_host_recv(void) {
 | 
			
		|||
    idle();
 | 
			
		||||
 | 
			
		||||
    /* start bit [1] */
 | 
			
		||||
    WAIT(clock_lo, 100, 1);  // TODO: this is enough?
 | 
			
		||||
    WAIT(clock_lo, 100, 1); // TODO: this is enough?
 | 
			
		||||
    WAIT(data_lo, 1, 2);
 | 
			
		||||
    WAIT(clock_hi, 50, 3);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
 | 
			
		|||
 | 
			
		||||
#if defined(__AVR__)
 | 
			
		||||
#    include <avr/interrupt.h>
 | 
			
		||||
#elif defined(PROTOCOL_CHIBIOS)  // TODO: or STM32 ?
 | 
			
		||||
#elif defined(PROTOCOL_CHIBIOS) // TODO: or STM32 ?
 | 
			
		||||
// chibiOS headers
 | 
			
		||||
#    include "ch.h"
 | 
			
		||||
#    include "hal.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +71,9 @@ static inline void    pbuf_clear(void);
 | 
			
		|||
 | 
			
		||||
#if defined(PROTOCOL_CHIBIOS)
 | 
			
		||||
void ps2_interrupt_service_routine(void);
 | 
			
		||||
void palCallback(void *arg) { ps2_interrupt_service_routine(); }
 | 
			
		||||
void palCallback(void *arg) {
 | 
			
		||||
    ps2_interrupt_service_routine();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#    define PS2_INT_INIT()                                 \
 | 
			
		||||
        { palSetLineMode(PS2_CLOCK_PIN, PAL_MODE_INPUT); } \
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +87,7 @@ void palCallback(void *arg) { ps2_interrupt_service_routine(); }
 | 
			
		|||
#    define PS2_INT_OFF()                       \
 | 
			
		||||
        { palDisableLineEvent(PS2_CLOCK_PIN); } \
 | 
			
		||||
        while (0)
 | 
			
		||||
#endif  // PROTOCOL_CHIBIOS
 | 
			
		||||
#endif // PROTOCOL_CHIBIOS
 | 
			
		||||
 | 
			
		||||
void ps2_host_init(void) {
 | 
			
		||||
    idle();
 | 
			
		||||
| 
						 | 
				
			
			@ -103,12 +105,12 @@ uint8_t ps2_host_send(uint8_t data) {
 | 
			
		|||
 | 
			
		||||
    /* terminate a transmission if we have */
 | 
			
		||||
    inhibit();
 | 
			
		||||
    wait_us(100);  // 100us [4]p.13, [5]p.50
 | 
			
		||||
    wait_us(100); // 100us [4]p.13, [5]p.50
 | 
			
		||||
 | 
			
		||||
    /* 'Request to Send' and Start bit */
 | 
			
		||||
    data_lo();
 | 
			
		||||
    clock_hi();
 | 
			
		||||
    WAIT(clock_lo, 10000, 10);  // 10ms [5]p.50
 | 
			
		||||
    WAIT(clock_lo, 10000, 10); // 10ms [5]p.50
 | 
			
		||||
 | 
			
		||||
    /* Data bit[2-9] */
 | 
			
		||||
    for (uint8_t i = 0; i < 8; i++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +246,9 @@ RETURN:
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
#if defined(__AVR__)
 | 
			
		||||
ISR(PS2_INT_VECT) { ps2_interrupt_service_routine(); }
 | 
			
		||||
ISR(PS2_INT_VECT) {
 | 
			
		||||
    ps2_interrupt_service_routine();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* send LED state to keyboard */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report);
 | 
			
		|||
void ps2_mouse_init(void) {
 | 
			
		||||
    ps2_host_init();
 | 
			
		||||
 | 
			
		||||
    wait_ms(PS2_MOUSE_INIT_DELAY);  // wait for powering up
 | 
			
		||||
    wait_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up
 | 
			
		||||
 | 
			
		||||
    PS2_MOUSE_SEND(PS2_MOUSE_RESET, "ps2_mouse_init: sending reset");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -113,9 +113,13 @@ void ps2_mouse_task(void) {
 | 
			
		|||
    ps2_mouse_clear_report(&mouse_report);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_disable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); }
 | 
			
		||||
void ps2_mouse_disable_data_reporting(void) {
 | 
			
		||||
    PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_enable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting"); }
 | 
			
		||||
void ps2_mouse_enable_data_reporting(void) {
 | 
			
		||||
    PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_set_remote_mode(void) {
 | 
			
		||||
    PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
 | 
			
		||||
| 
						 | 
				
			
			@ -127,13 +131,21 @@ void ps2_mouse_set_stream_mode(void) {
 | 
			
		|||
    ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_set_scaling_2_1(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1"); }
 | 
			
		||||
void ps2_mouse_set_scaling_2_1(void) {
 | 
			
		||||
    PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_set_scaling_1_1(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1"); }
 | 
			
		||||
void ps2_mouse_set_scaling_1_1(void) {
 | 
			
		||||
    PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution"); }
 | 
			
		||||
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) {
 | 
			
		||||
    PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate"); }
 | 
			
		||||
void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) {
 | 
			
		||||
    PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ============================= HELPERS ============================ */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +177,7 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report)
 | 
			
		|||
#ifdef PS2_MOUSE_INVERT_X
 | 
			
		||||
    mouse_report->x = -mouse_report->x;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef PS2_MOUSE_INVERT_Y  // NOTE if not!
 | 
			
		||||
#ifndef PS2_MOUSE_INVERT_Y // NOTE if not!
 | 
			
		||||
    // invert coordinate of y to conform to USB HID mouse
 | 
			
		||||
    mouse_report->y = -mouse_report->y;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,9 +74,13 @@ void adns5050_sync(void) {
 | 
			
		|||
    writePinHigh(ADNS5050_CS_PIN);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void adns5050_cs_select(void) { writePinLow(ADNS5050_CS_PIN); }
 | 
			
		||||
void adns5050_cs_select(void) {
 | 
			
		||||
    writePinLow(ADNS5050_CS_PIN);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void adns5050_cs_deselect(void) { writePinHigh(ADNS5050_CS_PIN); }
 | 
			
		||||
void adns5050_cs_deselect(void) {
 | 
			
		||||
    writePinHigh(ADNS5050_CS_PIN);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t adns5050_serial_read(void) {
 | 
			
		||||
    setPinInput(ADNS5050_SDIO_PIN);
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +194,7 @@ int8_t convert_twoscomp(uint8_t data) {
 | 
			
		|||
 | 
			
		||||
// Don't forget to use the definitions for CPI in the header file.
 | 
			
		||||
void adns5050_set_cpi(uint16_t cpi) {
 | 
			
		||||
    uint8_t cpival = constrain((cpi / 125), 0x1, 0xD);  // limits to 0--119
 | 
			
		||||
    uint8_t cpival = constrain((cpi / 125), 0x1, 0xD); // limits to 0--119
 | 
			
		||||
 | 
			
		||||
    adns5050_write_reg(REG_MOUSE_CONTROL2, 0b10000 | cpival);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,7 +77,9 @@
 | 
			
		|||
#define MSB1              0x80
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
void adns9800_spi_start(void) { spi_start(ADNS9800_CS_PIN, false, ADNS9800_SPI_MODE, ADNS9800_SPI_DIVISOR); }
 | 
			
		||||
void adns9800_spi_start(void) {
 | 
			
		||||
    spi_start(ADNS9800_CS_PIN, false, ADNS9800_SPI_MODE, ADNS9800_SPI_DIVISOR);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void adns9800_write(uint8_t reg_addr, uint8_t data) {
 | 
			
		||||
    adns9800_spi_start();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ uint16_t minAxisValue = ANALOG_JOYSTICK_AXIS_MIN;
 | 
			
		|||
uint16_t maxAxisValue = ANALOG_JOYSTICK_AXIS_MAX;
 | 
			
		||||
 | 
			
		||||
uint8_t maxCursorSpeed = ANALOG_JOYSTICK_SPEED_MAX;
 | 
			
		||||
uint8_t speedRegulator = ANALOG_JOYSTICK_SPEED_REGULATOR;  // Lower Values Create Faster Movement
 | 
			
		||||
uint8_t speedRegulator = ANALOG_JOYSTICK_SPEED_REGULATOR; // Lower Values Create Faster Movement
 | 
			
		||||
 | 
			
		||||
int16_t xOrigin, yOrigin;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,7 +54,9 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count);
 | 
			
		|||
void RAP_Write(uint8_t address, uint8_t data);
 | 
			
		||||
 | 
			
		||||
#ifdef CONSOLE_ENABLE
 | 
			
		||||
void print_byte(uint8_t byte) { xprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
 | 
			
		||||
void print_byte(uint8_t byte) {
 | 
			
		||||
    xprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0'));
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*  Logical Scaling Functions */
 | 
			
		||||
| 
						 | 
				
			
			@ -73,8 +75,12 @@ void ClipCoordinates(pinnacle_data_t* coordinates) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t cirque_pinnacle_get_scale(void) { return scale_data; }
 | 
			
		||||
void     cirque_pinnacle_set_scale(uint16_t scale) { scale_data = scale; }
 | 
			
		||||
uint16_t cirque_pinnacle_get_scale(void) {
 | 
			
		||||
    return scale_data;
 | 
			
		||||
}
 | 
			
		||||
void cirque_pinnacle_set_scale(uint16_t scale) {
 | 
			
		||||
    scale_data = scale;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Scales data to desired X & Y resolution
 | 
			
		||||
void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution) {
 | 
			
		||||
| 
						 | 
				
			
			@ -105,13 +111,13 @@ void cirque_pinnacle_clear_flags() {
 | 
			
		|||
void cirque_pinnacle_enable_feed(bool feedEnable) {
 | 
			
		||||
    uint8_t temp;
 | 
			
		||||
 | 
			
		||||
    RAP_ReadBytes(FEEDCONFIG_1, &temp, 1);  // Store contents of FeedConfig1 register
 | 
			
		||||
    RAP_ReadBytes(FEEDCONFIG_1, &temp, 1); // Store contents of FeedConfig1 register
 | 
			
		||||
 | 
			
		||||
    if (feedEnable) {
 | 
			
		||||
        temp |= 0x01;  // Set Feed Enable bit
 | 
			
		||||
        temp |= 0x01; // Set Feed Enable bit
 | 
			
		||||
        RAP_Write(0x04, temp);
 | 
			
		||||
    } else {
 | 
			
		||||
        temp &= ~0x01;  // Clear Feed Enable bit
 | 
			
		||||
        temp &= ~0x01; // Clear Feed Enable bit
 | 
			
		||||
        RAP_Write(0x04, temp);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -122,13 +128,13 @@ void cirque_pinnacle_enable_feed(bool feedEnable) {
 | 
			
		|||
void ERA_ReadBytes(uint16_t address, uint8_t* data, uint16_t count) {
 | 
			
		||||
    uint8_t ERAControlValue = 0xFF;
 | 
			
		||||
 | 
			
		||||
    cirque_pinnacle_enable_feed(false);  // Disable feed
 | 
			
		||||
    cirque_pinnacle_enable_feed(false); // Disable feed
 | 
			
		||||
 | 
			
		||||
    RAP_Write(ERA_HIGH_BYTE, (uint8_t)(address >> 8));     // Send upper byte of ERA address
 | 
			
		||||
    RAP_Write(ERA_LOW_BYTE, (uint8_t)(address & 0x00FF));  // Send lower byte of ERA address
 | 
			
		||||
    RAP_Write(ERA_HIGH_BYTE, (uint8_t)(address >> 8));    // Send upper byte of ERA address
 | 
			
		||||
    RAP_Write(ERA_LOW_BYTE, (uint8_t)(address & 0x00FF)); // Send lower byte of ERA address
 | 
			
		||||
 | 
			
		||||
    for (uint16_t i = 0; i < count; i++) {
 | 
			
		||||
        RAP_Write(ERA_CONTROL, 0x05);  // Signal ERA-read (auto-increment) to Pinnacle
 | 
			
		||||
        RAP_Write(ERA_CONTROL, 0x05); // Signal ERA-read (auto-increment) to Pinnacle
 | 
			
		||||
 | 
			
		||||
        // Wait for status register 0x1E to clear
 | 
			
		||||
        do {
 | 
			
		||||
| 
						 | 
				
			
			@ -145,14 +151,14 @@ void ERA_ReadBytes(uint16_t address, uint8_t* data, uint16_t count) {
 | 
			
		|||
void ERA_WriteByte(uint16_t address, uint8_t data) {
 | 
			
		||||
    uint8_t ERAControlValue = 0xFF;
 | 
			
		||||
 | 
			
		||||
    cirque_pinnacle_enable_feed(false);  // Disable feed
 | 
			
		||||
    cirque_pinnacle_enable_feed(false); // Disable feed
 | 
			
		||||
 | 
			
		||||
    RAP_Write(ERA_VALUE, data);  // Send data byte to be written
 | 
			
		||||
    RAP_Write(ERA_VALUE, data); // Send data byte to be written
 | 
			
		||||
 | 
			
		||||
    RAP_Write(ERA_HIGH_BYTE, (uint8_t)(address >> 8));     // Upper byte of ERA address
 | 
			
		||||
    RAP_Write(ERA_LOW_BYTE, (uint8_t)(address & 0x00FF));  // Lower byte of ERA address
 | 
			
		||||
    RAP_Write(ERA_HIGH_BYTE, (uint8_t)(address >> 8));    // Upper byte of ERA address
 | 
			
		||||
    RAP_Write(ERA_LOW_BYTE, (uint8_t)(address & 0x00FF)); // Lower byte of ERA address
 | 
			
		||||
 | 
			
		||||
    RAP_Write(ERA_CONTROL, 0x02);  // Signal an ERA-write to Pinnacle
 | 
			
		||||
    RAP_Write(ERA_CONTROL, 0x02); // Signal an ERA-write to Pinnacle
 | 
			
		||||
 | 
			
		||||
    // Wait for status register 0x1E to clear
 | 
			
		||||
    do {
 | 
			
		||||
| 
						 | 
				
			
			@ -166,7 +172,7 @@ void cirque_pinnacle_set_adc_attenuation(uint8_t adcGain) {
 | 
			
		|||
    uint8_t temp = 0x00;
 | 
			
		||||
 | 
			
		||||
    ERA_ReadBytes(0x0187, &temp, 1);
 | 
			
		||||
    temp &= 0x3F;  // clear top two bits
 | 
			
		||||
    temp &= 0x3F; // clear top two bits
 | 
			
		||||
    temp |= adcGain;
 | 
			
		||||
    ERA_WriteByte(0x0187, temp);
 | 
			
		||||
    ERA_ReadBytes(0x0187, &temp, 1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,16 +26,16 @@ void            cirque_pinnacle_set_scale(uint16_t scale);
 | 
			
		|||
 | 
			
		||||
// Coordinate scaling values
 | 
			
		||||
#ifndef CIRQUE_PINNACLE_X_LOWER
 | 
			
		||||
#    define CIRQUE_PINNACLE_X_LOWER 127  // min "reachable" X value
 | 
			
		||||
#    define CIRQUE_PINNACLE_X_LOWER 127 // min "reachable" X value
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef CIRQUE_PINNACLE_X_UPPER
 | 
			
		||||
#    define CIRQUE_PINNACLE_X_UPPER 1919  // max "reachable" X value
 | 
			
		||||
#    define CIRQUE_PINNACLE_X_UPPER 1919 // max "reachable" X value
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef CIRQUE_PINNACLE_Y_LOWER
 | 
			
		||||
#    define CIRQUE_PINNACLE_Y_LOWER 63  // min "reachable" Y value
 | 
			
		||||
#    define CIRQUE_PINNACLE_Y_LOWER 63 // min "reachable" Y value
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef CIRQUE_PINNACLE_Y_UPPER
 | 
			
		||||
#    define CIRQUE_PINNACLE_Y_UPPER 1471  // max "reachable" Y value
 | 
			
		||||
#    define CIRQUE_PINNACLE_Y_UPPER 1471 // max "reachable" Y value
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef CIRQUE_PINNACLE_X_RANGE
 | 
			
		||||
#    define CIRQUE_PINNACLE_X_RANGE (CIRQUE_PINNACLE_X_UPPER - CIRQUE_PINNACLE_X_LOWER)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ extern bool touchpad_init;
 | 
			
		|||
/*  RAP Functions */
 | 
			
		||||
// Reads <count> Pinnacle registers starting at <address>
 | 
			
		||||
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) {
 | 
			
		||||
        i2c_writeReg(CIRQUE_PINNACLE_ADDR << 1, cmdByte, NULL, 0, CIRQUE_PINNACLE_TIMEOUT);
 | 
			
		||||
        if (i2c_readReg(CIRQUE_PINNACLE_ADDR << 1, cmdByte, data, count, CIRQUE_PINNACLE_TIMEOUT) != I2C_STATUS_SUCCESS) {
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) {
 | 
			
		|||
 | 
			
		||||
// Writes single-byte <data> to <address>
 | 
			
		||||
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 (i2c_writeReg(CIRQUE_PINNACLE_ADDR << 1, cmdByte, &data, sizeof(data), CIRQUE_PINNACLE_TIMEOUT) != I2C_STATUS_SUCCESS) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,14 +13,14 @@ extern bool touchpad_init;
 | 
			
		|||
/*  RAP Functions */
 | 
			
		||||
// Reads <count> Pinnacle registers starting at <address>
 | 
			
		||||
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 (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) {
 | 
			
		||||
            spi_write(cmdByte);
 | 
			
		||||
            spi_read();  // filler
 | 
			
		||||
            spi_read();  // filler
 | 
			
		||||
            spi_read(); // filler
 | 
			
		||||
            spi_read(); // filler
 | 
			
		||||
            for (uint8_t i = 0; i < count; i++) {
 | 
			
		||||
                data[i] = spi_read();  // each sepsequent read gets another register's contents
 | 
			
		||||
                data[i] = spi_read(); // each sepsequent read gets another register's contents
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
#ifdef CONSOLE_ENABLE
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) {
 | 
			
		|||
 | 
			
		||||
// Writes single-byte <data> to <address>
 | 
			
		||||
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 (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,9 @@
 | 
			
		|||
 | 
			
		||||
static uint16_t precision = 128;
 | 
			
		||||
 | 
			
		||||
uint16_t pimoroni_trackball_get_cpi(void) { return (precision * 125); }
 | 
			
		||||
uint16_t pimoroni_trackball_get_cpi(void) {
 | 
			
		||||
    return (precision * 125);
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets the scaling value for pimoroni trackball
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,7 +86,9 @@
 | 
			
		|||
bool _inBurst = false;
 | 
			
		||||
 | 
			
		||||
#ifdef CONSOLE_ENABLE
 | 
			
		||||
void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
 | 
			
		||||
void print_byte(uint8_t byte) {
 | 
			
		||||
    dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0'));
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +146,7 @@ bool pmw3360_init(void) {
 | 
			
		|||
    pmw3360_spi_start();
 | 
			
		||||
    spi_stop();
 | 
			
		||||
 | 
			
		||||
    pmw3360_write(REG_Shutdown, 0xb6);  // Shutdown first
 | 
			
		||||
    pmw3360_write(REG_Shutdown, 0xb6); // Shutdown first
 | 
			
		||||
    wait_ms(300);
 | 
			
		||||
 | 
			
		||||
    pmw3360_spi_start();
 | 
			
		||||
| 
						 | 
				
			
			@ -222,7 +224,7 @@ bool pmw3360_check_signature(void) {
 | 
			
		|||
    uint8_t pid      = pmw3360_read(REG_Product_ID);
 | 
			
		||||
    uint8_t iv_pid   = pmw3360_read(REG_Inverse_Product_ID);
 | 
			
		||||
    uint8_t SROM_ver = pmw3360_read(REG_SROM_ID);
 | 
			
		||||
    return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]);  // signature for SROM 0x04
 | 
			
		||||
    return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]); // signature for SROM 0x04
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t pmw3360_get_cpi(void) {
 | 
			
		||||
| 
						 | 
				
			
			@ -248,17 +250,17 @@ report_pmw3360_t pmw3360_read_burst(void) {
 | 
			
		|||
 | 
			
		||||
    pmw3360_spi_start();
 | 
			
		||||
    spi_write(REG_Motion_Burst);
 | 
			
		||||
    wait_us(35);  // waits for tSRAD_MOTBR
 | 
			
		||||
    wait_us(35); // waits for tSRAD_MOTBR
 | 
			
		||||
 | 
			
		||||
    report.motion = spi_read();
 | 
			
		||||
    spi_read();  // skip Observation
 | 
			
		||||
    spi_read(); // skip Observation
 | 
			
		||||
    // delta registers
 | 
			
		||||
    report.dx  = spi_read();
 | 
			
		||||
    report.mdx = spi_read();
 | 
			
		||||
    report.dy  = spi_read();
 | 
			
		||||
    report.mdy = spi_read();
 | 
			
		||||
 | 
			
		||||
    if (report.motion & 0b111) {  // panic recovery, sometimes burst mode works weird.
 | 
			
		||||
    if (report.motion & 0b111) { // panic recovery, sometimes burst mode works weird.
 | 
			
		||||
        _inBurst = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,11 +58,11 @@
 | 
			
		|||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    int8_t  motion;
 | 
			
		||||
    bool    isMotion;     // True if a motion is detected.
 | 
			
		||||
    bool    isOnSurface;  // True when a chip is on a surface
 | 
			
		||||
    int16_t dx;           // displacement on x directions. Unit: Count. (CPI * Count = Inch value)
 | 
			
		||||
    bool    isMotion;    // True if a motion is detected.
 | 
			
		||||
    bool    isOnSurface; // True when a chip is on a surface
 | 
			
		||||
    int16_t dx;          // displacement on x directions. Unit: Count. (CPI * Count = Inch value)
 | 
			
		||||
    int8_t  mdx;
 | 
			
		||||
    int16_t dy;  // displacement on y directions.
 | 
			
		||||
    int16_t dy; // displacement on y directions.
 | 
			
		||||
    int8_t  mdy;
 | 
			
		||||
} report_pmw3360_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -90,7 +90,9 @@
 | 
			
		|||
bool _inBurst = false;
 | 
			
		||||
 | 
			
		||||
#ifdef CONSOLE_ENABLE
 | 
			
		||||
void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
 | 
			
		||||
void print_byte(uint8_t byte) {
 | 
			
		||||
    dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0'));
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -148,7 +150,7 @@ bool pmw3389_init(void) {
 | 
			
		|||
    pmw3389_spi_start();
 | 
			
		||||
    spi_stop();
 | 
			
		||||
 | 
			
		||||
    pmw3389_write(REG_Shutdown, 0xb6);  // Shutdown first
 | 
			
		||||
    pmw3389_write(REG_Shutdown, 0xb6); // Shutdown first
 | 
			
		||||
    wait_ms(300);
 | 
			
		||||
 | 
			
		||||
    pmw3389_spi_start();
 | 
			
		||||
| 
						 | 
				
			
			@ -226,7 +228,7 @@ bool pmw3389_check_signature(void) {
 | 
			
		|||
    uint8_t pid      = pmw3389_read(REG_Product_ID);
 | 
			
		||||
    uint8_t iv_pid   = pmw3389_read(REG_Inverse_Product_ID);
 | 
			
		||||
    uint8_t SROM_ver = pmw3389_read(REG_SROM_ID);
 | 
			
		||||
    return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]);  // signature for SROM 0x04
 | 
			
		||||
    return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]); // signature for SROM 0x04
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t pmw3389_get_cpi(void) {
 | 
			
		||||
| 
						 | 
				
			
			@ -254,17 +256,17 @@ report_pmw3389_t pmw3389_read_burst(void) {
 | 
			
		|||
 | 
			
		||||
    pmw3389_spi_start();
 | 
			
		||||
    spi_write(REG_Motion_Burst);
 | 
			
		||||
    wait_us(35);  // waits for tSRAD_MOTBR
 | 
			
		||||
    wait_us(35); // waits for tSRAD_MOTBR
 | 
			
		||||
 | 
			
		||||
    report.motion = spi_read();
 | 
			
		||||
    spi_read();  // skip Observation
 | 
			
		||||
    spi_read(); // skip Observation
 | 
			
		||||
    // delta registers
 | 
			
		||||
    report.dx  = spi_read();
 | 
			
		||||
    report.mdx = spi_read();
 | 
			
		||||
    report.dy  = spi_read();
 | 
			
		||||
    report.mdy = spi_read();
 | 
			
		||||
 | 
			
		||||
    if (report.motion & 0b111) {  // panic recovery, sometimes burst mode works weird.
 | 
			
		||||
    if (report.motion & 0b111) { // panic recovery, sometimes burst mode works weird.
 | 
			
		||||
        _inBurst = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,11 +59,11 @@
 | 
			
		|||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    int8_t  motion;
 | 
			
		||||
    bool    isMotion;     // True if a motion is detected.
 | 
			
		||||
    bool    isOnSurface;  // True when a chip is on a surface
 | 
			
		||||
    int16_t dx;           // displacement on x directions. Unit: Count. (CPI * Count = Inch value)
 | 
			
		||||
    bool    isMotion;    // True if a motion is detected.
 | 
			
		||||
    bool    isOnSurface; // True when a chip is on a surface
 | 
			
		||||
    int16_t dx;          // displacement on x directions. Unit: Count. (CPI * Count = Inch value)
 | 
			
		||||
    int8_t  mdx;
 | 
			
		||||
    int16_t dy;  // displacement on y directions.
 | 
			
		||||
    int16_t dy; // displacement on y directions.
 | 
			
		||||
    int8_t  mdy;
 | 
			
		||||
} report_pmw3389_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -352,7 +352,7 @@ void USB2422_init() {
 | 
			
		|||
    setPinInput(USB2422_ACTIVE_PIN);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    i2c_init();  // IC2 clk must be high at USB2422 reset release time to signal SMB configuration
 | 
			
		||||
    i2c_init(); // IC2 clk must be high at USB2422 reset release time to signal SMB configuration
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USB2422_configure() {
 | 
			
		||||
| 
						 | 
				
			
			@ -363,14 +363,14 @@ void USB2422_configure() {
 | 
			
		|||
    // configure Usb2422 registers
 | 
			
		||||
    config.VID.reg               = USB2422_VENDOR_ID;
 | 
			
		||||
    config.PID.reg               = USB2422_PRODUCT_ID;
 | 
			
		||||
    config.DID.reg               = USB2422_DEVICE_VER;  // BCD format, eg 01.01
 | 
			
		||||
    config.CFG1.bit.SELF_BUS_PWR = 1;                   // self powered for now
 | 
			
		||||
    config.CFG1.bit.HS_DISABLE   = 1;                   // full or high speed
 | 
			
		||||
    config.DID.reg               = USB2422_DEVICE_VER; // BCD format, eg 01.01
 | 
			
		||||
    config.CFG1.bit.SELF_BUS_PWR = 1;                  // self powered for now
 | 
			
		||||
    config.CFG1.bit.HS_DISABLE   = 1;                  // full or high speed
 | 
			
		||||
    // config.CFG2.bit.COMPOUND = 0; // compound device
 | 
			
		||||
    config.CFG3.bit.STRING_EN = 1;  // strings enabled
 | 
			
		||||
    config.CFG3.bit.STRING_EN = 1; // strings enabled
 | 
			
		||||
    // config.NRD.bit.PORT2_NR = 0; // MCU is non-removable
 | 
			
		||||
    config.MAXPB.reg = 20;  // 0mA
 | 
			
		||||
    config.HCMCB.reg = 20;  // 0mA
 | 
			
		||||
    config.MAXPB.reg = 20; // 0mA
 | 
			
		||||
    config.HCMCB.reg = 20; // 0mA
 | 
			
		||||
    config.MFRSL.reg = sizeof(USB2422_MANUFACTURER);
 | 
			
		||||
    config.PRDSL.reg = sizeof(USB2422_PRODUCT);
 | 
			
		||||
    config.SERSL.reg = sizeof(SERNAME);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,19 +33,19 @@
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef WS2812_T1H
 | 
			
		||||
#    define WS2812_T1H 900  // Width of a 1 bit in ns
 | 
			
		||||
#    define WS2812_T1H 900 // Width of a 1 bit in ns
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef WS2812_T1L
 | 
			
		||||
#    define WS2812_T1L (WS2812_TIMING - WS2812_T1H)  // Width of a 1 bit in ns
 | 
			
		||||
#    define WS2812_T1L (WS2812_TIMING - WS2812_T1H) // Width of a 1 bit in ns
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef WS2812_T0H
 | 
			
		||||
#    define WS2812_T0H 350  // Width of a 0 bit in ns
 | 
			
		||||
#    define WS2812_T0H 350 // Width of a 0 bit in ns
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef WS2812_T0L
 | 
			
		||||
#    define WS2812_T0L (WS2812_TIMING - WS2812_T0H)  // Width of a 0 bit in ns
 | 
			
		||||
#    define WS2812_T0L (WS2812_TIMING - WS2812_T0H) // Width of a 0 bit in ns
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue