From b624f32f944acdc59dcb130674c09090c5c404cb Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- drivers/arm/i2c_master.c | 121 +- drivers/arm/i2c_master.h | 91 +- drivers/avr/analog.c | 53 +- drivers/avr/analog.h | 26 +- drivers/avr/apa102.c | 147 +- drivers/avr/apa102.h | 5 +- drivers/avr/glcdfont.c | 280 +-- drivers/avr/hd44780.c | 510 ++-- drivers/avr/hd44780.h | 303 ++- drivers/avr/i2c_master.c | 260 +- drivers/avr/i2c_master.h | 12 +- drivers/avr/i2c_slave.c | 18 +- drivers/avr/i2c_slave.h | 2 +- drivers/avr/pro_micro.h | 270 +-- drivers/avr/ssd1306.c | 427 ++-- drivers/avr/ssd1306.h | 84 +- drivers/avr/ws2812.c | 384 ++- drivers/avr/ws2812.h | 17 +- drivers/boards/GENERIC_STM32_F303XC/board.c | 98 +- drivers/boards/GENERIC_STM32_F303XC/board.h | 1166 ++------- drivers/boards/IC_TEENSY_3_1/board.c | 237 +- drivers/boards/IC_TEENSY_3_1/board.h | 426 ++-- drivers/gpio/pca9555.c | 72 +- drivers/haptic/DRV2605L.c | 150 +- drivers/haptic/DRV2605L.h | 574 ++--- drivers/haptic/haptic.c | 316 +-- drivers/haptic/haptic.h | 78 +- drivers/haptic/solenoid.c | 100 +- drivers/haptic/solenoid.h | 10 +- drivers/issi/is31fl3218.c | 100 +- drivers/issi/is31fl3218.h | 4 +- drivers/issi/is31fl3731-simple.c | 71 +- drivers/issi/is31fl3731-simple.h | 171 +- drivers/issi/is31fl3731.c | 160 +- drivers/issi/is31fl3731.h | 195 +- drivers/issi/is31fl3733.c | 177 +- drivers/issi/is31fl3733.h | 437 ++-- drivers/issi/is31fl3736.c | 219 +- drivers/issi/is31fl3736.h | 254 +- drivers/issi/is31fl3737.c | 177 +- drivers/issi/is31fl3737.h | 341 ++- drivers/oled/glcdfont.c | 241 +- drivers/oled/oled_driver.c | 801 +++---- drivers/oled/oled_driver.h | 206 +- drivers/qwiic/micro_oled.c | 748 ++---- drivers/qwiic/micro_oled.h | 122 +- drivers/qwiic/qwiic.c | 12 +- drivers/qwiic/qwiic.h | 4 +- drivers/qwiic/util/font5x7.h | 265 +-- drivers/qwiic/util/font8x16.h | 108 +- .../gdisp/is31fl3731c/board_is31fl3731c_template.h | 85 +- drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c | 268 +-- drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h | 14 +- drivers/ugfx/gdisp/st7565/board_st7565_template.h | 71 +- drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c | 337 +-- drivers/ugfx/gdisp/st7565/gdisp_lld_config.h | 16 +- drivers/ugfx/gdisp/st7565/st7565.h | 42 +- quantum/api.c | 115 +- quantum/api.h | 53 +- quantum/api/api_sysex.c | 29 +- quantum/api/api_sysex.h | 2 +- quantum/audio/audio.c | 740 +++--- quantum/audio/audio.h | 26 +- quantum/audio/audio_arm.c | 846 +++---- quantum/audio/audio_pwm.c | 637 +++-- quantum/audio/luts.c | 380 +-- quantum/audio/luts.h | 18 +- quantum/audio/muse.c | 137 +- quantum/audio/musical_notes.h | 245 +- quantum/audio/song_list.h | 319 +-- quantum/audio/voices.c | 250 +- quantum/audio/voices.h | 20 +- quantum/audio/wave.h | 273 +-- quantum/color.c | 117 +- quantum/color.h | 45 +- quantum/config_common.h | 539 ++--- quantum/debounce/eager_pk.c | 94 +- quantum/debounce/eager_pr.c | 82 +- quantum/debounce/sym_g.c | 41 +- quantum/dynamic_keymap.c | 348 ++- quantum/dynamic_keymap.h | 25 +- quantum/dynamic_macro.h | 137 +- quantum/encoder.c | 88 +- quantum/fauxclicky.c | 24 +- quantum/fauxclicky.h | 48 +- quantum/keycode_config.c | 33 +- quantum/keycode_config.h | 24 +- quantum/keymap.h | 11 +- quantum/keymap_common.c | 99 +- quantum/keymap_extras/keymap_belgian.h | 102 +- quantum/keymap_extras/keymap_bepo.h | 498 ++-- quantum/keymap_extras/keymap_br_abnt2.h | 72 +- .../keymap_extras/keymap_canadian_multilingual.h | 354 +-- quantum/keymap_extras/keymap_colemak.h | 108 +- quantum/keymap_extras/keymap_dvorak.h | 136 +- quantum/keymap_extras/keymap_dvp.h | 136 +- quantum/keymap_extras/keymap_fr_ch.h | 70 +- quantum/keymap_extras/keymap_french.h | 114 +- quantum/keymap_extras/keymap_french_osx.h | 114 +- quantum/keymap_extras/keymap_german.h | 72 +- quantum/keymap_extras/keymap_german_ch.h | 82 +- quantum/keymap_extras/keymap_german_osx.h | 68 +- quantum/keymap_extras/keymap_hungarian.h | 78 +- quantum/keymap_extras/keymap_italian.h | 65 +- quantum/keymap_extras/keymap_jp.h | 86 +- quantum/keymap_extras/keymap_nordic.h | 44 +- quantum/keymap_extras/keymap_norman.h | 55 +- quantum/keymap_extras/keymap_norwegian.h | 28 +- quantum/keymap_extras/keymap_plover.h | 44 +- quantum/keymap_extras/keymap_plover_dvorak.h | 44 +- quantum/keymap_extras/keymap_slovenian.h | 66 +- quantum/keymap_extras/keymap_spanish.h | 66 +- quantum/keymap_extras/keymap_steno.h | 98 +- quantum/keymap_extras/keymap_swedish.h | 62 +- quantum/keymap_extras/keymap_uk.h | 22 +- quantum/keymap_extras/keymap_workman.h | 104 +- quantum/keymap_extras/sendstring_belgian.h | 69 +- quantum/keymap_extras/sendstring_bepo.h | 69 +- quantum/keymap_extras/sendstring_colemak.h | 29 +- quantum/keymap_extras/sendstring_dvorak.h | 29 +- quantum/keymap_extras/sendstring_french.h | 69 +- quantum/keymap_extras/sendstring_german.h | 69 +- quantum/keymap_extras/sendstring_jis.h | 49 +- quantum/keymap_extras/sendstring_norman.h | 29 +- quantum/keymap_extras/sendstring_spanish.h | 69 +- quantum/keymap_extras/sendstring_uk.h | 49 +- quantum/keymap_extras/sendstring_workman.h | 29 +- quantum/led_matrix.c | 135 +- quantum/led_matrix_drivers.c | 193 +- quantum/led_tables.c | 43 +- quantum/ledmatrix.h | 78 +- quantum/matrix.c | 218 +- quantum/pincontrol.h | 38 +- quantum/pointing_device.c | 45 +- quantum/pointing_device.h | 8 +- quantum/process_keycode/process_audio.c | 31 +- quantum/process_keycode/process_auto_shift.c | 296 ++- quantum/process_keycode/process_auto_shift.h | 2 +- quantum/process_keycode/process_clicky.c | 131 +- quantum/process_keycode/process_combo.c | 259 +- quantum/process_keycode/process_combo.h | 28 +- quantum/process_keycode/process_key_lock.c | 48 +- quantum/process_keycode/process_key_lock.h | 2 +- quantum/process_keycode/process_leader.c | 86 +- quantum/process_keycode/process_leader.h | 7 +- quantum/process_keycode/process_midi.c | 115 +- quantum/process_keycode/process_midi.h | 30 +- quantum/process_keycode/process_music.c | 354 ++- quantum/process_keycode/process_music.h | 28 +- quantum/process_keycode/process_printer.c | 443 ++-- quantum/process_keycode/process_printer_bb.c | 435 ++-- quantum/process_keycode/process_space_cadet.c | 175 +- quantum/process_keycode/process_steno.c | 208 +- quantum/process_keycode/process_steno.h | 8 +- quantum/process_keycode/process_tap_dance.c | 268 +-- quantum/process_keycode/process_tap_dance.h | 113 +- quantum/process_keycode/process_terminal.c | 271 +-- quantum/process_keycode/process_terminal.h | 2 +- quantum/process_keycode/process_ucis.c | 213 +- quantum/process_keycode/process_ucis.h | 24 +- quantum/process_keycode/process_unicode.c | 12 +- quantum/process_keycode/process_unicode_common.c | 321 ++- quantum/process_keycode/process_unicode_common.h | 246 +- quantum/process_keycode/process_unicodemap.c | 95 +- quantum/process_keycode/process_unicodemap.h | 4 +- quantum/quantum.c | 2495 +++++++++----------- quantum/quantum.h | 153 +- quantum/quantum_keycodes.h | 353 ++- quantum/rgb.h | 33 +- quantum/rgb_matrix.c | 624 +++-- quantum/rgb_matrix.h | 152 +- quantum/rgb_matrix_animations/alpha_mods_anim.h | 32 +- quantum/rgb_matrix_animations/breathing_anim.h | 26 +- .../colorband_pinwheel_sat_anim.h | 10 +- .../colorband_pinwheel_val_anim.h | 10 +- quantum/rgb_matrix_animations/colorband_sat_anim.h | 12 +- .../colorband_spiral_sat_anim.h | 10 +- .../colorband_spiral_val_anim.h | 10 +- quantum/rgb_matrix_animations/colorband_val_anim.h | 12 +- quantum/rgb_matrix_animations/cycle_all_anim.h | 12 +- .../rgb_matrix_animations/cycle_left_right_anim.h | 12 +- quantum/rgb_matrix_animations/cycle_out_in_anim.h | 12 +- .../rgb_matrix_animations/cycle_out_in_dual_anim.h | 16 +- .../rgb_matrix_animations/cycle_pinwheel_anim.h | 12 +- quantum/rgb_matrix_animations/cycle_spiral_anim.h | 12 +- quantum/rgb_matrix_animations/cycle_up_down_anim.h | 12 +- quantum/rgb_matrix_animations/digital_rain_anim.h | 120 +- quantum/rgb_matrix_animations/dual_beacon_anim.h | 12 +- .../rgb_matrix_animations/gradient_up_down_anim.h | 30 +- .../jellybean_raindrops_anim.h | 36 +- .../rgb_matrix_animations/rainbow_beacon_anim.h | 12 +- .../rainbow_moving_chevron_anim.h | 12 +- .../rgb_matrix_animations/rainbow_pinwheels_anim.h | 12 +- quantum/rgb_matrix_animations/raindrops_anim.h | 52 +- quantum/rgb_matrix_animations/solid_color_anim.h | 16 +- .../rgb_matrix_animations/solid_reactive_anim.h | 16 +- .../rgb_matrix_animations/solid_reactive_cross.h | 47 +- .../rgb_matrix_animations/solid_reactive_nexus.h | 45 +- .../solid_reactive_simple_anim.h | 16 +- .../rgb_matrix_animations/solid_reactive_wide.h | 39 +- quantum/rgb_matrix_animations/solid_splash_anim.h | 39 +- quantum/rgb_matrix_animations/splash_anim.h | 39 +- .../rgb_matrix_animations/typing_heatmap_anim.h | 87 +- quantum/rgb_matrix_drivers.c | 110 +- quantum/rgb_matrix_runners/effect_runner_dx_dy.h | 20 +- .../rgb_matrix_runners/effect_runner_dx_dy_dist.h | 22 +- quantum/rgb_matrix_runners/effect_runner_i.h | 16 +- .../rgb_matrix_runners/effect_runner_reactive.h | 34 +- .../effect_runner_reactive_splash.h | 36 +- .../rgb_matrix_runners/effect_runner_sin_cos_i.h | 20 +- quantum/rgb_matrix_types.h | 71 +- quantum/rgblight.c | 1444 ++++++----- quantum/rgblight.h | 212 +- quantum/rgblight_breathe_table.h | 562 ++++- quantum/rgblight_list.h | 253 +- quantum/rgblight_modes.h | 116 +- quantum/rgblight_post_config.h | 6 +- quantum/rgblight_reconfig.h | 41 +- quantum/send_string_keycodes.h | 392 +-- quantum/serial_link/protocol/byte_stuffer.c | 55 +- quantum/serial_link/protocol/frame_router.c | 23 +- quantum/serial_link/protocol/frame_validator.c | 80 +- quantum/serial_link/protocol/transport.c | 61 +- quantum/serial_link/protocol/transport.h | 168 +- .../serial_link/protocol/triple_buffered_object.c | 7 +- .../serial_link/protocol/triple_buffered_object.h | 14 +- quantum/serial_link/system/serial_link.c | 113 +- quantum/serial_link/system/serial_link.h | 26 +- quantum/serial_link/tests/byte_stuffer_tests.cpp | 211 +- quantum/serial_link/tests/frame_router_tests.cpp | 81 +- .../serial_link/tests/frame_validator_tests.cpp | 45 +- quantum/serial_link/tests/transport_tests.cpp | 28 +- .../tests/triple_buffered_object_tests.cpp | 18 +- quantum/split_common/matrix.c | 332 +-- quantum/split_common/post_config.h | 28 +- quantum/split_common/serial.c | 742 +++--- quantum/split_common/serial.h | 18 +- quantum/split_common/split_util.c | 86 +- quantum/split_common/split_util.h | 2 +- quantum/split_common/transport.c | 272 ++- quantum/stm32/chconf.h | 132 +- quantum/stm32/halconf.h | 244 +- quantum/stm32/mcuconf.h | 312 +-- quantum/template/avr/config.h | 22 +- quantum/template/base/keymaps/default/keymap.c | 61 +- quantum/template/base/template.h | 10 +- quantum/template/ps2avrgb/config.h | 21 +- quantum/template/ps2avrgb/template.c | 36 +- quantum/template/ps2avrgb/usbconfig.h | 96 +- quantum/variable_trace.c | 77 +- quantum/variable_trace.h | 13 +- quantum/velocikey.c | 36 +- quantum/velocikey.h | 8 +- quantum/visualizer/common_gfxconf.h | 103 +- quantum/visualizer/default_animations.c | 203 +- quantum/visualizer/lcd_backlight.c | 50 +- quantum/visualizer/lcd_backlight.h | 10 +- quantum/visualizer/lcd_backlight_keyframes.c | 42 +- quantum/visualizer/lcd_keyframes.c | 42 +- quantum/visualizer/lcd_keyframes.h | 1 - quantum/visualizer/led_backlight_keyframes.c | 40 +- quantum/visualizer/led_backlight_keyframes.h | 1 - quantum/visualizer/resources/lcd_logo.c | 41 +- quantum/visualizer/resources/resources.h | 1 - quantum/visualizer/visualizer.c | 256 +- quantum/visualizer/visualizer.h | 22 +- tests/basic/keymap.c | 26 +- tests/basic/test_keypress.cpp | 6 +- tests/basic/test_macro.cpp | 94 +- tests/test_common/keyboard_report_util.cpp | 62 +- tests/test_common/matrix.c | 32 +- tests/test_common/test_driver.cpp | 35 +- tests/test_common/test_fixture.cpp | 14 +- tmk_core/common/action.c | 671 +++--- tmk_core/common/action.h | 37 +- tmk_core/common/action_code.h | 239 +- tmk_core/common/action_layer.c | 234 +- tmk_core/common/action_layer.h | 58 +- tmk_core/common/action_macro.c | 24 +- tmk_core/common/action_macro.h | 70 +- tmk_core/common/action_tapping.c | 166 +- tmk_core/common/action_tapping.h | 9 +- tmk_core/common/action_util.c | 159 +- tmk_core/common/action_util.h | 71 +- tmk_core/common/arm_atsam/bootloader.c | 46 +- tmk_core/common/arm_atsam/eeprom.c | 83 +- tmk_core/common/arm_atsam/printf.c | 46 +- tmk_core/common/arm_atsam/printf.h | 3 +- tmk_core/common/arm_atsam/suspend.c | 42 +- tmk_core/common/arm_atsam/timer.c | 54 +- tmk_core/common/avr/bootloader.c | 365 +-- tmk_core/common/avr/sleep_led.c | 43 +- tmk_core/common/avr/suspend.c | 171 +- tmk_core/common/avr/suspend_avr.h | 32 +- tmk_core/common/avr/timer.c | 61 +- tmk_core/common/avr/timer_avr.h | 26 +- tmk_core/common/avr/xprintf.h | 17 +- tmk_core/common/backlight.c | 110 +- tmk_core/common/backlight.h | 32 +- tmk_core/common/bootloader.h | 1 - tmk_core/common/bootmagic.c | 50 +- tmk_core/common/bootmagic.h | 51 +- tmk_core/common/chibios/bootloader.c | 63 +- tmk_core/common/chibios/eeprom_stm32.c | 142 +- tmk_core/common/chibios/eeprom_stm32.h | 64 +- tmk_core/common/chibios/eeprom_teensy.c | 782 +++--- tmk_core/common/chibios/flash_stm32.c | 162 +- tmk_core/common/chibios/flash_stm32.h | 15 +- tmk_core/common/chibios/printf.c | 277 +-- tmk_core/common/chibios/printf.h | 59 +- tmk_core/common/chibios/sleep_led.c | 128 +- tmk_core/common/chibios/suspend.c | 46 +- tmk_core/common/chibios/timer.c | 46 +- tmk_core/common/command.c | 400 ++-- tmk_core/common/command.h | 70 +- tmk_core/common/debug.c | 6 +- tmk_core/common/debug.h | 173 +- tmk_core/common/eeconfig.c | 101 +- tmk_core/common/eeconfig.h | 83 +- tmk_core/common/eeprom.h | 28 +- tmk_core/common/host.c | 46 +- tmk_core/common/host.h | 18 +- tmk_core/common/host_driver.h | 2 +- tmk_core/common/keyboard.c | 138 +- tmk_core/common/keyboard.h | 10 +- tmk_core/common/keycode.h | 652 ++--- tmk_core/common/led.h | 11 +- tmk_core/common/magic.c | 8 +- tmk_core/common/matrix.h | 27 +- tmk_core/common/mbed/bootloader.c | 1 - tmk_core/common/mbed/suspend.c | 1 - tmk_core/common/mbed/timer.c | 32 +- tmk_core/common/mbed/xprintf.cpp | 5 +- tmk_core/common/mbed/xprintf.h | 1 - tmk_core/common/mousekey.c | 520 ++-- tmk_core/common/mousekey.h | 172 +- tmk_core/common/nodebug.h | 8 +- tmk_core/common/print.c | 25 +- tmk_core/common/print.h | 394 ++-- tmk_core/common/progmem.h | 10 +- tmk_core/common/raw_hid.h | 4 +- tmk_core/common/report.c | 66 +- tmk_core/common/report.h | 158 +- tmk_core/common/sendchar.h | 1 - tmk_core/common/sendchar_null.c | 6 +- tmk_core/common/sendchar_uart.c | 4 +- tmk_core/common/sleep_led.h | 9 +- tmk_core/common/suspend.h | 3 +- tmk_core/common/test/eeprom.c | 83 +- tmk_core/common/test/suspend.c | 2 - tmk_core/common/test/timer.c | 8 +- tmk_core/common/timer.h | 28 +- tmk_core/common/uart.c | 132 +- tmk_core/common/uart.h | 4 +- tmk_core/common/util.c | 116 +- tmk_core/common/util.h | 3 +- tmk_core/common/wait.h | 36 +- tmk_core/protocol/adb.c | 171 +- tmk_core/protocol/adb.h | 13 +- tmk_core/protocol/arm_atsam/adc.c | 110 +- tmk_core/protocol/arm_atsam/adc.h | 10 +- tmk_core/protocol/arm_atsam/arm_atsam_protocol.h | 27 +- tmk_core/protocol/arm_atsam/clks.c | 375 +-- tmk_core/protocol/arm_atsam/clks.h | 56 +- tmk_core/protocol/arm_atsam/d51_util.c | 289 +-- tmk_core/protocol/arm_atsam/d51_util.h | 73 +- tmk_core/protocol/arm_atsam/i2c_master.c | 526 ++--- tmk_core/protocol/arm_atsam/i2c_master.h | 130 +- tmk_core/protocol/arm_atsam/issi3733_driver.h | 260 +- tmk_core/protocol/arm_atsam/led_matrix.c | 430 ++-- tmk_core/protocol/arm_atsam/led_matrix.h | 146 +- tmk_core/protocol/arm_atsam/led_matrix_programs.c | 108 +- tmk_core/protocol/arm_atsam/main_arm_atsam.c | 185 +- tmk_core/protocol/arm_atsam/main_arm_atsam.h | 2 +- tmk_core/protocol/arm_atsam/md_bootloader.h | 16 +- tmk_core/protocol/arm_atsam/spi.c | 83 +- tmk_core/protocol/arm_atsam/spi.h | 48 +- tmk_core/protocol/arm_atsam/startup.c | 776 +++--- tmk_core/protocol/arm_atsam/usb/compiler.h | 934 ++++---- tmk_core/protocol/arm_atsam/usb/conf_usb.h | 73 +- tmk_core/protocol/arm_atsam/usb/main_usb.c | 74 +- tmk_core/protocol/arm_atsam/usb/status_codes.h | 98 +- tmk_core/protocol/arm_atsam/usb/udc.c | 651 +++-- tmk_core/protocol/arm_atsam/usb/udc.h | 26 +- tmk_core/protocol/arm_atsam/usb/udc_desc.h | 29 +- tmk_core/protocol/arm_atsam/usb/udd.h | 40 +- tmk_core/protocol/arm_atsam/usb/udi.h | 96 +- tmk_core/protocol/arm_atsam/usb/udi_cdc.c | 857 +++---- tmk_core/protocol/arm_atsam/usb/udi_cdc.h | 58 +- tmk_core/protocol/arm_atsam/usb/udi_cdc_conf.h | 16 +- tmk_core/protocol/arm_atsam/usb/udi_device_conf.h | 654 ++--- .../protocol/arm_atsam/usb/udi_device_epsize.h | 21 +- tmk_core/protocol/arm_atsam/usb/udi_hid.c | 82 +- tmk_core/protocol/arm_atsam/usb/udi_hid.h | 4 +- tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c | 789 +++---- tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.h | 48 +- tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_conf.h | 2 +- tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c | 108 +- tmk_core/protocol/arm_atsam/usb/ui.c | 39 +- tmk_core/protocol/arm_atsam/usb/ui.h | 2 +- tmk_core/protocol/arm_atsam/usb/usb.c | 345 ++- tmk_core/protocol/arm_atsam/usb/usb.h | 110 +- tmk_core/protocol/arm_atsam/usb/usb2422.c | 366 +-- tmk_core/protocol/arm_atsam/usb/usb2422.h | 384 ++- tmk_core/protocol/arm_atsam/usb/usb_atmel.h | 181 +- tmk_core/protocol/arm_atsam/usb/usb_device_udd.c | 386 ++- tmk_core/protocol/arm_atsam/usb/usb_main.h | 51 +- tmk_core/protocol/arm_atsam/usb/usb_protocol.h | 252 +- tmk_core/protocol/arm_atsam/usb/usb_protocol_cdc.h | 215 +- tmk_core/protocol/arm_atsam/usb/usb_protocol_hid.h | 383 ++- tmk_core/protocol/arm_atsam/usb/usb_util.c | 54 +- tmk_core/protocol/arm_atsam/usb/usb_util.h | 3 +- tmk_core/protocol/arm_atsam/wait_api.h | 1 - tmk_core/protocol/bluefruit/bluefruit.c | 123 +- tmk_core/protocol/bluefruit/bluefruit.h | 1 - tmk_core/protocol/bluefruit/main.c | 91 +- .../chibios/lufa_utils/LUFA/Drivers/USB/USB.h | 8 +- tmk_core/protocol/chibios/main.c | 180 +- tmk_core/protocol/chibios/usb_driver.c | 435 ++-- tmk_core/protocol/chibios/usb_driver.h | 168 +- tmk_core/protocol/chibios/usb_main.c | 1048 ++++---- tmk_core/protocol/chibios/usb_main.h | 7 +- tmk_core/protocol/ibm4704.c | 62 +- tmk_core/protocol/ibm4704.h | 113 +- tmk_core/protocol/iwrap/iwrap.c | 202 +- tmk_core/protocol/iwrap/iwrap.h | 16 +- tmk_core/protocol/iwrap/main.c | 312 +-- tmk_core/protocol/iwrap/suart.h | 4 +- tmk_core/protocol/iwrap/wd.h | 134 +- tmk_core/protocol/lufa/adafruit_ble.cpp | 1117 +++++---- tmk_core/protocol/lufa/adafruit_ble.h | 30 +- tmk_core/protocol/lufa/bluetooth.c | 20 +- tmk_core/protocol/lufa/bluetooth.h | 37 +- tmk_core/protocol/lufa/lufa.c | 692 +++--- tmk_core/protocol/lufa/lufa.h | 20 +- tmk_core/protocol/lufa/outputselect.c | 9 +- tmk_core/protocol/lufa/outputselect.h | 14 +- tmk_core/protocol/m0110.c | 262 +- tmk_core/protocol/m0110.h | 48 +- tmk_core/protocol/mbed/HIDKeyboard.cpp | 241 +- tmk_core/protocol/mbed/HIDKeyboard.h | 37 +- tmk_core/protocol/mbed/mbed_driver.cpp | 40 +- tmk_core/protocol/midi/Config/LUFAConfig.h | 28 +- tmk_core/protocol/midi/bytequeue/bytequeue.c | 93 +- tmk_core/protocol/midi/bytequeue/bytequeue.h | 59 +- .../protocol/midi/bytequeue/interrupt_setting.c | 54 +- .../protocol/midi/bytequeue/interrupt_setting.h | 33 +- tmk_core/protocol/midi/midi.c | 344 +-- tmk_core/protocol/midi/midi.h | 152 +- tmk_core/protocol/midi/midi_device.c | 477 ++-- tmk_core/protocol/midi/midi_device.h | 121 +- tmk_core/protocol/midi/midi_function_types.h | 44 +- tmk_core/protocol/midi/qmk_midi.c | 258 +- tmk_core/protocol/midi/qmk_midi.h | 10 +- tmk_core/protocol/midi/sysex_tools.c | 158 +- tmk_core/protocol/midi/sysex_tools.h | 34 +- tmk_core/protocol/news.c | 19 +- tmk_core/protocol/news.h | 3 +- tmk_core/protocol/next_kbd.c | 127 +- tmk_core/protocol/next_kbd.h | 12 +- tmk_core/protocol/pjrc/main.c | 18 +- tmk_core/protocol/pjrc/pjrc.c | 40 +- tmk_core/protocol/pjrc/pjrc.h | 1 - tmk_core/protocol/pjrc/usb.c | 1464 ++++++------ tmk_core/protocol/pjrc/usb.h | 144 +- tmk_core/protocol/pjrc/usb_debug.c | 128 +- tmk_core/protocol/pjrc/usb_debug.h | 15 +- tmk_core/protocol/pjrc/usb_extra.c | 70 +- tmk_core/protocol/pjrc/usb_extra.h | 12 +- tmk_core/protocol/pjrc/usb_keyboard.c | 62 +- tmk_core/protocol/pjrc/usb_keyboard.h | 8 +- tmk_core/protocol/pjrc/usb_mouse.c | 88 +- tmk_core/protocol/pjrc/usb_mouse.h | 25 +- tmk_core/protocol/ps2.h | 70 +- tmk_core/protocol/ps2_busywait.c | 60 +- tmk_core/protocol/ps2_interrupt.c | 112 +- tmk_core/protocol/ps2_io.h | 1 - tmk_core/protocol/ps2_io_avr.c | 69 +- tmk_core/protocol/ps2_io_mbed.c | 29 +- tmk_core/protocol/ps2_mouse.c | 102 +- tmk_core/protocol/ps2_mouse.h | 163 +- tmk_core/protocol/ps2_usart.c | 88 +- tmk_core/protocol/serial.h | 4 +- tmk_core/protocol/serial_mouse.h | 3 +- tmk_core/protocol/serial_mouse_microsoft.c | 35 +- tmk_core/protocol/serial_mouse_mousesystems.c | 38 +- tmk_core/protocol/serial_soft.c | 81 +- tmk_core/protocol/serial_uart.c | 58 +- tmk_core/protocol/usb_descriptor.c | 1072 +++------ tmk_core/protocol/usb_descriptor.h | 250 +- tmk_core/protocol/vusb/main.c | 42 +- tmk_core/protocol/vusb/sendchar_usart.c | 12 +- tmk_core/protocol/vusb/usbdrv/oddebug.c | 22 +- tmk_core/protocol/vusb/usbdrv/oddebug.h | 114 +- .../protocol/vusb/usbdrv/usbconfig-prototype.h | 86 +- tmk_core/protocol/vusb/usbdrv/usbdrv.c | 673 +++--- tmk_core/protocol/vusb/usbdrv/usbdrv.h | 487 ++-- tmk_core/protocol/vusb/vusb.c | 498 ++-- tmk_core/protocol/vusb/vusb.h | 3 +- tmk_core/protocol/xt.h | 56 +- tmk_core/protocol/xt_interrupt.c | 54 +- tmk_core/ring_buffer.h | 59 +- 502 files changed, 32694 insertions(+), 39497 deletions(-) mode change 100755 => 100644 drivers/avr/apa102.c mode change 100755 => 100644 drivers/avr/apa102.h mode change 100755 => 100644 drivers/avr/i2c_master.c mode change 100755 => 100644 drivers/avr/i2c_master.h mode change 100755 => 100644 drivers/avr/i2c_slave.c mode change 100755 => 100644 drivers/avr/i2c_slave.h mode change 100755 => 100644 tmk_core/common/chibios/eeprom_stm32.c mode change 100755 => 100644 tmk_core/common/chibios/eeprom_stm32.h mode change 100755 => 100644 tmk_core/common/chibios/flash_stm32.c mode change 100755 => 100644 tmk_core/common/chibios/flash_stm32.h mode change 100755 => 100644 tmk_core/protocol/midi/Config/LUFAConfig.h mode change 100755 => 100644 tmk_core/protocol/midi/bytequeue/bytequeue.c mode change 100755 => 100644 tmk_core/protocol/midi/bytequeue/bytequeue.h mode change 100755 => 100644 tmk_core/protocol/midi/bytequeue/interrupt_setting.c mode change 100755 => 100644 tmk_core/protocol/midi/bytequeue/interrupt_setting.h mode change 100755 => 100644 tmk_core/protocol/midi/midi.c mode change 100755 => 100644 tmk_core/protocol/midi/midi.h mode change 100755 => 100644 tmk_core/protocol/midi/midi_device.c mode change 100755 => 100644 tmk_core/protocol/midi/midi_device.h mode change 100755 => 100644 tmk_core/protocol/midi/midi_function_types.h mode change 100755 => 100644 tmk_core/protocol/midi/sysex_tools.c mode change 100755 => 100644 tmk_core/protocol/midi/sysex_tools.h diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index cba5a1c679..18068d3a6d 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -34,98 +34,83 @@ static uint8_t i2c_address; static const I2CConfig i2cconfig = { #ifdef USE_I2CV1 - I2C1_OPMODE, - I2C1_CLOCK_SPEED, - I2C1_DUTY_CYCLE, + I2C1_OPMODE, + I2C1_CLOCK_SPEED, + I2C1_DUTY_CYCLE, #else - 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_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 #endif }; static i2c_status_t chibios_to_qmk(const msg_t* status) { - switch (*status) { - case I2C_NO_ERROR: - return I2C_STATUS_SUCCESS; - case I2C_TIMEOUT: - return I2C_STATUS_TIMEOUT; - // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT - default: - return I2C_STATUS_ERROR; - } + switch (*status) { + case I2C_NO_ERROR: + return I2C_STATUS_SUCCESS; + case I2C_TIMEOUT: + return I2C_STATUS_TIMEOUT; + // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT + default: + return I2C_STATUS_ERROR; + } } -__attribute__ ((weak)) -void i2c_init(void) -{ - // Try releasing special pins for a short time - palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT); - palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT); +__attribute__((weak)) void i2c_init(void) { + // Try releasing special pins for a short time + palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT); + palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT); - chThdSleepMilliseconds(10); + chThdSleepMilliseconds(10); #ifdef USE_I2CV1 - palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_STM32_ALTERNATE_OPENDRAIN); - palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_STM32_ALTERNATE_OPENDRAIN); + palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_STM32_ALTERNATE_OPENDRAIN); + palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_STM32_ALTERNATE_OPENDRAIN); #else - palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); - palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); + palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); + palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); #endif - //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_address = address; - i2cStart(&I2C_DRIVER, &i2cconfig); - return I2C_STATUS_SUCCESS; +i2c_status_t i2c_start(uint8_t address) { + i2c_address = address; + i2cStart(&I2C_DRIVER, &i2cconfig); + return I2C_STATUS_SUCCESS; } -i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) -{ - i2c_address = address; - i2cStart(&I2C_DRIVER, &i2cconfig); - msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); - return chibios_to_qmk(&status); +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { + i2c_address = address; + i2cStart(&I2C_DRIVER, &i2cconfig); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); + return chibios_to_qmk(&status); } -i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) -{ - i2c_address = address; - i2cStart(&I2C_DRIVER, &i2cconfig); - msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); - return chibios_to_qmk(&status); +i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) { + i2c_address = address; + i2cStart(&I2C_DRIVER, &i2cconfig); + msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); + 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_address = devaddr; - i2cStart(&I2C_DRIVER, &i2cconfig); +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) { + i2c_address = devaddr; + i2cStart(&I2C_DRIVER, &i2cconfig); - uint8_t complete_packet[length + 1]; - for(uint8_t i = 0; i < length; i++) - { - complete_packet[i+1] = data[i]; - } - complete_packet[0] = regaddr; + uint8_t complete_packet[length + 1]; + for (uint8_t i = 0; i < length; i++) { + complete_packet[i + 1] = data[i]; + } + complete_packet[0] = regaddr; - msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); - return chibios_to_qmk(&status); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); + 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_address = devaddr; - i2cStart(&I2C_DRIVER, &i2cconfig); - msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), ®addr, 1, data, length, MS2ST(timeout)); - 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_address = devaddr; + i2cStart(&I2C_DRIVER, &i2cconfig); + msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), ®addr, 1, data, length, MS2ST(timeout)); + return chibios_to_qmk(&status); } -void i2c_stop(void) -{ - i2cStop(&I2C_DRIVER); -} +void i2c_stop(void) { i2cStop(&I2C_DRIVER); } diff --git a/drivers/arm/i2c_master.h b/drivers/arm/i2c_master.h index c8afa31e28..b40fa0a910 100644 --- a/drivers/arm/i2c_master.h +++ b/drivers/arm/i2c_master.h @@ -27,84 +27,83 @@ #include "ch.h" #include - #if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx) - #define USE_I2CV1 +# define USE_I2CV1 #endif #ifdef I2C1_BANK - #define I2C1_SCL_BANK I2C1_BANK - #define I2C1_SDA_BANK I2C1_BANK +# define I2C1_SCL_BANK I2C1_BANK +# define I2C1_SDA_BANK I2C1_BANK #endif #ifndef I2C1_SCL_BANK - #define I2C1_SCL_BANK GPIOB +# define I2C1_SCL_BANK GPIOB #endif #ifndef I2C1_SDA_BANK - #define I2C1_SDA_BANK GPIOB +# define I2C1_SDA_BANK GPIOB #endif #ifndef I2C1_SCL - #define I2C1_SCL 6 +# define I2C1_SCL 6 #endif #ifndef I2C1_SDA - #define I2C1_SDA 7 +# define I2C1_SDA 7 #endif #ifdef USE_I2CV1 - #ifndef I2C1_OPMODE - #define I2C1_OPMODE OPMODE_I2C - #endif - #ifndef I2C1_CLOCK_SPEED - #define I2C1_CLOCK_SPEED 100000 /* 400000 */ - #endif - #ifndef I2C1_DUTY_CYCLE - #define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */ - #endif +# ifndef I2C1_OPMODE +# define I2C1_OPMODE OPMODE_I2C +# endif +# ifndef I2C1_CLOCK_SPEED +# define I2C1_CLOCK_SPEED 100000 /* 400000 */ +# endif +# ifndef I2C1_DUTY_CYCLE +# define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */ +# endif #else - // The default PAL alternate modes are used to signal that the pins are used for I2C - #ifndef I2C1_SCL_PAL_MODE - #define I2C1_SCL_PAL_MODE 4 - #endif - #ifndef I2C1_SDA_PAL_MODE - #define I2C1_SDA_PAL_MODE 4 - #endif +// The default PAL alternate modes are used to signal that the pins are used for I2C +# ifndef I2C1_SCL_PAL_MODE +# define I2C1_SCL_PAL_MODE 4 +# endif +# ifndef I2C1_SDA_PAL_MODE +# define I2C1_SDA_PAL_MODE 4 +# endif - // The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock - // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html - #ifndef I2C1_TIMINGR_PRESC - #define I2C1_TIMINGR_PRESC 15U - #endif - #ifndef I2C1_TIMINGR_SCLDEL - #define I2C1_TIMINGR_SCLDEL 4U - #endif - #ifndef I2C1_TIMINGR_SDADEL - #define I2C1_TIMINGR_SDADEL 2U - #endif - #ifndef I2C1_TIMINGR_SCLH - #define I2C1_TIMINGR_SCLH 15U - #endif - #ifndef I2C1_TIMINGR_SCLL - #define I2C1_TIMINGR_SCLL 21U - #endif +// The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock +// For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html +# ifndef I2C1_TIMINGR_PRESC +# define I2C1_TIMINGR_PRESC 15U +# endif +# ifndef I2C1_TIMINGR_SCLDEL +# define I2C1_TIMINGR_SCLDEL 4U +# endif +# ifndef I2C1_TIMINGR_SDADEL +# define I2C1_TIMINGR_SDADEL 2U +# endif +# ifndef I2C1_TIMINGR_SCLH +# define I2C1_TIMINGR_SCLH 15U +# endif +# ifndef I2C1_TIMINGR_SCLL +# define I2C1_TIMINGR_SCLL 21U +# endif #endif #ifndef I2C_DRIVER - #define I2C_DRIVER I2CD1 +# define I2C_DRIVER I2CD1 #endif typedef int16_t i2c_status_t; #define I2C_STATUS_SUCCESS (0) -#define I2C_STATUS_ERROR (-1) +#define I2C_STATUS_ERROR (-1) #define I2C_STATUS_TIMEOUT (-2) -void i2c_init(void); +void i2c_init(void); i2c_status_t i2c_start(uint8_t address); i2c_status_t i2c_transmit(uint8_t address, const 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_status_t i2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length); +i2c_status_t i2c_transmit_receive(uint8_t address, uint8_t* tx_body, uint16_t tx_length, uint8_t* rx_body, uint16_t rx_length); 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_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); -void i2c_stop(void); +void i2c_stop(void); diff --git a/drivers/avr/analog.c b/drivers/avr/analog.c index 1ec38df75d..1a8da4261d 100644 --- a/drivers/avr/analog.c +++ b/drivers/avr/analog.c @@ -21,49 +21,38 @@ #include #include "analog.h" +static uint8_t aref = (1 << REFS0); // default to AREF = Vcc -static uint8_t aref = (1<= 12) return 0; - return adc_read(pgm_read_byte(pin_to_mux + pin)); + static const uint8_t PROGMEM pin_to_mux[] = {0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20}; + if (pin >= 12) return 0; + return adc_read(pgm_read_byte(pin_to_mux + pin)); #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) - if (pin >= 8) return 0; - return adc_read(pin); + if (pin >= 8) return 0; + return adc_read(pin); #else - return 0; + return 0; #endif } // Mux input -int16_t adc_read(uint8_t mux) -{ +int16_t adc_read(uint8_t mux) { #if defined(__AVR_AT90USB162__) - return 0; + return 0; #else - uint8_t low; - - ADCSRA = (1< -void analogReference(uint8_t mode); +void analogReference(uint8_t mode); int16_t analogRead(uint8_t pin); int16_t adc_read(uint8_t mux); -#define ADC_REF_POWER (1<. -*/ + * APA102 lib V1.0a + * + * Controls APA102 RGB-LEDs + * Author: Mikkel (Duckle29 on github) + * + * Dec 22th, 2017 v1.0a Initial Version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "apa102.h" #include @@ -27,75 +27,70 @@ #include "debug.h" // Setleds for standard RGB -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)); -} +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)); } -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_CLK_PIN, PinDirectionOutput); +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_CLK_PIN, PinDirectionOutput); - apa102_send_array((uint8_t*)ledarray,leds) + apa102_send_array((uint8_t *)ledarray, leds) } -void apa102_send_array(uint8_t *data, uint16_t leds){ // Data is struct of 3 bytes. RGB - leds is number of leds in data - apa102_start_frame(); - while(leds--){ - apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r); - data++; - } - apa102_end_frame(leds); +void apa102_send_array(uint8_t *data, uint16_t leds) { // Data is struct of 3 bytes. RGB - leds is number of leds in data + apa102_start_frame(); + while (leds--) { + apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r); + data++; + } + apa102_end_frame(leds); } -void apa102_send_frame(uint32_t frame){ - for(uint32_t i=0xFF; i>0;){ - apa102_send_byte(frame & i); - i = i << 8; - } +void apa102_send_frame(uint32_t frame) { + for (uint32_t i = 0xFF; i > 0;) { + apa102_send_byte(frame & i); + i = i << 8; + } } -void apa102_start_frame(){ - apa102_send_frame(0); -} +void apa102_start_frame() { apa102_send_frame(0); } -void apa102_end_frame(uint16_t leds) -{ - // 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? +void apa102_end_frame(uint16_t leds) { + // 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? - // We need to send some more bytes to ensure that all the LEDs in the - // chain see their new color and start displaying it. - // - // The data stream seen by the last LED in the chain will be delayed by - // (count - 1) clock edges, because each LED before it inverts the clock - // line and delays the data by one clock edge. Therefore, to make sure - // the last LED actually receives the data we wrote, the number of extra - // edges we send at the end of the frame must be at least (count - 1). - // For the APA102C, that is sufficient. - // - // The SK9822 only updates after it sees 32 zero bits followed by one more - // rising edge. To avoid having the update time depend on the color of - // the last LED, we send a dummy 0xFF byte. (Unfortunately, this means - // that partial updates of the beginning of an LED strip are not possible; - // the LED after the last one you are trying to update will be black.) - // After that, to ensure that the last LED in the chain sees 32 zero bits - // and a rising edge, we need to send at least 65 + (count - 1) edges. It - // is sufficent and simpler to just send (5 + count/16) bytes of zeros. - // - // We are ignoring the specification for the end frame in the APA102/SK9822 - // datasheets because it does not actually ensure that all the LEDs will - // start displaying their new colors right away. + // We need to send some more bytes to ensure that all the LEDs in the + // chain see their new color and start displaying it. + // + // The data stream seen by the last LED in the chain will be delayed by + // (count - 1) clock edges, because each LED before it inverts the clock + // line and delays the data by one clock edge. Therefore, to make sure + // the last LED actually receives the data we wrote, the number of extra + // edges we send at the end of the frame must be at least (count - 1). + // For the APA102C, that is sufficient. + // + // The SK9822 only updates after it sees 32 zero bits followed by one more + // rising edge. To avoid having the update time depend on the color of + // the last LED, we send a dummy 0xFF byte. (Unfortunately, this means + // that partial updates of the beginning of an LED strip are not possible; + // the LED after the last one you are trying to update will be black.) + // After that, to ensure that the last LED in the chain sees 32 zero bits + // and a rising edge, we need to send at least 65 + (count - 1) edges. It + // is sufficent and simpler to just send (5 + count/16) bytes of zeros. + // + // We are ignoring the specification for the end frame in the APA102/SK9822 + // datasheets because it does not actually ensure that all the LEDs will + // start displaying their new colors right away. - apa102_send_byte(0xFF); - for (uint16_t i = 0; i < 5 + leds / 16; i++){ - apa102_send_byte(0); - } + apa102_send_byte(0xFF); + for (uint16_t i = 0; i < 5 + leds / 16; i++) { + apa102_send_byte(0); + } } -void apa102_send_byte(uint8_t byte){ - uint8_t i; - for (i = 0; i < 8; i++){ +void apa102_send_byte(uint8_t byte) { + uint8_t i; + for (i = 0; i < 8; i++) { digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i))); digitalWrite(RGB_CLK_PIN, PinLevelHigh); - } + } } diff --git a/drivers/avr/apa102.h b/drivers/avr/apa102.h old mode 100755 new mode 100644 index 5d852e0673..d4c1e18ee1 --- a/drivers/avr/apa102.h +++ b/drivers/avr/apa102.h @@ -27,7 +27,6 @@ #include "color.h" - /* User Interface * * Input: @@ -41,6 +40,6 @@ * - Wait 50�s to reset the LEDs */ -void apa102_setleds (LED_TYPE *ledarray, uint16_t number_of_leds); -void apa102_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask); +void apa102_setleds(LED_TYPE *ledarray, uint16_t number_of_leds); +void apa102_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pinmask); void apa102_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); diff --git a/drivers/avr/glcdfont.c b/drivers/avr/glcdfont.c index 6f88bd23a7..2c332ea6db 100644 --- a/drivers/avr/glcdfont.c +++ b/drivers/avr/glcdfont.c @@ -5,272 +5,30 @@ #define FONT5X7_H #ifdef __AVR__ - #include - #include +# include +# include #elif defined(ESP8266) - #include +# include #else - #define PROGMEM +# define PROGMEM #endif // Standard ASCII 5x7 font static const unsigned char font[] PROGMEM = { - 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, - 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 - 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block - 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, - 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 + 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, 0x1