clang-format changes

This commit is contained in:
skullY 2019-08-30 11:19:03 -07:00 committed by skullydazed
parent 61af76a10d
commit b624f32f94
502 changed files with 32259 additions and 39062 deletions

View file

@ -38,11 +38,7 @@ static const I2CConfig i2cconfig = {
I2C1_CLOCK_SPEED, I2C1_CLOCK_SPEED,
I2C1_DUTY_CYCLE, I2C1_DUTY_CYCLE,
#else #else
STM32_TIMINGR_PRESC(I2C1_TIMINGR_PRESC) | STM32_TIMINGR_PRESC(I2C1_TIMINGR_PRESC) | STM32_TIMINGR_SCLDEL(I2C1_TIMINGR_SCLDEL) | STM32_TIMINGR_SDADEL(I2C1_TIMINGR_SDADEL) | STM32_TIMINGR_SCLH(I2C1_TIMINGR_SCLH) | STM32_TIMINGR_SCLL(I2C1_TIMINGR_SCLL), 0, 0
STM32_TIMINGR_SCLDEL(I2C1_TIMINGR_SCLDEL) | STM32_TIMINGR_SDADEL(I2C1_TIMINGR_SDADEL) |
STM32_TIMINGR_SCLH(I2C1_TIMINGR_SCLH) | STM32_TIMINGR_SCLL(I2C1_TIMINGR_SCLL),
0,
0
#endif #endif
}; };
@ -58,9 +54,7 @@ static i2c_status_t chibios_to_qmk(const msg_t* status) {
} }
} }
__attribute__ ((weak)) __attribute__((weak)) void i2c_init(void) {
void i2c_init(void)
{
// Try releasing special pins for a short time // Try releasing special pins for a short time
palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT); palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT);
palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT); palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT);
@ -78,37 +72,32 @@ void i2c_init(void)
// i2cInit(); //This is invoked by halInit() so no need to redo it. // i2cInit(); //This is invoked by halInit() so no need to redo it.
} }
i2c_status_t i2c_start(uint8_t address) i2c_status_t i2c_start(uint8_t address) {
{
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
return I2C_STATUS_SUCCESS; return I2C_STATUS_SUCCESS;
} }
i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) {
{
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) {
{
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) {
{
i2c_address = devaddr; i2c_address = devaddr;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
uint8_t complete_packet[length + 1]; uint8_t complete_packet[length + 1];
for(uint8_t i = 0; i < length; i++) for (uint8_t i = 0; i < length; i++) {
{
complete_packet[i + 1] = data[i]; complete_packet[i + 1] = data[i];
} }
complete_packet[0] = regaddr; complete_packet[0] = regaddr;
@ -117,15 +106,11 @@ i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data,
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
{
i2c_address = devaddr; i2c_address = devaddr;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, MS2ST(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
void i2c_stop(void) void i2c_stop(void) { i2cStop(&I2C_DRIVER); }
{
i2cStop(&I2C_DRIVER);
}

View file

@ -27,7 +27,6 @@
#include "ch.h" #include "ch.h"
#include <hal.h> #include <hal.h>
#if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx) #if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx)
# define USE_I2CV1 # define USE_I2CV1
#endif #endif

View file

@ -21,23 +21,14 @@
#include <stdint.h> #include <stdint.h>
#include "analog.h" #include "analog.h"
static uint8_t aref = (1 << REFS0); // default to AREF = Vcc static uint8_t aref = (1 << REFS0); // default to AREF = Vcc
void analogReference(uint8_t mode) { aref = mode & 0xC0; }
void analogReference(uint8_t mode)
{
aref = mode & 0xC0;
}
// Arduino compatible pin input // Arduino compatible pin input
int16_t analogRead(uint8_t pin) int16_t analogRead(uint8_t pin) {
{
#if defined(__AVR_ATmega32U4__) #if defined(__AVR_ATmega32U4__)
static const uint8_t PROGMEM pin_to_mux[] = { static const uint8_t PROGMEM pin_to_mux[] = {0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20};
0x00, 0x01, 0x04, 0x05, 0x06, 0x07,
0x25, 0x24, 0x23, 0x22, 0x21, 0x20};
if (pin >= 12) return 0; if (pin >= 12) return 0;
return adc_read(pgm_read_byte(pin_to_mux + pin)); return adc_read(pgm_read_byte(pin_to_mux + pin));
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
@ -49,8 +40,7 @@ int16_t analogRead(uint8_t pin)
} }
// Mux input // Mux input
int16_t adc_read(uint8_t mux) int16_t adc_read(uint8_t mux) {
{
#if defined(__AVR_AT90USB162__) #if defined(__AVR_AT90USB162__)
return 0; return 0;
#else #else
@ -60,10 +50,9 @@ int16_t adc_read(uint8_t mux)
ADCSRB = (1 << ADHSM) | (mux & 0x20); // high speed mode ADCSRB = (1 << ADHSM) | (mux & 0x20); // high speed mode
ADMUX = aref | (mux & 0x1F); // configure mux input ADMUX = aref | (mux & 0x1F); // configure mux input
ADCSRA = (1 << ADEN) | ADC_PRESCALER | (1 << ADSC); // start the conversion ADCSRA = (1 << ADEN) | ADC_PRESCALER | (1 << ADSC); // start the conversion
while (ADCSRA & (1<<ADSC)) ; // wait for result while (ADCSRA & (1 << ADSC))
; // wait for result
low = ADCL; // must read LSB first low = ADCL; // must read LSB first
return (ADCH << 8) | low; // must read MSB only once! return (ADCH << 8) | low; // must read MSB only once!
#endif #endif
} }

11
drivers/avr/apa102.c Executable file → Normal file
View file

@ -27,9 +27,7 @@
#include "debug.h" #include "debug.h"
// Setleds for standard RGB // Setleds for standard RGB
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds){ void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds) { apa102_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF)); }
apa102_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF));
}
void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) { void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) {
pinMode(RGB_DI_PIN, PinDirectionOutput); pinMode(RGB_DI_PIN, PinDirectionOutput);
@ -54,12 +52,9 @@ void apa102_send_frame(uint32_t frame){
} }
} }
void apa102_start_frame(){ void apa102_start_frame() { apa102_send_frame(0); }
apa102_send_frame(0);
}
void apa102_end_frame(uint16_t leds) void apa102_end_frame(uint16_t leds) {
{
// This function has been taken from: https://github.com/pololu/apa102-arduino/blob/master/APA102.h // This function has been taken from: https://github.com/pololu/apa102-arduino/blob/master/APA102.h
// and adapted. The code is MIT licensed. I think thats compatible? // and adapted. The code is MIT licensed. I think thats compatible?

1
drivers/avr/apa102.h Executable file → Normal file
View file

@ -27,7 +27,6 @@
#include "color.h" #include "color.h"
/* User Interface /* User Interface
* *
* Input: * Input:

View file

@ -16,261 +16,19 @@
// Standard ASCII 5x7 font // Standard ASCII 5x7 font
static const unsigned char font[] PROGMEM = { static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, 0x18, 0x3C, 0x18, 0x00, 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, 0x18, 0x24, 0x18, 0x00, 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x26, 0x29, 0x79, 0x29, 0x26, 0x40, 0x7F, 0x05, 0x05, 0x07, 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, 0x66, 0x89, 0x95, 0x6A, 0x60, 0x60, 0x60, 0x60, 0x60, 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x10, 0x20, 0x7E, 0x20, 0x10, 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x1E, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x30, 0x38, 0x3E, 0x38, 0x30, 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x23, 0x13, 0x08, 0x64, 0x62, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x41, 0x22, 0x1C, 0x00, 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x80, 0x70, 0x30, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x60, 0x60, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x72, 0x49, 0x49, 0x49, 0x46, 0x21, 0x41, 0x49, 0x4D, 0x33, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x27, 0x45, 0x45, 0x45, 0x39, 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x41, 0x21, 0x11, 0x09, 0x07, 0x36, 0x49, 0x49, 0x49, 0x36, 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x40, 0x34, 0x00, 0x00,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, 0x08, 0x14, 0x22, 0x41, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x41, 0x22, 0x14, 0x08, 0x02, 0x01, 0x59, 0x09, 0x06, 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x3E, 0x41, 0x41, 0x51, 0x73, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x26, 0x49, 0x49, 0x49, 0x32, 0x03, 0x01, 0x7F, 0x01, 0x03, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x63, 0x14, 0x08, 0x14, 0x63, 0x03, 0x04, 0x78, 0x04, 0x03,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x41, 0x41, 0x41, 0x7F, 0x04, 0x02, 0x01, 0x02, 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x03, 0x07, 0x08, 0x00, 0x20, 0x54, 0x54, 0x78, 0x40, 0x7F, 0x28, 0x44, 0x44, 0x38, 0x38, 0x44, 0x44, 0x44, 0x28, 0x38, 0x44, 0x44, 0x28, 0x7F, 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, 0x08, 0x7E, 0x09, 0x02, 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x44, 0x7D, 0x40, 0x00, 0x20, 0x40, 0x40, 0x3D, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x7C, 0x08, 0x04, 0x04, 0x78, 0x38, 0x44, 0x44, 0x44, 0x38, 0xFC, 0x18, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x18, 0xFC, 0x7C, 0x08, 0x04, 0x04, 0x08, 0x48, 0x54, 0x54, 0x54, 0x24, 0x04, 0x04, 0x3F, 0x44, 0x24, 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x3C, 0x40, 0x30, 0x40, 0x3C,
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x44, 0x28, 0x10, 0x28, 0x44, 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x36, 0x08, 0x00, 0x02, 0x01, 0x02, 0x04, 0x02, 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x1E, 0xA1, 0xA1, 0x61, 0x12, 0x3A, 0x40, 0x40, 0x20, 0x7A, 0x38, 0x54, 0x54, 0x55, 0x59, 0x21, 0x55, 0x55, 0x79, 0x41, 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x21, 0x55, 0x54, 0x78, 0x40, 0x20, 0x54, 0x55, 0x79, 0x40, 0x0C, 0x1E, 0x52, 0x72, 0x12, 0x39, 0x55, 0x55, 0x55, 0x59, 0x39, 0x54, 0x54, 0x54, 0x59, 0x39, 0x55, 0x54, 0x54, 0x58, 0x00, 0x00, 0x45, 0x7C, 0x41, 0x00, 0x02, 0x45, 0x7D, 0x42, 0x00, 0x01, 0x45, 0x7C, 0x40, 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0xF0, 0x28, 0x25, 0x28, 0xF0, 0x7C, 0x54, 0x55, 0x45, 0x00, 0x20, 0x54, 0x54, 0x7C, 0x54, 0x7C, 0x0A, 0x09, 0x7F, 0x49, 0x32, 0x49, 0x49, 0x49, 0x32, 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut
0x00, 0x18, 0x3C, 0x18, 0x00, 0x32, 0x4A, 0x48, 0x48, 0x30, 0x3A, 0x41, 0x41, 0x21, 0x7A, 0x3A, 0x42, 0x40, 0x20, 0x78, 0x00, 0x9D, 0xA0, 0xA0, 0x7D, 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x3D, 0x40, 0x40, 0x40, 0x3D, 0x3C, 0x24, 0xFF, 0x24, 0x24, 0x48, 0x7E, 0x49, 0x43, 0x66, 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, 0xFF, 0x09, 0x29, 0xF6, 0x20, 0xC0, 0x88, 0x7E, 0x09, 0x03, 0x20, 0x54, 0x54, 0x79, 0x41, 0x00, 0x00, 0x44, 0x7D, 0x41, 0x30, 0x48, 0x48, 0x4A, 0x32, 0x38, 0x40, 0x40, 0x22, 0x7A, 0x00, 0x7A, 0x0A, 0x0A, 0x72, 0x7D, 0x0D, 0x19, 0x31, 0x7D, 0x26, 0x29, 0x29, 0x2F, 0x28, 0x26, 0x29, 0x29, 0x29, 0x26, 0x30, 0x48, 0x4D, 0x40, 0x20, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x2F, 0x10, 0xC8, 0xAC, 0xBA, 0x2F, 0x10, 0x28, 0x34, 0xFA, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x08, 0x14, 0x2A, 0x14, 0x22, 0x22, 0x14, 0x2A, 0x14, 0x08, 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
0x00, 0x18, 0x24, 0x18, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
0x30, 0x48, 0x3A, 0x06, 0x0E,
0x26, 0x29, 0x79, 0x29, 0x26,
0x40, 0x7F, 0x05, 0x05, 0x07,
0x40, 0x7F, 0x05, 0x25, 0x3F,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
0x14, 0x22, 0x7F, 0x22, 0x14,
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
0x06, 0x09, 0x7F, 0x01, 0x7F,
0x00, 0x66, 0x89, 0x95, 0x6A,
0x60, 0x60, 0x60, 0x60, 0x60,
0x94, 0xA2, 0xFF, 0xA2, 0x94,
0x08, 0x04, 0x7E, 0x04, 0x08,
0x10, 0x20, 0x7E, 0x20, 0x10,
0x08, 0x08, 0x2A, 0x1C, 0x08,
0x08, 0x1C, 0x2A, 0x08, 0x08,
0x1E, 0x10, 0x10, 0x10, 0x10,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x30, 0x38, 0x3E, 0x38, 0x30,
0x06, 0x0E, 0x3E, 0x0E, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C,
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C,
0x1E, 0xA1, 0xA1, 0x61, 0x12,
0x3A, 0x40, 0x40, 0x20, 0x7A,
0x38, 0x54, 0x54, 0x55, 0x59,
0x21, 0x55, 0x55, 0x79, 0x41,
0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut
0x21, 0x55, 0x54, 0x78, 0x40,
0x20, 0x54, 0x55, 0x79, 0x40,
0x0C, 0x1E, 0x52, 0x72, 0x12,
0x39, 0x55, 0x55, 0x55, 0x59,
0x39, 0x54, 0x54, 0x54, 0x59,
0x39, 0x55, 0x54, 0x54, 0x58,
0x00, 0x00, 0x45, 0x7C, 0x41,
0x00, 0x02, 0x45, 0x7D, 0x42,
0x00, 0x01, 0x45, 0x7C, 0x40,
0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut
0xF0, 0x28, 0x25, 0x28, 0xF0,
0x7C, 0x54, 0x55, 0x45, 0x00,
0x20, 0x54, 0x54, 0x7C, 0x54,
0x7C, 0x0A, 0x09, 0x7F, 0x49,
0x32, 0x49, 0x49, 0x49, 0x32,
0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut
0x32, 0x4A, 0x48, 0x48, 0x30,
0x3A, 0x41, 0x41, 0x21, 0x7A,
0x3A, 0x42, 0x40, 0x20, 0x78,
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut
0x3D, 0x40, 0x40, 0x40, 0x3D,
0x3C, 0x24, 0xFF, 0x24, 0x24,
0x48, 0x7E, 0x49, 0x43, 0x66,
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
0xFF, 0x09, 0x29, 0xF6, 0x20,
0xC0, 0x88, 0x7E, 0x09, 0x03,
0x20, 0x54, 0x54, 0x79, 0x41,
0x00, 0x00, 0x44, 0x7D, 0x41,
0x30, 0x48, 0x48, 0x4A, 0x32,
0x38, 0x40, 0x40, 0x22, 0x7A,
0x00, 0x7A, 0x0A, 0x0A, 0x72,
0x7D, 0x0D, 0x19, 0x31, 0x7D,
0x26, 0x29, 0x29, 0x2F, 0x28,
0x26, 0x29, 0x29, 0x29, 0x26,
0x30, 0x48, 0x4D, 0x40, 0x20,
0x38, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x38,
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
0x2F, 0x10, 0x28, 0x34, 0xFA,
0x00, 0x00, 0x7B, 0x00, 0x00,
0x08, 0x14, 0x2A, 0x14, 0x22,
0x22, 0x14, 0x2A, 0x14, 0x08,
0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code
0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block
0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x10, 0x10, 0x10, 0xFF, 0x00, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x10, 0x10, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x17, 0x14, 0x10, 0x10, 0x1F, 0x10, 0x1F,
0x10, 0x10, 0x10, 0xFF, 0x00, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x00, 0x00, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x00, 0x00, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0xFF, 0x10, 0xFF, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x38, 0x44, 0x44, 0x38, 0x44, 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta
0x14, 0x14, 0x14, 0xFF, 0x00, 0x7E, 0x02, 0x02, 0x06, 0x06, 0x02, 0x7E, 0x02, 0x7E, 0x02, 0x63, 0x55, 0x49, 0x41, 0x63, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x40, 0x7E, 0x20, 0x1E, 0x20, 0x06, 0x02, 0x7E, 0x02, 0x02, 0x99, 0xA5, 0xE7, 0xA5, 0x99, 0x1C, 0x2A, 0x49, 0x2A, 0x1C, 0x4C, 0x72, 0x01, 0x72, 0x4C, 0x30, 0x4A, 0x4D, 0x4D, 0x30, 0x30, 0x48, 0x78, 0x48, 0x30, 0xBC, 0x62, 0x5A, 0x46, 0x3D, 0x3E, 0x49, 0x49, 0x49, 0x00, 0x7E, 0x01, 0x01, 0x01, 0x7E, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x44, 0x44, 0x5F, 0x44, 0x44, 0x40, 0x51, 0x4A, 0x44, 0x40, 0x40, 0x44, 0x4A, 0x51, 0x40, 0x00, 0x00, 0xFF, 0x01, 0x03, 0xE0, 0x80, 0xFF, 0x00, 0x00, 0x08, 0x08, 0x6B, 0x6B, 0x08, 0x36, 0x12, 0x36, 0x24, 0x36, 0x06, 0x0F, 0x09, 0x0F, 0x06, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x30, 0x40, 0xFF, 0x01, 0x01, 0x00, 0x1F, 0x01, 0x01, 0x1E, 0x00, 0x19, 0x1D, 0x17, 0x12, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP
0x10, 0x10, 0xFF, 0x00, 0xFF,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x14, 0x14, 0x14, 0xFC, 0x00,
0x14, 0x14, 0xF7, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x14, 0x14, 0xF4, 0x04, 0xFC,
0x14, 0x14, 0x17, 0x10, 0x1F,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0x1F, 0x00,
0x10, 0x10, 0x10, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x10,
0x10, 0x10, 0x10, 0x1F, 0x10,
0x10, 0x10, 0x10, 0xF0, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0xFF, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x14,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x1F, 0x10, 0x17,
0x00, 0x00, 0xFC, 0x04, 0xF4,
0x14, 0x14, 0x17, 0x10, 0x17,
0x14, 0x14, 0xF4, 0x04, 0xF4,
0x00, 0x00, 0xFF, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0xF7, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x17, 0x14,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0xF4, 0x14,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x00, 0x00, 0x1F, 0x10, 0x1F,
0x00, 0x00, 0x00, 0x1F, 0x14,
0x00, 0x00, 0x00, 0xFC, 0x14,
0x00, 0x00, 0xF0, 0x10, 0xF0,
0x10, 0x10, 0xFF, 0x10, 0xFF,
0x14, 0x14, 0x14, 0xFF, 0x14,
0x10, 0x10, 0x10, 0x1F, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x10,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x38, 0x44, 0x44, 0x38, 0x44,
0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta
0x7E, 0x02, 0x02, 0x06, 0x06,
0x02, 0x7E, 0x02, 0x7E, 0x02,
0x63, 0x55, 0x49, 0x41, 0x63,
0x38, 0x44, 0x44, 0x3C, 0x04,
0x40, 0x7E, 0x20, 0x1E, 0x20,
0x06, 0x02, 0x7E, 0x02, 0x02,
0x99, 0xA5, 0xE7, 0xA5, 0x99,
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
0x4C, 0x72, 0x01, 0x72, 0x4C,
0x30, 0x4A, 0x4D, 0x4D, 0x30,
0x30, 0x48, 0x78, 0x48, 0x30,
0xBC, 0x62, 0x5A, 0x46, 0x3D,
0x3E, 0x49, 0x49, 0x49, 0x00,
0x7E, 0x01, 0x01, 0x01, 0x7E,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x44, 0x44, 0x5F, 0x44, 0x44,
0x40, 0x51, 0x4A, 0x44, 0x40,
0x40, 0x44, 0x4A, 0x51, 0x40,
0x00, 0x00, 0xFF, 0x01, 0x03,
0xE0, 0x80, 0xFF, 0x00, 0x00,
0x08, 0x08, 0x6B, 0x6B, 0x08,
0x36, 0x12, 0x36, 0x24, 0x36,
0x06, 0x0F, 0x09, 0x0F, 0x06,
0x00, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x10, 0x10, 0x00,
0x30, 0x40, 0xFF, 0x01, 0x01,
0x00, 0x1F, 0x01, 0x01, 0x1E,
0x00, 0x19, 0x1D, 0x17, 0x12,
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP
}; };
#endif // FONT5X7_H #endif // FONT5X7_H

View file

@ -40,7 +40,6 @@
# define PIN(x) (*(&x - 2)) /* address of input register of port x */ # define PIN(x) (*(&x - 2)) /* address of input register of port x */
#endif #endif
#if LCD_IO_MODE #if LCD_IO_MODE
# define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE) # define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
# define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN); # define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
@ -87,25 +86,21 @@ static void toggle_e(void);
** local functions ** local functions
*/ */
/************************************************************************* /*************************************************************************
delay for a minimum of <us> microseconds delay for a minimum of <us> microseconds
the number of loops is calculated at compile-time from MCU clock frequency the number of loops is calculated at compile-time from MCU clock frequency
*************************************************************************/ *************************************************************************/
#define delay(us) _delay_us(us) #define delay(us) _delay_us(us)
#if LCD_IO_MODE #if LCD_IO_MODE
/* toggle Enable Pin to initiate write */ /* toggle Enable Pin to initiate write */
static void toggle_e(void) static void toggle_e(void) {
{
lcd_e_high(); lcd_e_high();
lcd_e_delay(); lcd_e_delay();
lcd_e_low(); lcd_e_low();
} }
#endif #endif
/************************************************************************* /*************************************************************************
Low-level function to write byte to LCD controller Low-level function to write byte to LCD controller
Input: data byte to write to LCD Input: data byte to write to LCD
@ -114,11 +109,9 @@ Input: data byte to write to LCD
Returns: none Returns: none
*************************************************************************/ *************************************************************************/
#if LCD_IO_MODE #if LCD_IO_MODE
static void lcd_write(uint8_t data,uint8_t rs) static void lcd_write(uint8_t data, uint8_t rs) {
{
unsigned char dataBits; unsigned char dataBits;
if (rs) { /* write data (RS=1, RW=0) */ if (rs) { /* write data (RS=1, RW=0) */
lcd_rs_high(); lcd_rs_high();
} else { /* write instruction (RS=0, RW=0) */ } else { /* write instruction (RS=0, RW=0) */
@ -126,9 +119,7 @@ static void lcd_write(uint8_t data,uint8_t rs)
} }
lcd_rw_low(); /* RW=0 write mode */ lcd_rw_low(); /* RW=0 write mode */
if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT ) if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)) {
&& (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )
{
/* configure data pins as output */ /* configure data pins as output */
DDR(LCD_DATA0_PORT) |= 0x0F; DDR(LCD_DATA0_PORT) |= 0x0F;
@ -143,9 +134,7 @@ static void lcd_write(uint8_t data,uint8_t rs)
/* all data pins high (inactive) */ /* all data pins high (inactive) */
LCD_DATA0_PORT = dataBits | 0x0F; LCD_DATA0_PORT = dataBits | 0x0F;
} } else {
else
{
/* configure data pins as output */ /* configure data pins as output */
DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN); DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);
DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN); DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);
@ -182,12 +171,15 @@ static void lcd_write(uint8_t data,uint8_t rs)
} }
} }
#else #else
#define lcd_write(d,rs) if (rs) *(volatile uint8_t*)(LCD_IO_DATA) = d; else *(volatile uint8_t*)(LCD_IO_FUNCTION) = d; # define lcd_write(d, rs) \
if (rs) \
*(volatile uint8_t *)(LCD_IO_DATA) = d; \
else \
*(volatile uint8_t *)(LCD_IO_FUNCTION) = d;
/* rs==0 -> write instruction to LCD_IO_FUNCTION */ /* rs==0 -> write instruction to LCD_IO_FUNCTION */
/* rs==1 -> write data to LCD_IO_DATA */ /* rs==1 -> write data to LCD_IO_DATA */
#endif #endif
/************************************************************************* /*************************************************************************
Low-level function to read byte from LCD controller Low-level function to read byte from LCD controller
Input: rs 1: read data Input: rs 1: read data
@ -195,20 +187,16 @@ Input: rs 1: read data
Returns: byte read from LCD controller Returns: byte read from LCD controller
*************************************************************************/ *************************************************************************/
#if LCD_IO_MODE #if LCD_IO_MODE
static uint8_t lcd_read(uint8_t rs) static uint8_t lcd_read(uint8_t rs) {
{
uint8_t data; uint8_t data;
if (rs) if (rs)
lcd_rs_high(); /* RS=1: read data */ lcd_rs_high(); /* RS=1: read data */
else else
lcd_rs_low(); /* RS=0: read busy flag */ lcd_rs_low(); /* RS=0: read busy flag */
lcd_rw_high(); /* RW=1 read mode */ lcd_rw_high(); /* RW=1 read mode */
if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT ) if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)) {
&& ( LCD_DATA0_PIN == 0 )&& (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )
{
DDR(LCD_DATA0_PORT) &= 0xF0; /* configure data pins as input */ DDR(LCD_DATA0_PORT) &= 0xF0; /* configure data pins as input */
lcd_e_high(); lcd_e_high();
@ -222,9 +210,7 @@ static uint8_t lcd_read(uint8_t rs)
lcd_e_delay(); lcd_e_delay();
data |= PIN(LCD_DATA0_PORT) & 0x0F; /* read low nibble */ data |= PIN(LCD_DATA0_PORT) & 0x0F; /* read low nibble */
lcd_e_low(); lcd_e_low();
} } else {
else
{
/* configure data pins as input */ /* configure data pins as input */
DDR(LCD_DATA0_PORT) &= ~_BV(LCD_DATA0_PIN); DDR(LCD_DATA0_PORT) &= ~_BV(LCD_DATA0_PIN);
DDR(LCD_DATA1_PORT) &= ~_BV(LCD_DATA1_PIN); DDR(LCD_DATA1_PORT) &= ~_BV(LCD_DATA1_PIN);
@ -260,7 +246,6 @@ static uint8_t lcd_read(uint8_t rs)
/* rs==1 -> read data from LCD_IO_DATA */ /* rs==1 -> read data from LCD_IO_DATA */
#endif #endif
/************************************************************************* /*************************************************************************
loops while lcd is busy, returns address counter loops while lcd is busy, returns address counter
*************************************************************************/ *************************************************************************/
@ -270,7 +255,8 @@ static uint8_t lcd_waitbusy(void)
register uint8_t c; register uint8_t c;
/* wait until busy flag is cleared */ /* wait until busy flag is cleared */
while ( (c=lcd_read(0)) & (1<<LCD_BUSY)) {} while ((c = lcd_read(0)) & (1 << LCD_BUSY)) {
}
/* the address counter is updated 4us after the busy flag is cleared */ /* the address counter is updated 4us after the busy flag is cleared */
delay(LCD_DELAY_BUSY_FLAG); delay(LCD_DELAY_BUSY_FLAG);
@ -280,16 +266,13 @@ static uint8_t lcd_waitbusy(void)
} /* lcd_waitbusy */ } /* lcd_waitbusy */
/************************************************************************* /*************************************************************************
Move cursor to the start of next line or to the first line if the cursor Move cursor to the start of next line or to the first line if the cursor
is already on the last line. is already on the last line.
*************************************************************************/ *************************************************************************/
static inline void lcd_newline(uint8_t pos) static inline void lcd_newline(uint8_t pos) {
{
register uint8_t addressCounter; register uint8_t addressCounter;
#if LCD_LINES == 1 #if LCD_LINES == 1
addressCounter = 0; addressCounter = 0;
#endif #endif
@ -324,7 +307,6 @@ static inline void lcd_newline(uint8_t pos)
} /* lcd_newline */ } /* lcd_newline */
/* /*
** PUBLIC FUNCTIONS ** PUBLIC FUNCTIONS
*/ */
@ -334,34 +316,28 @@ Send LCD controller instruction command
Input: instruction to send to LCD controller, see HD44780 data sheet Input: instruction to send to LCD controller, see HD44780 data sheet
Returns: none Returns: none
*************************************************************************/ *************************************************************************/
void lcd_command(uint8_t cmd) void lcd_command(uint8_t cmd) {
{
lcd_waitbusy(); lcd_waitbusy();
lcd_write(cmd, 0); lcd_write(cmd, 0);
} }
/************************************************************************* /*************************************************************************
Send data byte to LCD controller Send data byte to LCD controller
Input: data to send to LCD controller, see HD44780 data sheet Input: data to send to LCD controller, see HD44780 data sheet
Returns: none Returns: none
*************************************************************************/ *************************************************************************/
void lcd_data(uint8_t data) void lcd_data(uint8_t data) {
{
lcd_waitbusy(); lcd_waitbusy();
lcd_write(data, 1); lcd_write(data, 1);
} }
/************************************************************************* /*************************************************************************
Set cursor to specified position Set cursor to specified position
Input: x horizontal position (0: left most position) Input: x horizontal position (0: left most position)
y vertical position (0: first line) y vertical position (0: first line)
Returns: none Returns: none
*************************************************************************/ *************************************************************************/
void lcd_gotoxy(uint8_t x, uint8_t y) void lcd_gotoxy(uint8_t x, uint8_t y) {
{
#if LCD_LINES == 1 #if LCD_LINES == 1
lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x);
#endif #endif
@ -384,50 +360,32 @@ void lcd_gotoxy(uint8_t x, uint8_t y)
} /* lcd_gotoxy */ } /* lcd_gotoxy */
/************************************************************************* /*************************************************************************
*************************************************************************/ *************************************************************************/
int lcd_getxy(void) int lcd_getxy(void) { return lcd_waitbusy(); }
{
return lcd_waitbusy();
}
/************************************************************************* /*************************************************************************
Clear display and set cursor to home position Clear display and set cursor to home position
*************************************************************************/ *************************************************************************/
void lcd_clrscr(void) void lcd_clrscr(void) { lcd_command(1 << LCD_CLR); }
{
lcd_command(1<<LCD_CLR);
}
/************************************************************************* /*************************************************************************
Set cursor to home position Set cursor to home position
*************************************************************************/ *************************************************************************/
void lcd_home(void) void lcd_home(void) { lcd_command(1 << LCD_HOME); }
{
lcd_command(1<<LCD_HOME);
}
/************************************************************************* /*************************************************************************
Display character at current cursor position Display character at current cursor position
Input: character to be displayed Input: character to be displayed
Returns: none Returns: none
*************************************************************************/ *************************************************************************/
void lcd_putc(char c) void lcd_putc(char c) {
{
uint8_t pos; uint8_t pos;
pos = lcd_waitbusy(); // read busy-flag and address counter pos = lcd_waitbusy(); // read busy-flag and address counter
if (c=='\n') if (c == '\n') {
{
lcd_newline(pos); lcd_newline(pos);
} } else {
else
{
#if LCD_WRAP_LINES == 1 #if LCD_WRAP_LINES == 1
# if LCD_LINES == 1 # if LCD_LINES == 1
if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) { if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
@ -457,7 +415,6 @@ void lcd_putc(char c)
} /* lcd_putc */ } /* lcd_putc */
/************************************************************************* /*************************************************************************
Display string without auto linefeed Display string without auto linefeed
Input: string to be displayed Input: string to be displayed
@ -474,7 +431,6 @@ void lcd_puts(const char *s)
} /* lcd_puts */ } /* lcd_puts */
/************************************************************************* /*************************************************************************
Display string from program memory without auto linefeed Display string from program memory without auto linefeed
Input: string from program memory be be displayed Input: string from program memory be be displayed
@ -491,7 +447,6 @@ void lcd_puts_p(const char *progmem_s)
} /* lcd_puts_p */ } /* lcd_puts_p */
/************************************************************************* /*************************************************************************
Initialize display and select type of cursor Initialize display and select type of cursor
Input: dispAttr LCD_DISP_OFF display off Input: dispAttr LCD_DISP_OFF display off
@ -500,32 +455,22 @@ Input: dispAttr LCD_DISP_OFF display off
LCD_DISP_CURSOR_BLINK display on, cursor on flashing LCD_DISP_CURSOR_BLINK display on, cursor on flashing
Returns: none Returns: none
*************************************************************************/ *************************************************************************/
void lcd_init(uint8_t dispAttr) void lcd_init(uint8_t dispAttr) {
{
#if LCD_IO_MODE #if LCD_IO_MODE
/* /*
* Initialize LCD to 4 bit I/O mode * Initialize LCD to 4 bit I/O mode
*/ */
if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT ) if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (&LCD_RS_PORT == &LCD_DATA0_PORT) && (&LCD_RW_PORT == &LCD_DATA0_PORT) && (&LCD_E_PORT == &LCD_DATA0_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) && (LCD_RS_PIN == 4) && (LCD_RW_PIN == 5) && (LCD_E_PIN == 6)) {
&& ( &LCD_RS_PORT == &LCD_DATA0_PORT) && ( &LCD_RW_PORT == &LCD_DATA0_PORT) && (&LCD_E_PORT == &LCD_DATA0_PORT)
&& (LCD_DATA0_PIN == 0 ) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)
&& (LCD_RS_PIN == 4 ) && (LCD_RW_PIN == 5) && (LCD_E_PIN == 6 ) )
{
/* configure all port bits as output (all LCD lines on same port) */ /* configure all port bits as output (all LCD lines on same port) */
DDR(LCD_DATA0_PORT) |= 0x7F; DDR(LCD_DATA0_PORT) |= 0x7F;
} } else if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)) {
else if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT )
&& (LCD_DATA0_PIN == 0 ) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )
{
/* configure all port bits as output (all LCD data lines on same port, but control lines on different ports) */ /* configure all port bits as output (all LCD data lines on same port, but control lines on different ports) */
DDR(LCD_DATA0_PORT) |= 0x0F; DDR(LCD_DATA0_PORT) |= 0x0F;
DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN); DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);
DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN); DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);
DDR(LCD_E_PORT) |= _BV(LCD_E_PIN); DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);
} } else {
else
{
/* configure all port bits as output (LCD data and control lines on different ports */ /* configure all port bits as output (LCD data and control lines on different ports */
DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN); DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);
DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN); DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);
@ -589,4 +534,3 @@ void lcd_init(uint8_t dispAttr)
lcd_command(dispAttr); /* display/cursor control */ lcd_command(dispAttr); /* display/cursor control */
} /* lcd_init */ } /* lcd_init */

View file

@ -50,7 +50,6 @@
# error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !" # error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"
#endif #endif
/**@{*/ /**@{*/
/* /*
@ -62,7 +61,6 @@
# include "lcd_definitions.h" # include "lcd_definitions.h"
#endif #endif
/** /**
* @name Definition for LCD controller type * @name Definition for LCD controller type
* Use 0 for HD44780 controller, change to 1 for displays with KS0073 controller. * Use 0 for HD44780 controller, change to 1 for displays with KS0073 controller.
@ -105,7 +103,6 @@
# define LCD_WRAP_LINES 0 /**< 0: no wrap, 1: wrap at end of visibile line */ # define LCD_WRAP_LINES 0 /**< 0: no wrap, 1: wrap at end of visibile line */
#endif #endif
/** /**
* @name Definitions for 4-bit IO mode * @name Definitions for 4-bit IO mode
* *
@ -174,9 +171,7 @@
# define LCD_E_PIN 1 /**< pin for Enable line */ # define LCD_E_PIN 1 /**< pin for Enable line */
# endif # endif
#elif defined(__AVR_AT90S4414__) || defined(__AVR_AT90S8515__) || defined(__AVR_ATmega64__) || \ #elif defined(__AVR_AT90S4414__) || defined(__AVR_AT90S8515__) || defined(__AVR_ATmega64__) || defined(__AVR_ATmega8515__) || defined(__AVR_ATmega103__) || defined(__AVR_ATmega128__) || defined(__AVR_ATmega161__) || defined(__AVR_ATmega162__)
defined(__AVR_ATmega8515__)|| defined(__AVR_ATmega103__) || defined(__AVR_ATmega128__) || \
defined(__AVR_ATmega161__) || defined(__AVR_ATmega162__)
/* /*
* memory mapped mode is only supported when the device has an external data memory interface * memory mapped mode is only supported when the device has an external data memory interface
*/ */
@ -189,7 +184,6 @@
#endif #endif
/** /**
* @name Definitions of delays * @name Definitions of delays
* Used to calculate delay timers. * Used to calculate delay timers.
@ -219,7 +213,6 @@
# define LCD_DELAY_ENABLE_PULSE 1 /**< enable signal pulse width in micro seconds */ # define LCD_DELAY_ENABLE_PULSE 1 /**< enable signal pulse width in micro seconds */
#endif #endif
/** /**
* @name Definitions for LCD command instructions * @name Definitions for LCD command instructions
* The constants define the various LCD controller instructions which can be passed to the * The constants define the various LCD controller instructions which can be passed to the
@ -272,16 +265,12 @@
#define LCD_FUNCTION_8BIT_1LINE 0x30 /* 8-bit interface, single line, 5x7 dots */ #define LCD_FUNCTION_8BIT_1LINE 0x30 /* 8-bit interface, single line, 5x7 dots */
#define LCD_FUNCTION_8BIT_2LINES 0x38 /* 8-bit interface, dual line, 5x7 dots */ #define LCD_FUNCTION_8BIT_2LINES 0x38 /* 8-bit interface, dual line, 5x7 dots */
#define LCD_MODE_DEFAULT ((1 << LCD_ENTRY_MODE) | (1 << LCD_ENTRY_INC)) #define LCD_MODE_DEFAULT ((1 << LCD_ENTRY_MODE) | (1 << LCD_ENTRY_INC))
/** /**
* @name Functions * @name Functions
*/ */
/** /**
@brief Initialize display and select type of cursor @brief Initialize display and select type of cursor
@param dispAttr \b LCD_DISP_OFF display off\n @param dispAttr \b LCD_DISP_OFF display off\n
@ -292,21 +281,18 @@
*/ */
extern void lcd_init(uint8_t dispAttr); extern void lcd_init(uint8_t dispAttr);
/** /**
@brief Clear display and set cursor to home position @brief Clear display and set cursor to home position
@return none @return none
*/ */
extern void lcd_clrscr(void); extern void lcd_clrscr(void);
/** /**
@brief Set cursor to home position @brief Set cursor to home position
@return none @return none
*/ */
extern void lcd_home(void); extern void lcd_home(void);
/** /**
@brief Set cursor to specified position @brief Set cursor to specified position
@ -316,7 +302,6 @@ extern void lcd_home(void);
*/ */
extern void lcd_gotoxy(uint8_t x, uint8_t y); extern void lcd_gotoxy(uint8_t x, uint8_t y);
/** /**
@brief Display character at current cursor position @brief Display character at current cursor position
@param c character to be displayed @param c character to be displayed
@ -324,7 +309,6 @@ extern void lcd_gotoxy(uint8_t x, uint8_t y);
*/ */
extern void lcd_putc(char c); extern void lcd_putc(char c);
/** /**
@brief Display string without auto linefeed @brief Display string without auto linefeed
@param s string to be displayed @param s string to be displayed
@ -332,7 +316,6 @@ extern void lcd_putc(char c);
*/ */
extern void lcd_puts(const char *s); extern void lcd_puts(const char *s);
/** /**
@brief Display string from program memory without auto linefeed @brief Display string from program memory without auto linefeed
@param progmem_s string from program memory be be displayed @param progmem_s string from program memory be be displayed
@ -341,7 +324,6 @@ extern void lcd_puts(const char *s);
*/ */
extern void lcd_puts_p(const char *progmem_s); extern void lcd_puts_p(const char *progmem_s);
/** /**
@brief Send LCD controller instruction command @brief Send LCD controller instruction command
@param cmd instruction to send to LCD controller, see HD44780 data sheet @param cmd instruction to send to LCD controller, see HD44780 data sheet
@ -349,7 +331,6 @@ extern void lcd_puts_p(const char *progmem_s);
*/ */
extern void lcd_command(uint8_t cmd); extern void lcd_command(uint8_t cmd);
/** /**
@brief Send data byte to LCD controller @brief Send data byte to LCD controller
@ -359,7 +340,6 @@ extern void lcd_command(uint8_t cmd);
*/ */
extern void lcd_data(uint8_t data); extern void lcd_data(uint8_t data);
/** /**
@brief macros for automatically storing string constant in program memory @brief macros for automatically storing string constant in program memory
*/ */
@ -368,4 +348,3 @@ extern void lcd_data(uint8_t data);
/**@}*/ /**@}*/
#endif // LCD_H #endif // LCD_H

0
drivers/avr/i2c_master.c Executable file → Normal file
View file

0
drivers/avr/i2c_master.h Executable file → Normal file
View file

0
drivers/avr/i2c_slave.c Executable file → Normal file
View file

0
drivers/avr/i2c_slave.h Executable file → Normal file
View file

View file

@ -182,33 +182,15 @@ extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
// appropriate addresses for various functions (e.g. reading // appropriate addresses for various functions (e.g. reading
// and writing) // and writing)
const uint16_t PROGMEM port_to_mode_PGM[] = { const uint16_t PROGMEM port_to_mode_PGM[] = {
NOT_A_PORT, NOT_A_PORT, NOT_A_PORT, (uint16_t)&DDRB, (uint16_t)&DDRC, (uint16_t)&DDRD, (uint16_t)&DDRE, (uint16_t)&DDRF,
NOT_A_PORT,
(uint16_t) &DDRB,
(uint16_t) &DDRC,
(uint16_t) &DDRD,
(uint16_t) &DDRE,
(uint16_t) &DDRF,
}; };
const uint16_t PROGMEM port_to_output_PGM[] = { const uint16_t PROGMEM port_to_output_PGM[] = {
NOT_A_PORT, NOT_A_PORT, NOT_A_PORT, (uint16_t)&PORTB, (uint16_t)&PORTC, (uint16_t)&PORTD, (uint16_t)&PORTE, (uint16_t)&PORTF,
NOT_A_PORT,
(uint16_t) &PORTB,
(uint16_t) &PORTC,
(uint16_t) &PORTD,
(uint16_t) &PORTE,
(uint16_t) &PORTF,
}; };
const uint16_t PROGMEM port_to_input_PGM[] = { const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PORT, NOT_A_PORT, NOT_A_PORT, (uint16_t)&PINB, (uint16_t)&PINC, (uint16_t)&PIND, (uint16_t)&PINE, (uint16_t)&PINF,
NOT_A_PORT,
(uint16_t) &PINB,
(uint16_t) &PINC,
(uint16_t) &PIND,
(uint16_t) &PINE,
(uint16_t) &PINF,
}; };
const uint8_t PROGMEM digital_pin_to_port_PGM[] = { const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
@ -286,40 +268,20 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
}; };
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, TIMER0B, /* 3 */
NOT_ON_TIMER, NOT_ON_TIMER, TIMER3A, /* 5 */
NOT_ON_TIMER,
TIMER0B, /* 3 */
NOT_ON_TIMER,
TIMER3A, /* 5 */
TIMER4D, /* 6 */ TIMER4D, /* 6 */
NOT_ON_TIMER, NOT_ON_TIMER,
NOT_ON_TIMER, NOT_ON_TIMER, TIMER1A, /* 9 */
TIMER1A, /* 9 */
TIMER1B, /* 10 */ TIMER1B, /* 10 */
TIMER0A, /* 11 */ TIMER0A, /* 11 */
NOT_ON_TIMER, NOT_ON_TIMER, TIMER4A, /* 13 */
TIMER4A, /* 13 */
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
}; };
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {

View file

@ -76,9 +76,18 @@ static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
return _send_cmd1(opr2); return _send_cmd1(opr2);
} }
#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} # define send_cmd1(c) \
#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} if (!_send_cmd1(c)) { \
#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} goto done; \
}
# define send_cmd2(c, o) \
if (!_send_cmd2(c, o)) { \
goto done; \
}
# define send_cmd3(c, o1, o2) \
if (!_send_cmd3(c, o1, o2)) { \
goto done; \
}
static void clear_display(void) { static void clear_display(void) {
matrix_clear(&display); matrix_clear(&display);
@ -129,7 +138,6 @@ bool iota_gfx_init(void) {
send_cmd2(SetDisplayOffset, 0); send_cmd2(SetDisplayOffset, 0);
send_cmd1(SetStartLine | 0x0); send_cmd1(SetStartLine | 0x0);
send_cmd2(SetChargePump, 0x14 /* Enable */); send_cmd2(SetChargePump, 0x14 /* Enable */);
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
@ -196,8 +204,7 @@ void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
// We went off the end; scroll the display upwards by one line // We went off the end; scroll the display upwards by one line
memmove(&matrix->display[0], &matrix->display[1], memmove(&matrix->display[0], &matrix->display[1], MatrixCols * (MatrixRows - 1));
MatrixCols * (MatrixRows - 1));
matrix->cursor = &matrix->display[MatrixRows - 1][0]; matrix->cursor = &matrix->display[MatrixRows - 1][0];
memset(matrix->cursor, ' ', MatrixCols); memset(matrix->cursor, ' ', MatrixCols);
} }
@ -220,9 +227,7 @@ void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
matrix_write_char_inner(matrix, c); matrix_write_char_inner(matrix, c);
} }
void iota_gfx_write_char(uint8_t c) { void iota_gfx_write_char(uint8_t c) { matrix_write_char(&display, c); }
matrix_write_char(&display, c);
}
void matrix_write(struct CharacterMatrix *matrix, const char *data) { void matrix_write(struct CharacterMatrix *matrix, const char *data) {
const char *end = data + strlen(data); const char *end = data + strlen(data);
@ -232,9 +237,7 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data) {
} }
} }
void iota_gfx_write(const char *data) { void iota_gfx_write(const char *data) { matrix_write(&display, data); }
matrix_write(&display, data);
}
void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
while (true) { while (true) {
@ -247,9 +250,7 @@ void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
} }
} }
void iota_gfx_write_P(const char *data) { void iota_gfx_write_P(const char *data) { matrix_write_P(&display, data); }
matrix_write_P(&display, data);
}
void matrix_clear(struct CharacterMatrix *matrix) { void matrix_clear(struct CharacterMatrix *matrix) {
memset(matrix->display, ' ', sizeof(matrix->display)); memset(matrix->display, ' ', sizeof(matrix->display));
@ -257,9 +258,7 @@ void matrix_clear(struct CharacterMatrix *matrix) {
matrix->dirty = true; matrix->dirty = true;
} }
void iota_gfx_clear_screen(void) { void iota_gfx_clear_screen(void) { matrix_clear(&display); }
matrix_clear(&display);
}
void matrix_render(struct CharacterMatrix *matrix) { void matrix_render(struct CharacterMatrix *matrix) {
last_flush = timer_read(); last_flush = timer_read();
@ -303,13 +302,9 @@ done:
# endif # endif
} }
void iota_gfx_flush(void) { void iota_gfx_flush(void) { matrix_render(&display); }
matrix_render(&display);
}
__attribute__ ((weak)) __attribute__((weak)) void iota_gfx_task_user(void) {}
void iota_gfx_task_user(void) {
}
void iota_gfx_task(void) { void iota_gfx_task(void) {
iota_gfx_task_user(); iota_gfx_task_user();

View file

@ -88,6 +88,4 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data);
void matrix_write_P(struct CharacterMatrix *matrix, const char *data); void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
void matrix_render(struct CharacterMatrix *matrix); void matrix_render(struct CharacterMatrix *matrix);
#endif #endif

View file

@ -60,14 +60,10 @@ I2C_PORT &= ~ (1 << I2C_CLK);
# define I2C_DELAY 1 # define I2C_DELAY 1
void I2C_WriteBit(unsigned char c) void I2C_WriteBit(unsigned char c) {
{ if (c > 0) {
if (c > 0)
{
I2C_DATA_HI(); I2C_DATA_HI();
} } else {
else
{
I2C_DATA_LO(); I2C_DATA_LO();
} }
@ -77,8 +73,7 @@ void I2C_WriteBit(unsigned char c)
I2C_CLOCK_LO(); I2C_CLOCK_LO();
_delay_us(I2C_DELAY); _delay_us(I2C_DELAY);
if (c > 0) if (c > 0) {
{
I2C_DATA_LO(); I2C_DATA_LO();
} }
@ -87,8 +82,7 @@ void I2C_WriteBit(unsigned char c)
// Inits bitbanging port, must be called before using the functions below // Inits bitbanging port, must be called before using the functions below
// //
void I2C_Init(void) void I2C_Init(void) {
{
I2C_PORT &= ~((1 << I2C_DAT) | (1 << I2C_CLK)); I2C_PORT &= ~((1 << I2C_DAT) | (1 << I2C_CLK));
I2C_CLOCK_HI(); I2C_CLOCK_HI();
@ -99,8 +93,7 @@ void I2C_Init(void)
// Send a START Condition // Send a START Condition
// //
void I2C_Start(void) void I2C_Start(void) {
{
// set both to high at the same time // set both to high at the same time
I2C_DDR &= ~((1 << I2C_DAT) | (1 << I2C_CLK)); I2C_DDR &= ~((1 << I2C_DAT) | (1 << I2C_CLK));
_delay_us(I2C_DELAY); _delay_us(I2C_DELAY);
@ -114,8 +107,7 @@ void I2C_Start(void)
// Send a STOP Condition // Send a STOP Condition
// //
void I2C_Stop(void) void I2C_Stop(void) {
{
I2C_CLOCK_HI(); I2C_CLOCK_HI();
_delay_us(I2C_DELAY); _delay_us(I2C_DELAY);
@ -125,16 +117,13 @@ void I2C_Stop(void)
// write a byte to the I2C slave device // write a byte to the I2C slave device
// //
unsigned char I2C_Write(unsigned char c) unsigned char I2C_Write(unsigned char c) {
{ for (char i = 0; i < 8; i++) {
for (char i = 0; i < 8; i++)
{
I2C_WriteBit(c & 128); I2C_WriteBit(c & 128);
c <<= 1; c <<= 1;
} }
I2C_WriteBit(0); I2C_WriteBit(0);
_delay_us(I2C_DELAY); _delay_us(I2C_DELAY);
_delay_us(I2C_DELAY); _delay_us(I2C_DELAY);
@ -144,20 +133,17 @@ unsigned char I2C_Write(unsigned char c)
return 0; return 0;
} }
#endif #endif
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
// Set an led in the buffer to a color // Set an led in the buffer to a color
void inline ws2812_setled(int i, uint8_t r, uint8_t g, uint8_t b) void inline ws2812_setled(int i, uint8_t r, uint8_t g, uint8_t b) {
{
led[i].r = r; led[i].r = r;
led[i].g = g; led[i].g = g;
led[i].b = b; led[i].b = b;
} }
void ws2812_setled_all (uint8_t r, uint8_t g, uint8_t b) void ws2812_setled_all(uint8_t r, uint8_t g, uint8_t b) {
{
for (int i = 0; i < sizeof(led) / sizeof(led[0]); i++) { for (int i = 0; i < sizeof(led) / sizeof(led[0]); i++) {
led[i].r = r; led[i].r = r;
led[i].g = g; led[i].g = g;
@ -167,14 +153,12 @@ void ws2812_setled_all (uint8_t r, uint8_t g, uint8_t b)
#endif #endif
// Setleds for standard RGB // Setleds for standard RGB
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
{
// ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin));
ws2812_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF)); ws2812_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF));
} }
void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) {
{
// ws2812_DDRREG |= pinmask; // Enable DDR // ws2812_DDRREG |= pinmask; // Enable DDR
// new universal format (DDR) // new universal format (DDR)
_SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask; _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask;
@ -184,9 +168,7 @@ void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmas
} }
// Setleds for SK6812RGBW // Setleds for SK6812RGBW
void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) {
{
#ifdef RGBW_BB_TWI #ifdef RGBW_BB_TWI
uint8_t sreg_prev, twcr_prev; uint8_t sreg_prev, twcr_prev;
sreg_prev = SREG; sreg_prev = SREG;
@ -208,23 +190,18 @@ void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds)
TWCR = twcr_prev; TWCR = twcr_prev;
#endif #endif
// ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
// new universal format (DDR) // new universal format (DDR)
_SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF);
ws2812_sendarray_mask((uint8_t *)ledarray, leds << 2, _BV(RGB_DI_PIN & 0xF)); ws2812_sendarray_mask((uint8_t *)ledarray, leds << 2, _BV(RGB_DI_PIN & 0xF));
#ifndef RGBW_BB_TWI #ifndef RGBW_BB_TWI
_delay_us(80); _delay_us(80);
#endif #endif
} }
void ws2812_sendarray(uint8_t *data,uint16_t datlen) void ws2812_sendarray(uint8_t *data, uint16_t datlen) { ws2812_sendarray_mask(data, datlen, _BV(RGB_DI_PIN & 0xF)); }
{
ws2812_sendarray_mask(data,datlen,_BV(RGB_DI_PIN & 0xF));
}
/* /*
This routine writes an array of bytes with RGB values to the Dataout pin This routine writes an array of bytes with RGB values to the Dataout pin
@ -287,8 +264,7 @@ void ws2812_sendarray(uint8_t *data,uint16_t datlen)
#define w_nop8 w_nop4 w_nop4 #define w_nop8 w_nop4 w_nop4
#define w_nop16 w_nop8 w_nop8 #define w_nop16 w_nop8 w_nop8
void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi) void inline ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t maskhi) {
{
uint8_t curbyte, ctr, masklo; uint8_t curbyte, ctr, masklo;
uint8_t sreg_prev; uint8_t sreg_prev;
@ -302,8 +278,7 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
while (datlen--) { while (datlen--) {
curbyte = (*data++); curbyte = (*data++);
asm volatile( asm volatile(" ldi %0,8 \n\t"
" ldi %0,8 \n\t"
"loop%=: \n\t" "loop%=: \n\t"
" out %2,%3 \n\t" // '1' [01] '0' [01] - re " out %2,%3 \n\t" // '1' [01] '0' [01] - re
#if (w1_nops & 1) #if (w1_nops & 1)
@ -359,8 +334,7 @@ w_nop16
" dec %0 \n\t" // '1' [+2] '0' [+2] " dec %0 \n\t" // '1' [+2] '0' [+2]
" brne loop%=\n\t" // '1' [+3] '0' [+4] " brne loop%=\n\t" // '1' [+3] '0' [+4]
: "=&d"(ctr) : "=&d"(ctr)
: "r" (curbyte), "I" (_SFR_IO_ADDR(_SFR_IO8((RGB_DI_PIN >> 4) + 2))), "r" (maskhi), "r" (masklo) : "r"(curbyte), "I"(_SFR_IO_ADDR(_SFR_IO8((RGB_DI_PIN >> 4) + 2))), "r"(maskhi), "r"(masklo));
);
} }
SREG = sreg_prev; SREG = sreg_prev;

View file

@ -61,7 +61,6 @@ void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
void ws2812_sendarray(uint8_t *array, uint16_t length); void ws2812_sendarray(uint8_t *array, uint16_t length);
void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask); void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask);
/* /*
* Internal defines * Internal defines
*/ */

View file

@ -24,40 +24,31 @@
*/ */
const PALConfig pal_default_config = { const PALConfig pal_default_config = {
# if STM32_HAS_GPIOA # if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
# endif # endif
# if STM32_HAS_GPIOB # if STM32_HAS_GPIOB
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
# endif # endif
# if STM32_HAS_GPIOC # if STM32_HAS_GPIOC
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
# endif # endif
# if STM32_HAS_GPIOD # if STM32_HAS_GPIOD
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
# endif # endif
# if STM32_HAS_GPIOE # if STM32_HAS_GPIOE
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
# endif # endif
# if STM32_HAS_GPIOF # if STM32_HAS_GPIOF
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
# endif # endif
# if STM32_HAS_GPIOG # if STM32_HAS_GPIOG
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
# endif # endif
# if STM32_HAS_GPIOH # if STM32_HAS_GPIOH
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
# endif # endif
# if STM32_HAS_GPIOI # if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
# endif # endif
}; };
#endif #endif
@ -79,7 +70,6 @@ void __early_init(void) {
* @brief SDC card detection. * @brief SDC card detection.
*/ */
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp; (void)sdcp;
/* TODO: Fill the implementation.*/ /* TODO: Fill the implementation.*/
return true; return true;
@ -89,7 +79,6 @@ bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
* @brief SDC card write protection detection. * @brief SDC card write protection detection.
*/ */
bool sdc_lld_is_write_protected(SDCDriver *sdcp) { bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp; (void)sdcp;
/* TODO: Fill the implementation.*/ /* TODO: Fill the implementation.*/
return false; return false;
@ -101,7 +90,6 @@ bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
*/ */
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
(void)mmcp; (void)mmcp;
/* TODO: Fill the implementation.*/ /* TODO: Fill the implementation.*/
return true; return true;
@ -111,7 +99,6 @@ bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
* @brief MMC_SPI card write protection detection. * @brief MMC_SPI card write protection detection.
*/ */
bool mmc_lld_is_write_protected(MMCDriver *mmcp) { bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
(void)mmcp; (void)mmcp;
/* TODO: Fill the implementation.*/ /* TODO: Fill the implementation.*/
return false; return false;
@ -122,5 +109,4 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @brief Board-specific initialization code. * @brief Board-specific initialization code.
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {}
}

View file

@ -201,7 +201,6 @@
#define LINE_CAPS_LOCK PAL_LINE(GPIOB, 7U) #define LINE_CAPS_LOCK PAL_LINE(GPIOB, 7U)
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -244,102 +243,13 @@
* PA14 - SWCLK (alternate 0). * PA14 - SWCLK (alternate 0).
* PA15 - ROW4 * PA15 - ROW4
*/ */
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | PIN_MODE_ALTERNATE(GPIOA_PIN1) | PIN_MODE_INPUT(GPIOA_PIN2) | PIN_MODE_INPUT(GPIOA_PIN3) | PIN_MODE_INPUT(GPIOA_PIN4) | PIN_MODE_INPUT(GPIOA_PIN5) | PIN_MODE_INPUT(GPIOA_PIN6) | PIN_MODE_INPUT(GPIOA_PIN7) | PIN_MODE_INPUT(GPIOA_PIN8) | PIN_MODE_INPUT(GPIOA_PIN9) | PIN_MODE_INPUT(GPIOA_PIN10) | PIN_MODE_ALTERNATE(GPIOA_USB_DM) | PIN_MODE_ALTERNATE(GPIOA_USB_DP) | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | PIN_MODE_INPUT(GPIOA_PIN15))
PIN_MODE_ALTERNATE(GPIOA_PIN1) | \ #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
PIN_MODE_INPUT(GPIOA_PIN2) | \ #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | PIN_OSPEED_HIGH(GPIOA_PIN1) | PIN_OSPEED_VERYLOW(GPIOA_PIN2) | PIN_OSPEED_VERYLOW(GPIOA_PIN3) | PIN_OSPEED_VERYLOW(GPIOA_PIN4) | PIN_OSPEED_VERYLOW(GPIOA_PIN5) | PIN_OSPEED_VERYLOW(GPIOA_PIN6) | PIN_OSPEED_VERYLOW(GPIOA_PIN7) | PIN_OSPEED_VERYLOW(GPIOA_PIN8) | PIN_OSPEED_VERYLOW(GPIOA_PIN9) | PIN_OSPEED_VERYLOW(GPIOA_PIN10) | PIN_OSPEED_HIGH(GPIOA_USB_DM) | PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | PIN_OSPEED_HIGH(GPIOA_SWDIO) | PIN_OSPEED_HIGH(GPIOA_SWCLK) | PIN_OSPEED_VERYLOW(GPIOA_PIN15))
PIN_MODE_INPUT(GPIOA_PIN3) | \ #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | PIN_PUPDR_FLOATING(GPIOA_PIN1) | PIN_PUPDR_PULLUP(GPIOA_PIN2) | PIN_PUPDR_PULLUP(GPIOA_PIN3) | PIN_PUPDR_PULLUP(GPIOA_PIN4) | PIN_PUPDR_PULLUP(GPIOA_PIN5) | PIN_PUPDR_PULLUP(GPIOA_PIN6) | PIN_PUPDR_FLOATING(GPIOA_PIN7) | PIN_PUPDR_PULLUP(GPIOA_PIN8) | PIN_PUPDR_PULLUP(GPIOA_PIN9) | PIN_PUPDR_PULLUP(GPIOA_PIN10) | PIN_PUPDR_FLOATING(GPIOA_USB_DM) | PIN_PUPDR_FLOATING(GPIOA_USB_DP) | PIN_PUPDR_PULLUP(GPIOA_SWDIO) | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | PIN_PUPDR_PULLUP(GPIOA_PIN15))
PIN_MODE_INPUT(GPIOA_PIN4) | \ #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | PIN_ODR_HIGH(GPIOA_PIN1) | PIN_ODR_HIGH(GPIOA_PIN2) | PIN_ODR_HIGH(GPIOA_PIN3) | PIN_ODR_HIGH(GPIOA_PIN4) | PIN_ODR_HIGH(GPIOA_PIN5) | PIN_ODR_HIGH(GPIOA_PIN6) | PIN_ODR_HIGH(GPIOA_PIN7) | PIN_ODR_HIGH(GPIOA_PIN8) | PIN_ODR_HIGH(GPIOA_PIN9) | PIN_ODR_HIGH(GPIOA_PIN10) | PIN_ODR_HIGH(GPIOA_USB_DM) | PIN_ODR_HIGH(GPIOA_USB_DP) | PIN_ODR_HIGH(GPIOA_SWDIO) | PIN_ODR_HIGH(GPIOA_SWCLK) | PIN_ODR_HIGH(GPIOA_PIN15))
PIN_MODE_INPUT(GPIOA_PIN5) | \ #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | PIN_AFIO_AF(GPIOA_PIN1, 1) | PIN_AFIO_AF(GPIOA_PIN2, 0) | PIN_AFIO_AF(GPIOA_PIN3, 0) | PIN_AFIO_AF(GPIOA_PIN4, 0) | PIN_AFIO_AF(GPIOA_PIN5, 5) | PIN_AFIO_AF(GPIOA_PIN6, 5) | PIN_AFIO_AF(GPIOA_PIN7, 5))
PIN_MODE_INPUT(GPIOA_PIN6) | \ #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | PIN_AFIO_AF(GPIOA_PIN9, 0) | PIN_AFIO_AF(GPIOA_PIN10, 0) | PIN_AFIO_AF(GPIOA_USB_DM, 14) | PIN_AFIO_AF(GPIOA_USB_DP, 14) | PIN_AFIO_AF(GPIOA_SWDIO, 0) | PIN_AFIO_AF(GPIOA_SWCLK, 0) | PIN_AFIO_AF(GPIOA_PIN15, 0))
PIN_MODE_INPUT(GPIOA_PIN7) | \
PIN_MODE_INPUT(GPIOA_PIN8) | \
PIN_MODE_INPUT(GPIOA_PIN9) | \
PIN_MODE_INPUT(GPIOA_PIN10) | \
PIN_MODE_ALTERNATE(GPIOA_USB_DM) | \
PIN_MODE_ALTERNATE(GPIOA_USB_DP) | \
PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
PIN_MODE_INPUT(GPIOA_PIN15))
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \
PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \
PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \
PIN_OSPEED_HIGH(GPIOA_PIN1) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \
PIN_OSPEED_HIGH(GPIOA_USB_DM) | \
PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \
PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
PIN_OSPEED_VERYLOW(GPIOA_PIN15))
#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | \
PIN_PUPDR_FLOATING(GPIOA_PIN1) | \
PIN_PUPDR_PULLUP(GPIOA_PIN2) | \
PIN_PUPDR_PULLUP(GPIOA_PIN3) | \
PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
PIN_PUPDR_FLOATING(GPIOA_PIN7) | \
PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
PIN_PUPDR_PULLUP(GPIOA_PIN9) | \
PIN_PUPDR_PULLUP(GPIOA_PIN10) | \
PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \
PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \
PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
PIN_PUPDR_PULLUP(GPIOA_PIN15))
#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \
PIN_ODR_HIGH(GPIOA_PIN1) | \
PIN_ODR_HIGH(GPIOA_PIN2) | \
PIN_ODR_HIGH(GPIOA_PIN3) | \
PIN_ODR_HIGH(GPIOA_PIN4) | \
PIN_ODR_HIGH(GPIOA_PIN5) | \
PIN_ODR_HIGH(GPIOA_PIN6) | \
PIN_ODR_HIGH(GPIOA_PIN7) | \
PIN_ODR_HIGH(GPIOA_PIN8) | \
PIN_ODR_HIGH(GPIOA_PIN9) | \
PIN_ODR_HIGH(GPIOA_PIN10) | \
PIN_ODR_HIGH(GPIOA_USB_DM) | \
PIN_ODR_HIGH(GPIOA_USB_DP) | \
PIN_ODR_HIGH(GPIOA_SWDIO) | \
PIN_ODR_HIGH(GPIOA_SWCLK) | \
PIN_ODR_HIGH(GPIOA_PIN15))
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | \
PIN_AFIO_AF(GPIOA_PIN1, 1) | \
PIN_AFIO_AF(GPIOA_PIN2, 0) | \
PIN_AFIO_AF(GPIOA_PIN3, 0) | \
PIN_AFIO_AF(GPIOA_PIN4, 0) | \
PIN_AFIO_AF(GPIOA_PIN5, 5) | \
PIN_AFIO_AF(GPIOA_PIN6, 5) | \
PIN_AFIO_AF(GPIOA_PIN7, 5))
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | \
PIN_AFIO_AF(GPIOA_PIN9, 0) | \
PIN_AFIO_AF(GPIOA_PIN10, 0) | \
PIN_AFIO_AF(GPIOA_USB_DM, 14) | \
PIN_AFIO_AF(GPIOA_USB_DP, 14) | \
PIN_AFIO_AF(GPIOA_SWDIO, 0) | \
PIN_AFIO_AF(GPIOA_SWCLK, 0) | \
PIN_AFIO_AF(GPIOA_PIN15, 0))
/* /*
* GPIOB setup: * GPIOB setup:
@ -361,102 +271,13 @@
* PB14 - PIN14 (input pullup). * PB14 - PIN14 (input pullup).
* PB15 - PIN15 (input pullup). * PB15 - PIN15 (input pullup).
*/ */
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | PIN_MODE_INPUT(GPIOB_PIN1) | PIN_MODE_INPUT(GPIOB_PIN2) | PIN_MODE_ALTERNATE(GPIOB_PIN3) | PIN_MODE_INPUT(GPIOB_PIN4) | PIN_MODE_INPUT(GPIOB_PIN5) | PIN_MODE_ALTERNATE(GPIOB_PIN6) | PIN_MODE_OUTPUT(GPIOB_PIN7) | PIN_MODE_INPUT(GPIOB_PIN8) | PIN_MODE_INPUT(GPIOB_PIN9) | PIN_MODE_INPUT(GPIOB_PIN10) | PIN_MODE_INPUT(GPIOB_PIN11) | PIN_MODE_INPUT(GPIOB_PIN12) | PIN_MODE_INPUT(GPIOB_PIN13) | PIN_MODE_INPUT(GPIOB_PIN14) | PIN_MODE_INPUT(GPIOB_PIN15))
PIN_MODE_INPUT(GPIOB_PIN1) | \ #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | PIN_OTYPE_OPENDRAIN(GPIOB_PIN6) | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
PIN_MODE_INPUT(GPIOB_PIN2) | \ #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | PIN_OSPEED_VERYLOW(GPIOB_PIN1) | PIN_OSPEED_VERYLOW(GPIOB_PIN2) | PIN_OSPEED_HIGH(GPIOB_PIN3) | PIN_OSPEED_VERYLOW(GPIOB_PIN4) | PIN_OSPEED_VERYLOW(GPIOB_PIN5) | PIN_OSPEED_HIGH(GPIOB_PIN6) | PIN_OSPEED_VERYLOW(GPIOB_PIN7) | PIN_OSPEED_VERYLOW(GPIOB_PIN8) | PIN_OSPEED_VERYLOW(GPIOB_PIN9) | PIN_OSPEED_VERYLOW(GPIOB_PIN10) | PIN_OSPEED_VERYLOW(GPIOB_PIN11) | PIN_OSPEED_VERYLOW(GPIOB_PIN12) | PIN_OSPEED_VERYLOW(GPIOB_PIN13) | PIN_OSPEED_VERYLOW(GPIOB_PIN14) | PIN_OSPEED_VERYLOW(GPIOB_PIN15))
PIN_MODE_ALTERNATE(GPIOB_PIN3) | \ #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | PIN_PUPDR_PULLUP(GPIOB_PIN1) | PIN_PUPDR_PULLUP(GPIOB_PIN2) | PIN_PUPDR_FLOATING(GPIOB_PIN3) | PIN_PUPDR_PULLUP(GPIOB_PIN4) | PIN_PUPDR_PULLUP(GPIOB_PIN5) | PIN_PUPDR_FLOATING(GPIOB_PIN6) | PIN_PUPDR_PULLDOWN(GPIOB_PIN7) | PIN_PUPDR_PULLUP(GPIOB_PIN8) | PIN_PUPDR_PULLUP(GPIOB_PIN9) | PIN_PUPDR_PULLUP(GPIOB_PIN10) | PIN_PUPDR_PULLUP(GPIOB_PIN11) | PIN_PUPDR_PULLUP(GPIOB_PIN12) | PIN_PUPDR_PULLUP(GPIOB_PIN13) | PIN_PUPDR_PULLUP(GPIOB_PIN14) | PIN_PUPDR_PULLUP(GPIOB_PIN15))
PIN_MODE_INPUT(GPIOB_PIN4) | \ #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | PIN_ODR_HIGH(GPIOB_PIN1) | PIN_ODR_HIGH(GPIOB_PIN2) | PIN_ODR_HIGH(GPIOB_PIN3) | PIN_ODR_HIGH(GPIOB_PIN4) | PIN_ODR_HIGH(GPIOB_PIN5) | PIN_ODR_HIGH(GPIOB_PIN6) | PIN_ODR_LOW(GPIOB_PIN7) | PIN_ODR_HIGH(GPIOB_PIN8) | PIN_ODR_HIGH(GPIOB_PIN9) | PIN_ODR_HIGH(GPIOB_PIN10) | PIN_ODR_HIGH(GPIOB_PIN11) | PIN_ODR_HIGH(GPIOB_PIN12) | PIN_ODR_HIGH(GPIOB_PIN13) | PIN_ODR_HIGH(GPIOB_PIN14) | PIN_ODR_HIGH(GPIOB_PIN15))
PIN_MODE_INPUT(GPIOB_PIN5) | \ #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | PIN_AFIO_AF(GPIOB_PIN1, 0) | PIN_AFIO_AF(GPIOB_PIN2, 0) | PIN_AFIO_AF(GPIOB_PIN3, 0) | PIN_AFIO_AF(GPIOB_PIN4, 0) | PIN_AFIO_AF(GPIOB_PIN5, 0) | PIN_AFIO_AF(GPIOB_PIN6, 4) | PIN_AFIO_AF(GPIOB_PIN7, 0))
PIN_MODE_ALTERNATE(GPIOB_PIN6) | \ #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | PIN_AFIO_AF(GPIOB_PIN9, 0) | PIN_AFIO_AF(GPIOB_PIN10, 0) | PIN_AFIO_AF(GPIOB_PIN11, 0) | PIN_AFIO_AF(GPIOB_PIN12, 0) | PIN_AFIO_AF(GPIOB_PIN13, 0) | PIN_AFIO_AF(GPIOB_PIN14, 0) | PIN_AFIO_AF(GPIOB_PIN15, 0))
PIN_MODE_OUTPUT(GPIOB_PIN7) | \
PIN_MODE_INPUT(GPIOB_PIN8) | \
PIN_MODE_INPUT(GPIOB_PIN9) | \
PIN_MODE_INPUT(GPIOB_PIN10) | \
PIN_MODE_INPUT(GPIOB_PIN11) | \
PIN_MODE_INPUT(GPIOB_PIN12) | \
PIN_MODE_INPUT(GPIOB_PIN13) | \
PIN_MODE_INPUT(GPIOB_PIN14) | \
PIN_MODE_INPUT(GPIOB_PIN15))
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
PIN_OTYPE_OPENDRAIN(GPIOB_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN2) | \
PIN_OSPEED_HIGH(GPIOB_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \
PIN_OSPEED_HIGH(GPIOB_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \
PIN_OSPEED_VERYLOW(GPIOB_PIN15))
#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
PIN_PUPDR_FLOATING(GPIOB_PIN3) | \
PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
PIN_PUPDR_FLOATING(GPIOB_PIN6) | \
PIN_PUPDR_PULLDOWN(GPIOB_PIN7) | \
PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
PIN_PUPDR_PULLUP(GPIOB_PIN9) | \
PIN_PUPDR_PULLUP(GPIOB_PIN10) | \
PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
PIN_PUPDR_PULLUP(GPIOB_PIN15))
#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \
PIN_ODR_HIGH(GPIOB_PIN1) | \
PIN_ODR_HIGH(GPIOB_PIN2) | \
PIN_ODR_HIGH(GPIOB_PIN3) | \
PIN_ODR_HIGH(GPIOB_PIN4) | \
PIN_ODR_HIGH(GPIOB_PIN5) | \
PIN_ODR_HIGH(GPIOB_PIN6) | \
PIN_ODR_LOW(GPIOB_PIN7) | \
PIN_ODR_HIGH(GPIOB_PIN8) | \
PIN_ODR_HIGH(GPIOB_PIN9) | \
PIN_ODR_HIGH(GPIOB_PIN10) | \
PIN_ODR_HIGH(GPIOB_PIN11) | \
PIN_ODR_HIGH(GPIOB_PIN12) | \
PIN_ODR_HIGH(GPIOB_PIN13) | \
PIN_ODR_HIGH(GPIOB_PIN14) | \
PIN_ODR_HIGH(GPIOB_PIN15))
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | \
PIN_AFIO_AF(GPIOB_PIN1, 0) | \
PIN_AFIO_AF(GPIOB_PIN2, 0) | \
PIN_AFIO_AF(GPIOB_PIN3, 0) | \
PIN_AFIO_AF(GPIOB_PIN4, 0) | \
PIN_AFIO_AF(GPIOB_PIN5, 0) | \
PIN_AFIO_AF(GPIOB_PIN6, 4) | \
PIN_AFIO_AF(GPIOB_PIN7, 0))
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | \
PIN_AFIO_AF(GPIOB_PIN9, 0) | \
PIN_AFIO_AF(GPIOB_PIN10, 0) | \
PIN_AFIO_AF(GPIOB_PIN11, 0) | \
PIN_AFIO_AF(GPIOB_PIN12, 0) | \
PIN_AFIO_AF(GPIOB_PIN13, 0) | \
PIN_AFIO_AF(GPIOB_PIN14, 0) | \
PIN_AFIO_AF(GPIOB_PIN15, 0))
/* /*
* GPIOC setup: * GPIOC setup:
@ -478,102 +299,13 @@
* PC14 - PIN14 (input floating). * PC14 - PIN14 (input floating).
* PC15 - PIN15 (input floating). * PC15 - PIN15 (input floating).
*/ */
#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | PIN_MODE_INPUT(GPIOC_PIN1) | PIN_MODE_INPUT(GPIOC_PIN2) | PIN_MODE_INPUT(GPIOC_PIN3) | PIN_MODE_INPUT(GPIOC_PIN4) | PIN_MODE_INPUT(GPIOC_PIN5) | PIN_MODE_INPUT(GPIOC_PIN6) | PIN_MODE_INPUT(GPIOC_PIN7) | PIN_MODE_INPUT(GPIOC_PIN8) | PIN_MODE_INPUT(GPIOC_PIN9) | PIN_MODE_INPUT(GPIOC_PIN10) | PIN_MODE_INPUT(GPIOC_PIN11) | PIN_MODE_INPUT(GPIOC_PIN12) | PIN_MODE_INPUT(GPIOC_PIN13) | PIN_MODE_INPUT(GPIOC_PIN14) | PIN_MODE_INPUT(GPIOC_PIN15))
PIN_MODE_INPUT(GPIOC_PIN1) | \ #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
PIN_MODE_INPUT(GPIOC_PIN2) | \ #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | PIN_OSPEED_VERYLOW(GPIOC_PIN1) | PIN_OSPEED_VERYLOW(GPIOC_PIN2) | PIN_OSPEED_VERYLOW(GPIOC_PIN3) | PIN_OSPEED_VERYLOW(GPIOC_PIN4) | PIN_OSPEED_VERYLOW(GPIOC_PIN5) | PIN_OSPEED_VERYLOW(GPIOC_PIN6) | PIN_OSPEED_VERYLOW(GPIOC_PIN7) | PIN_OSPEED_VERYLOW(GPIOC_PIN8) | PIN_OSPEED_VERYLOW(GPIOC_PIN9) | PIN_OSPEED_VERYLOW(GPIOC_PIN10) | PIN_OSPEED_VERYLOW(GPIOC_PIN11) | PIN_OSPEED_VERYLOW(GPIOC_PIN12) | PIN_OSPEED_VERYLOW(GPIOC_PIN13) | PIN_OSPEED_HIGH(GPIOC_PIN14) | PIN_OSPEED_HIGH(GPIOC_PIN15))
PIN_MODE_INPUT(GPIOC_PIN3) | \ #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | PIN_PUPDR_PULLUP(GPIOC_PIN1) | PIN_PUPDR_PULLUP(GPIOC_PIN2) | PIN_PUPDR_PULLUP(GPIOC_PIN3) | PIN_PUPDR_PULLUP(GPIOC_PIN4) | PIN_PUPDR_PULLUP(GPIOC_PIN5) | PIN_PUPDR_PULLUP(GPIOC_PIN6) | PIN_PUPDR_PULLUP(GPIOC_PIN7) | PIN_PUPDR_PULLUP(GPIOC_PIN8) | PIN_PUPDR_PULLUP(GPIOC_PIN9) | PIN_PUPDR_PULLUP(GPIOC_PIN10) | PIN_PUPDR_PULLUP(GPIOC_PIN11) | PIN_PUPDR_PULLUP(GPIOC_PIN12) | PIN_PUPDR_PULLUP(GPIOC_PIN13) | PIN_PUPDR_FLOATING(GPIOC_PIN14) | PIN_PUPDR_FLOATING(GPIOC_PIN15))
PIN_MODE_INPUT(GPIOC_PIN4) | \ #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | PIN_ODR_HIGH(GPIOC_PIN1) | PIN_ODR_HIGH(GPIOC_PIN2) | PIN_ODR_HIGH(GPIOC_PIN3) | PIN_ODR_HIGH(GPIOC_PIN4) | PIN_ODR_HIGH(GPIOC_PIN5) | PIN_ODR_HIGH(GPIOC_PIN6) | PIN_ODR_HIGH(GPIOC_PIN7) | PIN_ODR_HIGH(GPIOC_PIN8) | PIN_ODR_HIGH(GPIOC_PIN9) | PIN_ODR_HIGH(GPIOC_PIN10) | PIN_ODR_HIGH(GPIOC_PIN11) | PIN_ODR_HIGH(GPIOC_PIN12) | PIN_ODR_HIGH(GPIOC_PIN13) | PIN_ODR_HIGH(GPIOC_PIN14) | PIN_ODR_HIGH(GPIOC_PIN15))
PIN_MODE_INPUT(GPIOC_PIN5) | \ #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | PIN_AFIO_AF(GPIOC_PIN1, 0) | PIN_AFIO_AF(GPIOC_PIN2, 0) | PIN_AFIO_AF(GPIOC_PIN3, 0) | PIN_AFIO_AF(GPIOC_PIN4, 0) | PIN_AFIO_AF(GPIOC_PIN5, 0) | PIN_AFIO_AF(GPIOC_PIN6, 0) | PIN_AFIO_AF(GPIOC_PIN7, 0))
PIN_MODE_INPUT(GPIOC_PIN6) | \ #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0) | PIN_AFIO_AF(GPIOC_PIN9, 0) | PIN_AFIO_AF(GPIOC_PIN10, 0) | PIN_AFIO_AF(GPIOC_PIN11, 0) | PIN_AFIO_AF(GPIOC_PIN12, 0) | PIN_AFIO_AF(GPIOC_PIN13, 0) | PIN_AFIO_AF(GPIOC_PIN14, 0) | PIN_AFIO_AF(GPIOC_PIN15, 0))
PIN_MODE_INPUT(GPIOC_PIN7) | \
PIN_MODE_INPUT(GPIOC_PIN8) | \
PIN_MODE_INPUT(GPIOC_PIN9) | \
PIN_MODE_INPUT(GPIOC_PIN10) | \
PIN_MODE_INPUT(GPIOC_PIN11) | \
PIN_MODE_INPUT(GPIOC_PIN12) | \
PIN_MODE_INPUT(GPIOC_PIN13) | \
PIN_MODE_INPUT(GPIOC_PIN14) | \
PIN_MODE_INPUT(GPIOC_PIN15))
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \
PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \
PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \
PIN_OSPEED_HIGH(GPIOC_PIN14) | \
PIN_OSPEED_HIGH(GPIOC_PIN15))
#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \
PIN_PUPDR_PULLUP(GPIOC_PIN1) | \
PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
PIN_PUPDR_PULLUP(GPIOC_PIN7) | \
PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
PIN_PUPDR_FLOATING(GPIOC_PIN14) | \
PIN_PUPDR_FLOATING(GPIOC_PIN15))
#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
PIN_ODR_HIGH(GPIOC_PIN1) | \
PIN_ODR_HIGH(GPIOC_PIN2) | \
PIN_ODR_HIGH(GPIOC_PIN3) | \
PIN_ODR_HIGH(GPIOC_PIN4) | \
PIN_ODR_HIGH(GPIOC_PIN5) | \
PIN_ODR_HIGH(GPIOC_PIN6) | \
PIN_ODR_HIGH(GPIOC_PIN7) | \
PIN_ODR_HIGH(GPIOC_PIN8) | \
PIN_ODR_HIGH(GPIOC_PIN9) | \
PIN_ODR_HIGH(GPIOC_PIN10) | \
PIN_ODR_HIGH(GPIOC_PIN11) | \
PIN_ODR_HIGH(GPIOC_PIN12) | \
PIN_ODR_HIGH(GPIOC_PIN13) | \
PIN_ODR_HIGH(GPIOC_PIN14) | \
PIN_ODR_HIGH(GPIOC_PIN15))
#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | \
PIN_AFIO_AF(GPIOC_PIN1, 0) | \
PIN_AFIO_AF(GPIOC_PIN2, 0) | \
PIN_AFIO_AF(GPIOC_PIN3, 0) | \
PIN_AFIO_AF(GPIOC_PIN4, 0) | \
PIN_AFIO_AF(GPIOC_PIN5, 0) | \
PIN_AFIO_AF(GPIOC_PIN6, 0) | \
PIN_AFIO_AF(GPIOC_PIN7, 0))
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0) | \
PIN_AFIO_AF(GPIOC_PIN9, 0) | \
PIN_AFIO_AF(GPIOC_PIN10, 0) | \
PIN_AFIO_AF(GPIOC_PIN11, 0) | \
PIN_AFIO_AF(GPIOC_PIN12, 0) | \
PIN_AFIO_AF(GPIOC_PIN13, 0) | \
PIN_AFIO_AF(GPIOC_PIN14, 0) | \
PIN_AFIO_AF(GPIOC_PIN15, 0))
/* /*
* GPIOD setup: * GPIOD setup:
@ -595,102 +327,13 @@
* PD14 - PIN14 (input pullup). * PD14 - PIN14 (input pullup).
* PD15 - PIN15 (input pullup). * PD15 - PIN15 (input pullup).
*/ */
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | PIN_MODE_INPUT(GPIOD_PIN1) | PIN_MODE_INPUT(GPIOD_PIN2) | PIN_MODE_INPUT(GPIOD_PIN3) | PIN_MODE_INPUT(GPIOD_PIN4) | PIN_MODE_INPUT(GPIOD_PIN5) | PIN_MODE_INPUT(GPIOD_PIN6) | PIN_MODE_INPUT(GPIOD_PIN7) | PIN_MODE_INPUT(GPIOD_PIN8) | PIN_MODE_INPUT(GPIOD_PIN9) | PIN_MODE_INPUT(GPIOD_PIN10) | PIN_MODE_INPUT(GPIOD_PIN11) | PIN_MODE_INPUT(GPIOD_PIN12) | PIN_MODE_INPUT(GPIOD_PIN13) | PIN_MODE_INPUT(GPIOD_PIN14) | PIN_MODE_INPUT(GPIOD_PIN15))
PIN_MODE_INPUT(GPIOD_PIN1) | \ #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
PIN_MODE_INPUT(GPIOD_PIN2) | \ #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | PIN_OSPEED_VERYLOW(GPIOD_PIN1) | PIN_OSPEED_VERYLOW(GPIOD_PIN2) | PIN_OSPEED_VERYLOW(GPIOD_PIN3) | PIN_OSPEED_VERYLOW(GPIOD_PIN4) | PIN_OSPEED_VERYLOW(GPIOD_PIN5) | PIN_OSPEED_VERYLOW(GPIOD_PIN6) | PIN_OSPEED_VERYLOW(GPIOD_PIN7) | PIN_OSPEED_VERYLOW(GPIOD_PIN8) | PIN_OSPEED_VERYLOW(GPIOD_PIN9) | PIN_OSPEED_VERYLOW(GPIOD_PIN10) | PIN_OSPEED_VERYLOW(GPIOD_PIN11) | PIN_OSPEED_VERYLOW(GPIOD_PIN12) | PIN_OSPEED_VERYLOW(GPIOD_PIN13) | PIN_OSPEED_VERYLOW(GPIOD_PIN14) | PIN_OSPEED_VERYLOW(GPIOD_PIN15))
PIN_MODE_INPUT(GPIOD_PIN3) | \ #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | PIN_PUPDR_PULLUP(GPIOD_PIN1) | PIN_PUPDR_PULLUP(GPIOD_PIN2) | PIN_PUPDR_PULLUP(GPIOD_PIN3) | PIN_PUPDR_PULLUP(GPIOD_PIN4) | PIN_PUPDR_PULLUP(GPIOD_PIN5) | PIN_PUPDR_PULLUP(GPIOD_PIN6) | PIN_PUPDR_PULLUP(GPIOD_PIN7) | PIN_PUPDR_PULLUP(GPIOD_PIN8) | PIN_PUPDR_PULLUP(GPIOD_PIN9) | PIN_PUPDR_PULLUP(GPIOD_PIN10) | PIN_PUPDR_PULLUP(GPIOD_PIN11) | PIN_PUPDR_PULLUP(GPIOD_PIN12) | PIN_PUPDR_PULLUP(GPIOD_PIN13) | PIN_PUPDR_PULLUP(GPIOD_PIN14) | PIN_PUPDR_PULLUP(GPIOD_PIN15))
PIN_MODE_INPUT(GPIOD_PIN4) | \ #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | PIN_ODR_HIGH(GPIOD_PIN1) | PIN_ODR_HIGH(GPIOD_PIN2) | PIN_ODR_HIGH(GPIOD_PIN3) | PIN_ODR_HIGH(GPIOD_PIN4) | PIN_ODR_HIGH(GPIOD_PIN5) | PIN_ODR_HIGH(GPIOD_PIN6) | PIN_ODR_HIGH(GPIOD_PIN7) | PIN_ODR_HIGH(GPIOD_PIN8) | PIN_ODR_HIGH(GPIOD_PIN9) | PIN_ODR_HIGH(GPIOD_PIN10) | PIN_ODR_HIGH(GPIOD_PIN11) | PIN_ODR_HIGH(GPIOD_PIN12) | PIN_ODR_HIGH(GPIOD_PIN13) | PIN_ODR_HIGH(GPIOD_PIN14) | PIN_ODR_HIGH(GPIOD_PIN15))
PIN_MODE_INPUT(GPIOD_PIN5) | \ #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0) | PIN_AFIO_AF(GPIOD_PIN1, 0) | PIN_AFIO_AF(GPIOD_PIN2, 0) | PIN_AFIO_AF(GPIOD_PIN3, 0) | PIN_AFIO_AF(GPIOD_PIN4, 0) | PIN_AFIO_AF(GPIOD_PIN5, 0) | PIN_AFIO_AF(GPIOD_PIN6, 0) | PIN_AFIO_AF(GPIOD_PIN7, 0))
PIN_MODE_INPUT(GPIOD_PIN6) | \ #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0) | PIN_AFIO_AF(GPIOD_PIN9, 0) | PIN_AFIO_AF(GPIOD_PIN10, 0) | PIN_AFIO_AF(GPIOD_PIN11, 0) | PIN_AFIO_AF(GPIOD_PIN12, 0) | PIN_AFIO_AF(GPIOD_PIN13, 0) | PIN_AFIO_AF(GPIOD_PIN14, 0) | PIN_AFIO_AF(GPIOD_PIN15, 0))
PIN_MODE_INPUT(GPIOD_PIN7) | \
PIN_MODE_INPUT(GPIOD_PIN8) | \
PIN_MODE_INPUT(GPIOD_PIN9) | \
PIN_MODE_INPUT(GPIOD_PIN10) | \
PIN_MODE_INPUT(GPIOD_PIN11) | \
PIN_MODE_INPUT(GPIOD_PIN12) | \
PIN_MODE_INPUT(GPIOD_PIN13) | \
PIN_MODE_INPUT(GPIOD_PIN14) | \
PIN_MODE_INPUT(GPIOD_PIN15))
#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \
PIN_OSPEED_VERYLOW(GPIOD_PIN15))
#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
PIN_PUPDR_PULLUP(GPIOD_PIN15))
#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
PIN_ODR_HIGH(GPIOD_PIN1) | \
PIN_ODR_HIGH(GPIOD_PIN2) | \
PIN_ODR_HIGH(GPIOD_PIN3) | \
PIN_ODR_HIGH(GPIOD_PIN4) | \
PIN_ODR_HIGH(GPIOD_PIN5) | \
PIN_ODR_HIGH(GPIOD_PIN6) | \
PIN_ODR_HIGH(GPIOD_PIN7) | \
PIN_ODR_HIGH(GPIOD_PIN8) | \
PIN_ODR_HIGH(GPIOD_PIN9) | \
PIN_ODR_HIGH(GPIOD_PIN10) | \
PIN_ODR_HIGH(GPIOD_PIN11) | \
PIN_ODR_HIGH(GPIOD_PIN12) | \
PIN_ODR_HIGH(GPIOD_PIN13) | \
PIN_ODR_HIGH(GPIOD_PIN14) | \
PIN_ODR_HIGH(GPIOD_PIN15))
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0) | \
PIN_AFIO_AF(GPIOD_PIN1, 0) | \
PIN_AFIO_AF(GPIOD_PIN2, 0) | \
PIN_AFIO_AF(GPIOD_PIN3, 0) | \
PIN_AFIO_AF(GPIOD_PIN4, 0) | \
PIN_AFIO_AF(GPIOD_PIN5, 0) | \
PIN_AFIO_AF(GPIOD_PIN6, 0) | \
PIN_AFIO_AF(GPIOD_PIN7, 0))
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0) | \
PIN_AFIO_AF(GPIOD_PIN9, 0) | \
PIN_AFIO_AF(GPIOD_PIN10, 0) | \
PIN_AFIO_AF(GPIOD_PIN11, 0) | \
PIN_AFIO_AF(GPIOD_PIN12, 0) | \
PIN_AFIO_AF(GPIOD_PIN13, 0) | \
PIN_AFIO_AF(GPIOD_PIN14, 0) | \
PIN_AFIO_AF(GPIOD_PIN15, 0))
/* /*
* GPIOE setup: * GPIOE setup:
@ -712,102 +355,13 @@
* PE14 - PIN14 (output pushpull maximum). * PE14 - PIN14 (output pushpull maximum).
* PE15 - PIN15 (output pushpull maximum). * PE15 - PIN15 (output pushpull maximum).
*/ */
#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \ #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | PIN_MODE_INPUT(GPIOE_PIN1) | PIN_MODE_INPUT(GPIOE_PIN2) | PIN_MODE_OUTPUT(GPIOE_PIN3) | PIN_MODE_INPUT(GPIOE_PIN4) | PIN_MODE_INPUT(GPIOE_PIN5) | PIN_MODE_INPUT(GPIOE_PIN6) | PIN_MODE_INPUT(GPIOE_PIN7) | PIN_MODE_OUTPUT(GPIOE_PIN8) | PIN_MODE_OUTPUT(GPIOE_PIN9) | PIN_MODE_OUTPUT(GPIOE_PIN10) | PIN_MODE_OUTPUT(GPIOE_PIN11) | PIN_MODE_OUTPUT(GPIOE_PIN12) | PIN_MODE_OUTPUT(GPIOE_PIN13) | PIN_MODE_OUTPUT(GPIOE_PIN14) | PIN_MODE_OUTPUT(GPIOE_PIN15))
PIN_MODE_INPUT(GPIOE_PIN1) | \ #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
PIN_MODE_INPUT(GPIOE_PIN2) |\ #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | PIN_OSPEED_VERYLOW(GPIOE_PIN1) | PIN_OSPEED_VERYLOW(GPIOE_PIN2) | PIN_OSPEED_HIGH(GPIOE_PIN3) | PIN_OSPEED_VERYLOW(GPIOE_PIN4) | PIN_OSPEED_VERYLOW(GPIOE_PIN5) | PIN_OSPEED_VERYLOW(GPIOE_PIN6) | PIN_OSPEED_VERYLOW(GPIOE_PIN7) | PIN_OSPEED_HIGH(GPIOE_PIN8) | PIN_OSPEED_HIGH(GPIOE_PIN9) | PIN_OSPEED_HIGH(GPIOE_PIN10) | PIN_OSPEED_HIGH(GPIOE_PIN11) | PIN_OSPEED_HIGH(GPIOE_PIN12) | PIN_OSPEED_HIGH(GPIOE_PIN13) | PIN_OSPEED_HIGH(GPIOE_PIN14) | PIN_OSPEED_HIGH(GPIOE_PIN15))
PIN_MODE_OUTPUT(GPIOE_PIN3) | \ #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | PIN_PUPDR_PULLUP(GPIOE_PIN1) | PIN_PUPDR_PULLUP(GPIOE_PIN2) | PIN_PUPDR_FLOATING(GPIOE_PIN3) | PIN_PUPDR_PULLUP(GPIOE_PIN4) | PIN_PUPDR_PULLUP(GPIOE_PIN5) | PIN_PUPDR_PULLUP(GPIOE_PIN6) | PIN_PUPDR_PULLUP(GPIOE_PIN7) | PIN_PUPDR_PULLUP(GPIOE_PIN8) | PIN_PUPDR_PULLUP(GPIOE_PIN9) | PIN_PUPDR_PULLUP(GPIOE_PIN10) | PIN_PUPDR_FLOATING(GPIOE_PIN11) | PIN_PUPDR_PULLUP(GPIOE_PIN12) | PIN_PUPDR_FLOATING(GPIOE_PIN13) | PIN_PUPDR_FLOATING(GPIOE_PIN14) | PIN_PUPDR_FLOATING(GPIOE_PIN15))
PIN_MODE_INPUT(GPIOE_PIN4) |\ #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | PIN_ODR_HIGH(GPIOE_PIN1) | PIN_ODR_HIGH(GPIOE_PIN2) | PIN_ODR_HIGH(GPIOE_PIN3) | PIN_ODR_HIGH(GPIOE_PIN4) | PIN_ODR_HIGH(GPIOE_PIN5) | PIN_ODR_HIGH(GPIOE_PIN6) | PIN_ODR_HIGH(GPIOE_PIN7) | PIN_ODR_LOW(GPIOE_PIN8) | PIN_ODR_LOW(GPIOE_PIN9) | PIN_ODR_LOW(GPIOE_PIN10) | PIN_ODR_LOW(GPIOE_PIN11) | PIN_ODR_LOW(GPIOE_PIN12) | PIN_ODR_LOW(GPIOE_PIN13) | PIN_ODR_LOW(GPIOE_PIN14) | PIN_ODR_LOW(GPIOE_PIN15))
PIN_MODE_INPUT(GPIOE_PIN5) |\ #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0) | PIN_AFIO_AF(GPIOE_PIN1, 0) | PIN_AFIO_AF(GPIOE_PIN2, 0) | PIN_AFIO_AF(GPIOE_PIN3, 0) | PIN_AFIO_AF(GPIOE_PIN4, 0) | PIN_AFIO_AF(GPIOE_PIN5, 0) | PIN_AFIO_AF(GPIOE_PIN6, 0) | PIN_AFIO_AF(GPIOE_PIN7, 0))
PIN_MODE_INPUT(GPIOE_PIN6) | \ #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0) | PIN_AFIO_AF(GPIOE_PIN9, 0) | PIN_AFIO_AF(GPIOE_PIN10, 0) | PIN_AFIO_AF(GPIOE_PIN11, 0) | PIN_AFIO_AF(GPIOE_PIN12, 0) | PIN_AFIO_AF(GPIOE_PIN13, 0) | PIN_AFIO_AF(GPIOE_PIN14, 0) | PIN_AFIO_AF(GPIOE_PIN15, 0))
PIN_MODE_INPUT(GPIOE_PIN7) | \
PIN_MODE_OUTPUT(GPIOE_PIN8) | \
PIN_MODE_OUTPUT(GPIOE_PIN9) | \
PIN_MODE_OUTPUT(GPIOE_PIN10) | \
PIN_MODE_OUTPUT(GPIOE_PIN11) | \
PIN_MODE_OUTPUT(GPIOE_PIN12) | \
PIN_MODE_OUTPUT(GPIOE_PIN13) | \
PIN_MODE_OUTPUT(GPIOE_PIN14) | \
PIN_MODE_OUTPUT(GPIOE_PIN15))
#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN1) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |\
PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) |\
PIN_OSPEED_VERYLOW(GPIOE_PIN1) |\
PIN_OSPEED_VERYLOW(GPIOE_PIN2) |\
PIN_OSPEED_HIGH(GPIOE_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOE_PIN4) |\
PIN_OSPEED_VERYLOW(GPIOE_PIN5) |\
PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \
PIN_OSPEED_HIGH(GPIOE_PIN8) | \
PIN_OSPEED_HIGH(GPIOE_PIN9) | \
PIN_OSPEED_HIGH(GPIOE_PIN10) | \
PIN_OSPEED_HIGH(GPIOE_PIN11) | \
PIN_OSPEED_HIGH(GPIOE_PIN12) | \
PIN_OSPEED_HIGH(GPIOE_PIN13) | \
PIN_OSPEED_HIGH(GPIOE_PIN14) | \
PIN_OSPEED_HIGH(GPIOE_PIN15))
#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
PIN_PUPDR_PULLUP(GPIOE_PIN2) |\
PIN_PUPDR_FLOATING(GPIOE_PIN3) | \
PIN_PUPDR_PULLUP(GPIOE_PIN4) |\
PIN_PUPDR_PULLUP(GPIOE_PIN5) |\
PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
PIN_PUPDR_FLOATING(GPIOE_PIN11) | \
PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
PIN_PUPDR_FLOATING(GPIOE_PIN13) | \
PIN_PUPDR_FLOATING(GPIOE_PIN14) |\
PIN_PUPDR_FLOATING(GPIOE_PIN15))
#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
PIN_ODR_HIGH(GPIOE_PIN1) | \
PIN_ODR_HIGH(GPIOE_PIN2) | \
PIN_ODR_HIGH(GPIOE_PIN3) | \
PIN_ODR_HIGH(GPIOE_PIN4) | \
PIN_ODR_HIGH(GPIOE_PIN5) | \
PIN_ODR_HIGH(GPIOE_PIN6) | \
PIN_ODR_HIGH(GPIOE_PIN7) | \
PIN_ODR_LOW(GPIOE_PIN8) | \
PIN_ODR_LOW(GPIOE_PIN9) | \
PIN_ODR_LOW(GPIOE_PIN10) | \
PIN_ODR_LOW(GPIOE_PIN11) | \
PIN_ODR_LOW(GPIOE_PIN12) | \
PIN_ODR_LOW(GPIOE_PIN13) | \
PIN_ODR_LOW(GPIOE_PIN14) | \
PIN_ODR_LOW(GPIOE_PIN15))
#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0) | \
PIN_AFIO_AF(GPIOE_PIN1, 0) | \
PIN_AFIO_AF(GPIOE_PIN2, 0) |\
PIN_AFIO_AF(GPIOE_PIN3, 0) | \
PIN_AFIO_AF(GPIOE_PIN4, 0) |\
PIN_AFIO_AF(GPIOE_PIN5, 0) |\
PIN_AFIO_AF(GPIOE_PIN6, 0) | \
PIN_AFIO_AF(GPIOE_PIN7, 0))
#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0) | \
PIN_AFIO_AF(GPIOE_PIN9, 0) | \
PIN_AFIO_AF(GPIOE_PIN10, 0) | \
PIN_AFIO_AF(GPIOE_PIN11, 0) | \
PIN_AFIO_AF(GPIOE_PIN12, 0) | \
PIN_AFIO_AF(GPIOE_PIN13, 0) | \
PIN_AFIO_AF(GPIOE_PIN14, 0) | \
PIN_AFIO_AF(GPIOE_PIN15, 0))
/* /*
* GPIOF setup: * GPIOF setup:
@ -829,102 +383,13 @@
* PF14 - PIN14 (input pullup). * PF14 - PIN14 (input pullup).
* PF15 - PIN15 (input pullup). * PF15 - PIN15 (input pullup).
*/ */
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_I2C2_SDA) | \ #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_I2C2_SDA) | PIN_MODE_INPUT(GPIOF_I2C2_SCL) | PIN_MODE_INPUT(GPIOF_PIN2) | PIN_MODE_INPUT(GPIOF_PIN3) | PIN_MODE_INPUT(GPIOF_PIN4) | PIN_MODE_INPUT(GPIOF_PIN5) | PIN_MODE_INPUT(GPIOF_PIN6) | PIN_MODE_INPUT(GPIOF_PIN7) | PIN_MODE_INPUT(GPIOF_PIN8) | PIN_MODE_INPUT(GPIOF_PIN9) | PIN_MODE_INPUT(GPIOF_PIN10) | PIN_MODE_INPUT(GPIOF_PIN11) | PIN_MODE_INPUT(GPIOF_PIN12) | PIN_MODE_INPUT(GPIOF_PIN13) | PIN_MODE_INPUT(GPIOF_PIN14) | PIN_MODE_INPUT(GPIOF_PIN15))
PIN_MODE_INPUT(GPIOF_I2C2_SCL) | \ #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SDA) | PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SCL) | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
PIN_MODE_INPUT(GPIOF_PIN2) | \ #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_I2C2_SDA) | PIN_OSPEED_HIGH(GPIOF_I2C2_SCL) | PIN_OSPEED_VERYLOW(GPIOF_PIN2) | PIN_OSPEED_VERYLOW(GPIOF_PIN3) | PIN_OSPEED_VERYLOW(GPIOF_PIN4) | PIN_OSPEED_VERYLOW(GPIOF_PIN5) | PIN_OSPEED_VERYLOW(GPIOF_PIN6) | PIN_OSPEED_VERYLOW(GPIOF_PIN7) | PIN_OSPEED_VERYLOW(GPIOF_PIN8) | PIN_OSPEED_VERYLOW(GPIOF_PIN9) | PIN_OSPEED_VERYLOW(GPIOF_PIN10) | PIN_OSPEED_VERYLOW(GPIOF_PIN11) | PIN_OSPEED_VERYLOW(GPIOF_PIN12) | PIN_OSPEED_VERYLOW(GPIOF_PIN13) | PIN_OSPEED_VERYLOW(GPIOF_PIN14) | PIN_OSPEED_VERYLOW(GPIOF_PIN15))
PIN_MODE_INPUT(GPIOF_PIN3) | \ #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_I2C2_SDA) | PIN_PUPDR_FLOATING(GPIOF_I2C2_SCL) | PIN_PUPDR_PULLUP(GPIOF_PIN2) | PIN_PUPDR_PULLUP(GPIOF_PIN3) | PIN_PUPDR_PULLUP(GPIOF_PIN4) | PIN_PUPDR_PULLUP(GPIOF_PIN5) | PIN_PUPDR_PULLUP(GPIOF_PIN6) | PIN_PUPDR_PULLUP(GPIOF_PIN7) | PIN_PUPDR_PULLUP(GPIOF_PIN8) | PIN_PUPDR_PULLUP(GPIOF_PIN9) | PIN_PUPDR_PULLUP(GPIOF_PIN10) | PIN_PUPDR_PULLUP(GPIOF_PIN11) | PIN_PUPDR_PULLUP(GPIOF_PIN12) | PIN_PUPDR_PULLUP(GPIOF_PIN13) | PIN_PUPDR_PULLUP(GPIOF_PIN14) | PIN_PUPDR_PULLUP(GPIOF_PIN15))
PIN_MODE_INPUT(GPIOF_PIN4) | \ #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_I2C2_SDA) | PIN_ODR_HIGH(GPIOF_I2C2_SCL) | PIN_ODR_HIGH(GPIOF_PIN2) | PIN_ODR_HIGH(GPIOF_PIN3) | PIN_ODR_HIGH(GPIOF_PIN4) | PIN_ODR_HIGH(GPIOF_PIN5) | PIN_ODR_HIGH(GPIOF_PIN6) | PIN_ODR_HIGH(GPIOF_PIN7) | PIN_ODR_HIGH(GPIOF_PIN8) | PIN_ODR_HIGH(GPIOF_PIN9) | PIN_ODR_HIGH(GPIOF_PIN10) | PIN_ODR_HIGH(GPIOF_PIN11) | PIN_ODR_HIGH(GPIOF_PIN12) | PIN_ODR_HIGH(GPIOF_PIN13) | PIN_ODR_HIGH(GPIOF_PIN14) | PIN_ODR_HIGH(GPIOF_PIN15))
PIN_MODE_INPUT(GPIOF_PIN5) | \ #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_I2C2_SDA, 0) | PIN_AFIO_AF(GPIOF_I2C2_SCL, 0) | PIN_AFIO_AF(GPIOF_PIN2, 0) | PIN_AFIO_AF(GPIOF_PIN3, 0) | PIN_AFIO_AF(GPIOF_PIN4, 0) | PIN_AFIO_AF(GPIOF_PIN5, 0) | PIN_AFIO_AF(GPIOF_PIN6, 0) | PIN_AFIO_AF(GPIOF_PIN7, 0))
PIN_MODE_INPUT(GPIOF_PIN6) | \ #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | PIN_AFIO_AF(GPIOF_PIN9, 0) | PIN_AFIO_AF(GPIOF_PIN10, 0) | PIN_AFIO_AF(GPIOF_PIN11, 0) | PIN_AFIO_AF(GPIOF_PIN12, 0) | PIN_AFIO_AF(GPIOF_PIN13, 0) | PIN_AFIO_AF(GPIOF_PIN14, 0) | PIN_AFIO_AF(GPIOF_PIN15, 0))
PIN_MODE_INPUT(GPIOF_PIN7) | \
PIN_MODE_INPUT(GPIOF_PIN8) | \
PIN_MODE_INPUT(GPIOF_PIN9) | \
PIN_MODE_INPUT(GPIOF_PIN10) | \
PIN_MODE_INPUT(GPIOF_PIN11) | \
PIN_MODE_INPUT(GPIOF_PIN12) | \
PIN_MODE_INPUT(GPIOF_PIN13) | \
PIN_MODE_INPUT(GPIOF_PIN14) | \
PIN_MODE_INPUT(GPIOF_PIN15))
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SDA) | \
PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SCL) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_I2C2_SDA) | \
PIN_OSPEED_HIGH(GPIOF_I2C2_SCL) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN2) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN10) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN11) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \
PIN_OSPEED_VERYLOW(GPIOF_PIN15))
#define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_I2C2_SDA) | \
PIN_PUPDR_FLOATING(GPIOF_I2C2_SCL) | \
PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
PIN_PUPDR_PULLUP(GPIOF_PIN15))
#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_I2C2_SDA) | \
PIN_ODR_HIGH(GPIOF_I2C2_SCL) | \
PIN_ODR_HIGH(GPIOF_PIN2) | \
PIN_ODR_HIGH(GPIOF_PIN3) | \
PIN_ODR_HIGH(GPIOF_PIN4) | \
PIN_ODR_HIGH(GPIOF_PIN5) | \
PIN_ODR_HIGH(GPIOF_PIN6) | \
PIN_ODR_HIGH(GPIOF_PIN7) | \
PIN_ODR_HIGH(GPIOF_PIN8) | \
PIN_ODR_HIGH(GPIOF_PIN9) | \
PIN_ODR_HIGH(GPIOF_PIN10) | \
PIN_ODR_HIGH(GPIOF_PIN11) | \
PIN_ODR_HIGH(GPIOF_PIN12) | \
PIN_ODR_HIGH(GPIOF_PIN13) | \
PIN_ODR_HIGH(GPIOF_PIN14) | \
PIN_ODR_HIGH(GPIOF_PIN15))
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_I2C2_SDA, 0) | \
PIN_AFIO_AF(GPIOF_I2C2_SCL, 0) | \
PIN_AFIO_AF(GPIOF_PIN2, 0) | \
PIN_AFIO_AF(GPIOF_PIN3, 0) | \
PIN_AFIO_AF(GPIOF_PIN4, 0) | \
PIN_AFIO_AF(GPIOF_PIN5, 0) | \
PIN_AFIO_AF(GPIOF_PIN6, 0) | \
PIN_AFIO_AF(GPIOF_PIN7, 0))
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | \
PIN_AFIO_AF(GPIOF_PIN9, 0) | \
PIN_AFIO_AF(GPIOF_PIN10, 0) | \
PIN_AFIO_AF(GPIOF_PIN11, 0) | \
PIN_AFIO_AF(GPIOF_PIN12, 0) | \
PIN_AFIO_AF(GPIOF_PIN13, 0) | \
PIN_AFIO_AF(GPIOF_PIN14, 0) | \
PIN_AFIO_AF(GPIOF_PIN15, 0))
/* /*
* GPIOG setup: * GPIOG setup:
@ -946,102 +411,13 @@
* PG14 - PIN14 (input pullup). * PG14 - PIN14 (input pullup).
* PG15 - PIN15 (input pullup). * PG15 - PIN15 (input pullup).
*/ */
#define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \ #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | PIN_MODE_INPUT(GPIOG_PIN1) | PIN_MODE_INPUT(GPIOG_PIN2) | PIN_MODE_INPUT(GPIOG_PIN3) | PIN_MODE_INPUT(GPIOG_PIN4) | PIN_MODE_INPUT(GPIOG_PIN5) | PIN_MODE_INPUT(GPIOG_PIN6) | PIN_MODE_INPUT(GPIOG_PIN7) | PIN_MODE_INPUT(GPIOG_PIN8) | PIN_MODE_INPUT(GPIOG_PIN9) | PIN_MODE_INPUT(GPIOG_PIN10) | PIN_MODE_INPUT(GPIOG_PIN11) | PIN_MODE_INPUT(GPIOG_PIN12) | PIN_MODE_INPUT(GPIOG_PIN13) | PIN_MODE_INPUT(GPIOG_PIN14) | PIN_MODE_INPUT(GPIOG_PIN15))
PIN_MODE_INPUT(GPIOG_PIN1) | \ #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
PIN_MODE_INPUT(GPIOG_PIN2) | \ #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | PIN_OSPEED_VERYLOW(GPIOG_PIN1) | PIN_OSPEED_VERYLOW(GPIOG_PIN2) | PIN_OSPEED_VERYLOW(GPIOG_PIN3) | PIN_OSPEED_VERYLOW(GPIOG_PIN4) | PIN_OSPEED_VERYLOW(GPIOG_PIN5) | PIN_OSPEED_VERYLOW(GPIOG_PIN6) | PIN_OSPEED_VERYLOW(GPIOG_PIN7) | PIN_OSPEED_VERYLOW(GPIOG_PIN8) | PIN_OSPEED_VERYLOW(GPIOG_PIN9) | PIN_OSPEED_VERYLOW(GPIOG_PIN10) | PIN_OSPEED_VERYLOW(GPIOG_PIN11) | PIN_OSPEED_VERYLOW(GPIOG_PIN12) | PIN_OSPEED_VERYLOW(GPIOG_PIN13) | PIN_OSPEED_VERYLOW(GPIOG_PIN14) | PIN_OSPEED_VERYLOW(GPIOG_PIN15))
PIN_MODE_INPUT(GPIOG_PIN3) | \ #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | PIN_PUPDR_PULLUP(GPIOG_PIN1) | PIN_PUPDR_PULLUP(GPIOG_PIN2) | PIN_PUPDR_PULLUP(GPIOG_PIN3) | PIN_PUPDR_PULLUP(GPIOG_PIN4) | PIN_PUPDR_PULLUP(GPIOG_PIN5) | PIN_PUPDR_PULLUP(GPIOG_PIN6) | PIN_PUPDR_PULLUP(GPIOG_PIN7) | PIN_PUPDR_PULLUP(GPIOG_PIN8) | PIN_PUPDR_PULLUP(GPIOG_PIN9) | PIN_PUPDR_PULLUP(GPIOG_PIN10) | PIN_PUPDR_PULLUP(GPIOG_PIN11) | PIN_PUPDR_PULLUP(GPIOG_PIN12) | PIN_PUPDR_PULLUP(GPIOG_PIN13) | PIN_PUPDR_PULLUP(GPIOG_PIN14) | PIN_PUPDR_PULLUP(GPIOG_PIN15))
PIN_MODE_INPUT(GPIOG_PIN4) | \ #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | PIN_ODR_HIGH(GPIOG_PIN1) | PIN_ODR_HIGH(GPIOG_PIN2) | PIN_ODR_HIGH(GPIOG_PIN3) | PIN_ODR_HIGH(GPIOG_PIN4) | PIN_ODR_HIGH(GPIOG_PIN5) | PIN_ODR_HIGH(GPIOG_PIN6) | PIN_ODR_HIGH(GPIOG_PIN7) | PIN_ODR_HIGH(GPIOG_PIN8) | PIN_ODR_HIGH(GPIOG_PIN9) | PIN_ODR_HIGH(GPIOG_PIN10) | PIN_ODR_HIGH(GPIOG_PIN11) | PIN_ODR_HIGH(GPIOG_PIN12) | PIN_ODR_HIGH(GPIOG_PIN13) | PIN_ODR_HIGH(GPIOG_PIN14) | PIN_ODR_HIGH(GPIOG_PIN15))
PIN_MODE_INPUT(GPIOG_PIN5) | \ #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0) | PIN_AFIO_AF(GPIOG_PIN1, 0) | PIN_AFIO_AF(GPIOG_PIN2, 0) | PIN_AFIO_AF(GPIOG_PIN3, 0) | PIN_AFIO_AF(GPIOG_PIN4, 0) | PIN_AFIO_AF(GPIOG_PIN5, 0) | PIN_AFIO_AF(GPIOG_PIN6, 0) | PIN_AFIO_AF(GPIOG_PIN7, 0))
PIN_MODE_INPUT(GPIOG_PIN6) | \ #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0) | PIN_AFIO_AF(GPIOG_PIN9, 0) | PIN_AFIO_AF(GPIOG_PIN10, 0) | PIN_AFIO_AF(GPIOG_PIN11, 0) | PIN_AFIO_AF(GPIOG_PIN12, 0) | PIN_AFIO_AF(GPIOG_PIN13, 0) | PIN_AFIO_AF(GPIOG_PIN14, 0) | PIN_AFIO_AF(GPIOG_PIN15, 0))
PIN_MODE_INPUT(GPIOG_PIN7) | \
PIN_MODE_INPUT(GPIOG_PIN8) | \
PIN_MODE_INPUT(GPIOG_PIN9) | \
PIN_MODE_INPUT(GPIOG_PIN10) | \
PIN_MODE_INPUT(GPIOG_PIN11) | \
PIN_MODE_INPUT(GPIOG_PIN12) | \
PIN_MODE_INPUT(GPIOG_PIN13) | \
PIN_MODE_INPUT(GPIOG_PIN14) | \
PIN_MODE_INPUT(GPIOG_PIN15))
#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \
PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \
PIN_OSPEED_VERYLOW(GPIOG_PIN15))
#define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \
PIN_PUPDR_PULLUP(GPIOG_PIN1) | \
PIN_PUPDR_PULLUP(GPIOG_PIN2) | \
PIN_PUPDR_PULLUP(GPIOG_PIN3) | \
PIN_PUPDR_PULLUP(GPIOG_PIN4) | \
PIN_PUPDR_PULLUP(GPIOG_PIN5) | \
PIN_PUPDR_PULLUP(GPIOG_PIN6) | \
PIN_PUPDR_PULLUP(GPIOG_PIN7) | \
PIN_PUPDR_PULLUP(GPIOG_PIN8) | \
PIN_PUPDR_PULLUP(GPIOG_PIN9) | \
PIN_PUPDR_PULLUP(GPIOG_PIN10) | \
PIN_PUPDR_PULLUP(GPIOG_PIN11) | \
PIN_PUPDR_PULLUP(GPIOG_PIN12) | \
PIN_PUPDR_PULLUP(GPIOG_PIN13) | \
PIN_PUPDR_PULLUP(GPIOG_PIN14) | \
PIN_PUPDR_PULLUP(GPIOG_PIN15))
#define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
PIN_ODR_HIGH(GPIOG_PIN1) | \
PIN_ODR_HIGH(GPIOG_PIN2) | \
PIN_ODR_HIGH(GPIOG_PIN3) | \
PIN_ODR_HIGH(GPIOG_PIN4) | \
PIN_ODR_HIGH(GPIOG_PIN5) | \
PIN_ODR_HIGH(GPIOG_PIN6) | \
PIN_ODR_HIGH(GPIOG_PIN7) | \
PIN_ODR_HIGH(GPIOG_PIN8) | \
PIN_ODR_HIGH(GPIOG_PIN9) | \
PIN_ODR_HIGH(GPIOG_PIN10) | \
PIN_ODR_HIGH(GPIOG_PIN11) | \
PIN_ODR_HIGH(GPIOG_PIN12) | \
PIN_ODR_HIGH(GPIOG_PIN13) | \
PIN_ODR_HIGH(GPIOG_PIN14) | \
PIN_ODR_HIGH(GPIOG_PIN15))
#define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0) | \
PIN_AFIO_AF(GPIOG_PIN1, 0) | \
PIN_AFIO_AF(GPIOG_PIN2, 0) | \
PIN_AFIO_AF(GPIOG_PIN3, 0) | \
PIN_AFIO_AF(GPIOG_PIN4, 0) | \
PIN_AFIO_AF(GPIOG_PIN5, 0) | \
PIN_AFIO_AF(GPIOG_PIN6, 0) | \
PIN_AFIO_AF(GPIOG_PIN7, 0))
#define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0) | \
PIN_AFIO_AF(GPIOG_PIN9, 0) | \
PIN_AFIO_AF(GPIOG_PIN10, 0) | \
PIN_AFIO_AF(GPIOG_PIN11, 0) | \
PIN_AFIO_AF(GPIOG_PIN12, 0) | \
PIN_AFIO_AF(GPIOG_PIN13, 0) | \
PIN_AFIO_AF(GPIOG_PIN14, 0) | \
PIN_AFIO_AF(GPIOG_PIN15, 0))
/* /*
* GPIOH setup: * GPIOH setup:
@ -1063,103 +439,13 @@
* PH14 - PIN14 (input pullup). * PH14 - PIN14 (input pullup).
* PH15 - PIN15 (input pullup). * PH15 - PIN15 (input pullup).
*/ */
#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \ #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | PIN_MODE_INPUT(GPIOH_PIN1) | PIN_MODE_INPUT(GPIOH_PIN2) | PIN_MODE_INPUT(GPIOH_PIN3) | PIN_MODE_INPUT(GPIOH_PIN4) | PIN_MODE_INPUT(GPIOH_PIN5) | PIN_MODE_INPUT(GPIOH_PIN6) | PIN_MODE_INPUT(GPIOH_PIN7) | PIN_MODE_INPUT(GPIOH_PIN8) | PIN_MODE_INPUT(GPIOH_PIN9) | PIN_MODE_INPUT(GPIOH_PIN10) | PIN_MODE_INPUT(GPIOH_PIN11) | PIN_MODE_INPUT(GPIOH_PIN12) | PIN_MODE_INPUT(GPIOH_PIN13) | PIN_MODE_INPUT(GPIOH_PIN14) | PIN_MODE_INPUT(GPIOH_PIN15))
PIN_MODE_INPUT(GPIOH_PIN1) | \ #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
PIN_MODE_INPUT(GPIOH_PIN2) | \ #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | PIN_OSPEED_VERYLOW(GPIOH_PIN1) | PIN_OSPEED_VERYLOW(GPIOH_PIN2) | PIN_OSPEED_VERYLOW(GPIOH_PIN3) | PIN_OSPEED_VERYLOW(GPIOH_PIN4) | PIN_OSPEED_VERYLOW(GPIOH_PIN5) | PIN_OSPEED_VERYLOW(GPIOH_PIN6) | PIN_OSPEED_VERYLOW(GPIOH_PIN7) | PIN_OSPEED_VERYLOW(GPIOH_PIN8) | PIN_OSPEED_VERYLOW(GPIOH_PIN9) | PIN_OSPEED_VERYLOW(GPIOH_PIN10) | PIN_OSPEED_VERYLOW(GPIOH_PIN11) | PIN_OSPEED_VERYLOW(GPIOH_PIN12) | PIN_OSPEED_VERYLOW(GPIOH_PIN13) | PIN_OSPEED_VERYLOW(GPIOH_PIN14) | PIN_OSPEED_VERYLOW(GPIOH_PIN15))
PIN_MODE_INPUT(GPIOH_PIN3) | \ #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | PIN_PUPDR_PULLUP(GPIOH_PIN1) | PIN_PUPDR_PULLUP(GPIOH_PIN2) | PIN_PUPDR_PULLUP(GPIOH_PIN3) | PIN_PUPDR_PULLUP(GPIOH_PIN4) | PIN_PUPDR_PULLUP(GPIOH_PIN5) | PIN_PUPDR_PULLUP(GPIOH_PIN6) | PIN_PUPDR_PULLUP(GPIOH_PIN7) | PIN_PUPDR_PULLUP(GPIOH_PIN8) | PIN_PUPDR_PULLUP(GPIOH_PIN9) | PIN_PUPDR_PULLUP(GPIOH_PIN10) | PIN_PUPDR_PULLUP(GPIOH_PIN11) | PIN_PUPDR_PULLUP(GPIOH_PIN12) | PIN_PUPDR_PULLUP(GPIOH_PIN13) | PIN_PUPDR_PULLUP(GPIOH_PIN14) | PIN_PUPDR_PULLUP(GPIOH_PIN15))
PIN_MODE_INPUT(GPIOH_PIN4) | \ #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | PIN_ODR_HIGH(GPIOH_PIN1) | PIN_ODR_HIGH(GPIOH_PIN2) | PIN_ODR_HIGH(GPIOH_PIN3) | PIN_ODR_HIGH(GPIOH_PIN4) | PIN_ODR_HIGH(GPIOH_PIN5) | PIN_ODR_HIGH(GPIOH_PIN6) | PIN_ODR_HIGH(GPIOH_PIN7) | PIN_ODR_HIGH(GPIOH_PIN8) | PIN_ODR_HIGH(GPIOH_PIN9) | PIN_ODR_HIGH(GPIOH_PIN10) | PIN_ODR_HIGH(GPIOH_PIN11) | PIN_ODR_HIGH(GPIOH_PIN12) | PIN_ODR_HIGH(GPIOH_PIN13) | PIN_ODR_HIGH(GPIOH_PIN14) | PIN_ODR_HIGH(GPIOH_PIN15))
PIN_MODE_INPUT(GPIOH_PIN5) | \ #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0) | PIN_AFIO_AF(GPIOH_PIN1, 0) | PIN_AFIO_AF(GPIOH_PIN2, 0) | PIN_AFIO_AF(GPIOH_PIN3, 0) | PIN_AFIO_AF(GPIOH_PIN4, 0) | PIN_AFIO_AF(GPIOH_PIN5, 0) | PIN_AFIO_AF(GPIOH_PIN6, 0) | PIN_AFIO_AF(GPIOH_PIN7, 0))
PIN_MODE_INPUT(GPIOH_PIN6) | \ #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0) | PIN_AFIO_AF(GPIOH_PIN9, 0) | PIN_AFIO_AF(GPIOH_PIN10, 0) | PIN_AFIO_AF(GPIOH_PIN11, 0) | PIN_AFIO_AF(GPIOH_PIN12, 0) | PIN_AFIO_AF(GPIOH_PIN13, 0) | PIN_AFIO_AF(GPIOH_PIN14, 0) | PIN_AFIO_AF(GPIOH_PIN15, 0))
PIN_MODE_INPUT(GPIOH_PIN7) | \
PIN_MODE_INPUT(GPIOH_PIN8) | \
PIN_MODE_INPUT(GPIOH_PIN9) | \
PIN_MODE_INPUT(GPIOH_PIN10) | \
PIN_MODE_INPUT(GPIOH_PIN11) | \
PIN_MODE_INPUT(GPIOH_PIN12) | \
PIN_MODE_INPUT(GPIOH_PIN13) | \
PIN_MODE_INPUT(GPIOH_PIN14) | \
PIN_MODE_INPUT(GPIOH_PIN15))
#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN1) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
PIN_OSPEED_VERYLOW(GPIOH_PIN15))
#define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | \
PIN_PUPDR_PULLUP(GPIOH_PIN1) | \
PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
PIN_PUPDR_PULLUP(GPIOH_PIN15))
#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \
PIN_ODR_HIGH(GPIOH_PIN1) | \
PIN_ODR_HIGH(GPIOH_PIN2) | \
PIN_ODR_HIGH(GPIOH_PIN3) | \
PIN_ODR_HIGH(GPIOH_PIN4) | \
PIN_ODR_HIGH(GPIOH_PIN5) | \
PIN_ODR_HIGH(GPIOH_PIN6) | \
PIN_ODR_HIGH(GPIOH_PIN7) | \
PIN_ODR_HIGH(GPIOH_PIN8) | \
PIN_ODR_HIGH(GPIOH_PIN9) | \
PIN_ODR_HIGH(GPIOH_PIN10) | \
PIN_ODR_HIGH(GPIOH_PIN11) | \
PIN_ODR_HIGH(GPIOH_PIN12) | \
PIN_ODR_HIGH(GPIOH_PIN13) | \
PIN_ODR_HIGH(GPIOH_PIN14) | \
PIN_ODR_HIGH(GPIOH_PIN15))
#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0) | \
PIN_AFIO_AF(GPIOH_PIN1, 0) | \
PIN_AFIO_AF(GPIOH_PIN2, 0) | \
PIN_AFIO_AF(GPIOH_PIN3, 0) | \
PIN_AFIO_AF(GPIOH_PIN4, 0) | \
PIN_AFIO_AF(GPIOH_PIN5, 0) | \
PIN_AFIO_AF(GPIOH_PIN6, 0) | \
PIN_AFIO_AF(GPIOH_PIN7, 0))
#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0) | \
PIN_AFIO_AF(GPIOH_PIN9, 0) | \
PIN_AFIO_AF(GPIOH_PIN10, 0) | \
PIN_AFIO_AF(GPIOH_PIN11, 0) | \
PIN_AFIO_AF(GPIOH_PIN12, 0) | \
PIN_AFIO_AF(GPIOH_PIN13, 0) | \
PIN_AFIO_AF(GPIOH_PIN14, 0) | \
PIN_AFIO_AF(GPIOH_PIN15, 0))
/* /*
* USB bus activation macro, required by the USB driver. * USB bus activation macro, required by the USB driver.
@ -1171,7 +457,9 @@
* USB bus de-activation macro, required by the USB driver. * USB bus de-activation macro, required by the USB driver.
*/ */
// #define usb_lld_disconnect_bus(usbp) // #define usb_lld_disconnect_bus(usbp)
#define usb_lld_disconnect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)); palClearPad(GPIOA, GPIOA_USB_DP) #define usb_lld_disconnect_bus(usbp) \
(palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)); \
palClearPad(GPIOA, GPIOA_USB_DP)
// #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12) // #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12)
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)

View file

@ -21,9 +21,9 @@
* @details Digital I/O ports static configuration as defined in @p board.h. * @details Digital I/O ports static configuration as defined in @p board.h.
* This variable is used by the HAL when initializing the PAL driver. * This variable is used by the HAL when initializing the PAL driver.
*/ */
const PALConfig pal_default_config = const PALConfig pal_default_config = {
.ports =
{ {
.ports = {
{ {
/* /*
* PORTA setup. * PORTA setup.
@ -37,18 +37,9 @@ const PALConfig pal_default_config =
* PTA0/3 SWD * PTA0/3 SWD
*/ */
.port = IOPORT1, .port = IOPORT1,
.pads = { .pads =
PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, {
PAL_MODE_ALTERNATIVE_7, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_7, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
}, },
}, },
{ {
@ -65,18 +56,9 @@ const PALConfig pal_default_config =
* PTB19 - PIN25 * PTB19 - PIN25
*/ */
.port = IOPORT2, .port = IOPORT2,
.pads = { .pads =
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, {
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3,
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
}, },
}, },
{ {
@ -97,18 +79,9 @@ const PALConfig pal_default_config =
* PTC11 - PIN30 * PTC11 - PIN30
*/ */
.port = IOPORT3, .port = IOPORT3,
.pads = { .pads =
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, {
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
}, },
}, },
{ {
@ -125,18 +98,9 @@ const PALConfig pal_default_config =
* PTD7 - PIN5 * PTD7 - PIN5
*/ */
.port = IOPORT4, .port = IOPORT4,
.pads = { .pads =
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, {
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
}, },
}, },
{ {
@ -147,18 +111,9 @@ const PALConfig pal_default_config =
* PTE1 - PIN26 * PTE1 - PIN26
*/ */
.port = IOPORT5, .port = IOPORT5,
.pads = { .pads =
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, {
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
}, },
}, },
}, },
@ -178,7 +133,8 @@ const PALConfig pal_default_config =
void __early_init(void) { void __early_init(void) {
// This is a dirty hack and should only be used as a temporary fix until this // This is a dirty hack and should only be used as a temporary fix until this
// is upstreamed. // is upstreamed.
while (WDOG_TMROUTL < 2); // Must wait for WDOG timer if already running, before jumping while (WDOG_TMROUTL < 2)
; // Must wait for WDOG timer if already running, before jumping
k20x_clock_init(); k20x_clock_init();
} }
@ -187,5 +143,4 @@ void __early_init(void) {
* @brief Board-specific initialization code. * @brief Board-specific initialization code.
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {}
}

View file

@ -20,13 +20,11 @@
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
uint8_t DRV2605L_transfer_buffer[2]; uint8_t DRV2605L_transfer_buffer[2];
uint8_t DRV2605L_tx_register[0]; uint8_t DRV2605L_tx_register[0];
uint8_t DRV2605L_read_buffer[0]; uint8_t DRV2605L_read_buffer[0];
uint8_t DRV2605L_read_register; uint8_t DRV2605L_read_register;
void DRV_write(uint8_t drv_register, uint8_t settings) { void DRV_write(uint8_t drv_register, uint8_t settings) {
DRV2605L_transfer_buffer[0] = drv_register; DRV2605L_transfer_buffer[0] = drv_register;
DRV2605L_transfer_buffer[1] = settings; DRV2605L_transfer_buffer[1] = settings;
@ -35,15 +33,11 @@ void DRV_write(uint8_t drv_register, uint8_t settings) {
uint8_t DRV_read(uint8_t regaddress) { uint8_t DRV_read(uint8_t regaddress) {
#ifdef __AVR__ #ifdef __AVR__
i2c_readReg(DRV2605L_BASE_ADDRESS << 1, i2c_readReg(DRV2605L_BASE_ADDRESS << 1, regaddress, DRV2605L_read_buffer, 1, 100);
regaddress, DRV2605L_read_buffer, 1, 100);
DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0]; DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
#else #else
DRV2605L_tx_register[0] = regaddress; DRV2605L_tx_register[0] = regaddress;
if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1, if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1, DRV2605L_tx_register, 1, DRV2605L_read_buffer, 1)) {
DRV2605L_tx_register, 1,
DRV2605L_read_buffer, 1
)){
printf("err reading reg \n"); printf("err reading reg \n");
} }
DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0]; DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
@ -51,8 +45,7 @@ uint8_t DRV_read(uint8_t regaddress) {
return DRV2605L_read_register; return DRV2605L_read_register;
} }
void DRV_init(void) void DRV_init(void) {
{
i2c_init(); i2c_init();
/* 0x07 sets DRV2605 into calibration mode */ /* 0x07 sets DRV2605 into calibration mode */
DRV_write(DRV_MODE, 0x07); DRV_write(DRV_MODE, 0x07);
@ -121,8 +114,7 @@ void DRV_init(void)
DRV_write(DRV_GO, 0x01); DRV_write(DRV_GO, 0x01);
} }
void DRV_pulse(uint8_t sequence) void DRV_pulse(uint8_t sequence) {
{
DRV_write(DRV_GO, 0x00); DRV_write(DRV_GO, 0x00);
DRV_write(DRV_WAVEFORM_SEQ_1, sequence); DRV_write(DRV_WAVEFORM_SEQ_1, sequence);
DRV_write(DRV_GO, 0x01); DRV_write(DRV_GO, 0x01);

View file

@ -86,8 +86,7 @@ if (haptic_config.enable) {
void haptic_feedback_toggle(void) { void haptic_feedback_toggle(void) {
haptic_config.feedback++; haptic_config.feedback++;
if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX) if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX) haptic_config.feedback = KEY_PRESS;
haptic_config.feedback = KEY_PRESS;
xprintf("haptic_config.feedback = %u\n", !haptic_config.feedback); xprintf("haptic_config.feedback = %u\n", !haptic_config.feedback);
eeconfig_update_haptic(haptic_config.raw); eeconfig_update_haptic(haptic_config.raw);
} }
@ -214,16 +213,36 @@ void haptic_play(void) {
} }
bool process_haptic(uint16_t keycode, keyrecord_t *record) { bool process_haptic(uint16_t keycode, keyrecord_t *record) {
if (keycode == HPT_ON && record->event.pressed) { haptic_enable(); } if (keycode == HPT_ON && record->event.pressed) {
if (keycode == HPT_OFF && record->event.pressed) { haptic_disable(); } haptic_enable();
if (keycode == HPT_TOG && record->event.pressed) { haptic_toggle(); } }
if (keycode == HPT_RST && record->event.pressed) { haptic_reset(); } if (keycode == HPT_OFF && record->event.pressed) {
if (keycode == HPT_FBK && record->event.pressed) { haptic_feedback_toggle(); } haptic_disable();
if (keycode == HPT_BUZ && record->event.pressed) { haptic_buzz_toggle(); } }
if (keycode == HPT_MODI && record->event.pressed) { haptic_mode_increase(); } if (keycode == HPT_TOG && record->event.pressed) {
if (keycode == HPT_MODD && record->event.pressed) { haptic_mode_decrease(); } haptic_toggle();
if (keycode == HPT_DWLI && record->event.pressed) { haptic_dwell_increase(); } }
if (keycode == HPT_DWLD && record->event.pressed) { haptic_dwell_decrease(); } if (keycode == HPT_RST && record->event.pressed) {
haptic_reset();
}
if (keycode == HPT_FBK && record->event.pressed) {
haptic_feedback_toggle();
}
if (keycode == HPT_BUZ && record->event.pressed) {
haptic_buzz_toggle();
}
if (keycode == HPT_MODI && record->event.pressed) {
haptic_mode_increase();
}
if (keycode == HPT_MODD && record->event.pressed) {
haptic_mode_decrease();
}
if (keycode == HPT_DWLI && record->event.pressed) {
haptic_dwell_increase();
}
if (keycode == HPT_DWLD && record->event.pressed) {
haptic_dwell_decrease();
}
if (haptic_config.enable) { if (haptic_config.enable) {
if (record->event.pressed) { if (record->event.pressed) {
// keypress // keypress
@ -244,5 +263,4 @@ void haptic_shutdown(void) {
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
solenoid_shutdown(); solenoid_shutdown();
#endif #endif
} }

View file

@ -23,7 +23,6 @@
# include "DRV2605L.h" # include "DRV2605L.h"
#endif #endif
#ifndef HAPTIC_FEEDBACK_DEFAULT #ifndef HAPTIC_FEEDBACK_DEFAULT
# define HAPTIC_FEEDBACK_DEFAULT 0 # define HAPTIC_FEEDBACK_DEFAULT 0
#endif #endif
@ -75,8 +74,3 @@ void haptic_dwell_decrease(void);
void haptic_play(void); void haptic_play(void);
void haptic_shutdown(void); void haptic_shutdown(void);

View file

@ -26,19 +26,11 @@ uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
extern haptic_config_t haptic_config; extern haptic_config_t haptic_config;
void solenoid_buzz_on(void) { haptic_set_buzz(1); }
void solenoid_buzz_on(void) { void solenoid_buzz_off(void) { haptic_set_buzz(0); }
haptic_set_buzz(1);
}
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_dwell_minus(uint8_t solenoid_dwell) { void solenoid_dwell_minus(uint8_t solenoid_dwell) {
if (solenoid_dwell > 0) solenoid_dwell--; if (solenoid_dwell > 0) solenoid_dwell--;
@ -48,9 +40,7 @@ void solenoid_dwell_plus(uint8_t solenoid_dwell) {
if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++; if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++;
} }
void solenoid_set_dwell(uint8_t dwell) { void solenoid_set_dwell(uint8_t dwell) { solenoid_dwell = dwell; }
solenoid_dwell = dwell;
}
void solenoid_stop(void) { void solenoid_stop(void) {
writePinLow(SOLENOID_PIN); writePinLow(SOLENOID_PIN);
@ -88,8 +78,7 @@ void solenoid_check(void) {
solenoid_buzzing = true; solenoid_buzzing = true;
writePinHigh(SOLENOID_PIN); writePinHigh(SOLENOID_PIN);
} }
} } else {
else {
if (solenoid_buzzing) { if (solenoid_buzzing) {
solenoid_buzzing = false; solenoid_buzzing = false;
writePinLow(SOLENOID_PIN); writePinLow(SOLENOID_PIN);
@ -103,7 +92,4 @@ void solenoid_setup(void) {
solenoid_fire(); solenoid_fire();
} }
void solenoid_shutdown(void) { void solenoid_shutdown(void) { writePinLow(SOLENOID_PIN); }
writePinLow(SOLENOID_PIN);
}

View file

@ -37,15 +37,13 @@ uint8_t g_twi_transfer_buffer[20];
uint8_t g_pwm_buffer[18]; uint8_t g_pwm_buffer[18];
bool g_pwm_buffer_update_required = false; bool g_pwm_buffer_update_required = false;
void IS31FL3218_write_register( uint8_t reg, uint8_t data ) void IS31FL3218_write_register(uint8_t reg, uint8_t data) {
{
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
} }
void IS31FL3218_write_pwm_buffer( uint8_t *pwm_buffer ) void IS31FL3218_write_pwm_buffer(uint8_t *pwm_buffer) {
{
g_twi_transfer_buffer[0] = ISSI_REG_PWM; g_twi_transfer_buffer[0] = ISSI_REG_PWM;
for (int i = 0; i < 18; i++) { for (int i = 0; i < 18; i++) {
g_twi_transfer_buffer[1 + i] = pwm_buffer[i]; g_twi_transfer_buffer[1 + i] = pwm_buffer[i];
@ -54,8 +52,7 @@ void IS31FL3218_write_pwm_buffer( uint8_t *pwm_buffer )
i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT); i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
} }
void IS31FL3218_init(void) void IS31FL3218_init(void) {
{
// In case we ever want to reinitialize (?) // In case we ever want to reinitialize (?)
IS31FL3218_write_register(ISSI_REG_RESET, 0x00); IS31FL3218_write_register(ISSI_REG_RESET, 0x00);
@ -76,23 +73,20 @@ void IS31FL3218_init(void)
IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01); IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
} }
void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
{
g_pwm_buffer[index * 3 + 0] = red; g_pwm_buffer[index * 3 + 0] = red;
g_pwm_buffer[index * 3 + 1] = green; g_pwm_buffer[index * 3 + 1] = green;
g_pwm_buffer[index * 3 + 2] = blue; g_pwm_buffer[index * 3 + 2] = blue;
g_pwm_buffer_update_required = true; g_pwm_buffer_update_required = true;
} }
void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
{
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
IS31FL3218_set_color(i, red, green, blue); IS31FL3218_set_color(i, red, green, blue);
} }
} }
void IS31FL3218_update_pwm_buffers(void) void IS31FL3218_update_pwm_buffers(void) {
{
if (g_pwm_buffer_update_required) { if (g_pwm_buffer_update_required) {
IS31FL3218_write_pwm_buffer(g_pwm_buffer); IS31FL3218_write_pwm_buffer(g_pwm_buffer);
// Load PWM registers and LED Control register data // Load PWM registers and LED Control register data

View file

@ -103,7 +103,6 @@ bool g_led_control_registers_update_required = false;
// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09 // 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09 // 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) { void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
@ -138,8 +137,7 @@ void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
@ -196,7 +194,6 @@ void IS31FL3731_init(uint8_t addr) {
// most usage after initialization is just writing PWM buffers in bank 0 // most usage after initialization is just writing PWM buffers in bank 0
// as there's not much point in double-buffering // as there's not much point in double-buffering
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0); IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
} }
void IS31FL3731_set_value(int index, uint8_t value) { void IS31FL3731_set_value(int index, uint8_t value) {

View file

@ -16,11 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef IS31FL3731_DRIVER_H #ifndef IS31FL3731_DRIVER_H
#define IS31FL3731_DRIVER_H #define IS31FL3731_DRIVER_H
typedef struct is31_led { typedef struct is31_led {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t v; uint8_t v;
@ -206,5 +204,4 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
#define C9_15 0xB2 #define C9_15 0xB2
#define C9_16 0xB3 #define C9_16 0xB3
#endif // IS31FL3731_DRIVER_H #endif // IS31FL3731_DRIVER_H

View file

@ -90,24 +90,20 @@ bool g_led_control_registers_update_required[DRIVER_COUNT] = { false };
// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09 // 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09 // 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data )
{
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
#endif #endif
} }
void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
{
// assumes bank is already selected // assumes bank is already selected
// transmit PWM registers in 9 transfers of 16 bytes // transmit PWM registers in 9 transfers of 16 bytes
@ -126,8 +122,7 @@ void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
@ -135,8 +130,7 @@ void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
} }
} }
void IS31FL3731_init( uint8_t addr ) void IS31FL3731_init(uint8_t addr) {
{
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, first enable software shutdown, // in the LED driver's PWM registers, first enable software shutdown,
// then set up the mode and other settings, clear the PWM registers, // then set up the mode and other settings, clear the PWM registers,
@ -165,20 +159,17 @@ void IS31FL3731_init( uint8_t addr )
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0); IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
// turn off all LEDs in the LED control register // turn off all LEDs in the LED control register
for ( int i = 0x00; i <= 0x11; i++ ) for (int i = 0x00; i <= 0x11; i++) {
{
IS31FL3731_write_register(addr, i, 0x00); IS31FL3731_write_register(addr, i, 0x00);
} }
// turn off all LEDs in the blink control register (not really needed) // turn off all LEDs in the blink control register (not really needed)
for ( int i = 0x12; i <= 0x23; i++ ) for (int i = 0x12; i <= 0x23; i++) {
{
IS31FL3731_write_register(addr, i, 0x00); IS31FL3731_write_register(addr, i, 0x00);
} }
// set PWM on all LEDs to 0 // set PWM on all LEDs to 0
for ( int i = 0x24; i <= 0xB3; i++ ) for (int i = 0x24; i <= 0xB3; i++) {
{
IS31FL3731_write_register(addr, i, 0x00); IS31FL3731_write_register(addr, i, 0x00);
} }
@ -192,11 +183,9 @@ void IS31FL3731_init( uint8_t addr )
// most usage after initialization is just writing PWM buffers in bank 0 // most usage after initialization is just writing PWM buffers in bank 0
// as there's not much point in double-buffering // as there's not much point in double-buffering
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0); IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
} }
void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
{
if (index >= 0 && index < DRIVER_LED_TOTAL) { if (index >= 0 && index < DRIVER_LED_TOTAL) {
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
@ -208,16 +197,13 @@ void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
} }
} }
void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
{ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
for ( int i = 0; i < DRIVER_LED_TOTAL; i++ )
{
IS31FL3731_set_color(i, red, green, blue); IS31FL3731_set_color(i, red, green, blue);
} }
} }
void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
{
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
uint8_t control_register_r = (led.r - 0x24) / 8; uint8_t control_register_r = (led.r - 0x24) / 8;
@ -244,24 +230,18 @@ void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, b
} }
g_led_control_registers_update_required[led.driver] = true; g_led_control_registers_update_required[led.driver] = true;
} }
void IS31FL3731_update_pwm_buffers( uint8_t addr, uint8_t index ) void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
{ if (g_pwm_buffer_update_required[index]) {
if ( g_pwm_buffer_update_required[index] )
{
IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]); IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
} }
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3731_update_led_control_registers( uint8_t addr, uint8_t index ) void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) {
{ if (g_led_control_registers_update_required[index]) {
if ( g_led_control_registers_update_required[index] ) for (int i = 0; i < 18; i++) {
{
for ( int i=0; i<18; i++ )
{
IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]); IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
} }
} }

View file

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef IS31FL3731_DRIVER_H #ifndef IS31FL3731_DRIVER_H
#define IS31FL3731_DRIVER_H #define IS31FL3731_DRIVER_H
@ -209,6 +208,4 @@ void IS31FL3731_update_led_control_registers( uint8_t addr, uint8_t index );
#define C9_15 0xB2 #define C9_15 0xB2
#define C9_16 0xB3 #define C9_16 0xB3
#endif // IS31FL3731_DRIVER_H #endif // IS31FL3731_DRIVER_H

View file

@ -80,23 +80,20 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false };
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data ) void IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
{
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
#endif #endif
} }
void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) void IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
{
// assumes PG1 is already selected // assumes PG1 is already selected
// transmit PWM registers in 12 transfers of 16 bytes // transmit PWM registers in 12 transfers of 16 bytes
@ -114,8 +111,7 @@ void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
@ -123,8 +119,7 @@ void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
} }
} }
void IS31FL3733_init( uint8_t addr, uint8_t sync) void IS31FL3733_init(uint8_t addr, uint8_t sync) {
{
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
@ -137,8 +132,7 @@ void IS31FL3733_init( uint8_t addr, uint8_t sync)
// Select PG0 // Select PG0
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
// Turn off all LEDs. // Turn off all LEDs.
for ( int i = 0x00; i <= 0x17; i++ ) for (int i = 0x00; i <= 0x17; i++) {
{
IS31FL3733_write_register(addr, i, 0x00); IS31FL3733_write_register(addr, i, 0x00);
} }
@ -149,8 +143,7 @@ void IS31FL3733_init( uint8_t addr, uint8_t sync)
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// Set PWM on all LEDs to 0 // Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default. // No need to setup Breath registers to PWM as that is the default.
for ( int i = 0x00; i <= 0xBF; i++ ) for (int i = 0x00; i <= 0xBF; i++) {
{
IS31FL3733_write_register(addr, i, 0x00); IS31FL3733_write_register(addr, i, 0x00);
} }
@ -172,8 +165,7 @@ void IS31FL3733_init( uint8_t addr, uint8_t sync)
#endif #endif
} }
void IS31FL3733_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
{
if (index >= 0 && index < DRIVER_LED_TOTAL) { if (index >= 0 && index < DRIVER_LED_TOTAL) {
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
@ -184,16 +176,13 @@ void IS31FL3733_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
} }
} }
void IS31FL3733_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
{ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
for ( int i = 0; i < DRIVER_LED_TOTAL; i++ )
{
IS31FL3733_set_color(i, red, green, blue); IS31FL3733_set_color(i, red, green, blue);
} }
} }
void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
{
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
uint8_t control_register_r = led.r / 8; uint8_t control_register_r = led.r / 8;
@ -220,13 +209,10 @@ void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, b
} }
g_led_control_registers_update_required[led.driver] = true; g_led_control_registers_update_required[led.driver] = true;
} }
void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index ) void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
{ if (g_pwm_buffer_update_required[index]) {
if ( g_pwm_buffer_update_required[index] )
{
// Firstly we need to unlock the command register and select PG1 // Firstly we need to unlock the command register and select PG1
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
@ -236,15 +222,12 @@ void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index )
g_pwm_buffer_update_required[index] = false; g_pwm_buffer_update_required[index] = false;
} }
void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index ) void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index) {
{ if (g_led_control_registers_update_required[index]) {
if ( g_led_control_registers_update_required[index] )
{
// Firstly we need to unlock the command register and select PG0 // Firstly we need to unlock the command register and select PG0
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for ( int i=0; i<24; i++ ) for (int i = 0; i < 24; i++) {
{
IS31FL3733_write_register(addr, i, g_led_control_registers[index][i]); IS31FL3733_write_register(addr, i, g_led_control_registers[index][i]);
} }
} }

View file

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef IS31FL3733_DRIVER_H #ifndef IS31FL3733_DRIVER_H
#define IS31FL3733_DRIVER_H #define IS31FL3733_DRIVER_H

View file

@ -14,7 +14,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef __AVR__ #ifdef __AVR__
# include <avr/interrupt.h> # include <avr/interrupt.h>
# include <avr/io.h> # include <avr/io.h>
@ -28,8 +27,6 @@
#include "i2c_master.h" #include "i2c_master.h"
#include "progmem.h" #include "progmem.h"
// This is a 7-bit address, that gets left-shifted and bit 0 // This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol) // set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring: // The address will vary depending on your wiring:
@ -81,23 +78,20 @@ bool g_pwm_buffer_update_required = false;
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
bool g_led_control_registers_update_required = false; bool g_led_control_registers_update_required = false;
void IS31FL3736_write_register( uint8_t addr, uint8_t reg, uint8_t data ) void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
{
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
#endif #endif
} }
void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
{
// assumes PG1 is already selected // assumes PG1 is already selected
// transmit PWM registers in 12 transfers of 16 bytes // transmit PWM registers in 12 transfers of 16 bytes
@ -115,8 +109,7 @@ void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
@ -124,8 +117,7 @@ void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
} }
} }
void IS31FL3736_init( uint8_t addr ) void IS31FL3736_init(uint8_t addr) {
{
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
@ -137,8 +129,7 @@ void IS31FL3736_init( uint8_t addr )
// Select PG0 // Select PG0
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
// Turn off all LEDs. // Turn off all LEDs.
for ( int i = 0x00; i <= 0x17; i++ ) for (int i = 0x00; i <= 0x17; i++) {
{
IS31FL3736_write_register(addr, i, 0x00); IS31FL3736_write_register(addr, i, 0x00);
} }
@ -149,8 +140,7 @@ void IS31FL3736_init( uint8_t addr )
IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// Set PWM on all LEDs to 0 // Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default. // No need to setup Breath registers to PWM as that is the default.
for ( int i = 0x00; i <= 0xBF; i++ ) for (int i = 0x00; i <= 0xBF; i++) {
{
IS31FL3736_write_register(addr, i, 0x00); IS31FL3736_write_register(addr, i, 0x00);
} }
@ -172,8 +162,7 @@ void IS31FL3736_init( uint8_t addr )
#endif #endif
} }
void IS31FL3736_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
{
if (index >= 0 && index < DRIVER_LED_TOTAL) { if (index >= 0 && index < DRIVER_LED_TOTAL) {
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
@ -184,16 +173,13 @@ void IS31FL3736_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
} }
} }
void IS31FL3736_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
{ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
for ( int i = 0; i < DRIVER_LED_TOTAL; i++ )
{
IS31FL3736_set_color(i, red, green, blue); IS31FL3736_set_color(i, red, green, blue);
} }
} }
void IS31FL3736_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
{
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
// IS31FL3733 // IS31FL3733
@ -234,11 +220,9 @@ void IS31FL3736_set_led_control_register( uint8_t index, bool red, bool green, b
} }
g_led_control_registers_update_required = true; g_led_control_registers_update_required = true;
} }
void IS31FL3736_mono_set_brightness( int index, uint8_t value ) void IS31FL3736_mono_set_brightness(int index, uint8_t value) {
{
if (index >= 0 && index < 96) { if (index >= 0 && index < 96) {
// Index in range 0..95 -> A1..A8, B1..B8, etc. // Index in range 0..95 -> A1..A8, B1..B8, etc.
// Map index 0..95 to registers 0x00..0xBE (interleaved) // Map index 0..95 to registers 0x00..0xBE (interleaved)
@ -248,16 +232,13 @@ void IS31FL3736_mono_set_brightness( int index, uint8_t value )
} }
} }
void IS31FL3736_mono_set_brightness_all( uint8_t value ) void IS31FL3736_mono_set_brightness_all(uint8_t value) {
{ for (int i = 0; i < 96; i++) {
for ( int i = 0; i < 96; i++ )
{
IS31FL3736_mono_set_brightness(i, value); IS31FL3736_mono_set_brightness(i, value);
} }
} }
void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled ) void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled) {
{
// Index in range 0..95 -> A1..A8, B1..B8, etc. // Index in range 0..95 -> A1..A8, B1..B8, etc.
// Map index 0..95 to registers 0x00..0xBE (interleaved) // Map index 0..95 to registers 0x00..0xBE (interleaved)
@ -275,10 +256,8 @@ void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled )
g_led_control_registers_update_required = true; g_led_control_registers_update_required = true;
} }
void IS31FL3736_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ) void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
{ if (g_pwm_buffer_update_required) {
if ( g_pwm_buffer_update_required )
{
// Firstly we need to unlock the command register and select PG1 // Firstly we need to unlock the command register and select PG1
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
@ -289,18 +268,14 @@ void IS31FL3736_update_pwm_buffers( uint8_t addr1, uint8_t addr2 )
g_pwm_buffer_update_required = false; g_pwm_buffer_update_required = false;
} }
void IS31FL3736_update_led_control_registers( uint8_t addr1, uint8_t addr2 ) void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
{ if (g_led_control_registers_update_required) {
if ( g_led_control_registers_update_required )
{
// Firstly we need to unlock the command register and select PG0 // Firstly we need to unlock the command register and select PG0
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for ( int i=0; i<24; i++ ) for (int i = 0; i < 24; i++) {
{
IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]); IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]);
// IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i] ); // IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i] );
} }
} }
} }

View file

@ -19,11 +19,9 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
// Simple interface option. // Simple interface option.
// If these aren't defined, just define them to make it compile // If these aren't defined, just define them to make it compile
#ifndef DRIVER_COUNT #ifndef DRIVER_COUNT
# define DRIVER_COUNT 2 # define DRIVER_COUNT 2
#endif #endif
@ -32,7 +30,6 @@
# define DRIVER_LED_TOTAL 96 # define DRIVER_LED_TOTAL 96
#endif #endif
typedef struct is31_led { typedef struct is31_led {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t r; uint8_t r;
@ -169,4 +166,3 @@ void IS31FL3736_update_led_control_registers( uint8_t addr1, uint8_t addr2 );
#define L_6 0xBA #define L_6 0xBA
#define L_7 0xBC #define L_7 0xBC
#define L_8 0xBE #define L_8 0xBE

View file

@ -80,23 +80,20 @@ bool g_pwm_buffer_update_required = false;
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}}; uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}};
bool g_led_control_registers_update_required = false; bool g_led_control_registers_update_required = false;
void IS31FL3737_write_register( uint8_t addr, uint8_t reg, uint8_t data ) void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
{
g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data; g_twi_transfer_buffer[1] = data;
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
#endif #endif
} }
void IS31FL3737_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
{
// assumes PG1 is already selected // assumes PG1 is already selected
// transmit PWM registers in 12 transfers of 16 bytes // transmit PWM registers in 12 transfers of 16 bytes
@ -114,8 +111,7 @@ void IS31FL3737_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
#if ISSI_PERSISTENCE > 0 #if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
break;
} }
#else #else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT); i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
@ -123,8 +119,7 @@ void IS31FL3737_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
} }
} }
void IS31FL3737_init( uint8_t addr ) void IS31FL3737_init(uint8_t addr) {
{
// In order to avoid the LEDs being driven with garbage data // In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last. // in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers, // Set up the mode and other settings, clear the PWM registers,
@ -136,8 +131,7 @@ void IS31FL3737_init( uint8_t addr )
// Select PG0 // Select PG0
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
// Turn off all LEDs. // Turn off all LEDs.
for ( int i = 0x00; i <= 0x17; i++ ) for (int i = 0x00; i <= 0x17; i++) {
{
IS31FL3737_write_register(addr, i, 0x00); IS31FL3737_write_register(addr, i, 0x00);
} }
@ -148,8 +142,7 @@ void IS31FL3737_init( uint8_t addr )
IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
// Set PWM on all LEDs to 0 // Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default. // No need to setup Breath registers to PWM as that is the default.
for ( int i = 0x00; i <= 0xBF; i++ ) for (int i = 0x00; i <= 0xBF; i++) {
{
IS31FL3737_write_register(addr, i, 0x00); IS31FL3737_write_register(addr, i, 0x00);
} }
@ -171,8 +164,7 @@ void IS31FL3737_init( uint8_t addr )
#endif #endif
} }
void IS31FL3737_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
{
if (index >= 0 && index < DRIVER_LED_TOTAL) { if (index >= 0 && index < DRIVER_LED_TOTAL) {
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
@ -183,16 +175,13 @@ void IS31FL3737_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
} }
} }
void IS31FL3737_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
{ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
for ( int i = 0; i < DRIVER_LED_TOTAL; i++ )
{
IS31FL3737_set_color(i, red, green, blue); IS31FL3737_set_color(i, red, green, blue);
} }
} }
void IS31FL3737_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
{
is31_led led = g_is31_leds[index]; is31_led led = g_is31_leds[index];
uint8_t control_register_r = led.r / 8; uint8_t control_register_r = led.r / 8;
@ -219,13 +208,10 @@ void IS31FL3737_set_led_control_register( uint8_t index, bool red, bool green, b
} }
g_led_control_registers_update_required = true; g_led_control_registers_update_required = true;
} }
void IS31FL3737_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ) void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
{ if (g_pwm_buffer_update_required) {
if ( g_pwm_buffer_update_required )
{
// Firstly we need to unlock the command register and select PG1 // Firstly we need to unlock the command register and select PG1
IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
@ -236,15 +222,12 @@ void IS31FL3737_update_pwm_buffers( uint8_t addr1, uint8_t addr2 )
g_pwm_buffer_update_required = false; g_pwm_buffer_update_required = false;
} }
void IS31FL3737_update_led_control_registers( uint8_t addr1, uint8_t addr2 ) void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
{ if (g_led_control_registers_update_required) {
if ( g_led_control_registers_update_required )
{
// Firstly we need to unlock the command register and select PG0 // Firstly we need to unlock the command register and select PG0
IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for ( int i=0; i<24; i++ ) for (int i = 0; i < 24; i++) {
{
IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]); IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]);
// IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i] ); // IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i] );
} }

View file

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef IS31FL3737_DRIVER_H #ifndef IS31FL3737_DRIVER_H
#define IS31FL3737_DRIVER_H #define IS31FL3737_DRIVER_H

View file

@ -13,228 +13,13 @@
// Online editor: http://teripom.x0.com/ // Online editor: http://teripom.x0.com/
static const unsigned char font[] PROGMEM = { static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, 0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0xF0, 0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0x3F, 0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0xF0, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xF8, 0xFC, 0x3E,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, 0x1E, 0x06, 0x01, 0x00, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x49, 0x49, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0xDF, 0xBF, 0xBF, 0x00, 0xBF, 0xBF, 0xDF, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x60, 0x60, 0xE0, 0xBF, 0x1F, 0x00, 0x7F, 0x7F, 0x07, 0x1E, 0x38, 0x1E, 0x07, 0x7F, 0x7F, 0x00, 0x7F, 0x7F, 0x0E, 0x1F, 0x3B, 0x71, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x0C, 0x0C, 0x0C, 0x00, 0x7E, 0x7E, 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x7E, 0x7E, 0x03, 0x03, 0x7F, 0x7E, 0x00, 0x0F,
0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0x3E, 0x70, 0x3C, 0x06, 0x3C, 0x70, 0x3E, 0x0F, 0x00, 0x32, 0x7B, 0x49, 0x49, 0x3F, 0x7E, 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00, 0x1E, 0x3F, 0x69, 0x69, 0x6F, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, 0x3F, 0x3C, 0x78, 0x70, 0x60, 0x00, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x07, 0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x7E, 0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
0x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
0x03, 0x04, 0x78, 0x04, 0x03, 0x00,
0x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
0x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
0x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
0x00, 0x03, 0x07, 0x08, 0x00, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40, 0x00,
0x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
0x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00,
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x40, 0x40, 0xF0, 0xF8, 0xF8,
0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0x3F,
0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8,
0xF8, 0xF0, 0x40, 0x40, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00,
0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00,
0x80, 0xC0, 0xC0, 0x00, 0xC0, 0xC0,
0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0xF0, 0xF8, 0xFC, 0x3E,
0x1E, 0x06, 0x01, 0x00, 0x00, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00,
0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x49, 0x49, 0x49, 0xFF, 0xFF, 0xFF,
0xFF, 0xE0, 0xDF, 0xBF, 0xBF, 0x00,
0xBF, 0xBF, 0xDF, 0xE0, 0xFF, 0xFF,
0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F,
0x60, 0x60, 0xE0, 0xBF, 0x1F, 0x00,
0x7F, 0x7F, 0x07, 0x1E, 0x38, 0x1E,
0x07, 0x7F, 0x7F, 0x00, 0x7F, 0x7F,
0x0E, 0x1F, 0x3B, 0x71, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F,
0x0C, 0x0C, 0x0C, 0x00, 0x7E, 0x7E,
0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00,
0x7F, 0x7E, 0x03, 0x03, 0x7E, 0x7E,
0x03, 0x03, 0x7F, 0x7E, 0x00, 0x0F,
0x3E, 0x70, 0x3C, 0x06, 0x3C, 0x70,
0x3E, 0x0F, 0x00, 0x32, 0x7B, 0x49,
0x49, 0x3F, 0x7E, 0x00, 0x7F, 0x7E,
0x03, 0x03, 0x00, 0x1E, 0x3F, 0x69,
0x69, 0x6F, 0x26, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x0F, 0x1F, 0x3F, 0x3C,
0x78, 0x70, 0x60, 0x00, 0x00, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00,
0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x07, 0x0F, 0x0F,
0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x7E,
0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F,
0x0F, 0x07, 0x01, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };

View file

@ -141,8 +141,7 @@ static i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t* data, uint16_
#endif #endif
// Flips the rendering bits for a character at the current cursor position // Flips the rendering bits for a character at the current cursor position
static void InvertCharacter(uint8_t *cursor) static void InvertCharacter(uint8_t *cursor) {
{
const uint8_t *end = cursor + OLED_FONT_WIDTH; const uint8_t *end = cursor + OLED_FONT_WIDTH;
while (cursor < end) { while (cursor < end) {
*cursor = ~(*cursor); *cursor = ~(*cursor);
@ -162,14 +161,19 @@ bool oled_init(uint8_t rotation) {
static const uint8_t PROGMEM display_setup1[] = { static const uint8_t PROGMEM display_setup1[] = {
I2C_CMD, I2C_CMD,
DISPLAY_OFF, DISPLAY_OFF,
DISPLAY_CLOCK, 0x80, DISPLAY_CLOCK,
MULTIPLEX_RATIO, OLED_DISPLAY_HEIGHT - 1, 0x80,
DISPLAY_OFFSET, 0x00, MULTIPLEX_RATIO,
OLED_DISPLAY_HEIGHT - 1,
DISPLAY_OFFSET,
0x00,
DISPLAY_START_LINE | 0x00, DISPLAY_START_LINE | 0x00,
CHARGE_PUMP, 0x14, CHARGE_PUMP,
0x14,
#if (OLED_IC != OLED_IC_SH1106) #if (OLED_IC != OLED_IC_SH1106)
// MEMORY_MODE is unsupported on SH1106 (Page Addressing only) // MEMORY_MODE is unsupported on SH1106 (Page Addressing only)
MEMORY_MODE, 0x00, // Horizontal addressing mode MEMORY_MODE,
0x00, // Horizontal addressing mode
#endif #endif
}; };
if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) {
@ -178,35 +182,20 @@ bool oled_init(uint8_t rotation) {
} }
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_180)) { if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_180)) {
static const uint8_t PROGMEM display_normal[] = { static const uint8_t PROGMEM display_normal[] = {I2C_CMD, SEGMENT_REMAP_INV, COM_SCAN_DEC};
I2C_CMD,
SEGMENT_REMAP_INV,
COM_SCAN_DEC };
if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) {
print("oled_init cmd normal rotation failed\n"); print("oled_init cmd normal rotation failed\n");
return false; return false;
} }
} else { } else {
static const uint8_t PROGMEM display_flipped[] = { static const uint8_t PROGMEM display_flipped[] = {I2C_CMD, SEGMENT_REMAP, COM_SCAN_INC};
I2C_CMD,
SEGMENT_REMAP,
COM_SCAN_INC };
if (I2C_TRANSMIT_P(display_flipped) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_flipped) != I2C_STATUS_SUCCESS) {
print("display_flipped failed\n"); print("display_flipped failed\n");
return false; return false;
} }
} }
static const uint8_t PROGMEM display_setup2[] = { static const uint8_t PROGMEM display_setup2[] = {I2C_CMD, COM_PINS, OLED_COM_PINS, CONTRAST, 0x8F, PRE_CHARGE_PERIOD, 0xF1, VCOM_DETECT, 0x40, DISPLAY_ALL_ON_RESUME, NORMAL_DISPLAY, DEACTIVATE_SCROLL, DISPLAY_ON};
I2C_CMD,
COM_PINS, OLED_COM_PINS,
CONTRAST, 0x8F,
PRE_CHARGE_PERIOD, 0xF1,
VCOM_DETECT, 0x40,
DISPLAY_ALL_ON_RESUME,
NORMAL_DISPLAY,
DEACTIVATE_SCROLL,
DISPLAY_ON };
if (I2C_TRANSMIT_P(display_setup2) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_setup2) != I2C_STATUS_SUCCESS) {
print("display_setup2 failed\n"); print("display_setup2 failed\n");
return false; return false;
@ -226,10 +215,7 @@ bool oled_init(uint8_t rotation) {
return true; return true;
} }
__attribute__((weak)) __attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; }
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return rotation;
}
void oled_clear(void) { void oled_clear(void) {
memset(oled_buffer, 0, sizeof(oled_buffer)); memset(oled_buffer, 0, sizeof(oled_buffer));
@ -237,8 +223,7 @@ void oled_clear(void) {
oled_dirty = -1; // -1 will be max value as long as display_dirty is unsigned type oled_dirty = -1; // -1 will be max value as long as display_dirty is unsigned type
} }
static void calc_bounds(uint8_t update_start, uint8_t* cmd_array) static void calc_bounds(uint8_t update_start, uint8_t *cmd_array) {
{
// Calculate commands to set memory addressing bounds. // Calculate commands to set memory addressing bounds.
uint8_t start_page = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH; uint8_t start_page = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH;
uint8_t start_column = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH; uint8_t start_column = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH;
@ -260,23 +245,21 @@ static void calc_bounds(uint8_t update_start, uint8_t* cmd_array)
#endif #endif
} }
static void calc_bounds_90(uint8_t update_start, uint8_t* cmd_array) static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) {
{
cmd_array[1] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8; cmd_array[1] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8;
cmd_array[4] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT; cmd_array[4] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT;
cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8 - 1 + cmd_array[1];; cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8 - 1 + cmd_array[1];
;
cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) % OLED_DISPLAY_HEIGHT / 8; cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) % OLED_DISPLAY_HEIGHT / 8;
} }
uint8_t crot(uint8_t a, int8_t n) uint8_t crot(uint8_t a, int8_t n) {
{
const uint8_t mask = 0x7; const uint8_t mask = 0x7;
n &= mask; n &= mask;
return a << n | a >> (-n & mask); return a << n | a >> (-n & mask);
} }
static void rotate_90(const uint8_t* src, uint8_t* dest) static void rotate_90(const uint8_t *src, uint8_t *dest) {
{
for (uint8_t i = 0, shift = 7; i < 8; ++i, --shift) { for (uint8_t i = 0, shift = 7; i < 8; ++i, --shift) {
uint8_t selector = (1 << i); uint8_t selector = (1 << i);
for (uint8_t j = 0; j < 8; ++j) { for (uint8_t j = 0; j < 8; ++j) {
@ -293,13 +276,12 @@ void oled_render(void) {
// Find first dirty block // Find first dirty block
uint8_t update_start = 0; uint8_t update_start = 0;
while (!(oled_dirty & (1 << update_start))) { ++update_start; } while (!(oled_dirty & (1 << update_start))) {
++update_start;
}
// Set column & page position // Set column & page position
static uint8_t display_start[] = { static uint8_t display_start[] = {I2C_CMD, COLUMN_ADDR, 0, OLED_DISPLAY_WIDTH - 1, PAGE_ADDR, 0, OLED_DISPLAY_HEIGHT / 8 - 1};
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)) { 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 { } else {
@ -363,8 +345,7 @@ void oled_advance_page(bool clearPageRemainder) {
remaining = remaining / OLED_FONT_WIDTH; remaining = remaining / OLED_FONT_WIDTH;
// Write empty character until next line // Write empty character until next line
while (remaining--) while (remaining--) oled_write_char(' ', false);
oled_write_char(' ', false);
} else { } else {
// Next page index out of bounds? // Next page index out of bounds?
if (index + remaining >= OLED_MATRIX_SIZE) { if (index + remaining >= OLED_MATRIX_SIZE) {
@ -498,8 +479,7 @@ bool oled_scroll_right(void) {
// Dont enable scrolling if we need to update the display // Dont enable scrolling if we need to update the display
// This prevents scrolling of bad data from starting the scroll too early after init // This prevents scrolling of bad data from starting the scroll too early after init
if (!oled_dirty && !oled_scrolling) { if (!oled_dirty && !oled_scrolling) {
static const uint8_t PROGMEM display_scroll_right[] = { static const uint8_t PROGMEM display_scroll_right[] = {I2C_CMD, SCROLL_RIGHT, 0x00, 0x00, 0x00, 0x0F, 0x00, 0xFF, ACTIVATE_SCROLL};
I2C_CMD, SCROLL_RIGHT, 0x00, 0x00, 0x00, 0x0F, 0x00, 0xFF, ACTIVATE_SCROLL };
if (I2C_TRANSMIT_P(display_scroll_right) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_scroll_right) != I2C_STATUS_SUCCESS) {
print("oled_scroll_right cmd failed\n"); print("oled_scroll_right cmd failed\n");
return oled_scrolling; return oled_scrolling;
@ -513,8 +493,7 @@ bool oled_scroll_left(void) {
// Dont enable scrolling if we need to update the display // Dont enable scrolling if we need to update the display
// This prevents scrolling of bad data from starting the scroll too early after init // This prevents scrolling of bad data from starting the scroll too early after init
if (!oled_dirty && !oled_scrolling) { if (!oled_dirty && !oled_scrolling) {
static const uint8_t PROGMEM display_scroll_left[] = { static const uint8_t PROGMEM display_scroll_left[] = {I2C_CMD, SCROLL_LEFT, 0x00, 0x00, 0x00, 0x0F, 0x00, 0xFF, ACTIVATE_SCROLL};
I2C_CMD, SCROLL_LEFT, 0x00, 0x00, 0x00, 0x0F, 0x00, 0xFF, ACTIVATE_SCROLL };
if (I2C_TRANSMIT_P(display_scroll_left) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_scroll_left) != I2C_STATUS_SUCCESS) {
print("oled_scroll_left cmd failed\n"); print("oled_scroll_left cmd failed\n");
return oled_scrolling; return oled_scrolling;
@ -588,6 +567,4 @@ void oled_task(void) {
#endif #endif
} }
__attribute__((weak)) __attribute__((weak)) void oled_task_user(void) {}
void oled_task_user(void) {
}

View file

@ -52,10 +52,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
// The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
# ifndef OLED_SOURCE_MAP # ifndef OLED_SOURCE_MAP
#define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } # define OLED_SOURCE_MAP \
{ 0, 8, 16, 24, 32, 40, 48, 56 }
# endif # endif
# ifndef OLED_TARGET_MAP # ifndef OLED_TARGET_MAP
#define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 } # define OLED_TARGET_MAP \
{ 56, 48, 40, 32, 24, 16, 8, 0 }
# endif # endif
// If OLED_BLOCK_TYPE is uint32_t, these tables would look like: // If OLED_BLOCK_TYPE is uint32_t, these tables would look like:
// #define OLED_SOURCE_MAP { 32, 40, 48, 56 } // #define OLED_SOURCE_MAP { 32, 40, 48, 56 }
@ -93,10 +95,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
// The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
# ifndef OLED_SOURCE_MAP # ifndef OLED_SOURCE_MAP
#define OLED_SOURCE_MAP { 0, 8, 16, 24 } # define OLED_SOURCE_MAP \
{ 0, 8, 16, 24 }
# endif # endif
# ifndef OLED_TARGET_MAP # ifndef OLED_TARGET_MAP
#define OLED_TARGET_MAP { 24, 16, 8, 0 } # define OLED_TARGET_MAP \
{ 24, 16, 8, 0 }
# endif # endif
// If OLED_BLOCK_TYPE is uint8_t, these tables would look like: // 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_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }

View file

@ -41,7 +41,12 @@ uint8_t foreColor,drawMode,fontWidth, fontHeight, fontType, fontStartChar, fontT
uint16_t fontMapWidth; uint16_t fontMapWidth;
#define _BV(x) (1 << (x)) #define _BV(x) (1 << (x))
#define swap(a, b) { uint8_t t = a; a = b; b = t; } #define swap(a, b) \
{ \
uint8_t t = a; \
a = b; \
b = t; \
}
uint8_t micro_oled_transfer_buffer[20]; uint8_t micro_oled_transfer_buffer[20];
static uint8_t micro_oled_screen_current[LCDWIDTH * LCDWIDTH / 8] = {0}; static uint8_t micro_oled_screen_current[LCDWIDTH * LCDWIDTH / 8] = {0};
@ -68,243 +73,28 @@ static uint8_t micro_oled_screen_current[LCDWIDTH*LCDWIDTH/8] = { 0 };
static uint8_t micro_oled_screen_buffer[] = { static uint8_t micro_oled_screen_buffer[] = {
// QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php // QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php
// 64x48 image // 64x48 image
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF, 0xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7, 0xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00,
0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
0xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE,
0xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF,
0xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7,
0xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06,
0x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
# endif # endif
#elif LCDWIDTH == 128 #elif LCDWIDTH == 128
# if LCDHEIGHT == 32 # if LCDHEIGHT == 32
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDWIDTH / 8] = { static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDWIDTH / 8] = {
// 128x32 qmk image // 128x32 qmk image
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xFC, 0xFC, 0xE0, 0xF0, 0xFC, 0xE0, 0xE0, 0xFC, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB2, 0xB2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xB7, 0xB2, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x02, 0x02, 0x03, 0x01, 0x00, 0x06, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x06, 0x00, 0x03, 0x1E, 0x18, 0x0F, 0x01, 0x0F, 0x18, 0x1E, 0x01, 0x00, 0x0F, 0x1F, 0x12, 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x12, 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x4D, 0x4D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF9, 0xF3, 0xF3, 0xC0, 0x80, 0xF3, 0xF3, 0xF3, 0xF9, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0x4D, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0xC0, 0x00, 0x70, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x1C, 0xF0, 0x00, 0x00, 0xFC, 0x0C, 0x38, 0xE0, 0x00, 0x00, 0xC0, 0x38, 0x0C, 0xFC, 0x00, 0x00, 0xFC, 0xFC, 0x60, 0x90, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xE0, 0xF0, 0xFC, 0xE0, 0xE0, 0xFC, 0xE0, 0xE0, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x3F, 0x3F, 0x07, 0x0F, 0x3F, 0x07, 0x07, 0x3F, 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x04, 0x04, 0x07, 0x01, 0x00, 0x00, 0x13, 0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x07, 0x0D, 0x08, 0x00, 0x07, 0x00, 0x00, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x07, 0x00, 0x01, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00,
0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80,
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00,
0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
0x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB2, 0xB2, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03,
0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF,
0xFF, 0xB7, 0xB2, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1F, 0x02, 0x02, 0x03, 0x01, 0x00, 0x06, 0x1F, 0x10,
0x10, 0x10, 0x1F, 0x06, 0x00, 0x03, 0x1E, 0x18, 0x0F, 0x01,
0x0F, 0x18, 0x1E, 0x01, 0x00, 0x0F, 0x1F, 0x12, 0x02, 0x12,
0x13, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x12,
0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x1F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x48, 0x4D, 0x4D, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFE, 0xF8, 0xF9, 0xF3, 0xF3, 0xC0, 0x80, 0xF3,
0xF3, 0xF3, 0xF9, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED,
0x4D, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0xC0, 0x00, 0x70, 0xC0,
0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C,
0x04, 0x04, 0x04, 0x04, 0x1C, 0xF0, 0x00, 0x00, 0xFC, 0x0C,
0x38, 0xE0, 0x00, 0x00, 0xC0, 0x38, 0x0C, 0xFC, 0x00, 0x00,
0xFC, 0xFC, 0x60, 0x90, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x3F,
0x3F, 0x07, 0x3F, 0x3F, 0x07, 0x0F, 0x3F, 0x07, 0x07, 0x3F,
0x07, 0x07, 0x3F, 0x3F, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x06, 0x04, 0x04, 0x07, 0x01, 0x00, 0x00, 0x13, 0x1E, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x04, 0x04,
0x04, 0x04, 0x07, 0x0D, 0x08, 0x00, 0x07, 0x00, 0x00, 0x01,
0x07, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x07,
0x00, 0x01, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};
# elif LCDHEIGHT == 64 # elif LCDHEIGHT == 64
static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = { static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDWIDTH / 8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF, 0x7F, 0x7E, 0xFE, 0xFF, 0xFF, 0xFE, 0xFE, 0x7F, 0x7F, 0xFE, 0xFE, 0xFF, 0xFF, 0xFE, 0x7E, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x99, 0x99, 0x99, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xF3, 0xF3, 0xE7, 0xE7, 0x00, 0x00, 0xE7, 0xE7, 0xF3, 0xF3, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x99, 0x99, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x1F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00, 0x80, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x00, 0x80, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x11, 0x11, 0x11, 0x0E, 0x00, 0x70, 0x88, 0x04, 0x04, 0x04, 0xF8, 0x00, 0x00, 0x3C, 0xE0, 0xC0, 0x38, 0x1C, 0xE0, 0x80, 0x70, 0x0C, 0x00, 0xF8, 0xAC, 0x24, 0x24, 0x3C, 0x30, 0x00, 0x00, 0xFC, 0x0C, 0x04, 0x00, 0xF8, 0xAC, 0x24, 0x24, 0x2C, 0x30, 0x00, 0x70, 0xDC, 0x04, 0x04, 0x88, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x8C, 0x04, 0x04, 0xF8, 0x00, 0x04, 0x3C, 0xE0, 0x80, 0xF0, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x83, 0x01, 0x01, 0x01, 0x81, 0xFE, 0x3C, 0x00, 0x00, 0xFF, 0x03, 0x0E, 0x70, 0xC0, 0xE0, 0x38, 0x06, 0x03, 0xFF, 0x00, 0x00, 0xFF, 0x18, 0x38, 0x66, 0xC3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00,
0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF,
0x7F, 0x7E, 0xFE, 0xFF, 0xFF, 0xFE, 0xFE, 0x7F, 0x7F, 0xFE,
0xFE, 0xFF, 0xFF, 0xFE, 0x7E, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC,
0xFC, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x88, 0x88, 0x88, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xDD, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x99, 0x99, 0x99, 0x99, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xF3, 0xF3, 0xE7, 0xE7, 0x00,
0x00, 0xE7, 0xE7, 0xF3, 0xF3, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x99, 0x99, 0x99, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x1F, 0x3F,
0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F,
0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF,
0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00,
0x80, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x00, 0x80, 0x01,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x11, 0x11, 0x11, 0x0E, 0x00, 0x70,
0x88, 0x04, 0x04, 0x04, 0xF8, 0x00, 0x00, 0x3C, 0xE0, 0xC0,
0x38, 0x1C, 0xE0, 0x80, 0x70, 0x0C, 0x00, 0xF8, 0xAC, 0x24,
0x24, 0x3C, 0x30, 0x00, 0x00, 0xFC, 0x0C, 0x04, 0x00, 0xF8,
0xAC, 0x24, 0x24, 0x2C, 0x30, 0x00, 0x70, 0xDC, 0x04, 0x04,
0x88, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x8C, 0x04, 0x04, 0xF8, 0x00, 0x04, 0x3C, 0xE0, 0x80, 0xF0,
0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x83, 0x01, 0x01,
0x01, 0x81, 0xFE, 0x3C, 0x00, 0x00, 0xFF, 0x03, 0x0E, 0x70,
0xC0, 0xE0, 0x38, 0x06, 0x03, 0xFF, 0x00, 0x00, 0xFF, 0x18,
0x38, 0x66, 0xC3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// TODO: generate bitmap of QMK logo here // TODO: generate bitmap of QMK logo here
# endif # endif
#else #else
@ -312,8 +102,6 @@ static uint8_t micro_oled_screen_buffer[] = {
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDWIDTH / 8] = {0}; static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDWIDTH / 8] = {0};
#endif #endif
void micro_oled_init(void) { void micro_oled_init(void) {
i2c_init(); i2c_init();
i2c_start(I2C_ADDRESS_SA0_1); i2c_start(I2C_ADDRESS_SA0_1);
@ -468,12 +256,10 @@ void send_buffer(void) {
Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode. Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode.
*/ */
void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) { void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) {
if ((x<0) || (x>=LCDWIDTH) || (y<0) || (y>=LCDHEIGHT)) if ((x < 0) || (x >= LCDWIDTH) || (y < 0) || (y >= LCDHEIGHT)) return;
return;
if (mode == XOR) { if (mode == XOR) {
if (color == PIXEL_ON) if (color == PIXEL_ON) micro_oled_screen_buffer[x + (y / 8) * LCDWIDTH] ^= _BV((y % 8));
micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] ^= _BV((y%8));
} else { } else {
if (color == PIXEL_ON) if (color == PIXEL_ON)
micro_oled_screen_buffer[x + (y / 8) * LCDWIDTH] |= _BV((y % 8)); micro_oled_screen_buffer[x + (y / 8) * LCDWIDTH] |= _BV((y % 8));
@ -507,7 +293,8 @@ void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, ui
if (y0 < y1) { if (y0 < y1) {
ystep = 1; ystep = 1;
} else { } else {
ystep = -1;} ystep = -1;
}
for (; x0 < x1; x0++) { for (; x0 < x1; x0++) {
if (steep) { if (steep) {
@ -526,16 +313,12 @@ void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, ui
/** \brief Draw horizontal line with color and mode. /** \brief Draw horizontal line with color and mode.
Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer. Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer.
*/ */
void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode) { void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode) { draw_line(x, y, x + width, y, color, mode); }
draw_line(x,y,x+width,y,color,mode);
}
/** \brief Draw vertical line. /** \brief Draw vertical line.
Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer. Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer.
*/ */
void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode) { void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode) { draw_line(x, y, x, y + height, color, mode); }
draw_line(x,y,x,y+height,color,mode);
}
/** \brief Draw rectangle with color and mode. /** \brief Draw rectangle with color and mode.
Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer. Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer.
@ -608,8 +391,7 @@ void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uin
uint8_t i, j, temp; uint8_t i, j, temp;
uint16_t charPerBitmapRow, charColPositionOnBitmap, charRowPositionOnBitmap, charBitmapStartPosition; uint16_t charPerBitmapRow, charColPositionOnBitmap, charRowPositionOnBitmap, charBitmapStartPosition;
if ((font>=TOTALFONTS) || (font<0)) if ((font >= TOTALFONTS) || (font < 0)) return;
return;
uint8_t fontType = font; uint8_t fontType = font;
uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType] + 0); uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType] + 0);
@ -638,8 +420,7 @@ void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uin
for (j = 0; j < 8; j++) { // 8 is the LCD's page height (see datasheet for explanation) for (j = 0; j < 8; j++) { // 8 is the LCD's page height (see datasheet for explanation)
if (temp & 0x1) { if (temp & 0x1) {
draw_pixel(x + i, y + j, color, mode); draw_pixel(x + i, y + j, color, mode);
} } else {
else {
draw_pixel(x + i, y + j, !color, mode); draw_pixel(x + i, y + j, !color, mode);
} }
@ -663,21 +444,17 @@ void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uin
for (j = 0; j < 8; j++) { // 8 is the LCD's page height (see datasheet for explanation) for (j = 0; j < 8; j++) { // 8 is the LCD's page height (see datasheet for explanation)
if (temp & 0x1) { if (temp & 0x1) {
draw_pixel(x + i, y + j + (row * 8), color, mode); draw_pixel(x + i, y + j + (row * 8), color, mode);
} } else {
else {
draw_pixel(x + i, y + j + (row * 8), !color, mode); draw_pixel(x + i, y + j + (row * 8), !color, mode);
} }
temp >>= 1; temp >>= 1;
} }
} }
} }
} }
void draw_string(uint8_t x, uint8_t y, char* string, uint8_t color, uint8_t mode, uint8_t font) { void draw_string(uint8_t x, uint8_t y, char* string, uint8_t color, uint8_t mode, uint8_t font) {
if ((font >= TOTALFONTS) || (font < 0)) return;
if ((font>=TOTALFONTS) || (font<0))
return;
uint8_t fontType = font; uint8_t fontType = font;
uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType] + 0); uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType] + 0);
@ -687,5 +464,4 @@ void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mod
draw_char(cur_x, y, string[i], color, mode, font); draw_char(cur_x, y, string[i], color, mode, font);
cur_x += fontWidth + 1; cur_x += fontWidth + 1;
} }
} }

View file

@ -29,260 +29,11 @@ https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
// Standard ASCII 5x7 font // Standard ASCII 5x7 font
static const unsigned char font5x7[] PROGMEM = { static const unsigned char font5x7[] PROGMEM = {
// first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
5,8,0,255,12,75, 5, 8, 0, 255, 12, 75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, 0x18, 0x3C, 0x18, 0x00, 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, 0x18, 0x24, 0x18, 0x00, 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x26, 0x29, 0x79, 0x29, 0x26, 0x40, 0x7F, 0x05, 0x05, 0x07, 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, 0x66, 0x89, 0x95, 0x6A, 0x60, 0x60, 0x60, 0x60, 0x60, 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x10, 0x20, 0x7E, 0x20, 0x10, 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x1E, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x30, 0x38, 0x3E, 0x38, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x23, 0x13, 0x08, 0x64, 0x62, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x41, 0x22, 0x1C, 0x00, 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x80, 0x70, 0x30, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x60, 0x60, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x72, 0x49, 0x49, 0x49, 0x46, 0x21, 0x41, 0x49, 0x4D, 0x33, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x27, 0x45, 0x45, 0x45, 0x39, 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x41, 0x21, 0x11, 0x09, 0x07, 0x36, 0x49, 0x49, 0x49, 0x36, 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x41, 0x22, 0x14, 0x08, 0x02,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x01, 0x59, 0x09, 0x06, 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x3E, 0x41, 0x41, 0x51, 0x73, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x26, 0x49, 0x49, 0x49, 0x32, 0x03, 0x01, 0x7F, 0x01, 0x03, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x63, 0x14, 0x08, 0x14, 0x63, 0x03, 0x04, 0x78, 0x04, 0x03, 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x41, 0x41, 0x41, 0x7F, 0x04, 0x02, 0x01, 0x02, 0x04, 0x40, 0x40,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x40, 0x40, 0x40, 0x00, 0x03, 0x07, 0x08, 0x00, 0x20, 0x54, 0x54, 0x78, 0x40, 0x7F, 0x28, 0x44, 0x44, 0x38, 0x38, 0x44, 0x44, 0x44, 0x28, 0x38, 0x44, 0x44, 0x28, 0x7F, 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, 0x08, 0x7E, 0x09, 0x02, 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x44, 0x7D, 0x40, 0x00, 0x20, 0x40, 0x40, 0x3D, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x7C, 0x08, 0x04, 0x04, 0x78, 0x38, 0x44, 0x44, 0x44, 0x38, 0xFC, 0x18, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x18, 0xFC, 0x7C, 0x08, 0x04, 0x04, 0x08, 0x48, 0x54, 0x54, 0x54, 0x24, 0x04, 0x04, 0x3F, 0x44, 0x24, 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x44, 0x28, 0x10, 0x28, 0x44, 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x36, 0x08, 0x00, 0x02, 0x01, 0x02, 0x04, 0x02, 0x3C, 0x26, 0x23,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x26, 0x3C, 0x1E, 0xA1, 0xA1, 0x61, 0x12, 0x3A, 0x40, 0x40, 0x20, 0x7A, 0x38, 0x54, 0x54, 0x55, 0x59, 0x21, 0x55, 0x55, 0x79, 0x41, 0x21, 0x54, 0x54, 0x78, 0x41, 0x21, 0x55, 0x54, 0x78, 0x40, 0x20, 0x54, 0x55, 0x79, 0x40, 0x0C, 0x1E, 0x52, 0x72, 0x12, 0x39, 0x55, 0x55, 0x55, 0x59, 0x39, 0x54, 0x54, 0x54, 0x59, 0x39, 0x55, 0x54, 0x54, 0x58, 0x00, 0x00, 0x45, 0x7C, 0x41, 0x00, 0x02, 0x45, 0x7D, 0x42, 0x00, 0x01, 0x45, 0x7C, 0x40, 0xF0, 0x29, 0x24, 0x29, 0xF0, 0xF0, 0x28, 0x25, 0x28, 0xF0, 0x7C, 0x54, 0x55, 0x45, 0x00, 0x20, 0x54, 0x54, 0x7C, 0x54, 0x7C, 0x0A, 0x09, 0x7F, 0x49, 0x32, 0x49, 0x49, 0x49, 0x32, 0x32, 0x48, 0x48, 0x48, 0x32, 0x32, 0x4A, 0x48, 0x48, 0x30, 0x3A, 0x41, 0x41, 0x21, 0x7A, 0x3A, 0x42, 0x40, 0x20, 0x78, 0x00, 0x9D, 0xA0, 0xA0, 0x7D, 0x39, 0x44, 0x44, 0x44, 0x39, 0x3D, 0x40, 0x40, 0x40, 0x3D, 0x3C, 0x24, 0xFF, 0x24, 0x24, 0x48, 0x7E, 0x49, 0x43, 0x66, 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, 0xFF, 0x09, 0x29, 0xF6, 0x20, 0xC0, 0x88, 0x7E, 0x09,
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x03, 0x20, 0x54, 0x54, 0x79, 0x41, 0x00, 0x00, 0x44, 0x7D, 0x41, 0x30, 0x48, 0x48, 0x4A, 0x32, 0x38, 0x40, 0x40, 0x22, 0x7A, 0x00, 0x7A, 0x0A, 0x0A, 0x72, 0x7D, 0x0D, 0x19, 0x31, 0x7D, 0x26, 0x29, 0x29, 0x2F, 0x28, 0x26, 0x29, 0x29, 0x29, 0x26, 0x30, 0x48, 0x4D, 0x40, 0x20, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x2F, 0x10, 0xC8, 0xAC, 0xBA, 0x2F, 0x10, 0x28, 0x34, 0xFA, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x08, 0x14, 0x2A, 0x14, 0x22, 0x22, 0x14, 0x2A, 0x14, 0x08, 0xAA, 0x00, 0x55, 0x00, 0xAA, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x10, 0x10, 0x10, 0xFF, 0x00, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x10, 0x10, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10,
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x17, 0x14, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x00, 0x00, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x00, 0x00, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0xFF, 0x10, 0xFF, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x38, 0x44, 0x44, 0x38, 0x44, 0x7C,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x2A, 0x2A, 0x3E, 0x14, 0x7E, 0x02, 0x02, 0x06, 0x06, 0x02, 0x7E, 0x02, 0x7E, 0x02, 0x63, 0x55, 0x49, 0x41, 0x63, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x40, 0x7E, 0x20, 0x1E, 0x20, 0x06, 0x02, 0x7E, 0x02, 0x02, 0x99, 0xA5, 0xE7, 0xA5, 0x99, 0x1C, 0x2A, 0x49, 0x2A, 0x1C, 0x4C, 0x72, 0x01, 0x72, 0x4C, 0x30, 0x4A, 0x4D, 0x4D, 0x30, 0x30, 0x48, 0x78, 0x48, 0x30, 0xBC, 0x62, 0x5A, 0x46, 0x3D, 0x3E, 0x49, 0x49, 0x49, 0x00, 0x7E, 0x01, 0x01, 0x01, 0x7E, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x44, 0x44, 0x5F, 0x44, 0x44, 0x40, 0x51, 0x4A, 0x44, 0x40, 0x40, 0x44, 0x4A, 0x51, 0x40, 0x00, 0x00, 0xFF, 0x01, 0x03, 0xE0, 0x80, 0xFF, 0x00, 0x00, 0x08, 0x08, 0x6B, 0x6B, 0x08, 0x36, 0x12, 0x36, 0x24, 0x36, 0x06, 0x0F, 0x09, 0x0F, 0x06, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x30, 0x40, 0xFF, 0x01, 0x01, 0x00, 0x1F, 0x01, 0x01, 0x1E, 0x00, 0x19, 0x1D, 0x17, 0x12, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00};
0x00, 0x18, 0x3C, 0x18, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
0x00, 0x18, 0x24, 0x18, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
0x30, 0x48, 0x3A, 0x06, 0x0E,
0x26, 0x29, 0x79, 0x29, 0x26,
0x40, 0x7F, 0x05, 0x05, 0x07,
0x40, 0x7F, 0x05, 0x25, 0x3F,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
0x14, 0x22, 0x7F, 0x22, 0x14,
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
0x06, 0x09, 0x7F, 0x01, 0x7F,
0x00, 0x66, 0x89, 0x95, 0x6A,
0x60, 0x60, 0x60, 0x60, 0x60,
0x94, 0xA2, 0xFF, 0xA2, 0x94,
0x08, 0x04, 0x7E, 0x04, 0x08,
0x10, 0x20, 0x7E, 0x20, 0x10,
0x08, 0x08, 0x2A, 0x1C, 0x08,
0x08, 0x1C, 0x2A, 0x08, 0x08,
0x1E, 0x10, 0x10, 0x10, 0x10,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x30, 0x38, 0x3E, 0x38, 0x30,
0x06, 0x0E, 0x3E, 0x0E, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C,
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C,
0x1E, 0xA1, 0xA1, 0x61, 0x12,
0x3A, 0x40, 0x40, 0x20, 0x7A,
0x38, 0x54, 0x54, 0x55, 0x59,
0x21, 0x55, 0x55, 0x79, 0x41,
0x21, 0x54, 0x54, 0x78, 0x41,
0x21, 0x55, 0x54, 0x78, 0x40,
0x20, 0x54, 0x55, 0x79, 0x40,
0x0C, 0x1E, 0x52, 0x72, 0x12,
0x39, 0x55, 0x55, 0x55, 0x59,
0x39, 0x54, 0x54, 0x54, 0x59,
0x39, 0x55, 0x54, 0x54, 0x58,
0x00, 0x00, 0x45, 0x7C, 0x41,
0x00, 0x02, 0x45, 0x7D, 0x42,
0x00, 0x01, 0x45, 0x7C, 0x40,
0xF0, 0x29, 0x24, 0x29, 0xF0,
0xF0, 0x28, 0x25, 0x28, 0xF0,
0x7C, 0x54, 0x55, 0x45, 0x00,
0x20, 0x54, 0x54, 0x7C, 0x54,
0x7C, 0x0A, 0x09, 0x7F, 0x49,
0x32, 0x49, 0x49, 0x49, 0x32,
0x32, 0x48, 0x48, 0x48, 0x32,
0x32, 0x4A, 0x48, 0x48, 0x30,
0x3A, 0x41, 0x41, 0x21, 0x7A,
0x3A, 0x42, 0x40, 0x20, 0x78,
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
0x39, 0x44, 0x44, 0x44, 0x39,
0x3D, 0x40, 0x40, 0x40, 0x3D,
0x3C, 0x24, 0xFF, 0x24, 0x24,
0x48, 0x7E, 0x49, 0x43, 0x66,
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
0xFF, 0x09, 0x29, 0xF6, 0x20,
0xC0, 0x88, 0x7E, 0x09, 0x03,
0x20, 0x54, 0x54, 0x79, 0x41,
0x00, 0x00, 0x44, 0x7D, 0x41,
0x30, 0x48, 0x48, 0x4A, 0x32,
0x38, 0x40, 0x40, 0x22, 0x7A,
0x00, 0x7A, 0x0A, 0x0A, 0x72,
0x7D, 0x0D, 0x19, 0x31, 0x7D,
0x26, 0x29, 0x29, 0x2F, 0x28,
0x26, 0x29, 0x29, 0x29, 0x26,
0x30, 0x48, 0x4D, 0x40, 0x20,
0x38, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x38,
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
0x2F, 0x10, 0x28, 0x34, 0xFA,
0x00, 0x00, 0x7B, 0x00, 0x00,
0x08, 0x14, 0x2A, 0x14, 0x22,
0x22, 0x14, 0x2A, 0x14, 0x08,
0xAA, 0x00, 0x55, 0x00, 0xAA,
0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x00, 0x00, 0x00, 0xFF, 0x00,
0x10, 0x10, 0x10, 0xFF, 0x00,
0x14, 0x14, 0x14, 0xFF, 0x00,
0x10, 0x10, 0xFF, 0x00, 0xFF,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x14, 0x14, 0x14, 0xFC, 0x00,
0x14, 0x14, 0xF7, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x14, 0x14, 0xF4, 0x04, 0xFC,
0x14, 0x14, 0x17, 0x10, 0x1F,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0x1F, 0x00,
0x10, 0x10, 0x10, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x10,
0x10, 0x10, 0x10, 0x1F, 0x10,
0x10, 0x10, 0x10, 0xF0, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0xFF, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x14,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x1F, 0x10, 0x17,
0x00, 0x00, 0xFC, 0x04, 0xF4,
0x14, 0x14, 0x17, 0x10, 0x17,
0x14, 0x14, 0xF4, 0x04, 0xF4,
0x00, 0x00, 0xFF, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0xF7, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x17, 0x14,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0xF4, 0x14,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x00, 0x00, 0x1F, 0x10, 0x1F,
0x00, 0x00, 0x00, 0x1F, 0x14,
0x00, 0x00, 0x00, 0xFC, 0x14,
0x00, 0x00, 0xF0, 0x10, 0xF0,
0x10, 0x10, 0xFF, 0x10, 0xFF,
0x14, 0x14, 0x14, 0xFF, 0x14,
0x10, 0x10, 0x10, 0x1F, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x10,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x38, 0x44, 0x44, 0x38, 0x44,
0x7C, 0x2A, 0x2A, 0x3E, 0x14,
0x7E, 0x02, 0x02, 0x06, 0x06,
0x02, 0x7E, 0x02, 0x7E, 0x02,
0x63, 0x55, 0x49, 0x41, 0x63,
0x38, 0x44, 0x44, 0x3C, 0x04,
0x40, 0x7E, 0x20, 0x1E, 0x20,
0x06, 0x02, 0x7E, 0x02, 0x02,
0x99, 0xA5, 0xE7, 0xA5, 0x99,
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
0x4C, 0x72, 0x01, 0x72, 0x4C,
0x30, 0x4A, 0x4D, 0x4D, 0x30,
0x30, 0x48, 0x78, 0x48, 0x30,
0xBC, 0x62, 0x5A, 0x46, 0x3D,
0x3E, 0x49, 0x49, 0x49, 0x00,
0x7E, 0x01, 0x01, 0x01, 0x7E,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x44, 0x44, 0x5F, 0x44, 0x44,
0x40, 0x51, 0x4A, 0x44, 0x40,
0x40, 0x44, 0x4A, 0x51, 0x40,
0x00, 0x00, 0xFF, 0x01, 0x03,
0xE0, 0x80, 0xFF, 0x00, 0x00,
0x08, 0x08, 0x6B, 0x6B, 0x08,
0x36, 0x12, 0x36, 0x24, 0x36,
0x06, 0x0F, 0x09, 0x0F, 0x06,
0x00, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x10, 0x10, 0x00,
0x30, 0x40, 0xFF, 0x01, 0x01,
0x00, 0x1F, 0x01, 0x01, 0x1E,
0x00, 0x19, 0x1D, 0x17, 0x12,
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -27,101 +27,13 @@ https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
static const unsigned char font8x16[] PROGMEM = { static const unsigned char font8x16[] PROGMEM = {
// first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
8,16,32,96,2,56, 8, 16, 32, 96, 2, 56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBE, 0x90, 0xD0, 0xBE, 0x90, 0x00, 0x00, 0x1C, 0x62, 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x0C, 0x12, 0x92, 0x4C, 0xB0, 0x88, 0x06, 0x00, 0x80, 0x7C, 0x62, 0xB2, 0x1C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x18, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x18, 0xE0, 0x00, 0x00, 0x00, 0x24, 0x18, 0x7E, 0x18, 0x24, 0x00, 0x00, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00, 0xF8, 0x04, 0xC2, 0x32, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x04, 0x04, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xC0, 0xA0, 0x98, 0x84, 0xFE, 0x80, 0x80, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x22, 0xC2, 0x00, 0x00, 0xF8, 0x44, 0x22, 0x22, 0x22, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x8C, 0x52, 0x22, 0x52, 0x8C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x26, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x0F, 0x04, 0x03, 0x00, 0x00, 0x04, 0x02, 0x01, 0x03, 0x04, 0x04, 0x03, 0x00,
0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBE, 0x90, 0xD0, 0xBE, 0x90, 0x00, 0x03, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04,
0x00, 0x1C, 0x62, 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x0C, 0x12, 0x92, 0x4C, 0xB0, 0x88, 0x06, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x04, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x04, 0x72, 0x8A, 0xFA, 0x84, 0x78, 0x00, 0x00, 0xC0, 0x38, 0x06, 0x38, 0xC0, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x22, 0xE2, 0x00, 0x00, 0xFE, 0x20, 0x20, 0x20, 0x20, 0xFE, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0xFE, 0x40, 0xB0, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x80, 0x7C, 0x62, 0xB2, 0x1C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x70, 0x80, 0x70, 0x0C, 0xFE, 0x00, 0xFE, 0x0C, 0x30, 0xC0, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0xFE, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x42, 0x42, 0xA2, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x42, 0x42, 0x80, 0x00, 0x00, 0x02, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x02, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x06, 0x38, 0xC0, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x3E, 0xC0, 0xF0, 0x0E, 0xF0, 0xC0, 0x3E, 0x00, 0x00, 0x06, 0x98, 0x60, 0x98, 0x06, 0x00, 0x00, 0x00, 0x06, 0x18, 0xE0, 0x18, 0x06, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0xE0, 0x18, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x18, 0xE0, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0C, 0x12, 0x11, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,
0x00, 0x24, 0x18, 0x7E, 0x18, 0x24, 0x00, 0x00, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, 0x00, 0x20, 0xFC, 0x22, 0x22, 0x22, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0xF0, 0x20, 0x10, 0xF0, 0x00, 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0x10, 0x70, 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x20, 0x00, 0x00, 0x00, 0x20, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x70, 0x80, 0x00, 0x80, 0x70, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0x00, 0xF0, 0x00, 0x00, 0x30, 0xC0, 0xC0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00, 0x10, 0x90, 0x50, 0x30, 0x00, 0x00, 0x00, 0x80, 0x80, 0x7E, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7E, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x24, 0x24, 0x22, 0x1F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00,
0xF8, 0x04, 0xC2, 0x32, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x04, 0x04, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x3F, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x3F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x06, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x20, 0x20, 0x31, 0x0E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00,
0xC0, 0xA0, 0x98, 0x84, 0xFE, 0x80, 0x80, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x22, 0xC2, 0x00, 0x00,
0xF8, 0x44, 0x22, 0x22, 0x22, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00,
0x00, 0x8C, 0x52, 0x22, 0x52, 0x8C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x26, 0xF8, 0x00, 0x00,
0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x04, 0x04, 0x0F, 0x04, 0x03, 0x00, 0x00, 0x04, 0x02, 0x01, 0x03, 0x04, 0x04, 0x03, 0x00,
0x03, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x06, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x06, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x03, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00,
0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00,
0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x04, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF8, 0x04, 0x72, 0x8A, 0xFA, 0x84, 0x78, 0x00, 0x00, 0xC0, 0x38, 0x06, 0x38, 0xC0, 0x00, 0x00,
0x00, 0xFE, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
0xFE, 0x02, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00,
0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x22, 0xE2, 0x00, 0x00,
0xFE, 0x20, 0x20, 0x20, 0x20, 0xFE, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0xFE, 0x40, 0xB0, 0x08, 0x04, 0x02, 0x00, 0x00,
0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x70, 0x80, 0x70, 0x0C, 0xFE, 0x00,
0xFE, 0x0C, 0x30, 0xC0, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00,
0xFE, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00,
0x00, 0xFE, 0x42, 0x42, 0xA2, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x42, 0x42, 0x80, 0x00, 0x00,
0x02, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x02, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00,
0x06, 0x38, 0xC0, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x3E, 0xC0, 0xF0, 0x0E, 0xF0, 0xC0, 0x3E, 0x00,
0x00, 0x06, 0x98, 0x60, 0x98, 0x06, 0x00, 0x00, 0x00, 0x06, 0x18, 0xE0, 0x18, 0x06, 0x00, 0x00,
0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x02, 0x00,
0x00, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00,
0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x00,
0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
0x07, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00,
0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00,
0x07, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0C, 0x12, 0x11, 0x10, 0x00,
0x00, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
0x00, 0x06, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0xE0, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00,
0x00, 0x20, 0xFC, 0x22, 0x22, 0x22, 0x02, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00,
0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0xF0, 0x20, 0x10, 0xF0, 0x00,
0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00,
0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
0x00, 0xF0, 0x20, 0x10, 0x10, 0x70, 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x20, 0x00, 0x00,
0x00, 0x20, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00,
0x00, 0x70, 0x80, 0x00, 0x80, 0x70, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0x00, 0xF0, 0x00,
0x00, 0x30, 0xC0, 0xC0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00,
0x00, 0x10, 0x10, 0x90, 0x50, 0x30, 0x00, 0x00, 0x00, 0x80, 0x80, 0x7E, 0x02, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7E, 0x80, 0x80, 0x00, 0x00,
0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00,
0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x24, 0x24, 0x22, 0x1F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00,
0x20, 0x20, 0x20, 0x20, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
0x00, 0x3F, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x3F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00,
0x00, 0x00, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x01, 0x06, 0x01, 0x00,
0x00, 0x06, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x20, 0x20, 0x31, 0x0E, 0x03, 0x00, 0x00, 0x00,
0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -58,7 +58,6 @@ static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
{NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0)}, {NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0)},
}; };
#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND #define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
#define IS31_TIMEOUT 5000 #define IS31_TIMEOUT 5000
@ -77,17 +76,14 @@ static GFXINLINE void init_board(GDisplay *g) {
I2CD1.i2c->FLT = 4; I2CD1.i2c->FLT = 4;
} }
static GFXINLINE void post_init_board(GDisplay *g) { static GFXINLINE void post_init_board(GDisplay* g) { (void)g; }
(void) g;
}
static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) { static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
(void)g; (void)g;
return led_mask; return led_mask;
} }
static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y) static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y) {
{
(void)g; (void)g;
return led_mapping[y][x]; return led_mapping[y][x];
} }
@ -96,8 +92,7 @@ static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
(void)g; (void)g;
if (!shutdown) { if (!shutdown) {
palSetPad(GPIOB, 16); palSetPad(GPIOB, 16);
} } else {
else {
palClearPad(GPIOB, 16); palClearPad(GPIOB, 16);
} }
} }

View file

@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "board_is31fl3731c.h" # include "board_is31fl3731c.h"
// Can't include led_tables from here // Can't include led_tables from here
extern const uint8_t CIE1931_CURVE[]; extern const uint8_t CIE1931_CURVE[];
@ -160,7 +159,6 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE); write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
gfxSleepMilliseconds(10); gfxSleepMilliseconds(10);
// zero all LED registers on all 8 pages, and enable the mask // zero all LED registers on all 8 pages, and enable the mask
__builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE); __builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
for (uint8_t i = 0; i < 8; i++) { for (uint8_t i = 0; i < 8; i++) {
@ -188,8 +186,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
# if GDISP_HARDWARE_FLUSH # if GDISP_HARDWARE_FLUSH
LLDSPEC void gdisp_lld_flush(GDisplay *g) { LLDSPEC void gdisp_lld_flush(GDisplay *g) {
// Don't flush if we don't need it. // Don't flush if we don't need it.
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return;
return;
PRIV(g)->page++; PRIV(g)->page++;
PRIV(g)->page %= 2; PRIV(g)->page %= 2;
@ -256,8 +253,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
LLDSPEC void gdisp_lld_control(GDisplay *g) { LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch (g->p.x) { switch (g->p.x) {
case GDISP_CONTROL_POWER: case GDISP_CONTROL_POWER:
if (g->g.Powermode == (powermode_t)g->p.ptr) if (g->g.Powermode == (powermode_t)g->p.ptr) return;
return;
switch ((powermode_t)g->p.ptr) { switch ((powermode_t)g->p.ptr) {
case powerOff: case powerOff:
case powerSleep: case powerSleep:
@ -274,8 +270,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
return; return;
case GDISP_CONTROL_ORIENTATION: case GDISP_CONTROL_ORIENTATION:
if (g->g.Orientation == (orientation_t)g->p.ptr) if (g->g.Orientation == (orientation_t)g->p.ptr) return;
return;
switch ((orientation_t)g->p.ptr) { switch ((orientation_t)g->p.ptr) {
/* Rotation is handled by the drawing routines */ /* Rotation is handled by the drawing routines */
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
@ -295,8 +290,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
return; return;
case GDISP_CONTROL_BACKLIGHT: case GDISP_CONTROL_BACKLIGHT:
if (g->g.Backlight == (unsigned)g->p.ptr) if (g->g.Backlight == (unsigned)g->p.ptr) return;
return;
unsigned val = (unsigned)g->p.ptr; unsigned val = (unsigned)g->p.ptr;
g->g.Backlight = val > 100 ? 100 : val; g->g.Backlight = val > 100 ? 100 : val;
g->flags |= GDISP_FLG_NEEDFLUSH; g->flags |= GDISP_FLG_NEEDFLUSH;

View file

@ -25,11 +25,9 @@
#define ST7565_SLCK_PIN 5 #define ST7565_SLCK_PIN 5
#define ST7565_SS_PIN 4 #define ST7565_SS_PIN 4
#define palSetPadModeRaw(portname, bits) \ #define palSetPadModeRaw(portname, bits) ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
#define palSetPadModeNamed(portname, portmode) \ #define palSetPadModeNamed(portname, portmode) palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2) #define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
// DSPI Clock and Transfer Attributes // DSPI Clock and Transfer Attributes
@ -44,8 +42,7 @@ static const SPIConfig spi1config = {
// brief The chip select line pad number - when not using pcs. // brief The chip select line pad number - when not using pcs.
.sspad = ST7565_SS_PIN, .sspad = ST7565_SS_PIN,
// SPI initialization data. // SPI initialization data.
.tar0 = .tar0 = SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
| SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
| SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
| SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
@ -82,28 +79,20 @@ static GFXINLINE void init_board(GDisplay *g) {
release_bus(g); release_bus(g);
} }
static GFXINLINE void post_init_board(GDisplay *g) { static GFXINLINE void post_init_board(GDisplay *g) { (void)g; }
(void) g;
}
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
(void)g; (void)g;
if (state) { if (state) {
palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN); palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
} } else {
else {
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN); palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
} }
} }
static GFXINLINE void enter_data_mode(GDisplay *g) { static GFXINLINE void enter_data_mode(GDisplay *g) { palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); }
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
}
static GFXINLINE void enter_cmd_mode(GDisplay *g) {
palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
}
static GFXINLINE void enter_cmd_mode(GDisplay *g) { palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN); }
static GFXINLINE void write_data(GDisplay *g, uint8_t *data, uint16_t length) { static GFXINLINE void write_data(GDisplay *g, uint8_t *data, uint16_t length) {
(void)g; (void)g;

View file

@ -67,17 +67,24 @@ typedef struct{
# define PRIV(g) ((PrivData *)g->priv) # define PRIV(g) ((PrivData *)g->priv)
# define RAM(g) (PRIV(g)->ram) # define RAM(g) (PRIV(g)->ram)
static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) { static GFXINLINE void write_cmd(GDisplay *g, uint8_t cmd) { PRIV(g)->data[PRIV(g)->data_pos++] = cmd; }
PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
}
static GFXINLINE void flush_cmd(GDisplay *g) { static GFXINLINE void flush_cmd(GDisplay *g) {
write_data(g, PRIV(g)->data, PRIV(g)->data_pos); write_data(g, PRIV(g)->data, PRIV(g)->data_pos);
PRIV(g)->data_pos = 0; PRIV(g)->data_pos = 0;
} }
#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); } # define write_cmd2(g, cmd1, cmd2) \
#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); } { \
write_cmd(g, cmd1); \
write_cmd(g, cmd2); \
}
# define write_cmd3(g, cmd1, cmd2, cmd3) \
{ \
write_cmd(g, cmd1); \
write_cmd(g, cmd2); \
write_cmd(g, cmd3); \
}
// Some common routines and macros // Some common routines and macros
# define delay(us) gfxSleepMicroseconds(us) # define delay(us) gfxSleepMicroseconds(us)
@ -153,8 +160,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
unsigned p; unsigned p;
// Don't flush if we don't need it. // Don't flush if we don't need it.
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return;
return;
acquire_bus(g); acquire_bus(g);
enter_cmd_mode(g); enter_cmd_mode(g);
@ -253,8 +259,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
uint8_t *dst = &(RAM(g)[xyaddr(dstx, dsty)]); uint8_t *dst = &(RAM(g)[xyaddr(dstx, dsty)]);
if (bitset) { if (bitset) {
*dst |= xybit(dsty); *dst |= xybit(dsty);
} } else {
else {
*dst &= ~xybit(dsty); *dst &= ~xybit(dsty);
} }
dstx++; dstx++;
@ -268,8 +273,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
LLDSPEC void gdisp_lld_control(GDisplay *g) { LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch (g->p.x) { switch (g->p.x) {
case GDISP_CONTROL_POWER: case GDISP_CONTROL_POWER:
if (g->g.Powermode == (powermode_t)g->p.ptr) if (g->g.Powermode == (powermode_t)g->p.ptr) return;
return;
switch ((powermode_t)g->p.ptr) { switch ((powermode_t)g->p.ptr) {
case powerOff: case powerOff:
case powerSleep: case powerSleep:
@ -294,8 +298,7 @@ LLDSPEC void gdisp_lld_control(GDisplay *g) {
return; return;
case GDISP_CONTROL_ORIENTATION: case GDISP_CONTROL_ORIENTATION:
if (g->g.Orientation == (orientation_t)g->p.ptr) if (g->g.Orientation == (orientation_t)g->p.ptr) return;
return;
switch ((orientation_t)g->p.ptr) { switch ((orientation_t)g->p.ptr) {
/* Rotation is handled by the drawing routines */ /* Rotation is handled by the drawing routines */
case GDISP_ROTATE_0: case GDISP_ROTATE_0:

View file

@ -24,24 +24,13 @@ void dword_to_bytes(uint32_t dword, uint8_t * bytes) {
bytes[3] = (dword >> 0) & 0xFF; bytes[3] = (dword >> 0) & 0xFF;
} }
uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) { uint32_t bytes_to_dword(uint8_t* bytes, uint8_t index) { return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3]; }
return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3];
}
__attribute__ ((weak)) __attribute__((weak)) bool process_api_quantum(uint8_t length, uint8_t* data) { return process_api_keyboard(length, data); }
bool process_api_quantum(uint8_t length, uint8_t * data) {
return process_api_keyboard(length, data);
}
__attribute__ ((weak)) __attribute__((weak)) bool process_api_keyboard(uint8_t length, uint8_t* data) { return process_api_user(length, data); }
bool process_api_keyboard(uint8_t length, uint8_t * data) {
return process_api_user(length, data);
}
__attribute__ ((weak)) __attribute__((weak)) bool process_api_user(uint8_t length, uint8_t* data) { return true; }
bool process_api_user(uint8_t length, uint8_t * data) {
return true;
}
void process_api(uint16_t length, uint8_t* data) { void process_api(uint16_t length, uint8_t* data) {
// SEND_STRING("\nRX: "); // SEND_STRING("\nRX: ");
@ -49,8 +38,7 @@ void process_api(uint16_t length, uint8_t * data) {
// send_byte(data[i]); // send_byte(data[i]);
// SEND_STRING(" "); // SEND_STRING(" ");
// } // }
if (!process_api_quantum(length, data)) if (!process_api_quantum(length, data)) return;
return;
switch (data[0]) { switch (data[0]) {
case MT_SET_DATA: case MT_SET_DATA:
@ -191,5 +179,4 @@ void process_api(uint16_t length, uint8_t * data) {
// break; // break;
// #endif // #endif
} }
} }

View file

@ -33,23 +33,7 @@ enum MESSAGE_TYPE {
MT_TYPE_ERROR = 0x80 // type not recognised (ACK) MT_TYPE_ERROR = 0x80 // type not recognised (ACK)
}; };
enum DATA_TYPE { enum DATA_TYPE { DT_NONE = 0x00, DT_HANDSHAKE, DT_DEFAULT_LAYER, DT_CURRENT_LAYER, DT_KEYMAP_OPTIONS, DT_BACKLIGHT, DT_RGBLIGHT, DT_UNICODE, DT_DEBUG, DT_AUDIO, DT_QUANTUM_ACTION, DT_KEYBOARD_ACTION, DT_USER_ACTION, DT_KEYMAP_SIZE, DT_KEYMAP };
DT_NONE = 0x00,
DT_HANDSHAKE,
DT_DEFAULT_LAYER,
DT_CURRENT_LAYER,
DT_KEYMAP_OPTIONS,
DT_BACKLIGHT,
DT_RGBLIGHT,
DT_UNICODE,
DT_DEBUG,
DT_AUDIO,
DT_QUANTUM_ACTION,
DT_KEYBOARD_ACTION,
DT_USER_ACTION,
DT_KEYMAP_SIZE,
DT_KEYMAP
};
void dword_to_bytes(uint32_t dword, uint8_t* bytes); void dword_to_bytes(uint32_t dword, uint8_t* bytes);
uint32_t bytes_to_dword(uint8_t* bytes, uint8_t index); uint32_t bytes_to_dword(uint8_t* bytes, uint8_t index);
@ -65,13 +49,10 @@ uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index);
void process_api(uint16_t length, uint8_t* data); void process_api(uint16_t length, uint8_t* data);
__attribute__ ((weak)) __attribute__((weak)) bool process_api_quantum(uint8_t length, uint8_t* data);
bool process_api_quantum(uint8_t length, uint8_t * data);
__attribute__ ((weak)) __attribute__((weak)) bool process_api_keyboard(uint8_t length, uint8_t* data);
bool process_api_keyboard(uint8_t length, uint8_t * data);
__attribute__ ((weak)) __attribute__((weak)) bool process_api_user(uint8_t length, uint8_t* data);
bool process_api_user(uint8_t length, uint8_t * data);
#endif #endif

View file

@ -29,7 +29,6 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
return; return;
} }
// The buffer size required is calculated as the following // The buffer size required is calculated as the following
// API_SYSEX_MAX_SIZE is the maximum length // API_SYSEX_MAX_SIZE is the maximum length
// In addition to that we have a two byte message header consisting of the message_type and data_type // In addition to that we have a two byte message header consisting of the message_type and data_type

View file

@ -112,7 +112,6 @@
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int voices = 0; int voices = 0;
int voice_place = 0; int voice_place = 0;
float frequency = 0; float frequency = 0;
@ -172,18 +171,14 @@ float startup_song[][2] = STARTUP_SONG;
float audio_on_song[][2] = AUDIO_ON_SONG; float audio_on_song[][2] = AUDIO_ON_SONG;
float audio_off_song[][2] = AUDIO_OFF_SONG; float audio_off_song[][2] = AUDIO_OFF_SONG;
void audio_init() void audio_init() {
{
// Check EEPROM // Check EEPROM
if (!eeconfig_is_enabled()) if (!eeconfig_is_enabled()) {
{
eeconfig_init(); eeconfig_init();
} }
audio_config.raw = eeconfig_read_audio(); audio_config.raw = eeconfig_read_audio();
if (!audio_initialized) { if (!audio_initialized) {
// Set audio ports as output // Set audio ports as output
#ifdef CPIN_AUDIO #ifdef CPIN_AUDIO
CPIN_SET_DIRECTION CPIN_SET_DIRECTION
@ -231,11 +226,9 @@ void audio_init()
if (audio_config.enable) { if (audio_config.enable) {
PLAY_SONG(startup_song); PLAY_SONG(startup_song);
} }
} }
void stop_all_notes() void stop_all_notes() {
{
dprintf("audio stop all notes"); dprintf("audio stop all notes");
if (!audio_initialized) { if (!audio_initialized) {
@ -259,15 +252,13 @@ void stop_all_notes()
frequency_alt = 0; frequency_alt = 0;
volume = 0; volume = 0;
for (uint8_t i = 0; i < 8; i++) for (uint8_t i = 0; i < 8; i++) {
{
frequencies[i] = 0; frequencies[i] = 0;
volumes[i] = 0; volumes[i] = 0;
} }
} }
void stop_note(float freq) void stop_note(float freq) {
{
dprintf("audio stop note freq=%d", (int)freq); dprintf("audio stop note freq=%d", (int)freq);
if (playing_note) { if (playing_note) {
@ -288,8 +279,7 @@ void stop_note(float freq)
} }
} }
voices--; voices--;
if (voices < 0) if (voices < 0) voices = 0;
voices = 0;
if (voice_place >= voices) { if (voice_place >= voices) {
voice_place = 0; voice_place = 0;
} }
@ -312,8 +302,7 @@ void stop_note(float freq)
#ifdef VIBRATO_ENABLE #ifdef VIBRATO_ENABLE
float mod(float a, int b) float mod(float a, int b) {
{
float r = fmod(a, b); float r = fmod(a, b);
return r < 0 ? r + b : r; return r < 0 ? r + b : r;
} }
@ -331,13 +320,11 @@ float vibrato(float average_freq) {
#endif #endif
#ifdef CPIN_AUDIO #ifdef CPIN_AUDIO
ISR(TIMER3_AUDIO_vect) ISR(TIMER3_AUDIO_vect) {
{
float freq; float freq;
if (playing_note) { if (playing_note) {
if (voices > 0) { if (voices > 0) {
# ifdef BPIN_AUDIO # ifdef BPIN_AUDIO
float freq_alt = 0; float freq_alt = 0;
if (voices > 1) { if (voices > 1) {
@ -513,8 +500,7 @@ ISR(TIMER3_AUDIO_vect)
#endif #endif
#ifdef BPIN_AUDIO #ifdef BPIN_AUDIO
ISR(TIMER1_AUDIO_vect) ISR(TIMER1_AUDIO_vect) {
{
# if defined(BPIN_AUDIO) && !defined(CPIN_AUDIO) # if defined(BPIN_AUDIO) && !defined(CPIN_AUDIO)
float freq = 0; float freq = 0;
@ -654,7 +640,6 @@ ISR(TIMER1_AUDIO_vect)
#endif #endif
void play_note(float freq, int vol) { void play_note(float freq, int vol) {
dprintf("audio play note freq=%d vol=%d", (int)freq, vol); dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
if (!audio_initialized) { if (!audio_initialized) {
@ -670,8 +655,7 @@ void play_note(float freq, int vol) {
#endif #endif
// Cancel notes if notes are playing // Cancel notes if notes are playing
if (playing_notes) if (playing_notes) stop_all_notes();
stop_all_notes();
playing_note = true; playing_note = true;
@ -699,18 +683,14 @@ void play_note(float freq, int vol) {
# endif # endif
#endif #endif
} }
} }
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) {
{
if (!audio_initialized) { if (!audio_initialized) {
audio_init(); audio_init();
} }
if (audio_config.enable) { if (audio_config.enable) {
#ifdef CPIN_AUDIO #ifdef CPIN_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR; DISABLE_AUDIO_COUNTER_3_ISR;
#endif #endif
@ -719,8 +699,7 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat)
#endif #endif
// Cancel note if a note is playing // Cancel note if a note is playing
if (playing_note) if (playing_note) stop_all_notes();
stop_all_notes();
playing_notes = true; playing_notes = true;
@ -735,7 +714,6 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat)
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
note_position = 0; note_position = 0;
#ifdef CPIN_AUDIO #ifdef CPIN_AUDIO
ENABLE_AUDIO_COUNTER_3_ISR; ENABLE_AUDIO_COUNTER_3_ISR;
ENABLE_AUDIO_COUNTER_3_OUTPUT; ENABLE_AUDIO_COUNTER_3_OUTPUT;
@ -747,22 +725,16 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat)
# endif # endif
#endif #endif
} }
} }
bool is_playing_notes(void) { bool is_playing_notes(void) { return playing_notes; }
return playing_notes;
}
bool is_audio_on(void) { bool is_audio_on(void) { return (audio_config.enable != 0); }
return (audio_config.enable != 0);
}
void audio_toggle(void) { void audio_toggle(void) {
audio_config.enable ^= 1; audio_config.enable ^= 1;
eeconfig_update_audio(audio_config.raw); eeconfig_update_audio(audio_config.raw);
if (audio_config.enable) if (audio_config.enable) audio_on_user();
audio_on_user();
} }
void audio_on(void) { void audio_on(void) {
@ -784,31 +756,19 @@ void audio_off(void) {
// Vibrato rate functions // Vibrato rate functions
void set_vibrato_rate(float rate) { void set_vibrato_rate(float rate) { vibrato_rate = rate; }
vibrato_rate = rate;
}
void increase_vibrato_rate(float change) { void increase_vibrato_rate(float change) { vibrato_rate *= change; }
vibrato_rate *= change;
}
void decrease_vibrato_rate(float change) { void decrease_vibrato_rate(float change) { vibrato_rate /= change; }
vibrato_rate /= change;
}
# ifdef VIBRATO_STRENGTH_ENABLE # ifdef VIBRATO_STRENGTH_ENABLE
void set_vibrato_strength(float strength) { void set_vibrato_strength(float strength) { vibrato_strength = strength; }
vibrato_strength = strength;
}
void increase_vibrato_strength(float change) { void increase_vibrato_strength(float change) { vibrato_strength *= change; }
vibrato_strength *= change;
}
void decrease_vibrato_strength(float change) { void decrease_vibrato_strength(float change) { vibrato_strength /= change; }
vibrato_strength /= change;
}
# endif /* VIBRATO_STRENGTH_ENABLE */ # endif /* VIBRATO_STRENGTH_ENABLE */
@ -816,41 +776,25 @@ void decrease_vibrato_strength(float change) {
// Polyphony functions // Polyphony functions
void set_polyphony_rate(float rate) { void set_polyphony_rate(float rate) { polyphony_rate = rate; }
polyphony_rate = rate;
}
void enable_polyphony() { void enable_polyphony() { polyphony_rate = 5; }
polyphony_rate = 5;
}
void disable_polyphony() { void disable_polyphony() { polyphony_rate = 0; }
polyphony_rate = 0;
}
void increase_polyphony_rate(float change) { void increase_polyphony_rate(float change) { polyphony_rate *= change; }
polyphony_rate *= change;
}
void decrease_polyphony_rate(float change) { void decrease_polyphony_rate(float change) { polyphony_rate /= change; }
polyphony_rate /= change;
}
// Timbre function // Timbre function
void set_timbre(float timbre) { void set_timbre(float timbre) { note_timbre = timbre; }
note_timbre = timbre;
}
// Tempo functions // Tempo functions
void set_tempo(uint8_t tempo) { void set_tempo(uint8_t tempo) { note_tempo = tempo; }
note_tempo = tempo;
}
void decrease_tempo(uint8_t tempo_change) { void decrease_tempo(uint8_t tempo_change) { note_tempo += tempo_change; }
note_tempo += tempo_change;
}
void increase_tempo(uint8_t tempo_change) { void increase_tempo(uint8_t tempo_change) {
if (note_tempo - tempo_change < 10) { if (note_tempo - tempo_change < 10) {

View file

@ -92,17 +92,15 @@ void stop_note(float freq);
void stop_all_notes(void); void stop_all_notes(void);
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat); void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat);
#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ #define SCALE \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ (int8_t[]) { 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), }
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
// These macros are used to allow play_notes to play an array of indeterminate // These macros are used to allow play_notes to play an array of indeterminate
// length. This works around the limitation of C's sizeof operation on pointers. // length. This works around the limitation of C's sizeof operation on pointers.
// The global float array for the song must be used here. // The global float array for the song must be used here.
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0])))) #define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \ #define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) \
play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \
_Pragma("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"") _Pragma("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"")
#define PLAY_SONG(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), false) #define PLAY_SONG(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), false)
#define PLAY_LOOP(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), true) #define PLAY_LOOP(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), true)

View file

@ -84,24 +84,29 @@ static void gpt_cb8(GPTDriver *gptp);
# define DAC_SAMPLE_MAX 65535U # define DAC_SAMPLE_MAX 65535U
#endif #endif
#define START_CHANNEL_1() gptStart(&GPTD6, &gpt6cfg1); \ #define START_CHANNEL_1() \
gptStart(&GPTD6, &gpt6cfg1); \
gptStartContinuous(&GPTD6, 2U) gptStartContinuous(&GPTD6, 2U)
#define START_CHANNEL_2() gptStart(&GPTD7, &gpt7cfg1); \ #define START_CHANNEL_2() \
gptStart(&GPTD7, &gpt7cfg1); \
gptStartContinuous(&GPTD7, 2U) gptStartContinuous(&GPTD7, 2U)
#define STOP_CHANNEL_1() gptStopTimer(&GPTD6) #define STOP_CHANNEL_1() gptStopTimer(&GPTD6)
#define STOP_CHANNEL_2() gptStopTimer(&GPTD7) #define STOP_CHANNEL_2() gptStopTimer(&GPTD7)
#define RESTART_CHANNEL_1() STOP_CHANNEL_1(); \ #define RESTART_CHANNEL_1() \
STOP_CHANNEL_1(); \
START_CHANNEL_1() START_CHANNEL_1()
#define RESTART_CHANNEL_2() STOP_CHANNEL_2(); \ #define RESTART_CHANNEL_2() \
STOP_CHANNEL_2(); \
START_CHANNEL_2() START_CHANNEL_2()
#define UPDATE_CHANNEL_1_FREQ(freq) gpt6cfg1.frequency = freq * DAC_BUFFER_SIZE; \ #define UPDATE_CHANNEL_1_FREQ(freq) \
gpt6cfg1.frequency = freq * DAC_BUFFER_SIZE; \
RESTART_CHANNEL_1() RESTART_CHANNEL_1()
#define UPDATE_CHANNEL_2_FREQ(freq) gpt7cfg1.frequency = freq * DAC_BUFFER_SIZE; \ #define UPDATE_CHANNEL_2_FREQ(freq) \
gpt7cfg1.frequency = freq * DAC_BUFFER_SIZE; \
RESTART_CHANNEL_2() RESTART_CHANNEL_2()
#define GET_CHANNEL_1_FREQ (uint16_t)(gpt6cfg1.frequency * DAC_BUFFER_SIZE) #define GET_CHANNEL_1_FREQ (uint16_t)(gpt6cfg1.frequency * DAC_BUFFER_SIZE)
#define GET_CHANNEL_2_FREQ (uint16_t)(gpt7cfg1.frequency * DAC_BUFFER_SIZE) #define GET_CHANNEL_2_FREQ (uint16_t)(gpt7cfg1.frequency * DAC_BUFFER_SIZE)
/* /*
* GPT6 configuration. * GPT6 configuration.
*/ */
@ -112,27 +117,20 @@ static void gpt_cb8(GPTDriver *gptp);
// .dier = 0U // .dier = 0U
// }; // };
GPTConfig gpt6cfg1 = { GPTConfig gpt6cfg1 = {.frequency = 440U * DAC_BUFFER_SIZE,
.frequency = 440U*DAC_BUFFER_SIZE,
.callback = NULL, .callback = NULL,
.cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */ .cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */
.dier = 0U .dier = 0U};
};
GPTConfig gpt7cfg1 = { GPTConfig gpt7cfg1 = {.frequency = 440U * DAC_BUFFER_SIZE,
.frequency = 440U*DAC_BUFFER_SIZE,
.callback = NULL, .callback = NULL,
.cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */ .cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */
.dier = 0U .dier = 0U};
};
GPTConfig gpt8cfg1 = { GPTConfig gpt8cfg1 = {.frequency = 10,
.frequency = 10,
.callback = gpt_cb8, .callback = gpt_cb8,
.cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */ .cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */
.dier = 0U .dier = 0U};
};
/* /*
* DAC test buffer (sine wave). * DAC test buffer (sine wave).
@ -222,14 +220,12 @@ static const dacsample_t dac_buffer_2[DAC_BUFFER_SIZE] = {
*/ */
size_t nx = 0, ny = 0, nz = 0; size_t nx = 0, ny = 0, nz = 0;
static void end_cb1(DACDriver *dacp, dacsample_t *buffer, size_t n) { static void end_cb1(DACDriver *dacp, dacsample_t *buffer, size_t n) {
(void)dacp; (void)dacp;
nz++; nz++;
if (dac_buffer == buffer) { if (dac_buffer == buffer) {
nx += n; nx += n;
} } else {
else {
ny += n; ny += n;
} }
@ -242,39 +238,21 @@ static void end_cb1(DACDriver *dacp, dacsample_t *buffer, size_t n) {
* DAC error callback. * DAC error callback.
*/ */
static void error_cb1(DACDriver *dacp, dacerror_t err) { static void error_cb1(DACDriver *dacp, dacerror_t err) {
(void)dacp; (void)dacp;
(void)err; (void)err;
chSysHalt("DAC failure"); chSysHalt("DAC failure");
} }
static const DACConfig dac1cfg1 = { static const DACConfig dac1cfg1 = {.init = DAC_SAMPLE_MAX, .datamode = DAC_DHRM_12BIT_RIGHT};
.init = DAC_SAMPLE_MAX,
.datamode = DAC_DHRM_12BIT_RIGHT
};
static const DACConversionGroup dacgrpcfg1 = { static const DACConversionGroup dacgrpcfg1 = {.num_channels = 1U, .end_cb = end_cb1, .error_cb = error_cb1, .trigger = DAC_TRG(0)};
.num_channels = 1U,
.end_cb = end_cb1,
.error_cb = error_cb1,
.trigger = DAC_TRG(0)
};
static const DACConfig dac1cfg2 = { static const DACConfig dac1cfg2 = {.init = DAC_SAMPLE_MAX, .datamode = DAC_DHRM_12BIT_RIGHT};
.init = DAC_SAMPLE_MAX,
.datamode = DAC_DHRM_12BIT_RIGHT
};
static const DACConversionGroup dacgrpcfg2 = { static const DACConversionGroup dacgrpcfg2 = {.num_channels = 1U, .end_cb = end_cb1, .error_cb = error_cb1, .trigger = DAC_TRG(0)};
.num_channels = 1U,
.end_cb = end_cb1,
.error_cb = error_cb1,
.trigger = DAC_TRG(0)
};
void audio_init() { void audio_init() {
if (audio_initialized) { if (audio_initialized) {
return; return;
} }
@ -320,7 +298,6 @@ void audio_init() {
} else { } else {
stop_all_notes(); stop_all_notes();
} }
} }
void stop_all_notes() { void stop_all_notes() {
@ -341,8 +318,7 @@ void stop_all_notes() {
frequency_alt = 0; frequency_alt = 0;
volume = 0; volume = 0;
for (uint8_t i = 0; i < 8; i++) for (uint8_t i = 0; i < 8; i++) {
{
frequencies[i] = 0; frequencies[i] = 0;
volumes[i] = 0; volumes[i] = 0;
} }
@ -411,7 +387,6 @@ static void gpt_cb8(GPTDriver *gptp) {
if (playing_note) { if (playing_note) {
if (voices > 0) { if (voices > 0) {
float freq_alt = 0; float freq_alt = 0;
if (voices > 1) { if (voices > 1) {
if (polyphony_rate == 0) { if (polyphony_rate == 0) {
@ -508,7 +483,6 @@ static void gpt_cb8(GPTDriver *gptp) {
freq = 30.52; freq = 30.52;
} }
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) { if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
UPDATE_CHANNEL_1_FREQ(freq); UPDATE_CHANNEL_1_FREQ(freq);
} else { } else {
@ -535,7 +509,6 @@ static void gpt_cb8(GPTDriver *gptp) {
} }
freq = voice_envelope(freq); freq = voice_envelope(freq);
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) { if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
UPDATE_CHANNEL_1_FREQ(freq); UPDATE_CHANNEL_1_FREQ(freq);
UPDATE_CHANNEL_2_FREQ(freq); UPDATE_CHANNEL_2_FREQ(freq);
@ -598,7 +571,6 @@ static void gpt_cb8(GPTDriver *gptp) {
} }
void play_note(float freq, int vol) { void play_note(float freq, int vol) {
dprintf("audio play note freq=%d vol=%d", (int)freq, vol); dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
if (!audio_initialized) { if (!audio_initialized) {
@ -606,7 +578,6 @@ void play_note(float freq, int vol) {
} }
if (audio_config.enable && voices < 8) { if (audio_config.enable && voices < 8) {
// Cancel notes if notes are playing // Cancel notes if notes are playing
if (playing_notes) { if (playing_notes) {
stop_all_notes(); stop_all_notes();
@ -627,17 +598,14 @@ void play_note(float freq, int vol) {
RESTART_CHANNEL_1(); RESTART_CHANNEL_1();
RESTART_CHANNEL_2(); RESTART_CHANNEL_2();
} }
} }
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) { void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) {
if (!audio_initialized) { if (!audio_initialized) {
audio_init(); audio_init();
} }
if (audio_config.enable) { if (audio_config.enable) {
// Cancel note if a note is playing // Cancel note if a note is playing
if (playing_note) { if (playing_note) {
stop_all_notes(); stop_all_notes();
@ -663,13 +631,9 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) {
} }
} }
bool is_playing_notes(void) { bool is_playing_notes(void) { return playing_notes; }
return playing_notes;
}
bool is_audio_on(void) { bool is_audio_on(void) { return (audio_config.enable != 0); }
return (audio_config.enable != 0);
}
void audio_toggle(void) { void audio_toggle(void) {
audio_config.enable ^= 1; audio_config.enable ^= 1;
@ -695,31 +659,19 @@ void audio_off(void) {
// Vibrato rate functions // Vibrato rate functions
void set_vibrato_rate(float rate) { void set_vibrato_rate(float rate) { vibrato_rate = rate; }
vibrato_rate = rate;
}
void increase_vibrato_rate(float change) { void increase_vibrato_rate(float change) { vibrato_rate *= change; }
vibrato_rate *= change;
}
void decrease_vibrato_rate(float change) { void decrease_vibrato_rate(float change) { vibrato_rate /= change; }
vibrato_rate /= change;
}
# ifdef VIBRATO_STRENGTH_ENABLE # ifdef VIBRATO_STRENGTH_ENABLE
void set_vibrato_strength(float strength) { void set_vibrato_strength(float strength) { vibrato_strength = strength; }
vibrato_strength = strength;
}
void increase_vibrato_strength(float change) { void increase_vibrato_strength(float change) { vibrato_strength *= change; }
vibrato_strength *= change;
}
void decrease_vibrato_strength(float change) { void decrease_vibrato_strength(float change) { vibrato_strength /= change; }
vibrato_strength /= change;
}
# endif /* VIBRATO_STRENGTH_ENABLE */ # endif /* VIBRATO_STRENGTH_ENABLE */
@ -727,41 +679,25 @@ void decrease_vibrato_strength(float change) {
// Polyphony functions // Polyphony functions
void set_polyphony_rate(float rate) { void set_polyphony_rate(float rate) { polyphony_rate = rate; }
polyphony_rate = rate;
}
void enable_polyphony() { void enable_polyphony() { polyphony_rate = 5; }
polyphony_rate = 5;
}
void disable_polyphony() { void disable_polyphony() { polyphony_rate = 0; }
polyphony_rate = 0;
}
void increase_polyphony_rate(float change) { void increase_polyphony_rate(float change) { polyphony_rate *= change; }
polyphony_rate *= change;
}
void decrease_polyphony_rate(float change) { void decrease_polyphony_rate(float change) { polyphony_rate /= change; }
polyphony_rate /= change;
}
// Timbre function // Timbre function
void set_timbre(float timbre) { void set_timbre(float timbre) { note_timbre = timbre; }
note_timbre = timbre;
}
// Tempo functions // Tempo functions
void set_tempo(uint8_t tempo) { void set_tempo(uint8_t tempo) { note_tempo = tempo; }
note_tempo = tempo;
}
void decrease_tempo(uint8_t tempo_change) { void decrease_tempo(uint8_t tempo_change) { note_tempo += tempo_change; }
note_tempo += tempo_change;
}
void increase_tempo(uint8_t tempo_change) { void increase_tempo(uint8_t tempo_change) {
if (note_tempo - tempo_change < 10) { if (note_tempo - tempo_change < 10) {

View file

@ -29,7 +29,6 @@
#define CPU_PRESCALER 8 #define CPU_PRESCALER 8
// Timer Abstractions // Timer Abstractions
// TIMSK3 - Timer/Counter #3 Interrupt Mask Register // TIMSK3 - Timer/Counter #3 Interrupt Mask Register
@ -37,17 +36,14 @@
#define ENABLE_AUDIO_COUNTER_3_ISR TIMSK3 |= _BV(OCIE3A) #define ENABLE_AUDIO_COUNTER_3_ISR TIMSK3 |= _BV(OCIE3A)
#define DISABLE_AUDIO_COUNTER_3_ISR TIMSK3 &= ~_BV(OCIE3A) #define DISABLE_AUDIO_COUNTER_3_ISR TIMSK3 &= ~_BV(OCIE3A)
// TCCR3A: Timer/Counter #3 Control Register // TCCR3A: Timer/Counter #3 Control Register
// Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6 // Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6
#define ENABLE_AUDIO_COUNTER_3_OUTPUT TCCR3A |= _BV(COM3A1); #define ENABLE_AUDIO_COUNTER_3_OUTPUT TCCR3A |= _BV(COM3A1);
#define DISABLE_AUDIO_COUNTER_3_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0)); #define DISABLE_AUDIO_COUNTER_3_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0));
#define NOTE_PERIOD ICR3 #define NOTE_PERIOD ICR3
#define NOTE_DUTY_CYCLE OCR3A #define NOTE_DUTY_CYCLE OCR3A
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
# include "wave.h" # include "wave.h"
# define SAMPLE_DIVIDER 39 # define SAMPLE_DIVIDER 39
@ -112,10 +108,8 @@ audio_config_t audio_config;
uint16_t envelope_index = 0; uint16_t envelope_index = 0;
void audio_init() { void audio_init() {
// Check EEPROM // Check EEPROM
if (!eeconfig_is_enabled()) if (!eeconfig_is_enabled()) {
{
eeconfig_init(); eeconfig_init();
} }
audio_config.raw = eeconfig_read_audio(); audio_config.raw = eeconfig_read_audio();
@ -124,7 +118,8 @@ void audio_init() {
PLLFRQ = _BV(PDIV2); PLLFRQ = _BV(PDIV2);
PLLCSR = _BV(PLLE); PLLCSR = _BV(PLLE);
while(!(PLLCSR & _BV(PLOCK))); while (!(PLLCSR & _BV(PLOCK)))
;
PLLFRQ |= _BV(PLLTM0); /* PCK 48MHz */ PLLFRQ |= _BV(PLLTM0); /* PCK 48MHz */
/* Init a fast PWM on Timer4 */ /* Init a fast PWM on Timer4 */
@ -177,15 +172,13 @@ void stop_all_notes() {
frequency = 0; frequency = 0;
volume = 0; volume = 0;
for (uint8_t i = 0; i < 8; i++) for (uint8_t i = 0; i < 8; i++) {
{
frequencies[i] = 0; frequencies[i] = 0;
volumes[i] = 0; volumes[i] = 0;
} }
} }
void stop_note(float freq) void stop_note(float freq) {
{
if (playing_note) { if (playing_note) {
if (!audio_initialized) { if (!audio_initialized) {
audio_init(); audio_init();
@ -207,8 +200,7 @@ void stop_note(float freq)
} }
} }
voices--; voices--;
if (voices < 0) if (voices < 0) voices = 0;
voices = 0;
if (voice_place >= voices) { if (voice_place >= voices) {
voice_place = 0; voice_place = 0;
} }
@ -228,8 +220,7 @@ void stop_note(float freq)
#ifdef VIBRATO_ENABLE #ifdef VIBRATO_ENABLE
float mod(float a, int b) float mod(float a, int b) {
{
float r = fmod(a, b); float r = fmod(a, b);
return r < 0 ? r + b : r; return r < 0 ? r + b : r;
} }
@ -246,8 +237,7 @@ float vibrato(float average_freq) {
#endif #endif
ISR(TIMER3_COMPA_vect) ISR(TIMER3_COMPA_vect) {
{
if (playing_note) { if (playing_note) {
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
if (voices == 1) { if (voices == 1) {
@ -273,8 +263,7 @@ ISR(TIMER3_COMPA_vect)
place += frequency; place += frequency;
if (place >= SINE_LENGTH) if (place >= SINE_LENGTH) place -= SINE_LENGTH;
place -= SINE_LENGTH;
} else { } else {
int sum = 0; int sum = 0;
@ -291,8 +280,7 @@ ISR(TIMER3_COMPA_vect)
places[i] += frequencies[i]; places[i] += frequencies[i];
if (places[i] >= SINE_LENGTH) if (places[i] >= SINE_LENGTH) places[i] -= SINE_LENGTH;
places[i] -= SINE_LENGTH;
} }
OCR4A = sum; OCR4A = sum;
} }
@ -325,7 +313,6 @@ ISR(TIMER3_COMPA_vect)
frequency = frequencies[voices - 1]; frequency = frequencies[voices - 1];
} }
# ifdef VIBRATO_ENABLE # ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) { if (vibrato_strength > 0) {
freq = vibrato(frequency); freq = vibrato(frequency);
@ -342,8 +329,7 @@ ISR(TIMER3_COMPA_vect)
} }
freq = voice_envelope(freq); freq = voice_envelope(freq);
if (freq < 30.517578125) if (freq < 30.517578125) freq = 30.52;
freq = 30.52;
NOTE_PERIOD = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period NOTE_PERIOD = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period
NOTE_DUTY_CYCLE = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period NOTE_DUTY_CYCLE = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
} }
@ -361,14 +347,12 @@ ISR(TIMER3_COMPA_vect)
// else // else
// DISABLE_AUDIO_COUNTER_3_ISR; // DISABLE_AUDIO_COUNTER_3_ISR;
if (playing_notes) { if (playing_notes) {
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 0; OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 0;
place += note_frequency; place += note_frequency;
if (place >= SINE_LENGTH) if (place >= SINE_LENGTH) place -= SINE_LENGTH;
place -= SINE_LENGTH;
#else #else
if (note_frequency > 0) { if (note_frequency > 0) {
float freq; float freq;
@ -396,7 +380,6 @@ ISR(TIMER3_COMPA_vect)
} }
#endif #endif
note_position++; note_position++;
bool end_of_note = false; bool end_of_note = false;
if (NOTE_PERIOD > 0) if (NOTE_PERIOD > 0)
@ -437,7 +420,6 @@ ISR(TIMER3_COMPA_vect)
} }
note_position = 0; note_position = 0;
} }
} }
if (!audio_config.enable) { if (!audio_config.enable) {
@ -447,7 +429,6 @@ ISR(TIMER3_COMPA_vect)
} }
void play_note(float freq, int vol) { void play_note(float freq, int vol) {
if (!audio_initialized) { if (!audio_initialized) {
audio_init(); audio_init();
} }
@ -456,8 +437,7 @@ void play_note(float freq, int vol) {
DISABLE_AUDIO_COUNTER_3_ISR; DISABLE_AUDIO_COUNTER_3_ISR;
// Cancel notes if notes are playing // Cancel notes if notes are playing
if (playing_notes) if (playing_notes) stop_all_notes();
stop_all_notes();
playing_note = true; playing_note = true;
@ -479,23 +459,18 @@ void play_note(float freq, int vol) {
ENABLE_AUDIO_COUNTER_3_OUTPUT; ENABLE_AUDIO_COUNTER_3_OUTPUT;
#endif #endif
} }
} }
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) {
{
if (!audio_initialized) { if (!audio_initialized) {
audio_init(); audio_init();
} }
if (audio_config.enable) { if (audio_config.enable) {
DISABLE_AUDIO_COUNTER_3_ISR; DISABLE_AUDIO_COUNTER_3_ISR;
// Cancel note if a note is playing // Cancel note if a note is playing
if (playing_note) if (playing_note) stop_all_notes();
stop_all_notes();
playing_notes = true; playing_notes = true;
@ -516,7 +491,6 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
#endif #endif
note_position = 0; note_position = 0;
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
ENABLE_AUDIO_COUNTER_3_ISR; ENABLE_AUDIO_COUNTER_3_ISR;
#else #else
@ -524,7 +498,6 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
ENABLE_AUDIO_COUNTER_3_OUTPUT; ENABLE_AUDIO_COUNTER_3_OUTPUT;
#endif #endif
} }
} }
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
@ -546,7 +519,6 @@ void play_sample(uint8_t * s, uint16_t l, bool r) {
} }
#endif #endif
void audio_toggle(void) { void audio_toggle(void) {
audio_config.enable ^= 1; audio_config.enable ^= 1;
eeconfig_update_audio(audio_config.raw); eeconfig_update_audio(audio_config.raw);
@ -566,31 +538,19 @@ void audio_off(void) {
// Vibrato rate functions // Vibrato rate functions
void set_vibrato_rate(float rate) { void set_vibrato_rate(float rate) { vibrato_rate = rate; }
vibrato_rate = rate;
}
void increase_vibrato_rate(float change) { void increase_vibrato_rate(float change) { vibrato_rate *= change; }
vibrato_rate *= change;
}
void decrease_vibrato_rate(float change) { void decrease_vibrato_rate(float change) { vibrato_rate /= change; }
vibrato_rate /= change;
}
# ifdef VIBRATO_STRENGTH_ENABLE # ifdef VIBRATO_STRENGTH_ENABLE
void set_vibrato_strength(float strength) { void set_vibrato_strength(float strength) { vibrato_strength = strength; }
vibrato_strength = strength;
}
void increase_vibrato_strength(float change) { void increase_vibrato_strength(float change) { vibrato_strength *= change; }
vibrato_strength *= change;
}
void decrease_vibrato_strength(float change) { void decrease_vibrato_strength(float change) { vibrato_strength /= change; }
vibrato_strength /= change;
}
# endif /* VIBRATO_STRENGTH_ENABLE */ # endif /* VIBRATO_STRENGTH_ENABLE */
@ -598,41 +558,25 @@ void decrease_vibrato_strength(float change) {
// Polyphony functions // Polyphony functions
void set_polyphony_rate(float rate) { void set_polyphony_rate(float rate) { polyphony_rate = rate; }
polyphony_rate = rate;
}
void enable_polyphony() { void enable_polyphony() { polyphony_rate = 5; }
polyphony_rate = 5;
}
void disable_polyphony() { void disable_polyphony() { polyphony_rate = 0; }
polyphony_rate = 0;
}
void increase_polyphony_rate(float change) { void increase_polyphony_rate(float change) { polyphony_rate *= change; }
polyphony_rate *= change;
}
void decrease_polyphony_rate(float change) { void decrease_polyphony_rate(float change) { polyphony_rate /= change; }
polyphony_rate /= change;
}
// Timbre function // Timbre function
void set_timbre(float timbre) { void set_timbre(float timbre) { note_timbre = timbre; }
note_timbre = timbre;
}
// Tempo functions // Tempo functions
void set_tempo(uint8_t tempo) { void set_tempo(uint8_t tempo) { note_tempo = tempo; }
note_tempo = tempo;
}
void decrease_tempo(uint8_t tempo_change) { void decrease_tempo(uint8_t tempo_change) { note_tempo += tempo_change; }
note_tempo += tempo_change;
}
void increase_tempo(uint8_t tempo_change) { void increase_tempo(uint8_t tempo_change) {
if (note_tempo - tempo_change < 10) { if (note_tempo - tempo_change < 10) {
@ -642,17 +586,10 @@ void increase_tempo(uint8_t tempo_change) {
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Override these functions in your keymap file to play different tunes on // Override these functions in your keymap file to play different tunes on
// startup and bootloader jump // startup and bootloader jump
__attribute__ ((weak)) __attribute__((weak)) void play_startup_tone() {}
void play_startup_tone()
{
}
__attribute__ ((weak)) __attribute__((weak)) void play_goodbye_tone() {}
void play_goodbye_tone()
{
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View file

@ -16,380 +16,12 @@
#include "luts.h" #include "luts.h"
const float vibrato_lut[VIBRATO_LUT_LENGTH] = const float vibrato_lut[VIBRATO_LUT_LENGTH] = {
{ 1.0022336811487, 1.0042529943610, 1.0058584256028, 1.0068905285205, 1.0072464122237, 1.0068905285205, 1.0058584256028, 1.0042529943610, 1.0022336811487, 1.0000000000000, 0.9977712970630, 0.9957650169978, 0.9941756956510, 0.9931566259436, 0.9928057204913, 0.9931566259436, 0.9941756956510, 0.9957650169978, 0.9977712970630, 1.0000000000000,
1.0022336811487,
1.0042529943610,
1.0058584256028,
1.0068905285205,
1.0072464122237,
1.0068905285205,
1.0058584256028,
1.0042529943610,
1.0022336811487,
1.0000000000000,
0.9977712970630,
0.9957650169978,
0.9941756956510,
0.9931566259436,
0.9928057204913,
0.9931566259436,
0.9941756956510,
0.9957650169978,
0.9977712970630,
1.0000000000000,
}; };
const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH] = const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH] = {
{ 0x8E0B, 0x8C02, 0x8A00, 0x8805, 0x8612, 0x8426, 0x8241, 0x8063, 0x7E8C, 0x7CBB, 0x7AF2, 0x792E, 0x7772, 0x75BB, 0x740B, 0x7261, 0x70BD, 0x6F20, 0x6D88, 0x6BF6, 0x6A69, 0x68E3, 0x6762, 0x65E6, 0x6470, 0x6300, 0x6194, 0x602E, 0x5ECD, 0x5D71, 0x5C1A, 0x5AC8, 0x597B, 0x5833, 0x56EF, 0x55B0, 0x5475, 0x533F, 0x520E, 0x50E1, 0x4FB8, 0x4E93, 0x4D73, 0x4C57, 0x4B3E, 0x4A2A, 0x491A, 0x480E, 0x4705, 0x4601, 0x4500, 0x4402, 0x4309, 0x4213, 0x4120, 0x4031, 0x3F46, 0x3E5D, 0x3D79, 0x3C97, 0x3BB9, 0x3ADD, 0x3A05, 0x3930, 0x385E, 0x3790, 0x36C4, 0x35FB, 0x3534, 0x3471, 0x33B1, 0x32F3, 0x3238, 0x3180, 0x30CA, 0x3017, 0x2F66, 0x2EB8, 0x2E0D, 0x2D64, 0x2CBD, 0x2C19, 0x2B77, 0x2AD8, 0x2A3A, 0x299F, 0x2907, 0x2870, 0x27DC, 0x2749, 0x26B9, 0x262B, 0x259F, 0x2515, 0x248D, 0x2407, 0x2382, 0x2300, 0x2280, 0x2201, 0x2184, 0x2109, 0x2090, 0x2018, 0x1FA3, 0x1F2E, 0x1EBC, 0x1E4B, 0x1DDC, 0x1D6E, 0x1D02, 0x1C98, 0x1C2F, 0x1BC8, 0x1B62, 0x1AFD, 0x1A9A,
0x8E0B, 0x1A38, 0x19D8, 0x1979, 0x191C, 0x18C0, 0x1865, 0x180B, 0x17B3, 0x175C, 0x1706, 0x16B2, 0x165E, 0x160C, 0x15BB, 0x156C, 0x151D, 0x14CF, 0x1483, 0x1438, 0x13EE, 0x13A4, 0x135C, 0x1315, 0x12CF, 0x128A, 0x1246, 0x1203, 0x11C1, 0x1180, 0x1140, 0x1100, 0x10C2, 0x1084, 0x1048, 0x100C, 0xFD1, 0xF97, 0xF5E, 0xF25, 0xEEE, 0xEB7, 0xE81, 0xE4C, 0xE17, 0xDE4, 0xDB1, 0xD7E, 0xD4D, 0xD1C, 0xCEC, 0xCBC, 0xC8E, 0xC60, 0xC32, 0xC05, 0xBD9, 0xBAE, 0xB83, 0xB59, 0xB2F, 0xB06, 0xADD, 0xAB6, 0xA8E, 0xA67, 0xA41, 0xA1C, 0x9F7, 0x9D2, 0x9AE, 0x98A, 0x967, 0x945, 0x923, 0x901, 0x8E0, 0x8C0, 0x8A0, 0x880, 0x861, 0x842, 0x824, 0x806, 0x7E8, 0x7CB, 0x7AF, 0x792, 0x777, 0x75B, 0x740, 0x726, 0x70B, 0x6F2, 0x6D8, 0x6BF, 0x6A6, 0x68E, 0x676, 0x65E, 0x647, 0x630, 0x619, 0x602, 0x5EC, 0x5D7, 0x5C1, 0x5AC, 0x597, 0x583, 0x56E, 0x55B, 0x547, 0x533, 0x520, 0x50E, 0x4FB, 0x4E9,
0x8C02, 0x4D7, 0x4C5, 0x4B3, 0x4A2, 0x491, 0x480, 0x470, 0x460, 0x450, 0x440, 0x430, 0x421, 0x412, 0x403, 0x3F4, 0x3E5, 0x3D7, 0x3C9, 0x3BB, 0x3AD, 0x3A0, 0x393, 0x385, 0x379, 0x36C, 0x35F, 0x353, 0x347, 0x33B, 0x32F, 0x323, 0x318, 0x30C, 0x301, 0x2F6, 0x2EB, 0x2E0, 0x2D6, 0x2CB, 0x2C1, 0x2B7, 0x2AD, 0x2A3, 0x299, 0x290, 0x287, 0x27D, 0x274, 0x26B, 0x262, 0x259, 0x251, 0x248, 0x240, 0x238, 0x230, 0x228, 0x220, 0x218, 0x210, 0x209, 0x201, 0x1FA, 0x1F2, 0x1EB, 0x1E4, 0x1DD, 0x1D6, 0x1D0, 0x1C9, 0x1C2, 0x1BC, 0x1B6, 0x1AF, 0x1A9, 0x1A3, 0x19D, 0x197, 0x191, 0x18C, 0x186, 0x180, 0x17B, 0x175, 0x170, 0x16B, 0x165, 0x160, 0x15B, 0x156, 0x151, 0x14C, 0x148, 0x143, 0x13E, 0x13A, 0x135, 0x131, 0x12C, 0x128, 0x124, 0x120, 0x11C, 0x118, 0x114, 0x110, 0x10C, 0x108, 0x104, 0x100, 0xFD, 0xF9, 0xF5, 0xF2, 0xEE,
0x8A00,
0x8805,
0x8612,
0x8426,
0x8241,
0x8063,
0x7E8C,
0x7CBB,
0x7AF2,
0x792E,
0x7772,
0x75BB,
0x740B,
0x7261,
0x70BD,
0x6F20,
0x6D88,
0x6BF6,
0x6A69,
0x68E3,
0x6762,
0x65E6,
0x6470,
0x6300,
0x6194,
0x602E,
0x5ECD,
0x5D71,
0x5C1A,
0x5AC8,
0x597B,
0x5833,
0x56EF,
0x55B0,
0x5475,
0x533F,
0x520E,
0x50E1,
0x4FB8,
0x4E93,
0x4D73,
0x4C57,
0x4B3E,
0x4A2A,
0x491A,
0x480E,
0x4705,
0x4601,
0x4500,
0x4402,
0x4309,
0x4213,
0x4120,
0x4031,
0x3F46,
0x3E5D,
0x3D79,
0x3C97,
0x3BB9,
0x3ADD,
0x3A05,
0x3930,
0x385E,
0x3790,
0x36C4,
0x35FB,
0x3534,
0x3471,
0x33B1,
0x32F3,
0x3238,
0x3180,
0x30CA,
0x3017,
0x2F66,
0x2EB8,
0x2E0D,
0x2D64,
0x2CBD,
0x2C19,
0x2B77,
0x2AD8,
0x2A3A,
0x299F,
0x2907,
0x2870,
0x27DC,
0x2749,
0x26B9,
0x262B,
0x259F,
0x2515,
0x248D,
0x2407,
0x2382,
0x2300,
0x2280,
0x2201,
0x2184,
0x2109,
0x2090,
0x2018,
0x1FA3,
0x1F2E,
0x1EBC,
0x1E4B,
0x1DDC,
0x1D6E,
0x1D02,
0x1C98,
0x1C2F,
0x1BC8,
0x1B62,
0x1AFD,
0x1A9A,
0x1A38,
0x19D8,
0x1979,
0x191C,
0x18C0,
0x1865,
0x180B,
0x17B3,
0x175C,
0x1706,
0x16B2,
0x165E,
0x160C,
0x15BB,
0x156C,
0x151D,
0x14CF,
0x1483,
0x1438,
0x13EE,
0x13A4,
0x135C,
0x1315,
0x12CF,
0x128A,
0x1246,
0x1203,
0x11C1,
0x1180,
0x1140,
0x1100,
0x10C2,
0x1084,
0x1048,
0x100C,
0xFD1,
0xF97,
0xF5E,
0xF25,
0xEEE,
0xEB7,
0xE81,
0xE4C,
0xE17,
0xDE4,
0xDB1,
0xD7E,
0xD4D,
0xD1C,
0xCEC,
0xCBC,
0xC8E,
0xC60,
0xC32,
0xC05,
0xBD9,
0xBAE,
0xB83,
0xB59,
0xB2F,
0xB06,
0xADD,
0xAB6,
0xA8E,
0xA67,
0xA41,
0xA1C,
0x9F7,
0x9D2,
0x9AE,
0x98A,
0x967,
0x945,
0x923,
0x901,
0x8E0,
0x8C0,
0x8A0,
0x880,
0x861,
0x842,
0x824,
0x806,
0x7E8,
0x7CB,
0x7AF,
0x792,
0x777,
0x75B,
0x740,
0x726,
0x70B,
0x6F2,
0x6D8,
0x6BF,
0x6A6,
0x68E,
0x676,
0x65E,
0x647,
0x630,
0x619,
0x602,
0x5EC,
0x5D7,
0x5C1,
0x5AC,
0x597,
0x583,
0x56E,
0x55B,
0x547,
0x533,
0x520,
0x50E,
0x4FB,
0x4E9,
0x4D7,
0x4C5,
0x4B3,
0x4A2,
0x491,
0x480,
0x470,
0x460,
0x450,
0x440,
0x430,
0x421,
0x412,
0x403,
0x3F4,
0x3E5,
0x3D7,
0x3C9,
0x3BB,
0x3AD,
0x3A0,
0x393,
0x385,
0x379,
0x36C,
0x35F,
0x353,
0x347,
0x33B,
0x32F,
0x323,
0x318,
0x30C,
0x301,
0x2F6,
0x2EB,
0x2E0,
0x2D6,
0x2CB,
0x2C1,
0x2B7,
0x2AD,
0x2A3,
0x299,
0x290,
0x287,
0x27D,
0x274,
0x26B,
0x262,
0x259,
0x251,
0x248,
0x240,
0x238,
0x230,
0x228,
0x220,
0x218,
0x210,
0x209,
0x201,
0x1FA,
0x1F2,
0x1EB,
0x1E4,
0x1DD,
0x1D6,
0x1D0,
0x1C9,
0x1C2,
0x1BC,
0x1B6,
0x1AF,
0x1A9,
0x1A3,
0x19D,
0x197,
0x191,
0x18C,
0x186,
0x180,
0x17B,
0x175,
0x170,
0x16B,
0x165,
0x160,
0x15B,
0x156,
0x151,
0x14C,
0x148,
0x143,
0x13E,
0x13A,
0x135,
0x131,
0x12C,
0x128,
0x124,
0x120,
0x11C,
0x118,
0x114,
0x110,
0x10C,
0x108,
0x104,
0x100,
0xFD,
0xF9,
0xF5,
0xF2,
0xEE,
}; };

View file

@ -1,52 +1,8 @@
#include "muse.h" #include "muse.h"
enum { enum { MUSE_OFF, MUSE_ON, MUSE_C_1_2, MUSE_C1, MUSE_C2, MUSE_C4, MUSE_C8, MUSE_C3, MUSE_C6, MUSE_B1, MUSE_B2, MUSE_B3, MUSE_B4, MUSE_B5, MUSE_B6, MUSE_B7, MUSE_B8, MUSE_B9, MUSE_B10, MUSE_B11, MUSE_B12, MUSE_B13, MUSE_B14, MUSE_B15, MUSE_B16, MUSE_B17, MUSE_B18, MUSE_B19, MUSE_B20, MUSE_B21, MUSE_B22, MUSE_B23, MUSE_B24, MUSE_B25, MUSE_B26, MUSE_B27, MUSE_B28, MUSE_B29, MUSE_B30, MUSE_B31 };
MUSE_OFF,
MUSE_ON,
MUSE_C_1_2,
MUSE_C1,
MUSE_C2,
MUSE_C4,
MUSE_C8,
MUSE_C3,
MUSE_C6,
MUSE_B1,
MUSE_B2,
MUSE_B3,
MUSE_B4,
MUSE_B5,
MUSE_B6,
MUSE_B7,
MUSE_B8,
MUSE_B9,
MUSE_B10,
MUSE_B11,
MUSE_B12,
MUSE_B13,
MUSE_B14,
MUSE_B15,
MUSE_B16,
MUSE_B17,
MUSE_B18,
MUSE_B19,
MUSE_B20,
MUSE_B21,
MUSE_B22,
MUSE_B23,
MUSE_B24,
MUSE_B25,
MUSE_B26,
MUSE_B27,
MUSE_B28,
MUSE_B29,
MUSE_B30,
MUSE_B31
};
bool number_of_ones_to_bool[16] = { bool number_of_ones_to_bool[16] = {1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1};
1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1
};
uint8_t muse_interval[4] = {MUSE_B7, MUSE_B19, MUSE_B3, MUSE_B28}; uint8_t muse_interval[4] = {MUSE_B7, MUSE_B19, MUSE_B3, MUSE_B28};
uint8_t muse_theme[4] = {MUSE_B8, MUSE_B23, MUSE_B18, MUSE_B17}; uint8_t muse_theme[4] = {MUSE_B8, MUSE_B23, MUSE_B18, MUSE_B17};
@ -83,13 +39,7 @@ bool bit_for_value(uint8_t value) {
} }
uint8_t muse_clock_pulse(void) { uint8_t muse_clock_pulse(void) {
bool top = number_of_ones_to_bool[bit_for_value(muse_theme[0]) + (bit_for_value(muse_theme[1]) << 1) + (bit_for_value(muse_theme[2]) << 2) + (bit_for_value(muse_theme[3]) << 3)];
bool top = number_of_ones_to_bool[
bit_for_value(muse_theme[0]) +
(bit_for_value(muse_theme[1]) << 1) +
(bit_for_value(muse_theme[2]) << 2) +
(bit_for_value(muse_theme[3]) << 3)
];
if (muse_timer_1bit == 0) { if (muse_timer_1bit == 0) {
if (muse_timer_2bit_counter == 0) { if (muse_timer_2bit_counter == 0) {
@ -102,10 +52,5 @@ uint8_t muse_clock_pulse(void) {
muse_timer_1bit = (muse_timer_1bit + 1) % 2; muse_timer_1bit = (muse_timer_1bit + 1) % 2;
return return bit_for_value(muse_interval[0]) + (bit_for_value(muse_interval[1]) << 1) + (bit_for_value(muse_interval[2]) << 2) + (bit_for_value(muse_interval[3]) << 3);
bit_for_value(muse_interval[0]) +
(bit_for_value(muse_interval[1]) << 1) +
(bit_for_value(muse_interval[2]) << 2) +
(bit_for_value(muse_interval[3]) << 3);
} }

View file

@ -20,12 +20,12 @@
// Tempo Placeholder // Tempo Placeholder
#define TEMPO_DEFAULT 100 #define TEMPO_DEFAULT 100
#define SONG(notes...) \
#define SONG(notes...) { notes } { notes }
// Note Types // Note Types
#define MUSICAL_NOTE(note, duration) {(NOTE##note), duration} #define MUSICAL_NOTE(note, duration) \
{ (NOTE##note), duration }
#define BREVE_NOTE(note) MUSICAL_NOTE(note, 128) #define BREVE_NOTE(note) MUSICAL_NOTE(note, 128)
#define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64) #define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64)
#define HALF_NOTE(note) MUSICAL_NOTE(note, 32) #define HALF_NOTE(note) MUSICAL_NOTE(note, 32)
@ -230,5 +230,4 @@
#define NOTE_AF8 NOTE_GS8 #define NOTE_AF8 NOTE_GS8
#define NOTE_BF8 NOTE_AS8 #define NOTE_BF8 NOTE_AS8
#endif #endif

View file

@ -26,25 +26,15 @@
* Author: Friedrich Schiller * Author: Friedrich Schiller
+ License: Public Domain + License: Public Domain
*/ */
#define ODE_TO_JOY \ #define ODE_TO_JOY Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), Q__NOTE(_C4), Q__NOTE(_C4), Q__NOTE(_D4), Q__NOTE(_E4), QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4),
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \
Q__NOTE(_C4), Q__NOTE(_C4), Q__NOTE(_D4), Q__NOTE(_E4), \
QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4),
/* Rock-a-bye Baby /* Rock-a-bye Baby
* Author: Unknown * Author: Unknown
+ License: Public Domain + License: Public Domain
*/ */
#define ROCK_A_BYE_BABY \ #define ROCK_A_BYE_BABY QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), H__NOTE(_A5), Q__NOTE(_G5), QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), H__NOTE(_FS5),
QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), \
H__NOTE(_A5), Q__NOTE(_G5), \
QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), \
H__NOTE(_FS5),
#define CLUEBOARD_SOUND HD_NOTE(_C3), HD_NOTE(_D3), HD_NOTE(_E3), HD_NOTE(_F3), HD_NOTE(_G3), HD_NOTE(_A4), HD_NOTE(_B4), HD_NOTE(_C4)
#define CLUEBOARD_SOUND \
HD_NOTE(_C3), HD_NOTE(_D3), HD_NOTE(_E3), HD_NOTE(_F3), HD_NOTE(_G3), HD_NOTE(_A4), HD_NOTE(_B4), HD_NOTE(_C4)
/* /*
HD_NOTE(_G3), HD_NOTE(_E3), HD_NOTE(_C3), \ HD_NOTE(_G3), HD_NOTE(_E3), HD_NOTE(_C3), \
Q__NOTE(_E3), Q__NOTE(_C3), Q__NOTE(_G3), \ Q__NOTE(_E3), Q__NOTE(_C3), Q__NOTE(_G3), \
@ -56,258 +46,93 @@
Q__NOTE(_F3) Q__NOTE(_F3)
*/ */
#define STARTUP_SOUND \ #define STARTUP_SOUND E__NOTE(_E6), E__NOTE(_A6), ED_NOTE(_E7),
E__NOTE(_E6), \
E__NOTE(_A6), \
ED_NOTE(_E7),
#define GOODBYE_SOUND \ #define GOODBYE_SOUND E__NOTE(_E7), E__NOTE(_A6), ED_NOTE(_E6),
E__NOTE(_E7), \
E__NOTE(_A6), \
ED_NOTE(_E6),
#define PLANCK_SOUND \ #define PLANCK_SOUND ED_NOTE(_E7), E__NOTE(_CS7), E__NOTE(_E6), E__NOTE(_A6), M__NOTE(_CS7, 20),
ED_NOTE(_E7 ), \
E__NOTE(_CS7), \
E__NOTE(_E6 ), \
E__NOTE(_A6 ), \
M__NOTE(_CS7, 20),
#define PREONIC_SOUND \ #define PREONIC_SOUND M__NOTE(_B5, 20), E__NOTE(_B6), M__NOTE(_DS6, 20), E__NOTE(_B6),
M__NOTE(_B5, 20), \
E__NOTE(_B6), \
M__NOTE(_DS6, 20), \
E__NOTE(_B6),
#define QWERTY_SOUND \ #define QWERTY_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), Q__NOTE(_E7),
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
Q__NOTE(_E7 ),
#define COLEMAK_SOUND \ #define COLEMAK_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_E7), S__NOTE(_REST), ED_NOTE(_GS7),
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_E7 ), \
S__NOTE(_REST), \
ED_NOTE(_GS7 ),
#define DVORAK_SOUND \ #define DVORAK_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), E__NOTE(_E7), S__NOTE(_REST), E__NOTE(_FS7), S__NOTE(_REST), E__NOTE(_E7),
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
E__NOTE(_E7 ), \
S__NOTE(_REST), \
E__NOTE(_FS7 ), \
S__NOTE(_REST), \
E__NOTE(_E7 ),
#define WORKMAN_SOUND \ #define WORKMAN_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_FS7), S__NOTE(_REST), ED_NOTE(_A7),
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_FS7 ), \
S__NOTE(_REST), \
ED_NOTE(_A7 ),
#define PLOVER_SOUND \ #define PLOVER_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_E7), S__NOTE(_REST), ED_NOTE(_A7),
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_E7 ), \
S__NOTE(_REST), \
ED_NOTE(_A7 ),
#define PLOVER_GOODBYE_SOUND \ #define PLOVER_GOODBYE_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_A7), S__NOTE(_REST), ED_NOTE(_E7),
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_A7 ), \
S__NOTE(_REST), \
ED_NOTE(_E7 ),
#define MUSIC_ON_SOUND \ #define MUSIC_ON_SOUND E__NOTE(_A5), E__NOTE(_B5), E__NOTE(_CS6), E__NOTE(_D6), E__NOTE(_E6), E__NOTE(_FS6), E__NOTE(_GS6), E__NOTE(_A6),
E__NOTE(_A5 ), \
E__NOTE(_B5 ), \
E__NOTE(_CS6), \
E__NOTE(_D6 ), \
E__NOTE(_E6 ), \
E__NOTE(_FS6), \
E__NOTE(_GS6), \
E__NOTE(_A6 ),
#define AUDIO_ON_SOUND \ #define AUDIO_ON_SOUND E__NOTE(_A5), E__NOTE(_A6),
E__NOTE(_A5 ), \
E__NOTE(_A6 ),
#define AUDIO_OFF_SOUND \ #define AUDIO_OFF_SOUND E__NOTE(_A6), E__NOTE(_A5),
E__NOTE(_A6 ), \
E__NOTE(_A5 ),
#define MUSIC_SCALE_SOUND MUSIC_ON_SOUND #define MUSIC_SCALE_SOUND MUSIC_ON_SOUND
#define MUSIC_OFF_SOUND \ #define MUSIC_OFF_SOUND E__NOTE(_A6), E__NOTE(_GS6), E__NOTE(_FS6), E__NOTE(_E6), E__NOTE(_D6), E__NOTE(_CS6), E__NOTE(_B5), E__NOTE(_A5),
E__NOTE(_A6 ), \
E__NOTE(_GS6 ), \
E__NOTE(_FS6), \
E__NOTE(_E6 ), \
E__NOTE(_D6 ), \
E__NOTE(_CS6), \
E__NOTE(_B5), \
E__NOTE(_A5 ),
#define VOICE_CHANGE_SOUND \ #define VOICE_CHANGE_SOUND Q__NOTE(_A5), Q__NOTE(_CS6), Q__NOTE(_E6), Q__NOTE(_A6),
Q__NOTE(_A5 ), \
Q__NOTE(_CS6), \
Q__NOTE(_E6 ), \
Q__NOTE(_A6 ),
#define CHROMATIC_SOUND \ #define CHROMATIC_SOUND Q__NOTE(_A5), Q__NOTE(_AS5), Q__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_CS6),
Q__NOTE(_A5 ), \
Q__NOTE(_AS5 ), \
Q__NOTE(_B5), \
Q__NOTE(_C6 ), \
Q__NOTE(_CS6 ),
#define MAJOR_SOUND \ #define MAJOR_SOUND Q__NOTE(_A5), Q__NOTE(_B5), Q__NOTE(_CS6), Q__NOTE(_D6), Q__NOTE(_E6),
Q__NOTE(_A5 ), \
Q__NOTE(_B5 ), \
Q__NOTE(_CS6), \
Q__NOTE(_D6 ), \
Q__NOTE(_E6 ),
#define MINOR_SOUND \ #define MINOR_SOUND Q__NOTE(_A5), Q__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_D6), Q__NOTE(_E6),
Q__NOTE(_A5 ), \
Q__NOTE(_B5 ), \
Q__NOTE(_C6 ), \
Q__NOTE(_D6 ), \
Q__NOTE(_E6 ),
#define GUITAR_SOUND \ #define GUITAR_SOUND Q__NOTE(_E5), Q__NOTE(_A5), Q__NOTE(_D6), Q__NOTE(_G6),
Q__NOTE(_E5 ), \
Q__NOTE(_A5), \
Q__NOTE(_D6 ), \
Q__NOTE(_G6 ),
#define VIOLIN_SOUND \ #define VIOLIN_SOUND Q__NOTE(_G5), Q__NOTE(_D6), Q__NOTE(_A6), Q__NOTE(_E7),
Q__NOTE(_G5 ), \
Q__NOTE(_D6), \
Q__NOTE(_A6 ), \
Q__NOTE(_E7 ),
#define CAPS_LOCK_ON_SOUND \ #define CAPS_LOCK_ON_SOUND E__NOTE(_A3), E__NOTE(_B3),
E__NOTE(_A3), \
E__NOTE(_B3),
#define CAPS_LOCK_OFF_SOUND \ #define CAPS_LOCK_OFF_SOUND E__NOTE(_B3), E__NOTE(_A3),
E__NOTE(_B3), \
E__NOTE(_A3),
#define SCROLL_LOCK_ON_SOUND \ #define SCROLL_LOCK_ON_SOUND E__NOTE(_D4), E__NOTE(_E4),
E__NOTE(_D4), \
E__NOTE(_E4),
#define SCROLL_LOCK_OFF_SOUND \ #define SCROLL_LOCK_OFF_SOUND E__NOTE(_E4), E__NOTE(_D4),
E__NOTE(_E4), \
E__NOTE(_D4),
#define NUM_LOCK_ON_SOUND \ #define NUM_LOCK_ON_SOUND E__NOTE(_D5), E__NOTE(_E5),
E__NOTE(_D5), \
E__NOTE(_E5),
#define NUM_LOCK_OFF_SOUND \ #define NUM_LOCK_OFF_SOUND E__NOTE(_E5), E__NOTE(_D5),
E__NOTE(_E5), \
E__NOTE(_D5),
#define AG_NORM_SOUND \ #define AG_NORM_SOUND E__NOTE(_A5), E__NOTE(_A5),
E__NOTE(_A5), \
E__NOTE(_A5),
#define AG_SWAP_SOUND \ #define AG_SWAP_SOUND SD_NOTE(_B5), SD_NOTE(_A5), SD_NOTE(_B5), SD_NOTE(_A5),
SD_NOTE(_B5), \
SD_NOTE(_A5), \
SD_NOTE(_B5), \
SD_NOTE(_A5),
#define UNICODE_WINDOWS \ #define UNICODE_WINDOWS E__NOTE(_B5), S__NOTE(_E6),
E__NOTE(_B5), \
S__NOTE(_E6),
#define UNICODE_LINUX \ #define UNICODE_LINUX E__NOTE(_E6), S__NOTE(_B5),
E__NOTE(_E6), \
S__NOTE(_B5),
#define TERMINAL_SOUND \
E__NOTE(_C5 )
#define TERMINAL_SOUND E__NOTE(_C5)
/* Title: La Campanella /* Title: La Campanella
* Author/Composer: Frank Lizst * Author/Composer: Frank Lizst
+ License: Public Domain + License: Public Domain
*/ */
#define CAMPANELLA \ #define CAMPANELLA \
Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS5), E__NOTE(_DS5), \ Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS6), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_E5), E__NOTE(_E5), E__NOTE(_DS6), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_AS4), \
E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), \ E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), Q__NOTE(_CS6), E__NOTE(_CS6), E__NOTE(_DS7), Q__NOTE(_B5), E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_B5), E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), E__NOTE(_DS7), Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_G5), E__NOTE(_G5), E__NOTE(_DS7), Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), E__NOTE(_DS7), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS7), W__NOTE(_DS6), W__NOTE(_GS5),
Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_GS4), \
E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), \
E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS6), \
Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_E5), E__NOTE(_E5), E__NOTE(_DS6), Q__NOTE(_DS5), \
E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), \
E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), \
Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), \
E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), \
E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), \
Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), Q__NOTE(_CS6), E__NOTE(_CS6), E__NOTE(_DS7), Q__NOTE(_B5), \
E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_B5), E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), \
E__NOTE(_DS7), Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_G5), E__NOTE(_G5), E__NOTE(_DS7), \
Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), E__NOTE(_DS7), Q__NOTE(_DS5), \
E__NOTE(_DS5), E__NOTE(_DS7), W__NOTE(_DS6), W__NOTE(_GS5),
/* Title: Fantaisie-Impromptu /* Title: Fantaisie-Impromptu
* Author/Composer: Chopin * Author/Composer: Chopin
* License: Public Domain * License: Public Domain
*/ */
#define FANTASIE_IMPROMPTU \ #define FANTASIE_IMPROMPTU \
E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), \ E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_A4), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_CS6), E__NOTE(_DS6), E__NOTE(_B6), E__NOTE(_A6), E__NOTE(_GS6), E__NOTE(_FS6), E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_FS6), E__NOTE(_CS6), E__NOTE(_C5), E__NOTE(_DS6), E__NOTE(_A5), E__NOTE(_GS5), E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_FS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_DS5), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_B4), E__NOTE(_A4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), \
E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_A4), \ E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_AS4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_DS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_REST), E__NOTE(_DS5), E__NOTE(_B5), E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_CS6), E__NOTE(_B5), E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_AS5), WD_NOTE(_GS5),
E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), \
E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_A4), E__NOTE(_CS5), E__NOTE(_DS5), \
E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_CS6), E__NOTE(_DS6), E__NOTE(_B6), E__NOTE(_A6), E__NOTE(_GS6), E__NOTE(_FS6), \
E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_FS6), E__NOTE(_CS6), E__NOTE(_C5), E__NOTE(_DS6), E__NOTE(_A5), E__NOTE(_GS5), \
E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_FS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_DS5), \
E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_B4), E__NOTE(_A4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), \
E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), \
E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_AS4), E__NOTE(_GS4), E__NOTE(_REST), \
E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), \
E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_DS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_REST), E__NOTE(_DS5), \
E__NOTE(_B5), E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_CS6), E__NOTE(_B5), \
E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_AS5), WD_NOTE(_GS5),
/* Title: Nocturne Op. 9 No. 1 in B flat minor /* Title: Nocturne Op. 9 No. 1 in B flat minor
* Author/Composer: Chopin * Author/Composer: Chopin
License: Public Domain License: Public Domain
*/ */
#define NOCTURNE_OP_9_NO_1 \ #define NOCTURNE_OP_9_NO_1 \
H__NOTE(_BF5), H__NOTE(_C6), H__NOTE(_DF6), H__NOTE(_A5), H__NOTE(_BF5), H__NOTE(_GF5), W__NOTE(_F5), W__NOTE(_F5), W__NOTE(_F5), \ H__NOTE(_BF5), H__NOTE(_C6), H__NOTE(_DF6), H__NOTE(_A5), H__NOTE(_BF5), H__NOTE(_GF5), W__NOTE(_F5), W__NOTE(_F5), W__NOTE(_F5), W__NOTE(_F5), H__NOTE(_GF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_C5), B__NOTE(_DF5), W__NOTE(_BF4), Q__NOTE(_BF5), Q__NOTE(_C6), Q__NOTE(_DF6), Q__NOTE(_A5), Q__NOTE(_BF5), Q__NOTE(_A5), Q__NOTE(_GS5), Q__NOTE(_A5), Q__NOTE(_C6), Q__NOTE(_BF5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_GF5), Q__NOTE(_E5), Q__NOTE(_F5), Q__NOTE(_BF5), Q__NOTE(_A5), Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), Q__NOTE(_D5), Q__NOTE(_DF5), Q__NOTE(_C5), Q__NOTE(_DF5), Q__NOTE(_C5), Q__NOTE(_B4), Q__NOTE(_C5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), B__NOTE(_DF5), W__NOTE(_BF4), W__NOTE(_BF5), W__NOTE(_BF5), W__NOTE(_BF5), BD_NOTE(_AF5), W__NOTE(_DF5), H__NOTE(_BF4), H__NOTE(_C5), H__NOTE(_DF5), H__NOTE(_GF5), H__NOTE(_GF5), BD_NOTE(_F5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_DF5), H__NOTE(_A4), B__NOTE(_AF4), \
W__NOTE(_F5), H__NOTE(_GF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_C5), B__NOTE(_DF5), W__NOTE(_BF4), Q__NOTE(_BF5), \ W__NOTE(_DF5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_DF5), H__NOTE(_EF5), BD_NOTE(_F5),
Q__NOTE(_C6), Q__NOTE(_DF6), Q__NOTE(_A5), Q__NOTE(_BF5), Q__NOTE(_A5), Q__NOTE(_GS5), Q__NOTE(_A5), Q__NOTE(_C6), \
Q__NOTE(_BF5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_GF5), Q__NOTE(_E5), Q__NOTE(_F5), Q__NOTE(_BF5), Q__NOTE(_A5), \
Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), Q__NOTE(_D5), Q__NOTE(_DF5), \
Q__NOTE(_C5), Q__NOTE(_DF5), Q__NOTE(_C5), Q__NOTE(_B4), Q__NOTE(_C5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), \
B__NOTE(_DF5), W__NOTE(_BF4), W__NOTE(_BF5), W__NOTE(_BF5), W__NOTE(_BF5), BD_NOTE(_AF5), W__NOTE(_DF5), H__NOTE(_BF4), \
H__NOTE(_C5), H__NOTE(_DF5), H__NOTE(_GF5), H__NOTE(_GF5), BD_NOTE(_F5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), \
H__NOTE(_DF5), H__NOTE(_A4), B__NOTE(_AF4), W__NOTE(_DF5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_DF5), \
H__NOTE(_EF5), BD_NOTE(_F5),
/* Removed sounds /* Removed sounds
+ This list is here solely for compatibility, so that removed songs don't just break things + This list is here solely for compatibility, so that removed songs don't just break things

View file

@ -25,22 +25,15 @@ extern bool glissando;
voice_type voice = default_voice; voice_type voice = default_voice;
void set_voice(voice_type v) { void set_voice(voice_type v) { voice = v; }
voice = v;
}
void voice_iterate() { void voice_iterate() { voice = (voice + 1) % number_of_voices; }
voice = (voice + 1) % number_of_voices;
}
void voice_deiterate() { void voice_deiterate() { voice = (voice - 1 + number_of_voices) % number_of_voices; }
voice = (voice - 1 + number_of_voices) % number_of_voices;
}
float voice_envelope(float frequency) { float voice_envelope(float frequency) {
// envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
__attribute__ ((unused)) __attribute__((unused)) uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
switch (voice) { switch (voice) {
case default_voice: case default_voice:
@ -90,9 +83,7 @@ float voice_envelope(float frequency) {
// frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8); // frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
if (frequency < 80.0) { if (frequency < 80.0) {
} else if (frequency < 160.0) { } else if (frequency < 160.0) {
// Bass drum: 60 - 100 Hz // Bass drum: 60 - 100 Hz
frequency = (rand() % (int)(40)) + 60; frequency = (rand() % (int)(40)) + 60;
switch (envelope_index) { switch (envelope_index) {
@ -108,8 +99,6 @@ float voice_envelope(float frequency) {
} }
} else if (frequency < 320.0) { } else if (frequency < 320.0) {
// Snare drum: 1 - 2 KHz // Snare drum: 1 - 2 KHz
frequency = (rand() % (int)(1000)) + 1000; frequency = (rand() % (int)(1000)) + 1000;
switch (envelope_index) { switch (envelope_index) {
@ -125,7 +114,6 @@ float voice_envelope(float frequency) {
} }
} else if (frequency < 640.0) { } else if (frequency < 640.0) {
// Closed Hi-hat: 3 - 5 KHz // Closed Hi-hat: 3 - 5 KHz
frequency = (rand() % (int)(2000)) + 3000; frequency = (rand() % (int)(2000)) + 3000;
switch (envelope_index) { switch (envelope_index) {
@ -141,7 +129,6 @@ float voice_envelope(float frequency) {
} }
} else if (frequency < 1280.0) { } else if (frequency < 1280.0) {
// Open Hi-hat: 3 - 5 KHz // Open Hi-hat: 3 - 5 KHz
frequency = (rand() % (int)(2000)) + 3000; frequency = (rand() % (int)(2000)) + 3000;
switch (envelope_index) { switch (envelope_index) {
@ -155,7 +142,6 @@ float voice_envelope(float frequency) {
note_timbre = 0; note_timbre = 0;
break; break;
} }
} }
break; break;
case butts_fader: case butts_fader:
@ -225,10 +211,8 @@ float voice_envelope(float frequency) {
glissando = true; glissando = true;
polyphony_rate = 0; polyphony_rate = 0;
note_timbre = (envelope_index % 2) * .125 + .375 * 2; note_timbre = (envelope_index % 2) * .125 + .375 * 2;
if ((envelope_index % 4) == 0) if ((envelope_index % 4) == 0) note_timbre = 0.5;
note_timbre = 0.5; if ((envelope_index % 8) == 0) note_timbre = 0;
if ((envelope_index % 8) == 0)
note_timbre = 0;
break; break;
case delayed_vibrato: case delayed_vibrato:
glissando = true; glissando = true;

View file

@ -21,261 +21,16 @@
#define SINE_LENGTH 2048 #define SINE_LENGTH 2048
const uint8_t sinewave[] PROGMEM = // 2048 values const uint8_t sinewave[] PROGMEM = // 2048 values
{ {0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x82, 0x82, 0x83, 0x83, 0x83, 0x84, 0x84, 0x85, 0x85, 0x85, 0x86, 0x86, 0x87, 0x87, 0x87, 0x88, 0x88, 0x88, 0x89, 0x89, 0x8a, 0x8a, 0x8a, 0x8b, 0x8b, 0x8c, 0x8c, 0x8c, 0x8d, 0x8d, 0x8e, 0x8e, 0x8e, 0x8f, 0x8f, 0x8f, 0x90, 0x90, 0x91, 0x91, 0x91, 0x92, 0x92, 0x93, 0x93, 0x93, 0x94, 0x94, 0x95, 0x95, 0x95, 0x96, 0x96, 0x96, 0x97, 0x97, 0x98, 0x98, 0x98, 0x99, 0x99, 0x9a, 0x9a, 0x9a, 0x9b, 0x9b, 0x9b, 0x9c, 0x9c, 0x9d, 0x9d, 0x9d, 0x9e, 0x9e, 0x9e, 0x9f, 0x9f, 0xa0, 0xa0, 0xa0, 0xa1, 0xa1, 0xa2, 0xa2, 0xa2, 0xa3, 0xa3, 0xa3, 0xa4, 0xa4, 0xa5, 0xa5, 0xa5, 0xa6, 0xa6, 0xa6, 0xa7, 0xa7, 0xa7, 0xa8, 0xa8, 0xa9, 0xa9, 0xa9, 0xaa, 0xaa, 0xaa, 0xab, 0xab, 0xac, 0xac, 0xac, 0xad, 0xad, 0xad, 0xae, 0xae, 0xae, 0xaf, 0xaf, 0xb0, 0xb0, 0xb0, 0xb1, 0xb1, 0xb1, 0xb2, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb4, 0xb5, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8, 0xb9, 0xb9, 0xba, 0xba, 0xba, 0xbb,
0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82, 0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbe, 0xbe, 0xbe, 0xbf, 0xbf, 0xbf, 0xc0, 0xc0, 0xc0, 0xc1, 0xc1, 0xc1, 0xc2, 0xc2, 0xc2, 0xc3, 0xc3, 0xc3, 0xc4, 0xc4, 0xc4, 0xc5, 0xc5, 0xc5, 0xc6, 0xc6, 0xc6, 0xc7, 0xc7, 0xc7, 0xc8, 0xc8, 0xc8, 0xc9, 0xc9, 0xc9, 0xca, 0xca, 0xca, 0xcb, 0xcb, 0xcb, 0xcb, 0xcc, 0xcc, 0xcc, 0xcd, 0xcd, 0xcd, 0xce, 0xce, 0xce, 0xcf, 0xcf, 0xcf, 0xcf, 0xd0, 0xd0, 0xd0, 0xd1, 0xd1, 0xd1, 0xd2, 0xd2, 0xd2, 0xd2, 0xd3, 0xd3, 0xd3, 0xd4, 0xd4, 0xd4, 0xd5, 0xd5, 0xd5, 0xd5, 0xd6, 0xd6, 0xd6, 0xd7, 0xd7, 0xd7, 0xd7, 0xd8, 0xd8, 0xd8, 0xd9, 0xd9, 0xd9, 0xd9, 0xda, 0xda, 0xda, 0xda, 0xdb, 0xdb, 0xdb, 0xdc, 0xdc, 0xdc, 0xdc, 0xdd, 0xdd, 0xdd, 0xdd, 0xde, 0xde, 0xde, 0xde, 0xdf, 0xdf, 0xdf, 0xe0, 0xe0, 0xe0, 0xe0, 0xe1, 0xe1, 0xe1, 0xe1, 0xe2, 0xe2, 0xe2, 0xe2, 0xe3, 0xe3, 0xe3, 0xe3, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe5, 0xe5, 0xe5, 0xe5, 0xe6, 0xe6, 0xe6, 0xe6, 0xe7, 0xe7, 0xe7, 0xe7, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8,
0x83,0x83,0x83,0x84,0x84,0x85,0x85,0x85, 0xe9, 0xe9, 0xe9, 0xe9, 0xea, 0xea, 0xea, 0xea, 0xea, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xec, 0xec, 0xec, 0xec, 0xec, 0xed, 0xed, 0xed, 0xed, 0xed, 0xee, 0xee, 0xee, 0xee, 0xee, 0xef, 0xef, 0xef, 0xef, 0xef, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x88, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7,
0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xef, 0xef, 0xef, 0xef, 0xef, 0xee, 0xee, 0xee, 0xee, 0xee, 0xed, 0xed, 0xed, 0xed, 0xed, 0xec, 0xec, 0xec, 0xec, 0xec, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xea, 0xea, 0xea, 0xea, 0xea, 0xe9, 0xe9, 0xe9, 0xe9, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0xe7, 0xe7, 0xe7, 0xe7, 0xe6, 0xe6, 0xe6, 0xe6, 0xe5, 0xe5, 0xe5, 0xe5, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe3, 0xe3, 0xe3, 0xe3, 0xe2, 0xe2, 0xe2, 0xe2, 0xe1, 0xe1, 0xe1, 0xe1, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xdf, 0xdf, 0xde, 0xde, 0xde, 0xde, 0xdd, 0xdd, 0xdd, 0xdd, 0xdc, 0xdc, 0xdc, 0xdc, 0xdb, 0xdb, 0xdb, 0xda, 0xda, 0xda, 0xda, 0xd9, 0xd9, 0xd9, 0xd9, 0xd8, 0xd8, 0xd8, 0xd7, 0xd7, 0xd7, 0xd7, 0xd6, 0xd6, 0xd6, 0xd5, 0xd5, 0xd5, 0xd5, 0xd4, 0xd4, 0xd4,
0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f, 0xd3, 0xd3, 0xd3, 0xd2, 0xd2, 0xd2, 0xd2, 0xd1, 0xd1, 0xd1, 0xd0, 0xd0, 0xd0, 0xcf, 0xcf, 0xcf, 0xcf, 0xce, 0xce, 0xce, 0xcd, 0xcd, 0xcd, 0xcc, 0xcc, 0xcc, 0xcb, 0xcb, 0xcb, 0xcb, 0xca, 0xca, 0xca, 0xc9, 0xc9, 0xc9, 0xc8, 0xc8, 0xc8, 0xc7, 0xc7, 0xc7, 0xc6, 0xc6, 0xc6, 0xc5, 0xc5, 0xc5, 0xc4, 0xc4, 0xc4, 0xc3, 0xc3, 0xc3, 0xc2, 0xc2, 0xc2, 0xc1, 0xc1, 0xc1, 0xc0, 0xc0, 0xc0, 0xbf, 0xbf, 0xbf, 0xbe, 0xbe, 0xbe, 0xbd, 0xbd, 0xbd, 0xbc, 0xbc, 0xbc, 0xbb, 0xbb, 0xbb, 0xba, 0xba, 0xba, 0xb9, 0xb9, 0xb8, 0xb8, 0xb8, 0xb7, 0xb7, 0xb7, 0xb6, 0xb6, 0xb6, 0xb5, 0xb5, 0xb5, 0xb4, 0xb4, 0xb4, 0xb3, 0xb3, 0xb2, 0xb2, 0xb2, 0xb1, 0xb1, 0xb1, 0xb0, 0xb0, 0xb0, 0xaf, 0xaf, 0xae, 0xae, 0xae, 0xad, 0xad, 0xad, 0xac, 0xac, 0xac, 0xab, 0xab, 0xaa, 0xaa, 0xaa, 0xa9, 0xa9, 0xa9, 0xa8, 0xa8, 0xa7, 0xa7, 0xa7, 0xa6, 0xa6, 0xa6, 0xa5, 0xa5, 0xa5, 0xa4, 0xa4, 0xa3, 0xa3, 0xa3, 0xa2, 0xa2, 0xa2, 0xa1, 0xa1, 0xa0, 0xa0, 0xa0, 0x9f, 0x9f, 0x9e, 0x9e, 0x9e, 0x9d,
0x8f,0x8f,0x90,0x90,0x91,0x91,0x91,0x92, 0x9d, 0x9d, 0x9c, 0x9c, 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x99, 0x99, 0x98, 0x98, 0x98, 0x97, 0x97, 0x96, 0x96, 0x96, 0x95, 0x95, 0x95, 0x94, 0x94, 0x93, 0x93, 0x93, 0x92, 0x92, 0x91, 0x91, 0x91, 0x90, 0x90, 0x8f, 0x8f, 0x8f, 0x8e, 0x8e, 0x8e, 0x8d, 0x8d, 0x8c, 0x8c, 0x8c, 0x8b, 0x8b, 0x8a, 0x8a, 0x8a, 0x89, 0x89, 0x88, 0x88, 0x88, 0x87, 0x87, 0x87, 0x86, 0x86, 0x85, 0x85, 0x85, 0x84, 0x84, 0x83, 0x83, 0x83, 0x82, 0x82, 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x7f, 0x7f, 0x7e, 0x7e, 0x7e, 0x7d, 0x7d, 0x7c, 0x7c, 0x7c, 0x7b, 0x7b, 0x7a, 0x7a, 0x7a, 0x79, 0x79, 0x78, 0x78, 0x78, 0x77, 0x77, 0x77, 0x76, 0x76, 0x75, 0x75, 0x75, 0x74, 0x74, 0x73, 0x73, 0x73, 0x72, 0x72, 0x71, 0x71, 0x71, 0x70, 0x70, 0x70, 0x6f, 0x6f, 0x6e, 0x6e, 0x6e, 0x6d, 0x6d, 0x6c, 0x6c, 0x6c, 0x6b, 0x6b, 0x6a, 0x6a, 0x6a, 0x69, 0x69, 0x69, 0x68, 0x68, 0x67, 0x67, 0x67, 0x66, 0x66, 0x65, 0x65, 0x65, 0x64, 0x64, 0x64, 0x63, 0x63, 0x62, 0x62, 0x62, 0x61, 0x61, 0x61, 0x60,
0x92,0x93,0x93,0x93,0x94,0x94,0x95,0x95, 0x60, 0x5f, 0x5f, 0x5f, 0x5e, 0x5e, 0x5d, 0x5d, 0x5d, 0x5c, 0x5c, 0x5c, 0x5b, 0x5b, 0x5a, 0x5a, 0x5a, 0x59, 0x59, 0x59, 0x58, 0x58, 0x58, 0x57, 0x57, 0x56, 0x56, 0x56, 0x55, 0x55, 0x55, 0x54, 0x54, 0x53, 0x53, 0x53, 0x52, 0x52, 0x52, 0x51, 0x51, 0x51, 0x50, 0x50, 0x4f, 0x4f, 0x4f, 0x4e, 0x4e, 0x4e, 0x4d, 0x4d, 0x4d, 0x4c, 0x4c, 0x4b, 0x4b, 0x4b, 0x4a, 0x4a, 0x4a, 0x49, 0x49, 0x49, 0x48, 0x48, 0x48, 0x47, 0x47, 0x47, 0x46, 0x46, 0x45, 0x45, 0x45, 0x44, 0x44, 0x44, 0x43, 0x43, 0x43, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x40, 0x40, 0x40, 0x3f, 0x3f, 0x3f, 0x3e, 0x3e, 0x3e, 0x3d, 0x3d, 0x3d, 0x3c, 0x3c, 0x3c, 0x3b, 0x3b, 0x3b, 0x3a, 0x3a, 0x3a, 0x39, 0x39, 0x39, 0x38, 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x36, 0x35, 0x35, 0x35, 0x34, 0x34, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32, 0x31, 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x2f, 0x2f, 0x2e, 0x2e, 0x2e, 0x2d, 0x2d, 0x2d, 0x2d, 0x2c, 0x2c, 0x2c, 0x2b, 0x2b, 0x2b, 0x2a, 0x2a,
0x95,0x96,0x96,0x96,0x97,0x97,0x98,0x98, 0x2a, 0x2a, 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26, 0x26, 0x25, 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21, 0x21, 0x20, 0x20, 0x20, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x1e, 0x1e, 0x1e, 0x1d, 0x1d, 0x1d, 0x1d, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1a, 0x1a, 0x1a, 0x1a, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15, 0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xe, 0xe, 0xe, 0xe, 0xe, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x8, 0x8, 0x8,
0x98,0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9b, 0x8, 0x8, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
0x9b,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,0x9e, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xe, 0xe, 0xe, 0xe, 0xe, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17,
0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x1a, 0x1a, 0x1a, 0x1a, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1c, 0x1c, 0x1c, 0x1c, 0x1d, 0x1d, 0x1d, 0x1d, 0x1e, 0x1e, 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x28, 0x28, 0x28, 0x28, 0x29, 0x29, 0x29, 0x2a, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x30, 0x30, 0x31, 0x31, 0x31, 0x32, 0x32, 0x32, 0x33, 0x33, 0x33, 0x34, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35, 0x36, 0x36, 0x36, 0x37, 0x37, 0x37, 0x38, 0x38, 0x38, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3d, 0x3d, 0x3d, 0x3e, 0x3e, 0x3e, 0x3f, 0x3f, 0x3f, 0x40, 0x40, 0x40, 0x41, 0x41, 0x41, 0x42, 0x42, 0x42, 0x43, 0x43, 0x43, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x46,
0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4, 0x46, 0x47, 0x47, 0x47, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x4a, 0x4a, 0x4a, 0x4b, 0x4b, 0x4b, 0x4c, 0x4c, 0x4d, 0x4d, 0x4d, 0x4e, 0x4e, 0x4e, 0x4f, 0x4f, 0x4f, 0x50, 0x50, 0x51, 0x51, 0x51, 0x52, 0x52, 0x52, 0x53, 0x53, 0x53, 0x54, 0x54, 0x55, 0x55, 0x55, 0x56, 0x56, 0x56, 0x57, 0x57, 0x58, 0x58, 0x58, 0x59, 0x59, 0x59, 0x5a, 0x5a, 0x5a, 0x5b, 0x5b, 0x5c, 0x5c, 0x5c, 0x5d, 0x5d, 0x5d, 0x5e, 0x5e, 0x5f, 0x5f, 0x5f, 0x60, 0x60, 0x61, 0x61, 0x61, 0x62, 0x62, 0x62, 0x63, 0x63, 0x64, 0x64, 0x64, 0x65, 0x65, 0x65, 0x66, 0x66, 0x67, 0x67, 0x67, 0x68, 0x68, 0x69, 0x69, 0x69, 0x6a, 0x6a, 0x6a, 0x6b, 0x6b, 0x6c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6e, 0x6e, 0x6e, 0x6f, 0x6f, 0x70, 0x70, 0x70, 0x71, 0x71, 0x71, 0x72, 0x72, 0x73, 0x73, 0x73, 0x74, 0x74, 0x75, 0x75, 0x75, 0x76, 0x76, 0x77, 0x77, 0x77, 0x78, 0x78, 0x78, 0x79, 0x79, 0x7a, 0x7a, 0x7a, 0x7b, 0x7b, 0x7c, 0x7c, 0x7c, 0x7d, 0x7d, 0x7e, 0x7e, 0x7e, 0x7f, 0x7f};
0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,
0xa7,0xa8,0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,
0xaa,0xab,0xab,0xac,0xac,0xac,0xad,0xad,
0xad,0xae,0xae,0xae,0xaf,0xaf,0xb0,0xb0,
0xb0,0xb1,0xb1,0xb1,0xb2,0xb2,0xb2,0xb3,
0xb3,0xb4,0xb4,0xb4,0xb5,0xb5,0xb5,0xb6,
0xb6,0xb6,0xb7,0xb7,0xb7,0xb8,0xb8,0xb8,
0xb9,0xb9,0xba,0xba,0xba,0xbb,0xbb,0xbb,
0xbc,0xbc,0xbc,0xbd,0xbd,0xbd,0xbe,0xbe,
0xbe,0xbf,0xbf,0xbf,0xc0,0xc0,0xc0,0xc1,
0xc1,0xc1,0xc2,0xc2,0xc2,0xc3,0xc3,0xc3,
0xc4,0xc4,0xc4,0xc5,0xc5,0xc5,0xc6,0xc6,
0xc6,0xc7,0xc7,0xc7,0xc8,0xc8,0xc8,0xc9,
0xc9,0xc9,0xca,0xca,0xca,0xcb,0xcb,0xcb,
0xcb,0xcc,0xcc,0xcc,0xcd,0xcd,0xcd,0xce,
0xce,0xce,0xcf,0xcf,0xcf,0xcf,0xd0,0xd0,
0xd0,0xd1,0xd1,0xd1,0xd2,0xd2,0xd2,0xd2,
0xd3,0xd3,0xd3,0xd4,0xd4,0xd4,0xd5,0xd5,
0xd5,0xd5,0xd6,0xd6,0xd6,0xd7,0xd7,0xd7,
0xd7,0xd8,0xd8,0xd8,0xd9,0xd9,0xd9,0xd9,
0xda,0xda,0xda,0xda,0xdb,0xdb,0xdb,0xdc,
0xdc,0xdc,0xdc,0xdd,0xdd,0xdd,0xdd,0xde,
0xde,0xde,0xde,0xdf,0xdf,0xdf,0xe0,0xe0,
0xe0,0xe0,0xe1,0xe1,0xe1,0xe1,0xe2,0xe2,
0xe2,0xe2,0xe3,0xe3,0xe3,0xe3,0xe4,0xe4,
0xe4,0xe4,0xe4,0xe5,0xe5,0xe5,0xe5,0xe6,
0xe6,0xe6,0xe6,0xe7,0xe7,0xe7,0xe7,0xe8,
0xe8,0xe8,0xe8,0xe8,0xe9,0xe9,0xe9,0xe9,
0xea,0xea,0xea,0xea,0xea,0xeb,0xeb,0xeb,
0xeb,0xeb,0xec,0xec,0xec,0xec,0xec,0xed,
0xed,0xed,0xed,0xed,0xee,0xee,0xee,0xee,
0xee,0xef,0xef,0xef,0xef,0xef,0xf0,0xf0,
0xf0,0xf0,0xf0,0xf0,0xf1,0xf1,0xf1,0xf1,
0xf1,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf3,
0xf3,0xf3,0xf3,0xf3,0xf3,0xf4,0xf4,0xf4,
0xf4,0xf4,0xf4,0xf5,0xf5,0xf5,0xf5,0xf5,
0xf5,0xf5,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,
0xf6,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,
0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
0xfa,0xfa,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,
0xfb,0xfb,0xfb,0xfb,0xfc,0xfc,0xfc,0xfc,
0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfd,0xfd,0xfd,0xfd,0xfd,
0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
0xfd,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
0xfc,0xfc,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,
0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfa,
0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
0xfa,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,
0xf9,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
0xf8,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf5,
0xf5,0xf5,0xf5,0xf5,0xf5,0xf5,0xf4,0xf4,
0xf4,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf3,
0xf3,0xf3,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,
0xf1,0xf1,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,
0xf0,0xf0,0xf0,0xef,0xef,0xef,0xef,0xef,
0xee,0xee,0xee,0xee,0xee,0xed,0xed,0xed,
0xed,0xed,0xec,0xec,0xec,0xec,0xec,0xeb,
0xeb,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xea,
0xea,0xe9,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,
0xe8,0xe8,0xe7,0xe7,0xe7,0xe7,0xe6,0xe6,
0xe6,0xe6,0xe5,0xe5,0xe5,0xe5,0xe4,0xe4,
0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe3,0xe2,
0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe1,0xe0,
0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,
0xde,0xde,0xdd,0xdd,0xdd,0xdd,0xdc,0xdc,
0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,
0xda,0xd9,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,
0xd7,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,
0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3,
0xd3,0xd2,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,
0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xcf,0xce,
0xce,0xce,0xcd,0xcd,0xcd,0xcc,0xcc,0xcc,
0xcb,0xcb,0xcb,0xcb,0xca,0xca,0xca,0xc9,
0xc9,0xc9,0xc8,0xc8,0xc8,0xc7,0xc7,0xc7,
0xc6,0xc6,0xc6,0xc5,0xc5,0xc5,0xc4,0xc4,
0xc4,0xc3,0xc3,0xc3,0xc2,0xc2,0xc2,0xc1,
0xc1,0xc1,0xc0,0xc0,0xc0,0xbf,0xbf,0xbf,
0xbe,0xbe,0xbe,0xbd,0xbd,0xbd,0xbc,0xbc,
0xbc,0xbb,0xbb,0xbb,0xba,0xba,0xba,0xb9,
0xb9,0xb8,0xb8,0xb8,0xb7,0xb7,0xb7,0xb6,
0xb6,0xb6,0xb5,0xb5,0xb5,0xb4,0xb4,0xb4,
0xb3,0xb3,0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,
0xb0,0xb0,0xb0,0xaf,0xaf,0xae,0xae,0xae,
0xad,0xad,0xad,0xac,0xac,0xac,0xab,0xab,
0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa8,
0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa5,0xa5,
0xa5,0xa4,0xa4,0xa3,0xa3,0xa3,0xa2,0xa2,
0xa2,0xa1,0xa1,0xa0,0xa0,0xa0,0x9f,0x9f,
0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9c,0x9c,
0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x99,0x99,
0x98,0x98,0x98,0x97,0x97,0x96,0x96,0x96,
0x95,0x95,0x95,0x94,0x94,0x93,0x93,0x93,
0x92,0x92,0x91,0x91,0x91,0x90,0x90,0x8f,
0x8f,0x8f,0x8e,0x8e,0x8e,0x8d,0x8d,0x8c,
0x8c,0x8c,0x8b,0x8b,0x8a,0x8a,0x8a,0x89,
0x89,0x88,0x88,0x88,0x87,0x87,0x87,0x86,
0x86,0x85,0x85,0x85,0x84,0x84,0x83,0x83,
0x83,0x82,0x82,0x81,0x81,0x81,0x80,0x80,
0x80,0x7f,0x7f,0x7e,0x7e,0x7e,0x7d,0x7d,
0x7c,0x7c,0x7c,0x7b,0x7b,0x7a,0x7a,0x7a,
0x79,0x79,0x78,0x78,0x78,0x77,0x77,0x77,
0x76,0x76,0x75,0x75,0x75,0x74,0x74,0x73,
0x73,0x73,0x72,0x72,0x71,0x71,0x71,0x70,
0x70,0x70,0x6f,0x6f,0x6e,0x6e,0x6e,0x6d,
0x6d,0x6c,0x6c,0x6c,0x6b,0x6b,0x6a,0x6a,
0x6a,0x69,0x69,0x69,0x68,0x68,0x67,0x67,
0x67,0x66,0x66,0x65,0x65,0x65,0x64,0x64,
0x64,0x63,0x63,0x62,0x62,0x62,0x61,0x61,
0x61,0x60,0x60,0x5f,0x5f,0x5f,0x5e,0x5e,
0x5d,0x5d,0x5d,0x5c,0x5c,0x5c,0x5b,0x5b,
0x5a,0x5a,0x5a,0x59,0x59,0x59,0x58,0x58,
0x58,0x57,0x57,0x56,0x56,0x56,0x55,0x55,
0x55,0x54,0x54,0x53,0x53,0x53,0x52,0x52,
0x52,0x51,0x51,0x51,0x50,0x50,0x4f,0x4f,
0x4f,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4c,
0x4c,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x49,
0x49,0x49,0x48,0x48,0x48,0x47,0x47,0x47,
0x46,0x46,0x45,0x45,0x45,0x44,0x44,0x44,
0x43,0x43,0x43,0x42,0x42,0x42,0x41,0x41,
0x41,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3e,
0x3e,0x3e,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,
0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x39,0x39,
0x39,0x38,0x38,0x38,0x37,0x37,0x37,0x36,
0x36,0x36,0x35,0x35,0x35,0x34,0x34,0x34,
0x34,0x33,0x33,0x33,0x32,0x32,0x32,0x31,
0x31,0x31,0x30,0x30,0x30,0x30,0x2f,0x2f,
0x2f,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,
0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2a,0x2a,
0x2a,0x2a,0x29,0x29,0x29,0x28,0x28,0x28,
0x28,0x27,0x27,0x27,0x26,0x26,0x26,0x26,
0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x23,
0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x21,
0x21,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f,
0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,
0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x19,
0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x17,
0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,
0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,
0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x12,
0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,
0x11,0x10,0x10,0x10,0x10,0x10,0xf,0xf,
0xf,0xf,0xf,0xf,0xe,0xe,0xe,0xe,
0xe,0xd,0xd,0xd,0xd,0xd,0xd,0xc,
0xc,0xc,0xc,0xc,0xc,0xb,0xb,0xb,
0xb,0xb,0xb,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0x9,0x9,0x9,0x9,0x9,0x9,
0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
0x5,0x5,0x4,0x4,0x4,0x4,0x4,0x4,
0x4,0x4,0x4,0x4,0x3,0x3,0x3,0x3,
0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
0x2,0x2,0x2,0x2,0x2,0x2,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x2,0x2,0x2,0x2,0x2,
0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
0x3,0x3,0x3,0x3,0x3,0x4,0x4,0x4,
0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,
0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
0x5,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
0x6,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
0x7,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xb,0xb,
0xb,0xb,0xb,0xb,0xc,0xc,0xc,0xc,
0xc,0xc,0xd,0xd,0xd,0xd,0xd,0xd,
0xe,0xe,0xe,0xe,0xe,0xf,0xf,0xf,
0xf,0xf,0xf,0x10,0x10,0x10,0x10,0x10,
0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,
0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x14,
0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,
0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17,
0x17,0x17,0x18,0x18,0x18,0x18,0x19,0x19,
0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,
0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,
0x1f,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21,
0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23,
0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x25,
0x25,0x26,0x26,0x26,0x26,0x27,0x27,0x27,
0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,
0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2c,0x2c,
0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,
0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x31,
0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x33,
0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36,
0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,
0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,
0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,
0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,
0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,
0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x46,
0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x49,
0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,
0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,
0x4f,0x4f,0x4f,0x50,0x50,0x51,0x51,0x51,
0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54,
0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,
0x58,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,
0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,
0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,
0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63,
0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66,
0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x69,
0x6a,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,
0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,
0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x73,
0x73,0x73,0x74,0x74,0x75,0x75,0x75,0x76,
0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79,
0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,
0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f
};

View file

@ -14,19 +14,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "color.h" #include "color.h"
#include "led_tables.h" #include "led_tables.h"
#include "progmem.h" #include "progmem.h"
RGB hsv_to_rgb( HSV hsv ) RGB hsv_to_rgb(HSV hsv) {
{
RGB rgb; RGB rgb;
uint8_t region, remainder, p, q, t; uint8_t region, remainder, p, q, t;
uint16_t h, s, v; uint16_t h, s, v;
if ( hsv.s == 0 ) if (hsv.s == 0) {
{
#ifdef USE_CIE1931_CURVE #ifdef USE_CIE1931_CURVE
rgb.r = rgb.g = rgb.b = pgm_read_byte(&CIE1931_CURVE[hsv.v]); rgb.r = rgb.g = rgb.b = pgm_read_byte(&CIE1931_CURVE[hsv.v]);
#else #else
@ -48,8 +45,7 @@ RGB hsv_to_rgb( HSV hsv )
q = (v * (255 - ((s * remainder) >> 8))) >> 8; q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
switch ( region ) switch (region) {
{
case 6: case 6:
case 0: case 0:
rgb.r = v; rgb.r = v;
@ -91,4 +87,3 @@ RGB hsv_to_rgb( HSV hsv )
return rgb; return rgb;
} }

View file

@ -14,14 +14,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef COLOR_H #ifndef COLOR_H
#define COLOR_H #define COLOR_H
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#if defined(__GNUC__) #if defined(__GNUC__)
# define PACKED __attribute__((__packed__)) # define PACKED __attribute__((__packed__))
#else #else
@ -39,8 +37,7 @@
#endif #endif
// WS2812 specific layout // WS2812 specific layout
typedef struct PACKED typedef struct PACKED {
{
uint8_t g; uint8_t g;
uint8_t r; uint8_t r;
uint8_t b; uint8_t b;
@ -49,16 +46,14 @@ typedef struct PACKED
typedef cRGB RGB; typedef cRGB RGB;
// WS2812 specific layout // WS2812 specific layout
typedef struct PACKED typedef struct PACKED {
{
uint8_t g; uint8_t g;
uint8_t r; uint8_t r;
uint8_t b; uint8_t b;
uint8_t w; uint8_t w;
} cRGBW; } cRGBW;
typedef struct PACKED typedef struct PACKED {
{
uint8_t h; uint8_t h;
uint8_t s; uint8_t s;
uint8_t v; uint8_t v;

View file

@ -291,7 +291,8 @@
# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1) # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
# define SERIAL_UART_RXD_VECT USART1_RX_vect # define SERIAL_UART_RXD_VECT USART1_RX_vect
# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
# define SERIAL_UART_INIT() do { \ # define SERIAL_UART_INIT() \
do { \
/* baud rate */ \ /* baud rate */ \
UBRR1L = SERIAL_UART_UBRR; \ UBRR1L = SERIAL_UART_UBRR; \
/* baud rate */ \ /* baud rate */ \

View file

@ -28,8 +28,7 @@ static bool debouncing = false;
#if DEBOUNCE > 0 #if DEBOUNCE > 0
static uint16_t debouncing_time; static uint16_t debouncing_time;
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
{
if (changed) { if (changed) {
debouncing = true; debouncing = true;
debouncing_time = timer_read(); debouncing_time = timer_read();
@ -43,15 +42,11 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
} }
} }
#else // no debouncing. #else // no debouncing.
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
{
for (int i = 0; i < num_rows; i++) { for (int i = 0; i < num_rows; i++) {
cooked[i] = raw[i]; cooked[i] = raw[i];
} }
} }
#endif #endif
bool debounce_active(void) { bool debounce_active(void) { return debouncing; }
return debouncing;
}

View file

@ -43,20 +43,14 @@
# error DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE not defined # error DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE not defined
# endif # endif
uint8_t dynamic_keymap_get_layer_count(void) uint8_t dynamic_keymap_get_layer_count(void) { return DYNAMIC_KEYMAP_LAYER_COUNT; }
{
return DYNAMIC_KEYMAP_LAYER_COUNT;
}
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) {
{
// TODO: optimize this with some left shifts // TODO: optimize this with some left shifts
return ((void*)DYNAMIC_KEYMAP_EEPROM_ADDR) + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + return ((void *)DYNAMIC_KEYMAP_EEPROM_ADDR) + (layer * MATRIX_ROWS * MATRIX_COLS * 2) + (row * MATRIX_COLS * 2) + (column * 2);
( row * MATRIX_COLS * 2 ) + ( column * 2 );
} }
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) {
{
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want // Big endian, so we can read/write EEPROM directly from host if we want
uint16_t keycode = eeprom_read_byte(address) << 8; uint16_t keycode = eeprom_read_byte(address) << 8;
@ -64,16 +58,14 @@ uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column)
return keycode; return keycode;
} }
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) {
{
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want // Big endian, so we can read/write EEPROM directly from host if we want
eeprom_update_byte(address, (uint8_t)(keycode >> 8)); eeprom_update_byte(address, (uint8_t)(keycode >> 8));
eeprom_update_byte(address + 1, (uint8_t)(keycode & 0xFF)); eeprom_update_byte(address + 1, (uint8_t)(keycode & 0xFF));
} }
void dynamic_keymap_reset(void) void dynamic_keymap_reset(void) {
{
// Reset the keymaps in EEPROM to what is in flash. // Reset the keymaps in EEPROM to what is in flash.
// All keyboards using dynamic keymaps should define a layout // All keyboards using dynamic keymaps should define a layout
// for the same number of layers as DYNAMIC_KEYMAP_LAYER_COUNT. // for the same number of layers as DYNAMIC_KEYMAP_LAYER_COUNT.
@ -86,8 +78,7 @@ void dynamic_keymap_reset(void)
} }
} }
void dynamic_keymap_get_buffer( uint16_t offset, uint16_t size, uint8_t *data ) void dynamic_keymap_get_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
{
uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2; uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2;
void * source = (void *)(DYNAMIC_KEYMAP_EEPROM_ADDR + offset); void * source = (void *)(DYNAMIC_KEYMAP_EEPROM_ADDR + offset);
uint8_t *target = data; uint8_t *target = data;
@ -102,8 +93,7 @@ void dynamic_keymap_get_buffer( uint16_t offset, uint16_t size, uint8_t *data )
} }
} }
void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data ) void dynamic_keymap_set_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
{
uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2; uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2;
void * target = (void *)(DYNAMIC_KEYMAP_EEPROM_ADDR + offset); void * target = (void *)(DYNAMIC_KEYMAP_EEPROM_ADDR + offset);
uint8_t *source = data; uint8_t *source = data;
@ -117,31 +107,19 @@ void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data )
} }
// This overrides the one in quantum/keymap_common.c // This overrides the one in quantum/keymap_common.c
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
{ if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
if ( layer < DYNAMIC_KEYMAP_LAYER_COUNT &&
key.row < MATRIX_ROWS &&
key.col < MATRIX_COLS ) {
return dynamic_keymap_get_keycode(layer, key.row, key.col); return dynamic_keymap_get_keycode(layer, key.row, key.col);
} else { } else {
return KC_NO; return KC_NO;
} }
} }
uint8_t dynamic_keymap_macro_get_count(void) { return DYNAMIC_KEYMAP_MACRO_COUNT; }
uint16_t dynamic_keymap_macro_get_buffer_size(void) { return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE; }
uint8_t dynamic_keymap_macro_get_count(void) void dynamic_keymap_macro_get_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
{
return DYNAMIC_KEYMAP_MACRO_COUNT;
}
uint16_t dynamic_keymap_macro_get_buffer_size(void)
{
return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE;
}
void dynamic_keymap_macro_get_buffer( uint16_t offset, uint16_t size, uint8_t *data )
{
void * source = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + offset); void * source = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + offset);
uint8_t *target = data; uint8_t *target = data;
for (uint16_t i = 0; i < size; i++) { for (uint16_t i = 0; i < size; i++) {
@ -155,8 +133,7 @@ void dynamic_keymap_macro_get_buffer( uint16_t offset, uint16_t size, uint8_t *d
} }
} }
void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *data ) void dynamic_keymap_macro_set_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
{
void * target = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + offset); void * target = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + offset);
uint8_t *source = data; uint8_t *source = data;
for (uint16_t i = 0; i < size; i++) { for (uint16_t i = 0; i < size; i++) {
@ -168,8 +145,7 @@ void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *d
} }
} }
void dynamic_keymap_macro_reset(void) void dynamic_keymap_macro_reset(void) {
{
void *p = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR); void *p = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
void *end = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE); void *end = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
while (p != end) { while (p != end) {
@ -178,8 +154,7 @@ void dynamic_keymap_macro_reset(void)
} }
} }
void dynamic_keymap_macro_send( uint8_t id ) void dynamic_keymap_macro_send(uint8_t id) {
{
if (id >= DYNAMIC_KEYMAP_MACRO_COUNT) { if (id >= DYNAMIC_KEYMAP_MACRO_COUNT) {
return; return;
} }
@ -235,4 +210,3 @@ void dynamic_keymap_macro_send( uint8_t id )
} }
#endif // DYNAMIC_KEYMAP_ENABLE #endif // DYNAMIC_KEYMAP_ENABLE

View file

@ -37,8 +37,6 @@ void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data );
// This overrides the one in quantum/keymap_common.c // This overrides the one in quantum/keymap_common.c
// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); // uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
// Note regarding dynamic_keymap_macro_set_buffer(): // Note regarding dynamic_keymap_macro_set_buffer():
// The last byte of the buffer is used as a valid flag, // The last byte of the buffer is used as a valid flag,
// so macro sending is disabled during writing a new buffer, // so macro sending is disabled during writing a new buffer,
@ -60,4 +58,3 @@ void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *d
void dynamic_keymap_macro_reset(void); void dynamic_keymap_macro_reset(void);
void dynamic_keymap_macro_send(uint8_t id); void dynamic_keymap_macro_send(uint8_t id);

View file

@ -46,8 +46,7 @@ enum dynamic_macro_keycodes {
}; };
/* Blink the LEDs to notify the user about some event. */ /* Blink the LEDs to notify the user about some event. */
void dynamic_macro_led_blink(void) void dynamic_macro_led_blink(void) {
{
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
backlight_toggle(); backlight_toggle();
wait_ms(100); wait_ms(100);
@ -59,10 +58,8 @@ void dynamic_macro_led_blink(void)
* need a `direction` variable accessible at the call site. * need a `direction` variable accessible at the call site.
*/ */
#define DYNAMIC_MACRO_CURRENT_SLOT() (direction > 0 ? 1 : 2) #define DYNAMIC_MACRO_CURRENT_SLOT() (direction > 0 ? 1 : 2)
#define DYNAMIC_MACRO_CURRENT_LENGTH(BEGIN, POINTER) \ #define DYNAMIC_MACRO_CURRENT_LENGTH(BEGIN, POINTER) ((int)(direction * ((POINTER) - (BEGIN))))
((int)(direction * ((POINTER) - (BEGIN)))) #define DYNAMIC_MACRO_CURRENT_CAPACITY(BEGIN, END2) ((int)(direction * ((END2) - (BEGIN)) + 1))
#define DYNAMIC_MACRO_CURRENT_CAPACITY(BEGIN, END2) \
((int)(direction * ((END2) - (BEGIN)) + 1))
/** /**
* Start recording of the dynamic macro. * Start recording of the dynamic macro.
@ -70,9 +67,7 @@ void dynamic_macro_led_blink(void)
* @param[out] macro_pointer The new macro buffer iterator. * @param[out] macro_pointer The new macro buffer iterator.
* @param[in] macro_buffer The macro buffer used to initialize macro_pointer. * @param[in] macro_buffer The macro buffer used to initialize macro_pointer.
*/ */
void dynamic_macro_record_start( void dynamic_macro_record_start(keyrecord_t **macro_pointer, keyrecord_t *macro_buffer) {
keyrecord_t **macro_pointer, keyrecord_t *macro_buffer)
{
dprintln("dynamic macro recording: started"); dprintln("dynamic macro recording: started");
dynamic_macro_led_blink(); dynamic_macro_led_blink();
@ -89,9 +84,7 @@ void dynamic_macro_record_start(
* @param macro_end[in] The element after the last macro buffer element. * @param macro_end[in] The element after the last macro buffer element.
* @param direction[in] Either +1 or -1, which way to iterate the buffer. * @param direction[in] Either +1 or -1, which way to iterate the buffer.
*/ */
void dynamic_macro_play( void dynamic_macro_play(keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_t direction) {
keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_t direction)
{
dprintf("dynamic macro: slot %d playback\n", DYNAMIC_MACRO_CURRENT_SLOT()); dprintf("dynamic macro: slot %d playback\n", DYNAMIC_MACRO_CURRENT_SLOT());
uint32_t saved_layer_state = layer_state; uint32_t saved_layer_state = layer_state;
@ -118,13 +111,7 @@ void dynamic_macro_play(
* @param direction[in] Either +1 or -1, which way to iterate the buffer. * @param direction[in] Either +1 or -1, which way to iterate the buffer.
* @param record[in] The current keypress. * @param record[in] The current keypress.
*/ */
void dynamic_macro_record_key( void dynamic_macro_record_key(keyrecord_t *macro_buffer, keyrecord_t **macro_pointer, keyrecord_t *macro2_end, int8_t direction, keyrecord_t *record) {
keyrecord_t *macro_buffer,
keyrecord_t **macro_pointer,
keyrecord_t *macro2_end,
int8_t direction,
keyrecord_t *record)
{
/* If we've just started recording, ignore all the key releases. */ /* If we've just started recording, ignore all the key releases. */
if (!record->event.pressed && *macro_pointer == macro_buffer) { if (!record->event.pressed && *macro_pointer == macro_buffer) {
dprintln("dynamic macro: ignoring a leading key-up event"); dprintln("dynamic macro: ignoring a leading key-up event");
@ -141,38 +128,25 @@ void dynamic_macro_record_key(
dynamic_macro_led_blink(); dynamic_macro_led_blink();
} }
dprintf( dprintf("dynamic macro: slot %d length: %d/%d\n", DYNAMIC_MACRO_CURRENT_SLOT(), DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, *macro_pointer), DYNAMIC_MACRO_CURRENT_CAPACITY(macro_buffer, macro2_end));
"dynamic macro: slot %d length: %d/%d\n",
DYNAMIC_MACRO_CURRENT_SLOT(),
DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, *macro_pointer),
DYNAMIC_MACRO_CURRENT_CAPACITY(macro_buffer, macro2_end));
} }
/** /**
* End recording of the dynamic macro. Essentially just update the * End recording of the dynamic macro. Essentially just update the
* pointer to the end of the macro. * pointer to the end of the macro.
*/ */
void dynamic_macro_record_end( void dynamic_macro_record_end(keyrecord_t *macro_buffer, keyrecord_t *macro_pointer, int8_t direction, keyrecord_t **macro_end) {
keyrecord_t *macro_buffer,
keyrecord_t *macro_pointer,
int8_t direction,
keyrecord_t **macro_end)
{
dynamic_macro_led_blink(); dynamic_macro_led_blink();
/* Do not save the keys being held when stopping the recording, /* Do not save the keys being held when stopping the recording,
* i.e. the keys used to access the layer DYN_REC_STOP is on. * i.e. the keys used to access the layer DYN_REC_STOP is on.
*/ */
while (macro_pointer != macro_buffer && while (macro_pointer != macro_buffer && (macro_pointer - direction)->event.pressed) {
(macro_pointer - direction)->event.pressed) {
dprintln("dynamic macro: trimming a trailing key-down event"); dprintln("dynamic macro: trimming a trailing key-down event");
macro_pointer -= direction; macro_pointer -= direction;
} }
dprintf( dprintf("dynamic macro: slot %d saved, length: %d\n", DYNAMIC_MACRO_CURRENT_SLOT(), DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, macro_pointer));
"dynamic macro: slot %d saved, length: %d\n",
DYNAMIC_MACRO_CURRENT_SLOT(),
DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, macro_pointer));
*macro_end = macro_pointer; *macro_end = macro_pointer;
} }
@ -187,8 +161,7 @@ void dynamic_macro_record_end(
* <...THE REST OF THE FUNCTION...> * <...THE REST OF THE FUNCTION...>
* } * }
*/ */
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
{
/* Both macros use the same buffer but read/write on different /* Both macros use the same buffer but read/write on different
* ends of it. * ends of it.
* *

View file

@ -23,7 +23,6 @@
// for memcpy // for memcpy
#include <string.h> #include <string.h>
#ifndef ENCODER_RESOLUTION #ifndef ENCODER_RESOLUTION
# define ENCODER_RESOLUTION 4 # define ENCODER_RESOLUTION 4
#endif #endif
@ -32,7 +31,6 @@
# error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B" # error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
#endif #endif
#define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a) / sizeof(pin_t)) #define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a) / sizeof(pin_t))
static pin_t encoders_pad_a[] = ENCODERS_PAD_A; static pin_t encoders_pad_a[] = ENCODERS_PAD_A;
static pin_t encoders_pad_b[] = ENCODERS_PAD_B; static pin_t encoders_pad_b[] = ENCODERS_PAD_B;
@ -48,13 +46,9 @@ static int8_t encoder_value[NUMBER_OF_ENCODERS * 2] = {0};
static int8_t encoder_value[NUMBER_OF_ENCODERS] = {0}; static int8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
#endif #endif
__attribute__ ((weak)) __attribute__((weak)) void encoder_update_user(int8_t index, bool clockwise) {}
void encoder_update_user(int8_t index, bool clockwise) { }
__attribute__ ((weak)) __attribute__((weak)) void encoder_update_kb(int8_t index, bool clockwise) { encoder_update_user(index, clockwise); }
void encoder_update_kb(int8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
}
void encoder_init(void) { void encoder_init(void) {
#if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) #if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT)
@ -92,9 +86,7 @@ void encoder_read(void) {
} }
#ifdef SPLIT_KEYBOARD #ifdef SPLIT_KEYBOARD
void encoder_state_raw(uint8_t* slave_state) { void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, encoder_state, sizeof(encoder_state)); }
memcpy(slave_state, encoder_state, sizeof(encoder_state));
}
void encoder_update_raw(uint8_t* slave_state) { void encoder_update_raw(uint8_t* slave_state) {
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {

View file

@ -25,8 +25,7 @@ uint16_t note_start = 0;
bool note_playing = false; bool note_playing = false;
uint16_t note_period = 0; uint16_t note_period = 0;
void fauxclicky_init() void fauxclicky_init() {
{
// Set port PC6 (OC3A and /OC4A) as output // Set port PC6 (OC3A and /OC4A) as output
DDRC |= _BV(PORTC6); DDRC |= _BV(PORTC6);
@ -35,8 +34,7 @@ void fauxclicky_init()
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30); TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
} }
void fauxclicky_stop() void fauxclicky_stop() {
{
FAUXCLICKY_DISABLE_OUTPUT; FAUXCLICKY_DISABLE_OUTPUT;
note_playing = false; note_playing = false;
} }

View file

@ -20,12 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "musical_notes.h" #include "musical_notes.h"
#include "stdbool.h" #include "stdbool.h"
__attribute__ ((weak)) __attribute__((weak)) float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25);
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25); __attribute__((weak)) float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
__attribute__ ((weak)) __attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
__attribute__ ((weak))
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
bool fauxclicky_enabled; bool fauxclicky_enabled;
@ -50,13 +47,15 @@ bool fauxclicky_enabled;
#define FAUXCLICKY_ON fauxclicky_enabled = true #define FAUXCLICKY_ON fauxclicky_enabled = true
// disable // disable
#define FAUXCLICKY_OFF do { \ #define FAUXCLICKY_OFF \
do { \
fauxclicky_enabled = false; \ fauxclicky_enabled = false; \
fauxclicky_stop(); \ fauxclicky_stop(); \
} while (0) } while (0)
// toggle // toggle
#define FAUXCLICKY_TOGGLE do { \ #define FAUXCLICKY_TOGGLE \
do { \
if (fauxclicky_enabled) { \ if (fauxclicky_enabled) { \
FAUXCLICKY_OFF; \ FAUXCLICKY_OFF; \
} else { \ } else { \
@ -96,4 +95,3 @@ void fauxclicky_init(void);
void fauxclicky_stop(void); void fauxclicky_stop(void);
void fauxclicky_play(float note[2]); void fauxclicky_play(float note[2]);
void fauxclicky_check(void); void fauxclicky_check(void);

View file

@ -24,7 +24,6 @@ extern keymap_config_t keymap_config;
* and will return the corrected keycode, when appropriate. * and will return the corrected keycode, when appropriate.
*/ */
uint16_t keycode_config(uint16_t keycode) { uint16_t keycode_config(uint16_t keycode) {
switch (keycode) { switch (keycode) {
case KC_CAPSLOCK: case KC_CAPSLOCK:
case KC_LOCKING_CAPS: case KC_LOCKING_CAPS:

View file

@ -52,5 +52,4 @@ uint16_t keymap_function_id_to_action( uint16_t function_id );
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[]; extern const uint16_t fn_actions[];
#endif #endif

View file

@ -38,8 +38,7 @@ extern keymap_config_t keymap_config;
#include <inttypes.h> #include <inttypes.h>
/* converts key to action */ /* converts key to action */
action_t action_for_key(uint8_t layer, keypos_t key) action_t action_for_key(uint8_t layer, keypos_t key) {
{
// 16bit keycodes - important // 16bit keycodes - important
uint16_t keycode = keymap_key_to_keycode(layer, key); uint16_t keycode = keymap_key_to_keycode(layer, key);
@ -164,36 +163,24 @@ action_t action_for_key(uint8_t layer, keypos_t key)
return action; return action;
} }
__attribute__ ((weak)) __attribute__((weak)) const uint16_t PROGMEM fn_actions[] = {
const uint16_t PROGMEM fn_actions[] = {
}; };
/* Macro */ /* Macro */
__attribute__ ((weak)) __attribute__((weak)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { return MACRO_NONE; }
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
return MACRO_NONE;
}
/* Function */ /* Function */
__attribute__ ((weak)) __attribute__((weak)) void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {}
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
}
// translates key to keycode // translates key to keycode
__attribute__ ((weak)) __attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
// Read entire word (16bits) // Read entire word (16bits)
return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]); return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
} }
// translates function id to action // translates function id to action
__attribute__ ((weak)) __attribute__((weak)) uint16_t keymap_function_id_to_action(uint16_t function_id) {
uint16_t keymap_function_id_to_action( uint16_t function_id )
{
// The compiler sees the empty (weak) fn_actions and generates a warning // The compiler sees the empty (weak) fn_actions and generates a warning
// This function should not be called in that case, so the warning is too strict // This function should not be called in that case, so the warning is too strict
// If this function is called however, the keymap should have overridden fn_actions, and then the compile // If this function is called however, the keymap should have overridden fn_actions, and then the compile

View file

@ -70,11 +70,8 @@
#define IT_APOS KC_MINS // ', ?, , #define IT_APOS KC_MINS // ', ?, ,
#define IT_BKSL KC_GRAVE // backslash \, | #define IT_BKSL KC_GRAVE // backslash \, |
#define IT_ACUT // accent acute ´ and grave ` #define IT_ACUT // accent acute ´ and grave `
#define IT_LESS KC_NUBS // < and > and | #define IT_LESS KC_NUBS // < and > and |

View file

@ -20,14 +20,11 @@
* note: This website is written in Japanese. * note: This website is written in Japanese.
*/ */
#ifndef KEYMAP_JP_H #ifndef KEYMAP_JP_H
#define KEYMAP_JP_H #define KEYMAP_JP_H
#include "keymap.h" #include "keymap.h"
#define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi #define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi
#define JP_YEN KC_INT3 // yen, | #define JP_YEN KC_INT3 // yen, |
#define JP_CIRC KC_EQL // ^, ~ #define JP_CIRC KC_EQL // ^, ~
@ -43,7 +40,6 @@
#define JP_MKANA KC_LANG1 // kana on MacOSX #define JP_MKANA KC_LANG1 // kana on MacOSX
#define JP_MEISU KC_LANG2 // eisu on MacOSX #define JP_MEISU KC_LANG2 // eisu on MacOSX
// Aliases for shifted symbols // Aliases for shifted symbols
#define JP_DQT LSFT(KC_2) // " #define JP_DQT LSFT(KC_2) // "
#define JP_AMPR LSFT(KC_6) // & #define JP_AMPR LSFT(KC_6) // &
@ -60,7 +56,6 @@
#define JP_RCBR LSFT(JP_RBRC) // } #define JP_RCBR LSFT(JP_RBRC) // }
#define JP_UNDS LSFT(JP_BSLS) // _ #define JP_UNDS LSFT(JP_BSLS) // _
// These symbols are correspond to US101-layout. // These symbols are correspond to US101-layout.
#define JP_MINS KC_MINS // - #define JP_MINS KC_MINS // -
#define JP_SCLN KC_SCLN // ; #define JP_SCLN KC_SCLN // ;
@ -76,5 +71,4 @@
#define JP_GT KC_GT // > #define JP_GT KC_GT // >
#define JP_QUES KC_QUES // ? #define JP_QUES KC_QUES // ?
#endif #endif

View file

@ -51,4 +51,3 @@
#define NM_COMM KC_COMM #define NM_COMM KC_COMM
#define NM_DOT KC_DOT #define NM_DOT KC_DOT
#define NM_SLSH KC_SLSH #define NM_SLSH KC_SLSH

View file

@ -20,45 +20,13 @@
#include "keymap_belgian.h" #include "keymap_belgian.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
0, 0, 1, 1, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 0, 0, 0, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
const bool ascii_to_altgr_lut[128] PROGMEM = { const bool ascii_to_altgr_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -93,5 +61,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
KC_P, BE_Q, KC_R, KC_S, KC_T, KC_U, KC_V, BE_W, KC_P, BE_Q, KC_R, KC_S, KC_T, KC_U, KC_V, BE_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
KC_X, KC_Y, BE_Z, BE_CCED, BE_AMP, BE_AGRV, BE_EQL, KC_DEL KC_X, KC_Y, BE_Z, BE_CCED, BE_AMP, BE_AGRV, BE_EQL, KC_DEL};
};

View file

@ -20,45 +20,13 @@
#include "keymap_bepo.h" #include "keymap_bepo.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 0, 0, 1,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
const bool ascii_to_altgr_lut[128] PROGMEM = { const bool ascii_to_altgr_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -93,5 +61,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
BP_P, BP_Q, BP_R, BP_S, BP_T, BP_U, BP_V, BP_W, BP_P, BP_Q, BP_R, BP_S, BP_T, BP_U, BP_V, BP_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
BP_X, BP_Y, BP_Z, BP_Y, BP_B, BP_X, BP_K, KC_DEL BP_X, BP_Y, BP_Z, BP_Y, BP_B, BP_X, BP_K, KC_DEL};
};

View file

@ -53,5 +53,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W, CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};
};

View file

@ -53,5 +53,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
DV_P, DV_Q, DV_R, DV_S, DV_T, DV_U, DV_V, DV_W, DV_P, DV_Q, DV_R, DV_S, DV_T, DV_U, DV_V, DV_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_GRV, KC_DEL DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_GRV, KC_DEL};
};

View file

@ -20,45 +20,13 @@
#include "keymap_french.h" #include "keymap_french.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
0, 0, 0, 1, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 0, 0, 0, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
const bool ascii_to_altgr_lut[128] PROGMEM = { const bool ascii_to_altgr_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -93,5 +61,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
KC_P, FR_Q, KC_R, KC_S, KC_T, KC_U, KC_V, FR_W, KC_P, FR_Q, KC_R, KC_S, KC_T, KC_U, KC_V, FR_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
KC_X, KC_Y, FR_Z, FR_APOS, FR_MINS, FR_EQL, FR_EACU, KC_DEL KC_X, KC_Y, FR_Z, FR_APOS, FR_MINS, FR_EQL, FR_EACU, KC_DEL};
};

View file

@ -20,45 +20,13 @@
#include "keymap_german.h" #include "keymap_german.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1, 1, 1, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
const bool ascii_to_altgr_lut[128] PROGMEM = { const bool ascii_to_altgr_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -93,5 +61,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
DE_P, DE_Q, DE_R, DE_S, DE_T, DE_U, DE_V, DE_W, DE_P, DE_Q, DE_R, DE_S, DE_T, DE_U, DE_V, DE_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
DE_X, DE_Y, DE_Z, DE_7, DE_LESS, DE_0, DE_PLUS, KC_DEL DE_X, DE_Y, DE_Z, DE_7, DE_LESS, DE_0, DE_PLUS, KC_DEL};
};

View file

@ -20,25 +20,9 @@
#include "keymap_jp.h" #include "keymap_jp.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -73,5 +57,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W, KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
KC_X, KC_Y, KC_Z, JP_LBRC, JP_YEN, JP_RBRC, JP_CIRC, KC_DEL KC_X, KC_Y, KC_Z, JP_LBRC, JP_YEN, JP_RBRC, JP_CIRC, KC_DEL};
};

View file

@ -53,5 +53,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
NM_P, NM_Q, NM_R, NM_S, NM_T, NM_U, NM_V, NM_W, NM_P, NM_Q, NM_R, NM_S, NM_T, NM_U, NM_V, NM_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
NM_X, NM_Y, NM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL NM_X, NM_Y, NM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};
};

View file

@ -20,45 +20,13 @@
#include "keymap_spanish.h" #include "keymap_spanish.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1, 1, 1, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
const bool ascii_to_altgr_lut[128] PROGMEM = { const bool ascii_to_altgr_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -93,5 +61,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W, KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
KC_X, KC_Y, KC_Z, ES_ACUT, KC_1, ES_CCED, ES_NTIL, KC_DEL KC_X, KC_Y, KC_Z, ES_ACUT, KC_1, ES_CCED, ES_NTIL, KC_DEL};
};

View file

@ -20,25 +20,9 @@
#include "keymap_uk.h" #include "keymap_uk.h"
const bool ascii_to_shift_lut[128] PROGMEM = { const bool ascii_to_shift_lut[128] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0};
1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 1, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 0
};
const uint8_t ascii_to_keycode_lut[128] PROGMEM = { const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// NUL SOH STX ETX EOT ENQ ACK BEL // NUL SOH STX ETX EOT ENQ ACK BEL
@ -73,5 +57,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
UK_P, UK_Q, UK_R, UK_S, UK_T, UK_U, UK_V, UK_W, UK_P, UK_Q, UK_R, UK_S, UK_T, UK_U, UK_V, UK_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
UK_X, UK_Y, UK_Z, UK_LBRC, UK_BSLS, UK_RBRC, UK_HASH, KC_DEL UK_X, UK_Y, UK_Z, UK_LBRC, UK_BSLS, UK_RBRC, UK_HASH, KC_DEL};
};

View file

@ -53,5 +53,4 @@ const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
// p q r s t u v w // p q r s t u v w
WK_P, WK_Q, WK_R, WK_S, WK_T, WK_U, WK_V, WK_W, WK_P, WK_Q, WK_R, WK_S, WK_T, WK_U, WK_V, WK_W,
// x y z { | } ~ DEL // x y z { | } ~ DEL
WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};
};

View file

@ -64,13 +64,9 @@ uint8_t g_key_hit[LED_DRIVER_LED_COUNT];
// Ticks since any key was last hit. // Ticks since any key was last hit.
uint32_t g_any_key_hit = 0; uint32_t g_any_key_hit = 0;
uint32_t eeconfig_read_led_matrix(void) { uint32_t eeconfig_read_led_matrix(void) { return eeprom_read_dword(EECONFIG_LED_MATRIX); }
return eeprom_read_dword(EECONFIG_LED_MATRIX);
}
void eeconfig_update_led_matrix(uint32_t config_value) { void eeconfig_update_led_matrix(uint32_t config_value) { eeprom_update_dword(EECONFIG_LED_MATRIX, config_value); }
eeprom_update_dword(EECONFIG_LED_MATRIX, config_value);
}
void eeconfig_update_led_matrix_default(void) { void eeconfig_update_led_matrix_default(void) {
dprintf("eeconfig_update_led_matrix_default\n"); dprintf("eeconfig_update_led_matrix_default\n");
@ -110,17 +106,11 @@ void map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i, uint8_t
} }
} }
void led_matrix_update_pwm_buffers(void) { void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); }
led_matrix_driver.flush();
}
void led_matrix_set_index_value(int index, uint8_t value) { void led_matrix_set_index_value(int index, uint8_t value) { led_matrix_driver.set_value(index, value); }
led_matrix_driver.set_value(index, value);
}
void led_matrix_set_index_value_all(uint8_t value) { void led_matrix_set_index_value_all(uint8_t value) { led_matrix_driver.set_value_all(value); }
led_matrix_driver.set_value_all(value);
}
bool process_led_matrix(uint16_t keycode, keyrecord_t *record) { bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
@ -133,15 +123,13 @@ bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
g_last_led_hit[0] = led[0]; g_last_led_hit[0] = led[0];
g_last_led_count = MIN(LED_HITS_TO_REMEMBER, g_last_led_count + 1); g_last_led_count = MIN(LED_HITS_TO_REMEMBER, g_last_led_count + 1);
} }
for(uint8_t i = 0; i < led_count; i++) for (uint8_t i = 0; i < led_count; i++) g_key_hit[led[i]] = 0;
g_key_hit[led[i]] = 0;
g_any_key_hit = 0; g_any_key_hit = 0;
} else { } else {
#ifdef LED_MATRIX_KEYRELEASES #ifdef LED_MATRIX_KEYRELEASES
uint8_t led[8], led_count; uint8_t led[8], led_count;
map_row_column_to_led(record->event.key.row, record->event.key.col, led, &led_count); map_row_column_to_led(record->event.key.row, record->event.key.col, led, &led_count);
for(uint8_t i = 0; i < led_count; i++) for (uint8_t i = 0; i < led_count; i++) g_key_hit[led[i]] = 255;
g_key_hit[led[i]] = 255;
g_any_key_hit = 255; g_any_key_hit = 255;
#endif #endif
@ -149,19 +137,13 @@ bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
return true; return true;
} }
void led_matrix_set_suspend_state(bool state) { void led_matrix_set_suspend_state(bool state) { g_suspend_state = state; }
g_suspend_state = state;
}
// All LEDs off // All LEDs off
void led_matrix_all_off(void) { void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); }
led_matrix_set_index_value_all(0);
}
// Uniform brightness // Uniform brightness
void led_matrix_uniform_brightness(void) { void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_config.val); }
led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_config.val);
}
void led_matrix_custom(void) {} void led_matrix_custom(void) {}
@ -180,16 +162,14 @@ void led_matrix_task(void) {
for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) {
if (g_key_hit[led] < 255) { if (g_key_hit[led] < 255) {
if (g_key_hit[led] == 254) if (g_key_hit[led] == 254) g_last_led_count = MAX(g_last_led_count - 1, 0);
g_last_led_count = MAX(g_last_led_count - 1, 0);
g_key_hit[led]++; g_key_hit[led]++;
} }
} }
// Ideally we would also stop sending zeros to the LED driver PWM buffers // Ideally we would also stop sending zeros to the LED driver PWM buffers
// while suspended and just do a software shutdown. This is a cheap hack for now. // while suspended and just do a software shutdown. This is a cheap hack for now.
bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) || bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) || (LED_DISABLE_AFTER_TIMEOUT > 0 && g_any_key_hit > LED_DISABLE_AFTER_TIMEOUT * 60 * 20));
(LED_DISABLE_AFTER_TIMEOUT > 0 && g_any_key_hit > LED_DISABLE_AFTER_TIMEOUT * 60 * 20));
uint8_t effect = suspend_backlight ? 0 : led_matrix_config.mode; uint8_t effect = suspend_backlight ? 0 : led_matrix_config.mode;
// this gets ticked at 20 Hz. // this gets ticked at 20 Hz.
@ -217,12 +197,9 @@ void led_matrix_indicators(void) {
led_matrix_indicators_user(); led_matrix_indicators_user();
} }
__attribute__((weak)) __attribute__((weak)) void led_matrix_indicators_kb(void) {}
void led_matrix_indicators_kb(void) {}
__attribute__((weak))
void led_matrix_indicators_user(void) {}
__attribute__((weak)) void led_matrix_indicators_user(void) {}
// void led_matrix_set_indicator_index(uint8_t *index, uint8_t row, uint8_t column) // void led_matrix_set_indicator_index(uint8_t *index, uint8_t row, uint8_t column)
// { // {
@ -303,9 +280,7 @@ static uint8_t decrement(uint8_t value, uint8_t step, uint8_t min, uint8_t max)
// } // }
// } // }
uint32_t led_matrix_get_tick(void) { uint32_t led_matrix_get_tick(void) { return g_tick; }
return g_tick;
}
void led_matrix_toggle(void) { void led_matrix_toggle(void) {
led_matrix_config.enable ^= 1; led_matrix_config.enable ^= 1;
@ -317,18 +292,14 @@ void led_matrix_enable(void) {
eeconfig_update_led_matrix(led_matrix_config.raw); eeconfig_update_led_matrix(led_matrix_config.raw);
} }
void led_matrix_enable_noeeprom(void) { void led_matrix_enable_noeeprom(void) { led_matrix_config.enable = 1; }
led_matrix_config.enable = 1;
}
void led_matrix_disable(void) { void led_matrix_disable(void) {
led_matrix_config.enable = 0; led_matrix_config.enable = 0;
eeconfig_update_led_matrix(led_matrix_config.raw); eeconfig_update_led_matrix(led_matrix_config.raw);
} }
void led_matrix_disable_noeeprom(void) { void led_matrix_disable_noeeprom(void) { led_matrix_config.enable = 0; }
led_matrix_config.enable = 0;
}
void led_matrix_step(void) { void led_matrix_step(void) {
led_matrix_config.mode++; led_matrix_config.mode++;
@ -373,19 +344,13 @@ void led_matrix_mode(uint8_t mode, bool eeprom_write) {
} }
} }
uint8_t led_matrix_get_mode(void) { uint8_t led_matrix_get_mode(void) { return led_matrix_config.mode; }
return led_matrix_config.mode;
}
void led_matrix_set_value_noeeprom(uint8_t val) { void led_matrix_set_value_noeeprom(uint8_t val) { led_matrix_config.val = val; }
led_matrix_config.val = val;
}
void led_matrix_set_value(uint8_t val) { void led_matrix_set_value(uint8_t val) {
led_matrix_set_value_noeeprom(val); led_matrix_set_value_noeeprom(val);
eeconfig_update_led_matrix(led_matrix_config.raw); eeconfig_update_led_matrix(led_matrix_config.raw);
} }
void backlight_set(uint8_t val) { void backlight_set(uint8_t val) { led_matrix_set_value(val); }
led_matrix_set_value(val);
}

View file

@ -145,5 +145,4 @@ const led_matrix_driver_t led_matrix_driver = {
# endif # endif
}; };
#endif #endif

View file

@ -15,47 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "led_tables.h" #include "led_tables.h"
#ifdef USE_CIE1931_CURVE #ifdef USE_CIE1931_CURVE
// Lightness curve using the CIE 1931 lightness formula // Lightness curve using the CIE 1931 lightness formula
// Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm // Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
const uint8_t CIE1931_CURVE[256] PROGMEM = { const uint8_t CIE1931_CURVE[256] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 96, 97, 99, 100, 101, 103, 104, 106, 107, 108, 110, 111, 113, 114, 116, 118, 119, 121, 122, 124, 125, 127, 129, 130, 132, 134, 135, 137, 139, 141, 142, 144, 146, 148, 149, 151, 153, 155, 157, 159, 161, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 185, 187, 189, 191, 193, 195, 197, 200, 202, 204, 206, 208, 211, 213, 215, 218, 220, 222, 225, 227, 230, 232, 234, 237, 239, 242, 244, 247, 249, 252, 255};
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6,
6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11,
11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16,
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24,
25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34,
35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46,
47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
79, 80, 82, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 96, 97, 99,
100, 101, 103, 104, 106, 107, 108, 110, 111, 113, 114, 116, 118, 119, 121, 122,
124, 125, 127, 129, 130, 132, 134, 135, 137, 139, 141, 142, 144, 146, 148, 149,
151, 153, 155, 157, 159, 161, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
182, 185, 187, 189, 191, 193, 195, 197, 200, 202, 204, 206, 208, 211, 213, 215,
218, 220, 222, 225, 227, 230, 232, 234, 237, 239, 242, 244, 247, 249, 252, 255
};
#endif #endif
#ifdef USE_LED_BREATHING_TABLE #ifdef USE_LED_BREATHING_TABLE
const uint8_t LED_BREATHING_TABLE[256] PROGMEM = { const uint8_t LED_BREATHING_TABLE[256] PROGMEM = {0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9, 10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76, 79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173, 176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215, 218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244, 245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9, 255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246, 245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220, 218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179, 176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131, 128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82, 79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40, 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11, 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0};
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244,
245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246,
245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220,
218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179,
176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131,
128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82,
79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
};
#endif #endif

View file

@ -20,12 +20,10 @@
#ifndef LED_MATRIX_H #ifndef LED_MATRIX_H
#define LED_MATRIX_H #define LED_MATRIX_H
#ifndef BACKLIGHT_ENABLE #ifndef BACKLIGHT_ENABLE
# error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE # error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE
#endif #endif
typedef struct Point { typedef struct Point {
uint8_t x; uint8_t x;
uint8_t y; uint8_t y;

View file

@ -56,60 +56,31 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
static matrix_row_t matrix[MATRIX_ROWS]; // debounced values static matrix_row_t matrix[MATRIX_ROWS]; // debounced values
__attribute__ ((weak)) __attribute__((weak)) void matrix_init_quantum(void) { matrix_init_kb(); }
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak)) __attribute__((weak)) void matrix_scan_quantum(void) { matrix_scan_kb(); }
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak)) __attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak)) __attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak)) __attribute__((weak)) void matrix_init_user(void) {}
void matrix_init_user(void) {
}
__attribute__ ((weak)) __attribute__((weak)) void matrix_scan_user(void) {}
void matrix_scan_user(void) {
}
inline inline uint8_t matrix_rows(void) { return MATRIX_ROWS; }
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline inline uint8_t matrix_cols(void) { return MATRIX_COLS; }
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
// Deprecated. // Deprecated.
bool matrix_is_modified(void) bool matrix_is_modified(void) {
{
if (debounce_active()) return false; if (debounce_active()) return false;
return true; return true;
} }
inline inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); }
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline inline matrix_row_t matrix_get_row(uint8_t row) {
matrix_row_t matrix_get_row(uint8_t row)
{
// Matrix mask lets you disable switches in the returned matrix data. For example, if you have a // Matrix mask lets you disable switches in the returned matrix data. For example, if you have a
// switch blocker installed and the switch is always pressed. // switch blocker installed and the switch is always pressed.
#ifdef MATRIX_MASKED #ifdef MATRIX_MASKED
@ -119,19 +90,18 @@ matrix_row_t matrix_get_row(uint8_t row)
#endif #endif
} }
void matrix_print(void) void matrix_print(void) {
{
print_matrix_header(); print_matrix_header();
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": "); phex(row);
print(": ");
print_matrix_row(row); print_matrix_row(row);
print("\n"); print("\n");
} }
} }
uint8_t matrix_key_count(void) uint8_t matrix_key_count(void) {
{
uint8_t count = 0; uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += matrix_bitpop(i); count += matrix_bitpop(i);
@ -139,7 +109,6 @@ uint8_t matrix_key_count(void)
return count; return count;
} }
#ifdef DIRECT_PINS #ifdef DIRECT_PINS
static void init_pins(void) { static void init_pins(void) {
@ -169,19 +138,14 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
#elif (DIODE_DIRECTION == COL2ROW) #elif (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) static void select_row(uint8_t row) {
{
setPinOutput(row_pins[row]); setPinOutput(row_pins[row]);
writePinLow(row_pins[row]); writePinLow(row_pins[row]);
} }
static void unselect_row(uint8_t row) static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
{
setPinInputHigh(row_pins[row]);
}
static void unselect_rows(void) static void unselect_rows(void) {
{
for (uint8_t x = 0; x < MATRIX_ROWS; x++) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]); setPinInputHigh(row_pins[x]);
} }
@ -194,8 +158,7 @@ static void init_pins(void) {
} }
} }
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
{
// Store last value of row prior to reading // Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[current_row]; matrix_row_t last_row_value = current_matrix[current_row];
@ -208,7 +171,6 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
// For each col... // For each col...
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Select the col pin to read (active low) // Select the col pin to read (active low)
uint8_t pin_state = readPin(col_pins[col_index]); uint8_t pin_state = readPin(col_pins[col_index]);
@ -224,19 +186,14 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
#elif (DIODE_DIRECTION == ROW2COL) #elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col) static void select_col(uint8_t col) {
{
setPinOutput(col_pins[col]); setPinOutput(col_pins[col]);
writePinLow(col_pins[col]); writePinLow(col_pins[col]);
} }
static void unselect_col(uint8_t col) static void unselect_col(uint8_t col) { setPinInputHigh(col_pins[col]); }
{
setPinInputHigh(col_pins[col]);
}
static void unselect_cols(void) static void unselect_cols(void) {
{
for (uint8_t x = 0; x < MATRIX_COLS; x++) { for (uint8_t x = 0; x < MATRIX_COLS; x++) {
setPinInputHigh(col_pins[x]); setPinInputHigh(col_pins[x]);
} }
@ -249,8 +206,7 @@ static void init_pins(void) {
} }
} }
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
{
bool matrix_changed = false; bool matrix_changed = false;
// Select col and wait for col selecton to stabilize // Select col and wait for col selecton to stabilize
@ -258,27 +214,21 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
wait_us(30); wait_us(30);
// For each row... // For each row...
for(uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
{
// Store last value of row prior to reading // Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[row_index]; matrix_row_t last_row_value = current_matrix[row_index];
// Check row pin state // Check row pin state
if (readPin(row_pins[row_index]) == 0) if (readPin(row_pins[row_index]) == 0) {
{
// Pin LO, set col bit // Pin LO, set col bit
current_matrix[row_index] |= (ROW_SHIFTER << current_col); current_matrix[row_index] |= (ROW_SHIFTER << current_col);
} } else {
else
{
// Pin HI, clear col bit // Pin HI, clear col bit
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
} }
// Determine if the matrix changed state // Determine if the matrix changed state
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) {
{
matrix_changed = true; matrix_changed = true;
} }
} }
@ -292,7 +242,6 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
#endif #endif
void matrix_init(void) { void matrix_init(void) {
// initialize key pins // initialize key pins
init_pins(); init_pins();
@ -307,8 +256,7 @@ void matrix_init(void) {
matrix_init_quantum(); matrix_init_quantum();
} }
uint8_t matrix_scan(void) uint8_t matrix_scan(void) {
{
bool changed = false; bool changed = false;
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) #if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)

View file

@ -47,6 +47,4 @@ static inline void digitalWrite(uint8_t pin, int mode) {
// Return true if the pin is HIGH // Return true if the pin is HIGH
// digitalRead(B0) // digitalRead(B0)
static inline bool digitalRead(uint8_t pin) { static inline bool digitalRead(uint8_t pin) { return _SFR_IO8(pin >> 4) & _BV(pin & 0xf); }
return _SFR_IO8(pin >> 4) & _BV(pin & 0xf);
}

View file

@ -25,13 +25,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static report_mouse_t mouseReport = {}; static report_mouse_t mouseReport = {};
__attribute__ ((weak)) __attribute__((weak)) void pointing_device_init(void) {
void pointing_device_init(void){
// initialize device, if that needs to be done. // initialize device, if that needs to be done.
} }
__attribute__ ((weak)) __attribute__((weak)) void pointing_device_send(void) {
void pointing_device_send(void){
// If you need to do other things, like debugging, this is the place to do it. // If you need to do other things, like debugging, this is the place to do it.
host_mouse_send(&mouseReport); host_mouse_send(&mouseReport);
// send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device // send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
@ -41,8 +39,7 @@ void pointing_device_send(void){
mouseReport.h = 0; mouseReport.h = 0;
} }
__attribute__ ((weak)) __attribute__((weak)) void pointing_device_task(void) {
void pointing_device_task(void){
// gather info and put it in: // gather info and put it in:
// mouseReport.x = 127 max -127 min // mouseReport.x = 127 max -127 min
// mouseReport.y = 127 max -127 min // mouseReport.y = 127 max -127 min
@ -53,10 +50,6 @@ void pointing_device_task(void){
pointing_device_send(); pointing_device_send();
} }
report_mouse_t pointing_device_get_report(void){ report_mouse_t pointing_device_get_report(void) { return mouseReport; }
return mouseReport;
}
void pointing_device_set_report(report_mouse_t newMouseReport){ void pointing_device_set_report(report_mouse_t newMouseReport) { mouseReport = newMouseReport; }
mouseReport = newMouseReport;
}

View file

@ -10,14 +10,12 @@ float voice_change_song[][2] = VOICE_CHANGE_SONG;
# define PITCH_STANDARD_A 440.0f # define PITCH_STANDARD_A 440.0f
#endif #endif
float compute_freq_for_midi_note(uint8_t note) float compute_freq_for_midi_note(uint8_t note) {
{
// https://en.wikipedia.org/wiki/MIDI_tuning_standard // https://en.wikipedia.org/wiki/MIDI_tuning_standard
return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A; return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A;
} }
bool process_audio(uint16_t keycode, keyrecord_t *record) { bool process_audio(uint16_t keycode, keyrecord_t *record) {
if (keycode == AU_ON && record->event.pressed) { if (keycode == AU_ON && record->event.pressed) {
audio_on(); audio_on();
return false; return false;
@ -52,17 +50,10 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
return true; return true;
} }
void process_audio_noteon(uint8_t note) { void process_audio_noteon(uint8_t note) { play_note(compute_freq_for_midi_note(note), 0xF); }
play_note(compute_freq_for_midi_note(note), 0xF);
}
void process_audio_noteoff(uint8_t note) { void process_audio_noteoff(uint8_t note) { stop_note(compute_freq_for_midi_note(note)); }
stop_note(compute_freq_for_midi_note(note));
}
void process_audio_all_notes_off(void) { void process_audio_all_notes_off(void) { stop_all_notes(); }
stop_all_notes();
}
__attribute__ ((weak)) __attribute__((weak)) void audio_on_user() {}
void audio_on_user() {}

View file

@ -69,9 +69,7 @@ void autoshift_flush(void) {
bool autoshift_enabled = true; bool autoshift_enabled = true;
void autoshift_enable(void) { void autoshift_enable(void) { autoshift_enabled = true; }
autoshift_enabled = true;
}
void autoshift_disable(void) { void autoshift_disable(void) {
autoshift_enabled = false; autoshift_enabled = false;
autoshift_flush(); autoshift_flush();
@ -81,15 +79,12 @@ void autoshift_toggle(void) {
if (autoshift_enabled) { if (autoshift_enabled) {
autoshift_enabled = false; autoshift_enabled = false;
autoshift_flush(); autoshift_flush();
} } else {
else {
autoshift_enabled = true; autoshift_enabled = true;
} }
} }
bool autoshift_state(void) { bool autoshift_state(void) { return autoshift_enabled; }
return autoshift_enabled;
}
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
# ifndef AUTO_SHIFT_MODIFIERS # ifndef AUTO_SHIFT_MODIFIERS
@ -181,12 +176,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
if (!autoshift_enabled) return true; if (!autoshift_enabled) return true;
# ifndef AUTO_SHIFT_MODIFIERS # ifndef AUTO_SHIFT_MODIFIERS
any_mod_pressed = get_mods() & ( any_mod_pressed = get_mods() & (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI) | MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL) | MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT));
MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|
MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)|
MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTL)|
MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)
);
if (any_mod_pressed) { if (any_mod_pressed) {
return true; return true;

View file

@ -58,9 +58,7 @@ void clicky_freq_down(void) {
} }
} }
void clicky_freq_reset(void) { void clicky_freq_reset(void) { clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; }
clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
}
void clicky_toggle(void) { void clicky_toggle(void) {
audio_config.clicky_enable ^= 1; audio_config.clicky_enable ^= 1;
@ -77,21 +75,30 @@ void clicky_off(void) {
eeconfig_update_audio(audio_config.raw); eeconfig_update_audio(audio_config.raw);
} }
bool is_clicky_on(void) { bool is_clicky_on(void) { return (audio_config.clicky_enable != 0); }
return (audio_config.clicky_enable != 0);
}
bool process_clicky(uint16_t keycode, keyrecord_t *record) { bool process_clicky(uint16_t keycode, keyrecord_t *record) {
if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_toggle(); } if (keycode == CLICKY_TOGGLE && record->event.pressed) {
clicky_toggle();
}
if (keycode == CLICKY_ENABLE && record->event.pressed) { clicky_on(); } if (keycode == CLICKY_ENABLE && record->event.pressed) {
if (keycode == CLICKY_DISABLE && record->event.pressed) { clicky_off(); } clicky_on();
}
if (keycode == CLICKY_DISABLE && record->event.pressed) {
clicky_off();
}
if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq_reset(); } if (keycode == CLICKY_RESET && record->event.pressed) {
clicky_freq_reset();
if (keycode == CLICKY_UP && record->event.pressed) { clicky_freq_up(); } }
if (keycode == CLICKY_DOWN && record->event.pressed) { clicky_freq_down(); }
if (keycode == CLICKY_UP && record->event.pressed) {
clicky_freq_up();
}
if (keycode == CLICKY_DOWN && record->event.pressed) {
clicky_freq_down();
}
if (audio_config.enable && audio_config.clicky_enable) { if (audio_config.enable && audio_config.clicky_enable) {
if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound

View file

@ -21,8 +21,7 @@ __attribute__((weak)) combo_t key_combos[COMBO_COUNT] = {
}; };
__attribute__((weak)) void process_combo_event(uint8_t combo_index, __attribute__((weak)) void process_combo_event(uint8_t combo_index, bool pressed) {}
bool pressed) {}
static uint16_t timer = 0; static uint16_t timer = 0;
static uint8_t current_combo_index = 0; static uint8_t current_combo_index = 0;
@ -57,8 +56,7 @@ static inline void dump_key_buffer(bool emit) {
if (emit) { if (emit) {
for (uint8_t i = 0; i < buffer_size; i++) { for (uint8_t i = 0; i < buffer_size; i++) {
#ifdef COMBO_ALLOW_ACTION_KEYS #ifdef COMBO_ALLOW_ACTION_KEYS
const action_t action = store_or_get_action(key_buffer[i].event.pressed, const action_t action = store_or_get_action(key_buffer[i].event.pressed, key_buffer[i].event.key);
key_buffer[i].event.key);
process_action(&(key_buffer[i]), action); process_action(&(key_buffer[i]), action);
#else #else
register_code16(key_buffer[i]); register_code16(key_buffer[i]);
@ -80,22 +78,18 @@ static inline void dump_key_buffer(bool emit) {
combo->state &= ~(1 << key); \ combo->state &= ~(1 << key); \
} while (0) } while (0)
static bool process_single_combo(combo_t *combo, uint16_t keycode, static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) {
keyrecord_t *record) {
uint8_t count = 0; uint8_t count = 0;
uint8_t index = -1; uint8_t index = -1;
/* Find index of keycode and number of combo keys */ /* Find index of keycode and number of combo keys */
for (const uint16_t *keys = combo->keys;; ++count) { for (const uint16_t *keys = combo->keys;; ++count) {
uint16_t key = pgm_read_word(&keys[count]); uint16_t key = pgm_read_word(&keys[count]);
if (keycode == key) if (keycode == key) index = count;
index = count; if (COMBO_END == key) break;
if (COMBO_END == key)
break;
} }
/* Continue processing if not a combo key */ /* Continue processing if not a combo key */
if (-1 == (int8_t)index) if (-1 == (int8_t)index) return false;
return false;
bool is_combo_active = is_active; bool is_combo_active = is_active;
@ -144,10 +138,11 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
return true; return true;
} }
if (!is_combo_enabled()) { return true; } if (!is_combo_enabled()) {
return true;
}
for (current_combo_index = 0; current_combo_index < COMBO_COUNT; for (current_combo_index = 0; current_combo_index < COMBO_COUNT; ++current_combo_index) {
++current_combo_index) {
combo_t *combo = &key_combos[current_combo_index]; combo_t *combo = &key_combos[current_combo_index];
is_combo_key |= process_single_combo(combo, keycode, record); is_combo_key |= process_single_combo(combo, keycode, record);
no_combo_keys_pressed = no_combo_keys_pressed && NO_COMBO_KEYS_ARE_DOWN; no_combo_keys_pressed = no_combo_keys_pressed && NO_COMBO_KEYS_ARE_DOWN;
@ -185,7 +180,6 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
void matrix_scan_combo(void) { void matrix_scan_combo(void) {
if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) { if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) {
/* This disables the combo, meaning key events for this /* This disables the combo, meaning key events for this
* combo will be handled by the next processors in the chain * combo will be handled by the next processors in the chain
*/ */
@ -194,15 +188,12 @@ void matrix_scan_combo(void) {
} }
} }
void combo_enable(void) { void combo_enable(void) { b_combo_enable = true; }
b_combo_enable = true;
}
void combo_disable(void) { void combo_disable(void) {
b_combo_enable = is_active = false; b_combo_enable = is_active = false;
timer = 0; timer = 0;
dump_key_buffer(true); dump_key_buffer(true);
} }
void combo_toggle(void) { void combo_toggle(void) {
@ -213,6 +204,4 @@ void combo_toggle(void) {
} }
} }
bool is_combo_enabled(void) { bool is_combo_enabled(void) { return b_combo_enable; }
return b_combo_enable;
}

View file

@ -19,14 +19,11 @@
#include "process_key_lock.h" #include "process_key_lock.h"
#define BV_64(shift) (((uint64_t)1) << (shift)) #define BV_64(shift) (((uint64_t)1) << (shift))
#define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : \ #define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : ((code) < 0x80) ? key_state[1] : ((code) < 0xC0) ? key_state[2] : key_state[3])
((code) < 0x80) ? key_state[1] : \ #define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : ((code) < 0x80) ? (code)-0x40 : ((code) < 0xC0) ? (code)-0x80 : (code)-0xC0)
((code) < 0xC0) ? key_state[2] : key_state[3])
#define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : \
((code) < 0x80) ? (code) - 0x40 : \
((code) < 0xC0) ? (code) - 0x80 : (code) - 0xC0)
#define KEY_STATE(code) (GET_KEY_ARRAY(code) & BV_64(GET_CODE_INDEX(code))) == BV_64(GET_CODE_INDEX(code)) #define KEY_STATE(code) (GET_KEY_ARRAY(code) & BV_64(GET_CODE_INDEX(code))) == BV_64(GET_CODE_INDEX(code))
#define SET_KEY_ARRAY_STATE(code, val) do { \ #define SET_KEY_ARRAY_STATE(code, val) \
do { \
switch (code) { \ switch (code) { \
case 0x00 ... 0x3F: \ case 0x00 ... 0x3F: \
key_state[0] = (val); \ key_state[0] = (val); \
@ -135,4 +132,3 @@ bool process_key_lock(uint16_t *keycode, keyrecord_t *record) {
return !(IS_STANDARD_KEYCODE(translated_keycode) && KEY_STATE(translated_keycode)); return !(IS_STANDARD_KEYCODE(translated_keycode) && KEY_STATE(translated_keycode));
} }
} }

View file

@ -23,11 +23,9 @@
# define LEADER_TIMEOUT 300 # define LEADER_TIMEOUT 300
# endif # endif
__attribute__ ((weak)) __attribute__((weak)) void leader_start(void) {}
void leader_start(void) {}
__attribute__ ((weak)) __attribute__((weak)) void leader_end(void) {}
void leader_end(void) {}
// Leader key stuff // Leader key stuff
bool leading = false; bool leading = false;
@ -37,7 +35,9 @@ uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
uint8_t leader_sequence_size = 0; uint8_t leader_sequence_size = 0;
void qk_leader_start(void) { void qk_leader_start(void) {
if (leading) { return; } if (leading) {
return;
}
leader_start(); leader_start();
leading = true; leading = true;
leader_time = timer_read(); leader_time = timer_read();

View file

@ -19,7 +19,6 @@
#include "quantum.h" #include "quantum.h"
bool process_leader(uint16_t keycode, keyrecord_t *record); bool process_leader(uint16_t keycode, keyrecord_t *record);
void leader_start(void); void leader_start(void);
@ -32,7 +31,11 @@ void qk_leader_start(void);
#define SEQ_FOUR_KEYS(key1, key2, key3, key4) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == 0) #define SEQ_FOUR_KEYS(key1, key2, key3, key4) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == 0)
#define SEQ_FIVE_KEYS(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == (key5)) #define SEQ_FIVE_KEYS(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == (key5))
#define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[5]; extern uint8_t leader_sequence_size #define LEADER_EXTERNS() \
extern bool leading; \
extern uint16_t leader_time; \
extern uint16_t leader_sequence[5]; \
extern uint8_t leader_sequence_size
#define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT) #define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT)
#endif #endif

View file

@ -22,20 +22,11 @@
# ifdef MIDI_BASIC # ifdef MIDI_BASIC
void process_midi_basic_noteon(uint8_t note) void process_midi_basic_noteon(uint8_t note) { midi_send_noteon(&midi_device, 0, note, 127); }
{
midi_send_noteon(&midi_device, 0, note, 127);
}
void process_midi_basic_noteoff(uint8_t note) void process_midi_basic_noteoff(uint8_t note) { midi_send_noteoff(&midi_device, 0, note, 0); }
{
midi_send_noteoff(&midi_device, 0, note, 0);
}
void process_midi_all_notes_off(void) void process_midi_all_notes_off(void) { midi_send_cc(&midi_device, 0, 0x7B, 0); }
{
midi_send_cc(&midi_device, 0, 0x7B, 0);
}
# endif // MIDI_BASIC # endif // MIDI_BASIC
@ -50,21 +41,16 @@ static int8_t midi_modulation_step;
static uint16_t midi_modulation_timer; static uint16_t midi_modulation_timer;
midi_config_t midi_config; midi_config_t midi_config;
inline uint8_t compute_velocity(uint8_t setting) inline uint8_t compute_velocity(uint8_t setting) { return (setting + 1) * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN + 1)); }
{
return (setting + 1) * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN + 1));
}
void midi_init(void) void midi_init(void) {
{
midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN; midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
midi_config.transpose = 0; midi_config.transpose = 0;
midi_config.velocity = (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN); midi_config.velocity = (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN);
midi_config.channel = 0; midi_config.channel = 0;
midi_config.modulation_interval = 8; midi_config.modulation_interval = 8;
for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++) for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++) {
{
tone_status[i] = MIDI_INVALID_NOTE; tone_status[i] = MIDI_INVALID_NOTE;
} }
@ -73,16 +59,11 @@ void midi_init(void)
midi_modulation_timer = 0; midi_modulation_timer = 0;
} }
uint8_t midi_compute_note(uint16_t keycode) uint8_t midi_compute_note(uint16_t keycode) { return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; }
{
return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose;
}
bool process_midi(uint16_t keycode, keyrecord_t *record) bool process_midi(uint16_t keycode, keyrecord_t *record) {
{
switch (keycode) { switch (keycode) {
case MIDI_TONE_MIN ... MIDI_TONE_MAX: case MIDI_TONE_MIN ... MIDI_TONE_MAX: {
{
uint8_t channel = midi_config.channel; uint8_t channel = midi_config.channel;
uint8_t tone = keycode - MIDI_TONE_MIN; uint8_t tone = keycode - MIDI_TONE_MIN;
uint8_t velocity = compute_velocity(midi_config.velocity); uint8_t velocity = compute_velocity(midi_config.velocity);
@ -91,11 +72,9 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
midi_send_noteon(&midi_device, channel, note, velocity); midi_send_noteon(&midi_device, channel, note, velocity);
dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity); dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
tone_status[tone] = note; tone_status[tone] = note;
} } else {
else {
uint8_t note = tone_status[tone]; uint8_t note = tone_status[tone];
if (note != MIDI_INVALID_NOTE) if (note != MIDI_INVALID_NOTE) {
{
midi_send_noteoff(&midi_device, channel, note, velocity); midi_send_noteoff(&midi_device, channel, note, velocity);
dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity); dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
} }
@ -137,8 +116,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - MI_TRNS_0)) { if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - MI_TRNS_0)) {
const bool positive = midi_config.transpose > 0; const bool positive = midi_config.transpose > 0;
midi_config.transpose++; midi_config.transpose++;
if (positive && midi_config.transpose < 0) if (positive && midi_config.transpose < 0) midi_config.transpose--;
midi_config.transpose--;
dprintf("midi transpose %d\n", midi_config.transpose); dprintf("midi transpose %d\n", midi_config.transpose);
} }
return false; return false;
@ -211,8 +189,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed) { if (record->event.pressed) {
midi_config.modulation_interval++; midi_config.modulation_interval++;
// prevent overflow // prevent overflow
if (midi_config.modulation_interval == 0) if (midi_config.modulation_interval == 0) midi_config.modulation_interval--;
midi_config.modulation_interval--;
dprintf("midi modulation interval %d\n", midi_config.modulation_interval); dprintf("midi modulation interval %d\n", midi_config.modulation_interval);
} }
return false; return false;
@ -226,8 +203,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed) { if (record->event.pressed) {
midi_send_pitchbend(&midi_device, midi_config.channel, -0x2000); midi_send_pitchbend(&midi_device, midi_config.channel, -0x2000);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, -0x2000); dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, -0x2000);
} } else {
else {
midi_send_pitchbend(&midi_device, midi_config.channel, 0); midi_send_pitchbend(&midi_device, midi_config.channel, 0);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0); dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0);
} }
@ -236,8 +212,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed) { if (record->event.pressed) {
midi_send_pitchbend(&midi_device, midi_config.channel, 0x1fff); midi_send_pitchbend(&midi_device, midi_config.channel, 0x1fff);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0x1fff); dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0x1fff);
} } else {
else {
midi_send_pitchbend(&midi_device, midi_config.channel, 0); midi_send_pitchbend(&midi_device, midi_config.channel, 0);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0); dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0);
} }
@ -249,16 +224,13 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
# endif // MIDI_ADVANCED # endif // MIDI_ADVANCED
void midi_task(void) void midi_task(void) {
{
midi_device_process(&midi_device); midi_device_process(&midi_device);
# ifdef MIDI_ADVANCED # ifdef MIDI_ADVANCED
if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) return;
return;
midi_modulation_timer = timer_read(); midi_modulation_timer = timer_read();
if (midi_modulation_step != 0) if (midi_modulation_step != 0) {
{
dprintf("midi modulation %d\n", midi_modulation); dprintf("midi modulation %d\n", midi_modulation);
midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation); midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation);
@ -270,12 +242,9 @@ void midi_task(void)
midi_modulation += midi_modulation_step; midi_modulation += midi_modulation_step;
if (midi_modulation > 127) if (midi_modulation > 127) midi_modulation = 127;
midi_modulation = 127;
} }
# endif # endif
} }
#endif // MIDI_ENABLE #endif // MIDI_ENABLE

Some files were not shown because too many files have changed in this diff Show more