summaryrefslogtreecommitdiffstats
path: root/drivers/avr
Commit message (Collapse)AuthorAgeFilesLines
* Relocate platform specific drivers (#13894)Joel Challis2021-08-1718-3116/+0
| | | | | | | * Relocate platform specific drivers * Move stm eeprom * Tidy up slightly
* Extensible split data sync (#11930)Nick Brassel2021-06-185-124/+81
| | | | | | | | | | | | | | | | | | | | | | | | * Extensible split data sync capability through transactions. - Split common transport has been split up between the transport layer and data layer. - Split "transactions" model used, with convergence between I2C and serial data definitions. - Slave matrix "generation count" is used to determine if the full slave matrix needs to be retrieved. - Encoders get the same "generation count" treatment. - All other blocks of data are synchronised when a change is detected. - All transmissions have a globally-configurable deadline before a transmission is forced (`FORCED_SYNC_THROTTLE_MS`, default 100ms). - Added atomicity for all core-synced data, preventing partial updates - Added retries to AVR i2c_master's i2c_start, to minimise the number of failed transactions when interrupts are disabled on the slave due to atomicity checks. - Some keyboards have had slight modifications made in order to ensure that they still build due to firmware size restrictions. * Fixup LED_MATRIX compile. * Parameterise ERROR_DISCONNECT_COUNT.
* Tidy up spi_master includes (#13053)Ryan2021-06-032-4/+4
|
* Merge remote-tracking branch 'origin/master' into developQMK Bot2021-02-081-21/+17
|\
| * ws2812: Fix number of nops for AVR at 8 MHz (#9559)Sergey Vlasov2021-02-091-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ws2812: Fix number of nops for AVR at 8 MHz When trying to calculate the number of nops for AVR running at 8 MHz, the value of `w3` is expected to be negative; however, because `F_CPU` is defined in tmk_core/avr.mk with the `UL` suffix, the preprocessor performs its calculations using `unsigned long`, getting a very large positive number instead of the expected negative number; this then results in generating code with a huge number of nops. Fix the broken calculations by performing a comparison before subtraction, so that the unsigned number wraparound does not occur. The keyboard which triggers the problem is `handwired/promethium`; the buggy code silently compiles, but the resulting timings would be completely wrong. * ws2812: Clean up the code after the 8 MHz fix Remove old code which was unsuccessfully trying to clamp negative w1, w2 and w3 values to 0, and set w1_nops, w2_nops and w3_nops directly.
* | Include stdbool.h in uart.h (#11728)Drashna Jaelre2021-01-301-0/+1
| |
* | Adds AT90USB162 support (#11570)Dasky2021-01-294-6/+6
| | | | | | | | | | | | | | | | | | | | | | * at90usb162 support * fix missing bracket * Apply suggestions from code review Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
* | UART driver refactor (#11637)Ryan2021-01-272-0/+204
| |
* | Rewrite APA102 support (#10894)Aldehir Rojas2020-12-302-141/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rewrite APA102 support The APA102 source was broken by commit 16a15c1cfcbfd0feb2c2cf1383676747e2f97d73 as it did not include the quantum header. This commit addresses that, as well as other issues with transferring bytes over the SPI interface, i.e. it was not setting the clock pin back to low after sending a bit. The deviation when sending the end frame is kept, but updated to the latest from the referenced project. Finally, these changes expose the global LED brightness parameter of the APA102. Brightness values are configurable through `APA102_DEFAULT_BRIGHTNESS` and `APA102_MAX_BRIGHTNESS`. * Fix typo in led brightness extern * Move driver out of AVR directory and add delay for ARM * Experimental APA102 support on AVR and ARM Co-authored-by: Alde Rojas <hello@alde.io> * Refactor apa102_send_byte() calls to a loop * Implement io_wait function for ARM * Move APA102 drivers to own directory, fix copyright notice * Add APA102 keymap to handwired/onekey * Simplify RGBLIGHT_ENABLE/DRIVER option handling Co-authored-by: Mikkel Jeppesen <2756925+Duckle29@users.noreply.github.com>
* Change include guards in tmk_core/ and drivers/ to pragma once (#11240)Ryan2020-12-264-16/+5
|
* Fix error handling in SPI master. (#11122)Dimitris Papavasiliou2020-12-061-5/+11
| | | Co-authored-by: Dimitris Papavasiliou <dpapavas@gmail.com>
* 2020 November 28 Breaking Changes Update (#11053)James Young2020-11-281-42/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
* Fix ssd1306 compilation on avr-gcc 10 (#9267)Joel Challis2020-09-172-1/+3
|
* Hid joystick interface (#4226)a-chol2020-08-291-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add support for hid gamepad interface add documentation for HID joystick Add joystick_task to read analog axes values even when no key is pressed or release. update doc Update docs/feature_joystick.md Manage pin setup and read to maintain matrix scan after analog read * Incorporates patches and changes to HID reporting There are some patches provided by @a-chol incorporated on this commit, and also some changes I made to the HID Report structure. The most interesting is the one dealing with number of buttons: Linux doesn't seem to care, but Windows requires the HID structure to be byte aligned (that's in the spec). So if one declares 8/16/32... buttons they should not have any issues, but this is what happens when you have 9 buttons: ``` bits |0|1|2|3|4|5|6|7| |*|*|*|*|*|*|*|*| axis 0 (report size 8) |*|*|*|*|*|*|*|*| ... |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| axis 6 |*|*|*|*|*|*|*|*| first 8 buttons (report size 1) |*| | | | | | | | last of 9 buttons, not aligned ``` So for that I added a conditonal that will add a number of reports with size 1 to make sure it aligns to the next multiple of 8. Those reports send dummy inputs that don't do anything aside from aligning the data. Tested on Linux, Windows 10 and Street Fighter (where the joystick is recognized as direct-input) * Add save and restore of each pin used in reading joystick (AVR). Allow output pin to be JS_VIRTUAL_AXIS if the axis is connected to Vcc instead of an output pin from the MCU. Fix joystick report id Fix broken v-usb hid joystick interface. Make it more resilient to unusual settings (none multiple of eight button count, 0 buttons or 0 axes) Correct adc reading for multiple axes. Piecewise range conversion for uncentered raw value range. Input, output and ground pin configuration per axis. Documentation fixes * Fix port addressing for joystick analog read * The other required set of changes As per the PR, the changes still holding it up. Add onekey for testing. Fix ARM builds. Fix device descriptor when either axes or buttons is zero. Add compile-time check for at least one axis or button. Move definition to try to fix conflict. PR review comments. qmk cformat * avoid float functions to compute range mapping for axis adc reading * Remove V-USB support for now. Updated docs accordingly. * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios * Fix HID joystick report sending for ChibiOS. Add one analog axis to the onekey:joystick keymap. Fix pin state save and restore during joystick analog read for STM32 MCUs. * Update tmk_core/protocol/chibios/usb_main.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add missing mcuconf.h and halconf.h to onekey:joystick keymap. Add suggested fixes from PR. * Switch saveState and restoreState signature to use pin_t type. onekey:joystick : add a second axis, virtual and programmatically animated. * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Add PR corrections * Remove halconf.h and mcuconf.h from onekey keymaps * Change ADC_PIN to A0 Co-authored-by: achol <allecooll@hotmail.com> Co-authored-by: José Júnior <jose.junior@gmail.com> Co-authored-by: a-chol <achol@notamail.com> Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove inclusion of adafruit_ble.h from ssd1306.c (#9355)Ryan2020-08-291-3/+0
|
* Fix incorrect delay when setting WS2812 (and similar) leds (#9302)Joshua Diamond2020-06-202-55/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix incorrect delay when setting WS2812 (and similar) leds * Add documentation for WS2812_DELAY_MICROSECONDS * Remove improper cast to uint8_t Co-authored-by: Sergey Vlasov <sigprof@gmail.com> * Remove unneeded cast to uint8_t and correct math Co-authored-by: Sergey Vlasov <sigprof@gmail.com> * microseconds -> µs Co-authored-by: Ryan <fauxpark@gmail.com> * Make documentation better match the spec sheet. Co-authored-by: Ryan <fauxpark@gmail.com> * Rename macro to match spec sheet * Further correction to the delay maths for the SPI case. Co-authored-by: Joel Challis <git@zvecr.com> * Move ws2812_common.h to the drivers directory * Revert "Further correction to the delay maths for the SPI case." This reverts commit e61b56a2cfc7dfec9992a7a3af92afa50e5b8ec0. * Remove ws2812_setleds_pin(); consolidate ws2812.h Co-authored-by: Sergey Vlasov <sigprof@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Joel Challis <git@zvecr.com>
* adds support for the atmega328 (#9043)itsnoteasy2020-06-103-4/+4
| | | Co-authored-by: Ryan <fauxpark@gmail.com>
* Fix capitalisation of "GitHub" (#9184)Ryan2020-05-255-5/+5
|
* QMK-ify some GPIO macros (#8315)Ryan2020-04-302-5/+4
|
* Fix AVR SPI parameter configuration, remove timeouts due to sync protocol. ↵Nick Brassel2020-04-132-60/+73
| | | | (#8775)
* format code according to conventions [skip ci]QMK Bot2020-04-081-5/+5
|
* spi_master for AVR (#8299)Ryan2020-04-082-0/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Change _delay_ms/us() to wait_ms/us() * Switch to platform-agnostic GPIO macros * Add AVR spi_master and migrate Adafruit BLE code * Set verbose back to false * Add clock divisor, bit order and SPI mode configuration for init * Add start and stop functions * Move configuration of mode, endianness and speed to `spi_start()` * Some breaks here would be good * Default Adafruit BLE clock divisor to 4 (2MHz on the Feather 32U4) * Remove mode and divisor enums * Add some docs * No hr at EOF * Add links in sidebar
* Fix AVR ws2812 when ADDRESS_BASE is non zero (#8646)Joel Challis2020-04-022-22/+17
| | | | | | | * Fix AVR ws2812 when ADDRESS_BASE is non zero * fix port * remove unused function defs
* Remove pro_micro.h (#8374)Ryan2020-03-141-324/+0
| | | | | * Remove pro_micro.h * Include quantum.h
* Clean up includes for glcdfont headers (#7745)Ryan2020-03-011-12/+1
| | | | | | | | * Clean up includes for glcdfont headers * Remove pragma once, most of these are not headers * Missed these
* Update split serial code to use driver pattern (#7990)Joel Challis2020-01-242-0/+570
| | | | | | * Move avr serial code to drivers * Update src+= serial.c to driver pattern
* Improve support and docs for ADC driver (#7191)fauxpark2019-12-082-39/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improve support and docs for ADC driver * Comment ADC channels * Move to Makers and Modders section, and fix usage instructions * Flesh out intro * Superscript 328P note * Fix pin_to_mux LUT * Support USB64/1287 as well * analogReadPin() defaults to 0V mux on invalid pin * Update pinToMux() function documentation * Dot * Accept (some of) the `qmk cformat` changes * Do clang-format properly * More wording tweaks * Link to encoder docs
* Move Ergodox EZ RGB Light code to custom driver (#7309)Drashna Jaelre2019-11-141-127/+2
| | | | | | | | | | | | | | | | | | | * Move Ergodox EZ RGB code to custom driver Also implements full addressing of Ergodox EZ's LED Strip, as written by seebs Co-authored-by: Seebs <seebs@seebs.net> * Make Clipping range accessible for custom drivers * Remove RGBW_BB_TWI from driver and docs * Revert changes to clipping range support * Use just rgblight_set instead of full custom driver * Convert to i2c_master commands * Rename rgblight driver and clean up includes
* Unify RGB and RGBW commands (#7297)Drashna Jaelre2019-11-093-25/+12
| | | | | | | | | | | | | | | | | | | | | | * Fix unicode in comments Co-Authored-By: fauxpark <fauxpark@gmail.com> * Remove separate RGBW implementation for a unified function * Set White to 0 in RGBW LEDs This is just to get this working, later, proper brightness can be handled elsewhere. * Use us instead of nanoseconds(?) since it renders correctly on web * Remove RGBW function from arm/ws2812.h * Remove RGBW function from arm/ws2812.c * Formatting changes * Add doc info
* Refactor ps2avrgb i2c ws2812 to core (#7183)Joel Challis2019-10-291-0/+31
| | | | | | | | | | | | | | | | | | | | * Refactor ps2avrgb i2c ws2812 to core * Refactor jj40 to use ws2812 i2c driver * Refactor ps2avrgb template to use ws2812 i2c driver * Add ws2812 stub files * clang-format and driver config * Add ws2812 driver docs * Fix default config values * Update tmk_core/protocol/vusb/main.c Co-Authored-By: Drashna Jaelre <drashna@live.com>
* Reduce duplication for ARM/AVR ws2812 RGB Matrix driver (#7180)Joel Challis2019-10-292-57/+11
| | | | | | * Reduce duplication for ARM/AVR ws2812 rgb_matrix driver * Reduce duplication for ARM/AVR ws2812 rgb_matrix driver - Fix setled_all use of r,g,b
* Fix battery level code in adafruit_ble.cpp (#6648)bwhelm2019-09-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix battery level code in adafruit_ble.cpp The code in tsk_core/protocol/lufa/adafluit_ble.cpp that polls the battery level for the Adafruit feather BLE controller reads the regulated voltage, not the raw voltage coming from the battery. To do that, the Adafruit Feather docs say you should read from pin A9: https://learn.adafruit.com/adafruit-feather-32u4-basic-proto/power-management#measuring-battery-4-9. (See also https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/pinouts#logic-pins-2-9.) I'm not sure why, but analogRead(9); doesn't read the correct pin. Checking all available analog pins experimentally, it turns out that analogRead(7); returns the correct value. So the code above should read: state.vbat = analogRead(7); * Update tmk_core/protocol/lufa/adafruit_ble.cpp Co-Authored-By: Drashna Jaelre <drashna@live.com> * Remove old comment * Fix linking error * Remove `#ifdef` around `#include analog.h`. * Really fix linking error
* Removed prescaler define from avr i2c, as it was impossible to use (#6617)Mikkel Jeppesen2019-08-301-2/+2
|
* clang-format changesskullY2019-08-3016-1603/+1195
|
* Add GPL3 header to avr i2c files (#6332)Drashna Jaelre2019-07-154-2/+62
| | | | | | | | * Add GPL3 header to avr i2c files * Add for i2c_slave as well * Fix formatting of license header
* Moving rgb typedefs into a single location (#5978)XScorpion22019-06-042-2/+2
| | | | | Because someone named the define poorly Using full relative path as handwired/promethium has a color.h file
* Fixing incorrect usage of RGBLED_NUM in ws2812 driver when used with RGB ↵XScorpion22019-05-011-1/+1
| | | | Matrix (#5744)
* OLED Driver FeatureRyan Caltabiano2019-04-202-5/+5
|
* Features/ws2812 matrix driver (#5418)XScorpion22019-04-142-1/+29
| | | | | | * WS2812 driver implementation for RGB Matrix * Added driver configuration docs
* i2c_init update to work with atmega32a boards (#5562)MechMerlin2019-04-061-0/+12
| | | | | | | * On i2c_init, enable two wire interface, twi interrupt, and slave address ACK along with pull up resistors. * thanks to some testing by drashna, we know that setting TWI doesn't work for all boards. Putting the new code into an ifdef block
* Fix return value of i2c_readReg and i2c_receive (#5410)zvecr2019-03-151-2/+2
|
* Next set of split_common changes (#4974)James Churchill2019-03-123-95/+69
| | | | | | | | | | | | | | | | * Update split_common to use standard i2c drivers * Eliminate RGB_DIRTY/BACKLIT_DIRTY * Fix avr i2c_master error handling * Fix i2c_slave addressing * Remove unneeded timeout on i2c_stop() * Fix RGB I2C transfers * Remove incorrect comment
* Added APA102 support (#4940)Mikkel Jeppesen2019-02-152-0/+147
| | | | | | | | | | | | * Fixed pin for RGB * Re-did apa102 stuff * changed to use pincontrol functions * Removed a newline? * Changed to comply with project style
* Practice60 RGB and PWM Backlight (#4929)Andrew Kannan2019-01-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * Update Practice60 to enable RGB via SPI DMA and use PWM backlight breathing * Correct stm32f103c8t6 flash size in eeprom definition * Remove unused files and improve ifdef checks * Update quantum/rgblight.c Co-Authored-By: awkannan <andrew.kannan@klaviyo.com> * Update quantum/rgblight.c Co-Authored-By: awkannan <andrew.kannan@klaviyo.co