1
0

Compare commits

...

176 Commits

Author SHA1 Message Date
skullY
33fa2ddb95 Branch point for 2019 Nov 30 Breaking Change. 2019-09-21 11:34:58 -07:00
noroadsleft
42bf60751e [Keyboard] fix OLKB layout macro aliases (#6761) 2019-09-21 11:32:08 -07:00
MechMerlin
fd19795879 [Keyboard] Move more percent boards into the percent directory (#6781)
* move canoe into percent directory

* update readme for new make path

* move skog into percent directory

* update readme for new path and new instructions

* update readme

* fix error in naming
2019-09-21 11:27:53 -07:00
Drashna Jaelre
f069e9fc09 Generalize Tap Dance Layer functions (#6629)
* made tapdance dual_role general

* updated original dual_role functionality

* added toggling layer example

* Fix dual role and add alias

* Update docs about new layer tap dances

* Fix up based on feedback
2019-09-21 11:22:27 -07:00
Daniel Shields
63a0b1241d [Keymap] Move common code and configuration to userspace for dshields keymaps. (#6537) 2019-09-21 11:04:27 -07:00
Benjamin
75c9747787 [Keymap] Bonta keymap for massdrop/ALT (#6391)
* Added new bonta keymap.

* Added a note.

* Made map more mac like.
2019-09-21 10:13:44 -07:00
fauxpark
2df3799e3d Add list-keymaps make target (#5563) 2019-09-21 00:00:58 -07:00
jlquinn
ea96c4b787 [Keyboard] Update Stapelberg readme.md (#5557)
Previously suggested parts are hard to find or non-existent.  Update with available part numbers.
2019-09-20 23:59:16 -07:00
Sorixelle
7f65323e10 Add support for Void Linux systems to the qmk_install.sh script (#5526)
* Add support for Void Linux systems to the qmk_install.sh script

* Fix typos + grammatical edits in comments

* Sort distributions by alphabetical order in linux_install.sh

* Revert previous commit and sort Void packages in alphabetical order

* Fix permissions on `util/linux_install.sh`
2019-09-20 23:55:51 -07:00
fauxpark
3642a82d37 Add support for 328P hardware backlight on B1/B2 (#6776) 2019-09-20 22:11:15 -07:00
coseyfannitutti
c7d0262be7 [Keyboard] Add Discipad, Update Zadig doc for USBaspLoader (#6771)
* add discipad

* Update driver_installation_zadig.md

* Update keyboards/coseyfannitutti/discipad/info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/coseyfannitutti/discipad/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update rules.mk

* Update keyboards/coseyfannitutti/discipad/rules.mk

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/driver_installation_zadig.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/coseyfannitutti/discipad/discipad.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update docs/driver_installation_zadig.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update docs/driver_installation_zadig.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update rules.mk

* Update discipad.c

* Update driver_installation_zadig.md

* Update config.h
2019-09-20 22:07:21 -07:00
fauxpark
de4a47f1cc Cleanup rules.mk for 32A and 328P keyboards (#6767) 2019-09-20 22:06:32 -07:00
Konstantin Đorđević
beb4a12c9d Add reset instructions for boards that use Command to the Zadig driver installation guide (#6770)
* Add reset instructions for boards that use Command to the Zadig driver installation guide

* -> → →

* Apply suggestions from code review

Replace shorthand keycode names with full names

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-09-19 17:29:23 -07:00
Brian Lou
59000f491f [Keymap] Added my personal keymaps for dz60 and TMO50. (#6772)
* Added ottodokto keymaps for dz60 and tmo50.

* moved placement of keymaps to proper directory

* fixed accidental deletion of semicolon for tmo50 map

* fix to use short form codes

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-09-19 16:38:42 -07:00
fauxpark
44c5be0a3e Cleanup rules.mk for 16U2 and 32U2 keyboards (#6768)
* Cleanup rules.mk for 16U2 and 32U2 keyboards

* Add back Tap Dance build option
2019-09-19 09:55:14 -07:00
fauxpark
f34299efd7 Cleanup rules.mk for USB64 and USB128 keyboards (#6769) 2019-09-19 09:55:03 -07:00
MechMerlin
911b8915cc DRV2605L Continuous Haptic Feedback Support (#6461)
* provide means to turn on RTP mode and set the amplitude

* new keycode HPT_CONT to turn RTP off/on

* introduce new keycodes HPT_CONI, and HPT_COND for Haptic Continuous Increase and Decrease

* support for continuous mode amplitude increase and decrease

* code cleanup

* update docs to reference new keycodes and functionality

* don't touch the keymaps

* add function prototypes

* add proper guards

* cleanup guards

* remove extra reserved
2019-09-19 09:42:33 -07:00
MechMerlin
7a5a2591eb [Keyboard] 1up60hte cleanup + bugfix (#6763)
* move caps lock led to keyboard level so even QMK Configurator users have access to it

* set bootloader correctly to atmel-dfu

* clean up extra carriage return
2019-09-18 18:42:53 -07:00
Alex Mayer
7142b60405 [Keymap] Update Planck Layer Diagram To Match Layer (#6712) 2019-09-18 18:38:56 -07:00
XScorpion2
095b88bca5 Smoother Linear Light Table (#6764) 2019-09-18 18:32:38 -07:00
XScorpion2
46c49ae4e6 Updated split encoders so indexes are based on left hand encoders first (#6382)
* Updated encoder.c so that split encoders are indexed based on left hand encoders first.
This ensures when swapping master sides that code logic based on encoder index doesn't change.

PR Review fixes

* Removed extra define
2019-09-18 17:56:11 -07:00
Andrew Kannan
e5aa28455e [Keyboard] 201909 s75 custom encoder (#6745)
* Handle custom encoder configuration

* Whitespace changes

* Undo broken stuff

* more

* Remove printfs

* fix the dumb bug
2019-09-18 17:41:46 -07:00
Adrien Tétar
6f5f943bb9 [Keyboard] Introduce AT-AT 660M (#6729)
* Introduce AT-AT 660M

* PR feedback

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Add dfu-util args

* Add URL
2019-09-18 11:14:49 -07:00
vuhopkep
7d8dea30a4 [Keyboard] add personal fullsize pcb hnah108 (#6759)
* add personal fullsize pcb hnah108

* Update keymap.c
2019-09-17 23:36:05 -07:00
Drashna Jaelre
37c2996137 [Keyboard] Fix compile issues for OLKB Default keymaps (#6751) 2019-09-18 09:50:04 +10:00
fauxpark
54503168c9 Update bootloader.mk (#6698) 2019-09-18 09:48:58 +10:00
fougner
23186d32a3 [Keyboard] xd87: add capslock led support (#6758) 2019-09-17 10:37:01 -07:00
noroadsleft
12cdcd5e10 [Keyboard] Freyr: Configurator bugfixes (#6756)
- rebuild LAYOUT_all tree (key count mismatch)
- correct keyboard dimensions and key positioning
- complete key object labels
- debug linting (one key object per line; changes white space only)
2019-09-17 10:36:18 -07:00
noroadsleft
86d59f1034 [Keyboard] KBD75 refactor (#6755)
* convert codebase to #pragma once

* fix file includes

- quantum.h is included at keyboard level, redundant at revision level
- keyboard-level path is accessible at revision level, remove relative pathing

* duplicate common layout macros from rev1 to rev2

Add the layout macros supported by both rev1 and rev2 to rev2.h directly, which exposes these layouts to QMK Configurator.

* enable community layout support (75_ansi, 75_iso)

* add LAYOUT_75_iso layout data

It needs its own tree because its keys are in a different order from LAYOUT_iso_1u even though the physical layout is the same.

* minimize rules.mk files (use QMK defaults)

* use atmel-dfu bootloader rule

* fix typo on rev1 info.json
2019-09-17 10:34:52 -07:00
XScorpion2
c427023b31 [Keymap][Xulkal] User code update (#6752)
* Updating rgb menu behavior

* Fixing toggle keycode to work how I want it

* Enabling auto scroll timeout
2019-09-17 10:28:02 -07:00
Jason Thigpen
2493eecc7b [Keymap] Fix e65 7u WK layout and add crd's personal keymap (#6750)
* Add e65 keymap for crd

* Fix e65 7u wk layout
2019-09-17 10:27:07 -07:00
Drew Smathers
bb3569dce3 [Keymap] idobo/drewdobo keymap v1 (#6744) 2019-09-17 10:24:15 -07:00
vuhopkep
b364a40e60 [Keyboard] Correct info.json data for vn66 (#6741)
* Correct info.json data for vn66

* update .json file data

* Update info.json
2019-09-17 10:23:13 -07:00
Ethan Durrant
d137fdea78 [Keyboard] Adding YMDK "Bface" keyboard (#6731)
* making a new board setup for ymdk bface clone

* removing extra keymaps that copied over

* documentation and edits for new ymdk_bface board

* cleaning up config and keymaps

* removed extra keymap and working on READMEs

* readme edits

* shorter aliexpress link in ymdk_bface readme

* added images to readmes and edited the keymaps

* more flashing directions

* Mac directions formatting

* editing and creating the all layout

* cleanign up ymdk_bface keymaps

* fixed typos in layout

* removed tabs

* cleaned up the LED and Backlight configuration.

* adding more to info.josn and cleaning up readme

* fixing JSON typos

* made a ymdk folder and moved the bface into it.

* fixing file names for the new folder structure
2019-09-17 10:19:16 -07:00
Noan Mousy
ab48ffd5c5 [Keyboard] Adding AEK64 keyboard (#6725)
* Adding AEK64 keyboard

* Deleting useless layout definition

* Resolving many code review issues

* Documenting my 4sStylZ keymap

* Adding default keymap

* Apply suggestions from code review

Code review corrections

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/handwired/aek64/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Correcting the NKRO implementation
2019-09-17 10:17:03 -07:00
IanGC
32b2486c6b [Keymap] Plaid Keymap for Programmers (#6706)
* map programmer qwerty

* clarify and fix typo

* finishing touches

* use qmk
s templates for readme

* update copyright notice

* remove unnecessary code

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* remove unnecessary code

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/plaid/keymaps/thehalfdeafchef/keymap.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* fix documentation

* reformat code

* Apply suggestions from code review

Co-Authored-By: Drashna Jaelre <drashna@live.com>
2019-09-17 10:15:07 -07:00
Wilba
55432d0d91 [Keyboard] Fixed EEPROM start address for firmware using VIA (#6757) 2019-09-17 09:59:34 -07:00
Andrew Kannan
59af2cbe64 Add Chimera65 Keyboard (#6670)
* Add chimera board

* info json start

* Update keyboards/cannonkeys/chimera65/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Apply suggestions from code review

Co-Authored-By: Drashna Jaelre <drashna@live.com>
Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/cannonkeys/chimera65/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>
2019-09-16 19:37:51 -07:00
noroadsleft
7c1bb9decf Percent Studio Booster: Configurator fix (#6743) 2019-09-16 08:20:44 -07:00
Xerpocalypse
140c08e521 [Keymap] Added Xerpocalypse's layout (#6732)
* Added Xerpocalypse's layout

+ Number row and symbols are switched compared to default TMO50 layout
+ Right-hand spacebar acts as backspace and a hold-layer for layer 2.

* Update keyboards/tmo50/keymaps/xerpocalypse/keymap.c

Removed unnecessary #define

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/tmo50/keymaps/xerpocalypse/keymap.c

Changed keymap to use KC_UNDS instead of custom-defined keycode

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-09-15 21:32:34 -07:00
Michael Torres
a9c1a5a873 remove accidental characters in default preonic keymap (#6748) 2019-09-16 14:13:44 +10:00
xster
3b4b54f6ed Clarify the backlight_level API doc slightly (#6733)
* Clarify the backlight_level API doc slightly

* review
2019-09-15 19:22:02 +10:00
vuhopkep
9c280089aa add VN66 keyboard (#6722)
* add VN66 keyboard

* update

* Update readme.md

* Update readme.md

* add hnah108 personal pcb

* delete hnah108

* Update vn66.c
2019-09-15 19:13:19 +10:00
noroadsleft
38a0a6a092 [Keyboard] TheVanKeyboards Caravan: Configurator layout support (#6737) 2019-09-14 20:16:26 -07:00
GreenShadowMaker
8294a0de2c [Keymap] style cleanup of GreenShadowMaker's keymap (#6736) 2019-09-14 20:15:56 -07:00
xster
65c4b6cff1 [Keymap] Yet another xd75 keymap (#6734)
* add a keymap for xd75

* add colors, change some keys, add reactive modifier hold, key press

* add readme

* permissive hold
2019-09-14 20:14:16 -07:00
MechMerlin
9508b3f333 [Keyboard] Alps64 Refactor (#6723)
* get rid of custom matrix that is no longer being used

* remove _kc LAYOUT

* remove ifdefs and replace with pragma once

* cleanup rules and use bootmagic lite

* get rid of led.c

* Update keyboards/alps64/alps64.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* remove unneeded configurations
2019-09-14 20:03:11 -07:00
Drashna Jaelre
6c871408df [Keyboard] Fix default keymaps for OLKB boards to play Startup Sound (#6721)
* Fix Planck default keymap to play sounds on rev6

The dip_switch_update callback was overriding the default startup sound.  This should prevent that from happening, and still allow it to play sounds, or stop them, when appropriate.

* Fix Preonic default keymap to play sounds on Rev 3

The dip_switch_update callback was overriding the default startup sound.  This should prevent that from happening, and still allow it to play sounds, or stop them, when appropriate.
2019-09-14 19:59:44 -07:00
Drashna Jaelre
265d8abee1 Fix enables for Haptic Feedback (#6707)
* Fix enables for Haptic Feedback

If you enabled bothe DRV2605 and SOLENOID, it would only enable one of these, not both. 

This fixes the check so that you can enable both options.

* Fix check for haptic feature
2019-09-14 19:57:07 -07:00
Fedde Schaeffer
d13e0b5cfc [Keymap] Fix Georgi's RZ key in NKRO fake-steno mode (#6701)
It was sending a comma keypress, while I believe that the targeted
stenography software (at least on systems that generally use
US-International keyboard layout) expects a single-quote/apostrophe key.
2019-09-14 19:55:23 -07:00
m47ch4n
a4581e6620 [Keymap] Added m47ch4n keymap (#6673)
* Add m47ch4n's keymap

* Modify keymap

* Format m47ch4n keymap.c using clang-format

* Modify layer updater

* Fix wrong key repeating bug

* Add readme and QMK Configurator json

* Fix layer updateter

* Add Raise layer

* Add kana keys
2019-09-14 19:53:52 -07:00
J.Flanagan
0cbe1eb433 [Keyboard] Add 2key2crawl (#6727)
* adding working 2key2crawl

Adding working 2key2crawl files
edited files in accordance with original PR comments

* Changes

Changes and updates

* Update readme.md

* Update config.h

removed IS_COMMAND block that was missed in previous commit

* Changes to vol/keymap.c

Removed unneccesary function
2019-09-14 14:03:14 -07:00
Drashna Jaelre
969dd8be56 Fix Corne keyboard matrix configuration (#6684) 2019-09-14 17:46:14 +10:00
Drashna Jaelre
1620066475 Add to VSCode's recommended extensions (#6656)
This includes a number of recommended extensions from the VS Code doc page that should make coding things a lot easier for QMK Firmware.
2019-09-13 18:18:31 -04:00
Ethan Durrant
b4161ac190 [Keymap] adding emdarcher's keymap for mf68 and tada68 (#6718)
* adding a custom mf68 keymap

* added custom tada68 keymap

* readme edit on tada68 map

* added mac fast-forward and rewind keybindings to tada68 emdarcher keymap

* tada68 keymap documentation and edits

* cleanup and edits

* typo fix in emdarcher's tada68 keymap

* cleaning up emdarcher keymap for tada68

* cleaned up emdarcher keymap for mf68
2019-09-12 15:47:30 -07:00
Papop
b9de27161a [Keymap] xunz layout for dz60rgb (#6716)
* [Update] Add xunz layout for dz60rgb

* [Update] Update layout.json and Readme.md

* [Delete] Delete unnecessary files

* [Create] Create new readme.md

* Update keyboards/dztech/dz60rgb/keymaps/xunz/rules.mk

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* [Update] Delete some unnecessary code in config.h

* Update keyboards/dztech/dz60rgb/keymaps/xunz/config.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/dztech/dz60rgb/keymaps/xunz/config.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/dztech/dz60rgb/keymaps/xunz/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-09-12 15:46:24 -07:00
Joel Challis
ad3e4d6c13 Tidy up backlight header use to avoid build issues (#6714) 2019-09-11 23:15:39 +01:00
zvecr
251b4fb79d Fix boards being skipped during make all 2019-09-10 21:15:48 -07:00
Francis St-Amour
68dbf92d9e remove synthing conflict file (#6717) 2019-09-11 12:51:21 +10:00
Kenny Hoang
595232ec98 Created new_keymap.py, python version of new_keymap.sh (#6066)
* Created python version of new_keymap.sh: new_keymap.py

* Updated usage message

* Updated new_keymap.py to use python3.5+ syntax & be more similar to new_keyboard.sh

* Updated complete message

* Updated usage in argparser and removed incorrect usage_message

* Reverted the fstrings back to strings that use .format() & updated docstring convention

* Added helper to recursively cd .. until at qmk_firmware root directory

* Revert "Added helper to recursively cd .. until at qmk_firmware root directory"

This reverts commit 61a0ff3b25f91901287bec8d58eb51a1f126e2ad.

* Updated new_keymap.py to use printf-style format strings

* First draft lib/python/qmk/cli/new/keymap.py with milc

* Removed shebang & syspath appending lines

* Added optional args & resolved some cr comemnts

* Added a docstring and updated strings
2019-09-10 05:14:25 -07:00
Jonathan Cameron
2e521b509c [Keyboard] Added a simple 2x5 Keypad with 4 layers (#6699)
* Added new 2x5 Keypad with 3 LEDs to indicate the selected layer.  By Jonathan Cameron.

* Minor refactor from suggestions from qmk team

* Added

* Moved to 'handwired' directory

* Update readme.md

* Update readme.md

* Update readme.md

* Update keyboards/handwired/2x5keypad/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Switch to image offsite

* Moved image offsite

* Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/handwired/2x5keypad/2x5keypad.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Moved functions into .c file per suggestions

* Cosmetic

* Fixed function called, per suggestions.

* Update keyboards/handwired/2x5keypad/2x5keypad.h

Ok

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Moved LED functions to the top level since they can be used it various flavors

* Declare those moved LED functions!

* Update keyboards/handwired/2x5keypad/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>
2019-09-09 22:03:33 -07:00
MechMerlin
00225b77e5 [Keyboard] Waldo RGB Enable (#6711)
* enable rgb animations

* clean up code
2019-09-09 21:57:45 -07:00
Manassarn Manoonchai
9dae7f7d85 [Keymap] Update to narze keymaps (#6694)
Use Right GUI as backspace key & 1ms polling interval on narze keymaps

* Refactor & reimplement mod tap macros

* Reduce tapping term

* Update readme

* Add narze userspace

* Make use of narze userspace

* Extract Superduper mode

* Refactor Superduper mode

* (Ergodox Infinity) Prevent stuck modifiers

* Update ergodox_infinity/narze likewise

* Add warning for building Infinity with docker

* Fix include eeprom.h in superduper

* Try enabling superduper mode with combo for ergodox infinity

* Apply suggestions on #4546

* Convert to 4 spaces

* Map backlight step key

* Replace PLAY_NOTE_ARRAY

* Fix superduper toggle

* Re enable audio in planck rev4

* Use perform_space_cadet

* Remove superduper mod tap triggers

* Add readme for planck light firmware flashing command

* Remove unused layers

* Remove unused keycodes

* Add backlight toggle

* Remove unused songs & use DEFAULT_LAYER_SONGS

* Update readme

* Move includes to header file

* Set RGUI & raise as backspace & unbind actual backspace

* tmp

* Fix qwerty doc

* Use 1ms polling rate
2019-09-09 21:44:08 -07:00
Brice Figureau
a88b6db682 [Keyboard] Add the E6.5 keyboard (#6693)
The E6.5 is the new 65% keyboard made by Exclusive.
This changeset adds its PCB to QMK, including all the bottom row
variants and iso/ansi/split BS layouts.
2019-09-09 21:42:21 -07:00
MechMerlin
22a7e71fb3 [Keyboard] Add DP60 keyboard (#6679)
* add dp60 keyboard

* fixup wording in readme

* fix layout name in default keymap. I was missing an r

* Add QMK Configurator support for the additional layouts

* Update keyboards/dp60/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/dp60/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/dp60/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/dp60/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/dp60/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* strip out the VIA enabling from default rules.mk

* add a VIA only keymap
2019-09-09 21:38:08 -07:00
Kai Eckert
88908888b8 [Keyboard] Add Rabbit68 Keyboard w/ default,kaiec keymaps. (#6676)
* Add Rabbit68 Keyboard w/ default,kaiec keymaps.

* Requested changes by @fauxpark

* Change flash command, as suggested by @drashna

* Update keyboards/rabbit/rabbit68/readme.md

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Add link to Github repo 

As I per suggestion changed the link above to an image, I added now the link to the project page to the Open Source text, where it actually makes the most sense.
2019-09-09 21:36:32 -07:00
MechMerlin
99e58eab0f [Keyboard] Feature/dz60rgb cleanups (#6697)
* change LAYOUT_ANSI to LAYOUT_60_ansi

* change QMK Configurator layout to LAYOUT_60_ansi as well

* add 60_ansi support so I can make my userspace =)

* update readme

* Very strange. ISO keymap is still using 60_ansi LAYOUT macro. But then again....no ISO hottswap dz60 has been released
2019-09-08 10:27:01 -07:00
vuhopkep
d2f87df7f4 [Keyboard] Add Freyr keyboard (#6664)
* Add Freyr keyboard

Add new Freyr tkl keyboard

* add comunity layout

* Update info.json

* Update readme.md

* Update info.json

* Update keymap.c
2019-09-08 08:48:54 -07:00
Callum Hart
ff118bce6a Add Copenhagen Click Pad (#6681)
* Add Copenhagen Click Pad

* Update keyboards/copenhagen_click/click_pad_v1/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Removing left over boilerplate

* Update keyboards/copenhagen_click/click_pad_v1/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/copenhagen_click/click_pad_v1/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update readme.md
2019-09-08 10:34:39 +10:00
Drashna Jaelre
02f77e7215 Actually use correct bootloader not found message (#6695) 2019-09-08 09:55:18 +10:00
Drashna Jaelre
44fd317a87 Move Bootloader not found message to global variable (#6688)
* Move Bootloader not found message to global variable

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-09-08 02:06:39 +10:00
Annihilator6000
0728c0fa4e [Keymap] UT47.2 Planck-style layout switching (#6669)
* UT47.2 keymap/updates for Planck style layout switching

* UT47.2 keymap for Planck-style layout switching / code clean up

* UT47.2 keymap for Planck-style layout switching: Qwerty, Workman, Colemak, Colemak Mod-DH, and Dvorak added / code clean up

* Change the layout info to match the keymap

* Edit readme to contain relevant info for layout switching

* Edit readme to contain relevant info for layout switching

* Edit readme to contain relevant info for layout switching

* Edit readme to contain relevant info for layout switching. Add QMK Configurator file.

* Update readme.md with make information

* Undo breaking change in config.h

* Code cleanup

* Code cleanup

* Code cleanup

* More code cleanup
2019-09-07 09:04:31 -07:00
Jonathan Rascher
d90038eb9c [Keymap] Assorted personal keymap/userspace updates (#6691)
* Turn off more unnecessary features by default

* Double TAP_CODE_DELAY due to more media key issues

Even with this change, some of the rotary encoder turns on my BDN9's
volume knob still seem to get dropped. It's possible there's something
wrong with the encoder itself. (Maybe the TAP_CODE_DELAY actually causes
QMK to miss an encoder turn? Unclear.) The other knob (backlight
brightness) works fine, FWIW....

* Restructure userspace config.h a bit

* Hack around Instant60 Via EEPROM conflict

Remove this when #6589 is fixed for Via boards.

* Add backlight breathing and (EEPROM) reset to BDN9

* Add keymap for 9-Key macropad
2019-09-07 08:58:17 -07:00
Drashna Jaelre
e88f80a891 [Keymap] Big Drashna code update (#6639)
* Add a quefrency keymap

* New Alt-ernate layouts

* Enable Per Key Tapping Term to preserve sanity

* Use underglow and mod lights for status on Corne

* Update the drashna_ms keymap for quefrency

* Disable Audio since there isn't enough space

* Update KC_MAKE to ues :flash target

* Cleanup ergodox layout

* Enable i2c support for Iris

* Add keymap support for CG_SWAP

* Enable RGB Matrix Shutdown mode

* enable heatmap

* Update gitlab CI to install python3

* Remove game macros

These are no longer needed, and haven't been used in ages

* Cleanup planck layout

* Add RGB Matrix fun and RGB cleanup

* Add keycode and config for RGB Matrix idle animations

* Clean up rgb idle animation code

* Add rgb idle keycode to keymaps

* Fix issues with rgb matrix idle animation

* Fix some handling for idle animation

* Reduce idle animation timeout to 15s to be more reasonable

* fix up rgb stuff

* Fix isses with rgb functions not being called for matrix

* Use custom EEPROM Magic Number so testing is easier

* Extend Default Layer macro to support a lot more layers

* Fix bjohnson macropad

* Adjust KC_MAKE to process mods for more consistent behavior

* Fix up rgb stuff on corne

* Corne OLED Overhaul

* Fixes a number of issues with weirdness.
* Fixes issues with keylogger (should be more reliable now)
* Modulaize the OLED render sections
* Rewrite layer display code
* Update URL for Font Editor

Due to odd issues, I ended up rewriting from scratch.  And using PROGMEM versions, since I think I was getting memory overflows.

* Update polling rate on all keebs

* Fix planck ez layout config

* Remove macros from Viterbi
2019-09-07 08:57:30 -07:00
Nshan Petrosyan
79a6c6eda5 [Keymap] Update nshanpetrosyan keymap (#6683)
* Update keymap.c

Additional functionality added to layers.

* Error fix

Fixed missing key in layer 5, fixed brightness keys with universal codes, made code more readable.

* fix missing commas

fixed missing commas on line 19 and line 23

* fix Indicator LED sticking on RGB off toggle.

fixes issue: LED indicators stay on when toggling RGB off
2019-09-07 08:25:25 -07:00
fauxpark
490a13a02e Add 328P to mcu_selection.mk (#6682) 2019-09-07 08:24:19 -07:00
fauxpark
0d94730da0 Adafruit BLE: Set SPI2X bit only when F_CPU is 8MHz (#6671) 2019-09-07 08:18:05 -07:00
fauxpark
91bd2117df Banish some more magic numbers (#6662) 2019-09-07 08:12:46 -07:00
Manassarn Manoonchai
c21281c593 [Keymap] Add narze userspace (#6652)
* Refactor & reimplement mod tap macros

* Reduce tapping term

* Update readme

* Add narze userspace

* Make use of narze userspace

* Extract Superduper mode

* Refactor Superduper mode

* (Ergodox Infinity) Prevent stuck modifiers

* Update ergodox_infinity/narze likewise

* Add warning for building Infinity with docker

* Fix include eeprom.h in superduper

* Try enabling superduper mode with combo for ergodox infinity

* Apply suggestions on #4546

* Convert to 4 spaces

* Map backlight step key

* Replace PLAY_NOTE_ARRAY

* Fix superduper toggle

* Re enable audio in planck rev4

* Use perform_space_cadet

* Remove superduper mod tap triggers

* Add readme for planck light firmware flashing command

* Remove unused layers

* Remove unused keycodes

* Add backlight toggle

* Remove unused songs & use DEFAULT_LAYER_SONGS

* Update readme

* Move includes to header file
2019-09-07 08:06:30 -07:00
skullY
6ca29f2b9b Run the python tests inside docker 2019-09-07 07:58:41 -07:00
skullY
16366dd23d add missing apostrophes 2019-09-07 07:58:41 -07:00
skullY
18690ddaea filter python from the list of things that trigger default builds 2019-09-07 07:58:41 -07:00
skullY
1013ae2d34 Add python tests to the travis check 2019-09-07 07:58:41 -07:00
skullY
deb6fa6a87 Add a command to format python code 2019-09-07 07:58:41 -07:00
skullY
533d6d6a46 Make the modem manager check more pythonic 2019-09-07 07:58:41 -07:00
skullY
c7eede2249 run yapf on the code 2019-09-07 07:58:41 -07:00
skullY
5b7a5b2a76 Setup a python test framework 2019-09-07 07:58:41 -07:00
Konstantin Đorđević
4d339b7b5d Update docker_build.sh: indentation fix, error echo function (#6659)
* Replace spaces with tab in docker_build.sh

* Use errcho instead of echo >&2
2019-09-07 18:17:54 +10:00
jotix
736bdc7e97 Jotix (#6687)
* jotix ortho_4x12

* add shifted symbols

* jotix ortho_4x12 layot
2019-09-07 18:05:14 +10:00
MechMerlin
fc5fb2fc15 CA66 R1/R2 Cleanup (#6678)
* fixup readme to adhere to QMK standards and to also have more information

* use pragma once

* strip out the custom bootmagic lite routine as it is the same as QMK's default bootmagic lite routine. Also add the caps lock led indicator

* turn on bootmagic lite

* update default keymap

* Update keyboards/playkbtw/ca66/ca66.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* remove lines 4 thru 37 and add bootloader
2019-09-07 18:04:48 +10:00
Silvio Gulizia
ac8f8a8914 fix missing music mode legend (#6686) 2019-09-07 07:36:40 +10:00
fauxpark
7ffed07310 Make USB polling rate configurable with a define (#6668) 2019-09-06 07:41:24 -07:00
Mikkel Jeppesen
f8bf1d1b16 Changed to 1209 PID (#6677) 2019-09-06 14:34:37 +10:00
Danny
f0ad3fc68a [Keyboard] Add Iris Rev 4 (#6660)
* Add Iris Rev. 4

* Fix EEPROM addresses
2019-09-05 20:10:57 -07:00
fauxpark
98599173d7 Add 16U2, 16U4 and USB646 to mcu_selection.mk (#6566) 2019-09-05 14:50:43 -07:00
Xelus22
12812fa6a4 led fix (#6672) 2019-09-05 13:41:01 +10:00
Konstantin Đorđević
6d191635d0 Add personal Doro67 multi keymap, fix bug in KBD6X keymap (#6674)
* Add missing void parameter declarations to *_light functions

* Add doro67/multi:konstantin keymap

* Allow FNLK to be canceled with Esc

* Function layer → Fn layer in keymap comments
2019-09-05 13:38:54 +10:00
fauxpark
df5b2d204b [Keyboard] Missed a JTAG disable (#6667) 2019-09-03 20:26:01 -07:00
Vega Deftwing
7372ce6afd added ability to change unicode input method (#6666) 2019-09-04 09:03:16 +10:00
bwhelm
fa71c4c91e Fix battery level code in adafruit_ble.cpp (#6648)
* 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
2019-09-04 04:29:23 +10:00
Elliot Powell
e6a6b1f122 [Docs] Update i2c_driver.md (#6665)
Fix missing arg of i2c_start
2019-09-03 10:09:58 -07:00
Konstantin Đorđević
c522009816 [Keyboard] Doro67 cleanup (#6514)
Add spacing to LAYOUT macros, add layout comments, improve consistency, fix ISO layout bug

* Remove placeholder comments in regular.h and rgb.h

* Change K## to k## in multi.h and regular.h

* Add alignment whitespace in Doro67 LAYOUT macros

* Update multi default keymaps and add layout comments

* Update rgb default keymap and add layout comments

* Add RESET to Fn layer in multi default keymaps

* Replace KC_GESC with KC_ESC in rgb default keymap for consistency with other Doro keymaps

* Update regular default keymap and add layout comments

* WIP

* Replace odd F1, F2 with proper split LShift/Backspace keys in default_multi

* Minor fixes and tweaks in multi default keymaps

* Fix Enter and NUHS positions in multi LAYOUT_iso

* Return true in process_record_user in rgb default keymap

* Update Enter position in multi info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update labels in multi info.json to match the default keymaps
2019-09-03 09:05:29 -07:00
Danny
5c324ee104 [Keyboard] Add Tukey board (#6657) 2019-09-03 08:43:25 -07:00
Konstantin Đorđević
d633cf3ccb [Keymap] Update personal userspace and keymaps (#6654)
* Enable Fn layer tap dances only if LAYER_FN is defined

* Update KBD6X keymap spacing to match LAYOUT spacing

* Add regular FNLK to userspace, update keymap comment labels

* Rename KC_BRK → BREAK, KC_SYSR → SYSRQ in userspace

* Change mousekey positions in KBD6X

* Disable Console in KBD6X to reduce firmware size

* Return false in process_record_* only when overriding existing keys

* Fix Caps light not working after LSFT_FN

* Refactor Fn/Caps light, fix sequencing issues
2019-09-03 08:42:05 -07:00
Benjamin Grosse
55bae0a5b4 [Keymap] Satan GH60 with command prompt animation, react to keypresses (#6636)
Co-Authored-By: fauxpark <fauxpark@gmail.com>
Signed-off-by: Benjamin Große <benjamin@midokura.com>
2019-09-03 08:35:43 -07:00
Drashna Jaelre
dab4967f1b Add Dip Switch as a core feature (#6140)
* Add Dip Switches as a core feature

* Add documentation for Dip Switch feature

* Update Preonic Rev3 to use new feature and remove custom matrix

* Apply suggestions from code review

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Remove custom matrix line completely

Rather than just disabling it

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* DIP changes

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Use better check for DIP Switch configuration

* Add to show features

* Add bitmask callback for dip switch

* Fix OLKB Boards dip switch config

* Update docs to include bitmask example

* Fix comments/documentation

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Fix issues with docs and use example from @tuzonghua

* Fix wording

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Fix example to use proper formatting

Bad, BAAAAAAD drashna!!!

* Handle dip switch initialization better
2019-09-03 08:34:31 -07:00
Drashna Jaelre
9f46606dff Update submodule check to include LUFA (#6661)
As LUFA is now a submodule, we should be checking it.
2019-09-03 17:56:02 +10:00
Jonas Avellana
f2ea65db6b [keymap] ninjonas userspace and keymaps for hotdox, lily58, & pinky3 (#6649)
* [keyboard] introducing ninjonas userspace & keymaps for hotdox, lily58, and pinky3

* [fix(#6649)] removed M_EPRM and used builtin EEP_RST keycode as-per review.

* [chore(#6649)] forgot to update keymap legend on lily58
2019-09-02 07:40:01 -07:00
Sid Carter
0e153781f0 [Keymap] Update keymap for alice and fix for ctrl and os swap (#6642)
* update map for alice and fix for via boards

* enable bootmagic
2019-09-02 07:36:00 -07:00
fauxpark
27b3f3141b Fix typo in Open Graph description for docs (#6641) 2019-09-02 07:35:02 -07:00
Louis D
d653e55461 [Keyboard] add rgb led configuration for xd87 (#6635)
* add rgb led configuration for xd87

* Add RGB underglow to a separate keymap

* rename keymap and make small review changes
2019-09-02 07:33:04 -07:00
Cory Watson
05d0e8c09e Add dfu-programmer to pacman -S (#6619)
* Add `dfu-programmer` to `pacman -S` (#6618)

`dfu-programmer` now resides at `extra/dfu-programmer` and is no longer
in the AUR

* Add `--needed` option to `pacman -S` for efficiency

* Fix

* Update util/linux_install.sh

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-09-02 07:32:14 -07:00
Alex Schroeder
19e85a503c [Keyboard] Atreus: Flip the middle two keys when PCBDOWN is set. (#6616)
Flipping the columns isn't enough for the Atreus keyboard, since these
two keys are distinguished by row on the same column electrically.
2019-09-02 07:30:35 -07:00
fauxpark
5095a999b7 Fix msys2 not installing any packages because it can't find clang (#6655) 2019-09-02 10:09:09 -04:00
Drashna Jaelre
bf558e42fd Run dos2unix on whole repo (#6644) 2019-09-01 09:09:43 -07:00
Drashna Jaelre
3fae3076ce Always run util/travis_compiled_push.sh (#6640)
Specifically, the `util/travis_compiled_push.sh` runs a number of cleanup and deployment routines. This includes `dos2unix` that fixes the line endings for sanity's sake.   However, it only runs on successful builds.  That would be fine, except some builds WILL fail (community layouts, yay), which is a problem. 

This should change the behavior to always run the post compile checks. 

However, in the long run, we should break up this script into more parts.
2019-09-01 09:09:19 -07:00
noroadsleft
4c4ee4a26b NIU Mini Settings update and Refactor (#6651)
* update codebase to four-space indent

* update codebase to use #pragma once

* refactor config.h

* change info.json to debug linting

* refactor readme

- file header
- update docs links

* minimize and lint rules.mk

* change features

- enable mousekeys and nkro

* use GPIO commands for Status LED

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* use IS_LED_ON macro

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* update compile/flash examples in readme

* :flash doesn't use QMK Toolbox
2019-09-01 17:54:13 +10:00
Jarred Steenvoorden
f59d076898 [Keymap] Add leaf60 and tada68 keymaps (#6645)
* Add leaf60 and tada68 keymaps

* Cleanup files for pull request

* Cleanup tada68 keymap
2019-08-31 11:20:10 -07:00
Sid Carter
d12c024dde [Keymap] Combo keymap update - For planck and dz60rgb (#6643)
* update my planck layout

* update me planck layout

* For my purple Tofu60 with dz60rgb
2019-08-31 11:14:17 -07:00
skullY
2d688ad14e readability enhancements 2019-08-31 08:50:25 -07:00
skullY
1784d1bfac Add support for passing files at the command line 2019-08-31 08:50:25 -07:00
skullY
9547774962 CLI command to format C code 2019-08-31 08:50:25 -07:00
M-AS
d076234fd1 [Keymap] Added personal keymap for DZ68RGB (#6623)
* added personal CTRL keymap

* added personal dz60rgb keymap

* enabled new rgb effect

* added space cadet shift

* media player track buttons now orange

* updated keymaps with rgb setting and visual HSV setting preview

* fixed source stuff?

* added support for underglow toggle (bugged to all hell)

* everything now behaves as expected when ti comes to RGB toggles, thank god

* removed ifdefs

* changed color of MAS_CRM

* uh, whitespace

* changed rgb positions and modifiers within RGB matrix thing for CTRL and DZ60RGB

* updated keymap to work kindof

* KEYMAP: changed list of rgb effects

* changed CTRL rgb defaults

* KEYMAP: new LED layout for ctrl

* fixed white LED position in indicator

* changed capslock tap timing

* Added new keymap - dz68rgb

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Apply suggestions from code review

Co-Authored-By: Drashna Jaelre <drashna@live.com>
2019-08-30 17:52:35 -07:00
Mikkel Jeppesen
19a85015c2 [Keyboard] Added Vitamins Included Rev2 (#6593)
* Fixed pin for RGB

* Added support for second revision of vitamins included

* Added rev2 config and switched to #pragma once

* Switch to quantum.h pincontrol

* Fixed left-half check

* Moved revision agnostic code to main header file

* Moved common build options to main makefile

* Referred to rev2 documentation

* JTAG is dissabled in keyboard.c now

* moved EEHANDS to rev1 config

* moved rev2 to use split_common

* Updated default keymaps

* Changed handedness ifdef to allow user-overrides

* Add some space saving defines

* Changed to more sane I2C clock

* Removed rev2 check in matrix.c as rev2 uses split_common

* Removed rev2 check in rev1 only code

* Update debounce constant name

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Switch KEYMAP macro to LAYOUT

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Switch kc_keymap macro to layout_kc

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Switch kc_keymap macro to layout_kc

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Add legacy layout macro alias

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/vitamins_included/rev2/config.h

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Split readme into revision specific versions

* Updated src to allow LTO

* Renamed readmes to lower-case

* Switched my keyboards to FEED VID

* Fixed markdown lint errors

* fixed readme links

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Maintain keymap backwards compatibility

Co-Authored-By: Joel Challis <git@zvecr.com>
2019-08-30 17:52:02 -07:00
moyi4681
a2b855febb [Keyboard] add kbd67mkiirgb (#6605)
* add kbd67mkiirgb

* Update info.json

* Update readme.md

* Update rules.mk

* Update keyboards/kbdfans/kbd67mkiirgb/kbd67mkiirgb.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/kbdfans/kbd67mkiirgb/kbd67mkiirgb.c

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Delete kbd67mkiirgb.c.b

* Update keyboards/kbdfans/kbd67mkiirgb/config.h

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/keymaps/default/keymap.c

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/keymaps/default/keymap.c

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/kbd67mkiirgb.h

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/kbdfans/kbd67mkiirgb/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* fix led positon
2019-08-30 17:51:05 -07:00
Alex Schroeder
bbc5156781 [Keymap] Workman layout for Atreus keyboard (#6606) 2019-08-30 17:50:11 -07:00
Spaceman
42977d25fc [Keyboard] add Pancake Keyboard (#6610)
* Create readme.md

* Add files via upload

* Create readme.md

* Add files via upload

* Create readme.md

* Add files via upload

* Create readme.md

* Add files via upload

* Update keyboards/pancake/info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/keymaps/default/keymap.c

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/keymaps/default/keymap.c

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/keymaps/default/keymap.c

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/feather/rules.mk

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/promicro/rules.mk

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/pancake/keymaps/default/keymap.c

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update rules.mk

* Update rules.mk

* Update pancake.h
2019-08-30 17:49:48 -07:00
Mikkel Jeppesen
edc8283572 Removed prescaler define from avr i2c, as it was impossible to use (#6617) 2019-08-30 17:47:11 -07:00
gtips
b7ddf64b54 [Keyboard] Add keyboard Reviung39 (#6620)
* add keyboards/reviung39

* fix reviung39/keymaps/default/

* [Keymap] add keymap default_s for reviung39 type-s

* [keymap] fix default and default_s

* [keymap] remove backup directory(keyboards/reviung39/backup/)

* [keymap] Update readme.md

* [keyboards] fix keyboards/reviung39/reviung39.h, rules.mk, /keymaps/default/keymap.c

* [keymap] fix /default_s/keymap.c

* Update readme.md

* Update readme.md

* fix rules.mk

* [keymaps] fix default/keymap.c
2019-08-30 17:46:31 -07:00
Jonathan Rascher
9340b70b7e [Keyboard] Assorted personal keymap/layout updates (#6621)
* Switch Quefrency back to I2C (#6161 fixes the lag)

* Update Quefrency keymap

* Add reset and EEPROM reset keybindings so these tasks can be performed
separately, rather than relying on Bootmagic Lite, which performs both
tasks at the same time.

* Move Caps Lock from Fn+Ctrl to Fn+Tab since Fn+Ctrl is sometimes used
as part of a more complex keybinding, whereas Fn+Tab is always safe.

* Update KBD67 keymap

* Add reset and EEPROM reset keybindings so these tasks can be performed
separately, rather than relying on Bootmagic Lite, which performs both
tasks at the same time.

* Move Caps Lock from Fn+Ctrl to Fn+Tab since Fn+Ctrl is sometimes used
as part of a more complex keybinding, whereas Fn+Tab is always safe.

* Move Menu to a layer tap on the Fn key since that's a more natural
location.

* Update 60% Tsangan HHKB layout

* Move Caps Lock from Fn+Ctrl to Fn+Tab since Fn+Ctrl is sometimes used
as part of a more complex keybinding, whereas Fn+Tab is always safe.

* Update 60% ANSI split backspace/right-shift layout

* Add reset and EEPROM reset keybindings so these tasks can be performed
separately, rather than relying on Bootmagic Lite, which performs both
tasks at the same time.

* Move Caps Lock from Fn+Ctrl to Fn+Tab since Fn+Ctrl is sometimes used
as part of a more complex keybinding, whereas Fn+Tab is always safe.
2019-08-30 17:45:49 -07:00
Jonathan Rascher
733ec614d8 [Keyboard] Support flashing DZ60 with :flash command (#6624) 2019-08-30 17:44:47 -07:00
Jonathan Rascher
075495a792 [Keyboard] Support flashing Instant60 from command line (#6625) 2019-08-30 17:44:28 -07:00
Danny
feb1742061 [Keyboard] Add option to use 4x12 layout for Nyquist (#6633)
* Add option to use 4x12 layout for Nyquist

* Add 4x12 Nyquist support to configurator

* Add height to 4x12 configurator layout

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Remove QWERTY keycode

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-08-30 17:41:22 -07:00
Tobias V. Langhoff
2e9a096c46 [Keymap] Personal ISO-ish keymap for HHKB (#6632)
* Personal ISO-ish keymap for HHKB

* Fix keymap image
2019-08-30 17:40:24 -07:00
Nick Christus
06de8fd106 [Keyboard] Add Caravan keyboard (#6630)
* added caravan keyboard

* updates per PR review

* updated bootmagic setting

* updated LAYOUT

* updated imgur url
2019-08-30 17:39:35 -07:00
Drashna Jaelre
8de164e036 Fix Redefinition of OLED_TIMEOUT (#6628) 2019-08-30 16:55:47 -07:00
skullY
d217307747 consistency 2019-08-30 15:01:52 -07:00
skullY
1061c024d8 Add a note about clang-format to the changelog 2019-08-30 15:01:52 -07:00
skullY
ddb69d4d39 Merge point for 2019 Aug 30 Breaking Change 2019-08-30 15:01:52 -07:00
skullY
b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
skullY
61af76a10d Hotfix: Reinstate the KC_DELT alias 2019-08-30 15:01:52 -07:00
skullY
39baa5e80d add lufa as a submodule 2019-08-30 15:01:52 -07:00
Drashna Jaelre
cf4575b94a Fix the LUFA lib to use a submodule instead of just files (#6245)
* Remove LUFA files

* Update descriptions for newer version of LUFA

* Create PR6245.md

* Fix CDC(Serial) type errors

* Fix missed merge conflict for AUDIO_DTYPE_CSInterface
2019-08-30 15:01:52 -07:00
Joel Challis
75ee8df19e Update Atreus to current code conventions (#5849)
* Update atreus to current code conventions - add multi revision instead of defines

* Remove config.h duplication from user keymaps

* Add breaking change log

* Add missing pragma once
2019-08-30 15:01:52 -07:00
fauxpark
3619678b10 Migrate ACTION_BACKLIGHT_* to BL_* (#6299)
* Branch point for 2019 Aug 30 Breaking Change

* LUFA USB descriptor cleanup (#4871)

* Fix indentation

* Fix braces

* Expand descriptor headers

* Align descriptor elements

* Nicer formatting

* Tidy up preprocessor statements

* Remove VERSION_BCD redefine - LUFA_VERSION_INTEGER is currently 0x170418

* Tidy up comments

* Tweak ordering of  HID report elements (no functional changes)

* We don't need all of these newlines

* Move default USB_MAX_POWER_CONSUMPTION closer to where it makes sense

* Ask nicely

* Add some more comments

* Change indentation back to 4 spaces

* Add changelog entry

* Language Keymap extras backport from ZSA fork (#6198)

* Swedish extra keymap refactor

* Fix swedish $ sign definition (#81)

* Fix br abnt2 keymap compilation error

* Add PR changelog doc

* Update PR6198.md

* Enforce clang-format (#6293)

* Enforce clang-format on commit for core files

* forgot about tests

* Migrate ACTION_LAYER_MOMENTARYs to MO() (#5176)

* Migrate ACTION_LAYER_MOMENTARYs to MO()

* Add changelog entry

* Update docs/ChangeLog/20190830/PR5176.md

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>

* Migrate ACTION_BACKLIGHT_* to BL_*

* Add changelog

* Update docs/ChangeLog/20190830/PR6299.md

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>
2019-08-30 15:01:52 -07:00
Konstantin Đorđević
267a85c885 Remove KC_DELT alias in favor of KC_DEL (#6327)
* Remove KC_DELT alias in favor of KC_DEL

* Add changelog
2019-08-30 15:01:52 -07:00
skullY
7ff57644e1 Fix vusb compiling after clang-format 2019-08-30 15:01:52 -07:00
Drashna Jaelre
beb320a5c6 Fix Windows formatting issues
Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-08-30 15:01:52 -07:00
Drashna Jaelre
5a2a650730 Update swedish based keymaps with newer keycodes 2019-08-30 15:01:52 -07:00
skullY
691be16b23 Have clang ignore the code in bootloader_size.c 2019-08-30 15:01:52 -07:00
skullydazed
210da974a0 Add new files to the list of files that are formatted. (#6296) 2019-08-30 15:01:52 -07:00
fauxpark
554e4bf25c Migrate ACTION_LAYER_MOMENTARYs to MO() (#5176)
* Migrate ACTION_LAYER_MOMENTARYs to MO()

* Add changelog entry

* Update docs/ChangeLog/20190830/PR5176.md

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>
2019-08-30 15:01:52 -07:00
skullydazed
9e20478e6b Enforce clang-format (#6293)
* Enforce clang-format on commit for core files

* forgot about tests
2019-08-30 15:01:52 -07:00
Drashna Jaelre
51ee244906 Language Keymap extras backport from ZSA fork (#6198)
* Swedish extra keymap refactor

* Fix swedish $ sign definition (#81)

* Fix br abnt2 keymap compilation error

* Add PR changelog doc

* Update PR6198.md
2019-08-30 15:01:52 -07:00
fauxpark
ac16726895 LUFA USB descriptor cleanup (#4871)
* Fix indentation

* Fix braces

* Expand descriptor headers

* Align descriptor elements

* Nicer formatting

* Tidy up preprocessor statements

* Remove VERSION_BCD redefine - LUFA_VERSION_INTEGER is currently 0x170418

* Tidy up comments

* Tweak ordering of  HID report elements (no functional changes)

* We don't need all of these newlines

* Move default USB_MAX_POWER_CONSUMPTION closer to where it makes sense

* Ask nicely

* Add some more comments

* Change indentation back to 4 spaces

* Add changelog entry
2019-08-30 15:01:52 -07:00
skullY
21df614a8e Branch point for 2019 Aug 30 Breaking Change 2019-08-30 15:01:52 -07:00
fauxpark
c27aa60c50 Make the CLI Ψ capital (#6637) 2019-08-30 10:23:36 -07:00
Drashna Jaelre
931e9bdbe4 Decrement EECONFIG magic number
This will manually wipe the EEPROM. This is a hacky solution for when new ranges are added or moved around. 

A better (more complicated) solution would be to zero out everything, not just known ranges.  But for now, this is a hacky solution that will work.
2019-08-27 20:32:36 -07:00
Yan-Fa Li
5ef7367e6c Wonderland: README (#6613)
* Wonderland README

breaks

* Wonderland info.json

* Update keyboards/maartenwut/wonderland/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-08-27 16:22:20 -07:00
Jorde Vorstenbosch
5c6c556933 [Keymap] default keymap fix for questionmark (redox, redox_w) (#6574)
* default keymap fix for questionmark

Added /? to the default position for a qwerty keyboard. Moved |\ to the left ctrl with the same behaviour as before.

* Small PR adjustments and Keypad optimization

* Update keymap.c

* Update keymap.c
2019-08-27 14:20:25 -07:00
Yan-Fa Li
d2ce12d15d pegasushoof Specify the bootloader to use :flash (#6614)
A support for newer :flash command to pegasus hoof
2019-08-26 11:08:18 -07:00
Drashna Jaelre
bc86eb2233 Fix Typo in :flash target for missing bootloader (#6615) 2019-08-26 10:16:46 -07:00
MechMerlin
f2d9f912b1 Mars80 Bug: Physical/Electrical Matrix Mismatch (#6612) 2019-08-26 13:46:35 +01:00
Gabes Mak
0b89809ac4 [Keymap] Redox_w Use layer_state_set_user instead of matrix_scan_user (#6608)
* use layer_state_set_user

* fix
2019-08-25 12:50:29 -07:00
XScorpion2
957070a6b5 Added OLED Display autoscroll during periods of OLED data inactivity (#6546)
* Added OLED Display autoscroll during periods of OLED data inactivity.

* Fixing compile errors

* Feedback from review
2019-08-25 12:37:55 -07:00
skullydazed
f22c5c17b6 Refactor qmk compile-json to qmk compile (#6592) 2019-08-25 11:58:24 -07:00
Ethan Madden
c289a4cb20 RGB Inidcator example for new van pcbs (#6544)
* RGB Inidcator example for new van pcbs

* simplify config.h

As per @drashna in CR
2019-08-25 08:43:47 -07:00
Jonathan Rascher
cbe1af47de Add new 60% Tsangan HHKB layout (#6607) 2019-08-25 08:40:32 -07:00
Yan-Fa Li
f6da00b85d [Keyboard] Maartenwut Wonderland PCB (#6492)
* Initial Commit

* ID

* Use current manu name

* Fix define DEBOUNCE

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Fix NUM Lock LED detection

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Fix CAPs LED detection

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Fix Scroll Lock LED detection

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Use correct convention for setting pins

* Move folder to maartenwut

 - enable velocikey

* Fix columns size

* Sync with homerowco

* Add Keebs keymap

* Best practices

* Latest keymap changes from homerowco
2019-08-24 23:44:20 -07:00
Yan-Fa Li
43b0309970 Add 2015 revision of Pegasus Hoof to QMK (#6595)
* Add 2015 revision of pegasus hoof to QMK

* Add different version strings

* Fix ansi tkl layout

 - temporary JIS mapping, I can't test this as I don't have the hardware

* Reverse engineer JIS layout macro for 2015 Pegasus Hoof

* Linting on 2013.h

* Add more resources to readme

* Update keyboards/bpiphany/pegasushoof/2013/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/bpiphany/pegasushoof/2015/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/bpiphany/pegasushoof/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/bpiphany/pegasushoof/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Try to use core debouncing code

* return changed

* Use helpers
2019-08-24 13:10:36 -07:00
MechMerlin
caab1d0303 [Keyboard] New Keyboard: EVE Meteor (#6565)
* initial commit

* Add the correct pins and ordering

* create an appropriate keymap macro for the board

* add an appropriate LAYOUT macro

* add a keymap that fits the LAYOUT layout macro

* add QMK Configurator support

* add missing pin D7 and LAYOUT_all

* fix my mistake when I added an extra key to the electrical matrix instead of the physical one

* add qmk configurator support for LAYOUT_all

* Update keyboards/eve/meteor/readme.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/eve/meteor/rules.mk

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* use the default names so BMC still works

* remove mcu rules as per resolution of 6253
2019-08-24 09:44:04 -07:00
Jack Humbert
e243afe23e updates the coc 2019-08-24 12:43:39 -04:00
Stefano
c9c33978ce [Keymap] a keymap to "transform" a jj40 info a simil Alpha28, to enjoy its simplicity and power (#6599) 2019-08-24 09:08:54 -07:00
Danny
2c8d8be718 [Keyboard] Add JNAO keyboard (#6598)
* Add JNAO keyboard

* Use layout macro for default_4x12

* Add bakingpy keymap

* Add info.json data

* Remove bakingpy keymap from jnao, add ortho_4x12 layout fetching

* Clear up default keymaps
2019-08-24 09:06:27 -07:00
Iain King
70329b4fbb [Keymap] ISO keymap for TADA68 with programming in mind (#6597)
* Layout with better use of navigation keys

* Update keyboards/tada68/keymaps/onelivesleft/config.h

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-08-24 09:02:37 -07:00
kuchosauronad0
2ef6bbbf5f [Keymap] Update to userspace kuchosauroand0 (#6596)
* added combos

* minor adjustments, added combos

* Add second encoder, add modifiers to encoders

Added a skeleton for the possibily having a second encoder.
Added 9 modifiers for the first rotary encoder:

- None
  General navigation. Page up/down
- SHIFT
  Fast navigation. Home/end
- CTRL
  Vertical navigation. Up/down
- CTRL+SHIFT
  Horizontal navigation. Left/right
- ALT
  Audio volume control.
- GUI
  Browser navigation(windows). Forward/backward
- ALT+SHIFT
  Form navigation. Tab up/down
- ALT+CTRL
  Media control. (Play|pause)/mute
- HYPER
  Media navigation. Next/prev track

Key codes are stored in `uint16_t encoder_actions[2][9]`

* Add second encoder, add modifiers to encoders

Added a skeleton for the possibily having a second encoder.
Added 9 modifiers for the first rotary encoder:

- None
  General navigation. Page up/down
- SHIFT
  Fast navigation. Home/end
- CTRL
  Vertical navigation. Up/down
- CTRL+SHIFT
  Horizontal navigation. Left/right
- ALT
  Audio volume control.
- GUI
  Browser navigation(windows). Forward/backward
- ALT+SHIFT
  Form navigation. Tab up/down
- ALT+CTRL
  Media control. (Play|pause)/mute
- HYPER
  Media navigation. Next/prev track

Key codes are stored in `uint16_t encoder_actions[2][9]`

* Clean up; added combos

Combos:
- CV: Copy
- XC: Cut
- ZV: Paste
- QP: KC_SLEEP

* Fix LEADER_DICTIONARY to be more useful

* Add documentation

* Minor fixes

* Raise TAPPING_TERM

* testing

* Rearrange modifiers

* Fix kc being stored in uint8 instead of uint16

* Update documentation

* Clean up

* Remove excess comments

* Put encoder_actions in progmem
2019-08-24 09:01:12 -07:00
2953 changed files with 60086 additions and 442061 deletions

3
.gitmodules vendored
View File

@@ -11,3 +11,6 @@
[submodule "lib/googletest"] [submodule "lib/googletest"]
path = lib/googletest path = lib/googletest
url = https://github.com/google/googletest url = https://github.com/google/googletest
[submodule "lib/lufa"]
path = lib/lufa
url = https://github.com/qmk/lufa

View File

@@ -27,7 +27,7 @@ addons:
- diffutils - diffutils
- dos2unix - dos2unix
- doxygen - doxygen
after_success: after_script:
bash util/travis_compiled_push.sh bash util/travis_compiled_push.sh
notifications: notifications:
webhooks: webhooks:

View File

@@ -1,6 +1,11 @@
// Suggested extensions // Suggested extensions
{ {
"recommendations": [ "recommendations": [
"EditorConfig.EditorConfig" "EditorConfig.EditorConfig",
"xaver.clang-format",
"ms-vscode.cpptools",
"bierner.github-markdown-preview",
"donjayamanne.git-extension-pack",
"CoenraadS.bracket-pair-colorizer-2"
] ]
} }

View File

@@ -12,6 +12,8 @@
"*.c": "c", "*.c": "c",
"*.cpp": "cpp", "*.cpp": "cpp",
"*.hpp": "cpp", "*.hpp": "cpp",
"xstddef": "c" "xstddef": "c",
"type_traits": "c",
"utility": "c"
} }
} }

View File

@@ -8,8 +8,17 @@ Our users, contributors, and collaborators are expected to treat each other with
* The use of sexualized language or imagery * The use of sexualized language or imagery
* Unwelcome advances, sexual or otherwise * Unwelcome advances, sexual or otherwise
* Deliberate intimidation, stalking, or following
* Insults or derogatory comments, or personal or political attacks * Insults or derogatory comments, or personal or political attacks
* Publishing others private information without explicit permission * Publishing others private information without explicit permission
* Sustained disruption of talks or other events
* Other conduct which could reasonably be considered inappropriate in a professional setting * Other conduct which could reasonably be considered inappropriate in a professional setting
* Advocating for, or encouraging, any of the above behaviour
If someone is violating this Code of Conduct you may email hello@qmk.fm to bring your concern to the Members. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. # Reporting
If someone is violating this Code of Conduct, please email hello@qmk.fm or reach out to one of the Collaborators to bring it to our attention. All complaints will be reviewed and investigated.
QMK will seek to use the least punitive means available to resolve an issue. If the circumstances require asking an offender to leave, we will do that.
Reports will be taken and kept in strict confidence. You will not be required to confront an offender directly.

View File

@@ -371,6 +371,9 @@ define PARSE_KEYBOARD
# The same if all was specified # The same if all was specified
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true) else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
$$(eval $$(call PARSE_ALL_KEYMAPS)) $$(eval $$(call PARSE_ALL_KEYMAPS))
# List all keymaps for the given keyboard
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,list-keymaps),true)
$$(eval $$(call LIST_ALL_KEYMAPS))
# Try to match the specified keyamp with the list of known keymaps # Try to match the specified keyamp with the list of known keymaps
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true) else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM))) $$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
@@ -407,6 +410,16 @@ endef
# endif # endif
# endef # endef
# Prints a list of all known keymaps for the given keyboard
define LIST_ALL_KEYMAPS
COMMAND_true_LIST_KEYMAPS := \
printf "$$(KEYMAPS)\n";
COMMAND_false_LIST_KEYMAPS := \
printf "$$(MSG_AVAILABLE_KEYMAPS)\n"; \
printf "$$(KEYMAPS)\n";
COMMANDS += LIST_KEYMAPS
endef
# $1 Keymap # $1 Keymap
# This is the meat of compiling a keyboard, when entering this, everything is known # This is the meat of compiling a keyboard, when entering this, everything is known
# keyboard, subproject, and keymap # keyboard, subproject, and keymap
@@ -548,6 +561,7 @@ ifndef SKIP_GIT
if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 1 --init lib/chibios; fi if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 1 --init lib/chibios; fi
if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 1 --init lib/chibios-contrib; fi if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 1 --init lib/chibios-contrib; fi
if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 1 --init lib/ugfx; fi if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 1 --init lib/ugfx; fi
if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 1 --init lib/lufa; fi
git submodule status --recursive 2>/dev/null | \ git submodule status --recursive 2>/dev/null | \
while IFS= read -r x; do \ while IFS= read -r x; do \
case "$$x" in \ case "$$x" in \

12
bin/qmk
View File

@@ -38,7 +38,7 @@ with open('requirements.txt', 'r') as fd:
# Figure out our version # Figure out our version
command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags'] command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags']
result = subprocess.run(command, universal_newlines=True, capture_output=True) result = subprocess.run(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode == 0: if result.returncode == 0:
os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip() os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip()
@@ -47,7 +47,7 @@ else:
# Setup the CLI # Setup the CLI
import milc import milc
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}ψ{style_reset_all}' milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
# If we were invoked as `qmk <cmd>` massage sys.argv into `qmk-<cmd>`. # If we were invoked as `qmk <cmd>` massage sys.argv into `qmk-<cmd>`.
# This means we can't accept arguments to the qmk script itself. # This means we can't accept arguments to the qmk script itself.
@@ -94,4 +94,10 @@ else:
exit(1) exit(1)
if __name__ == '__main__': if __name__ == '__main__':
milc.cli() return_code = milc.cli()
if return_code is False:
exit(1)
elif return_code is not True and isinstance(return_code, int) and return_code < 256:
exit(return_code)
else:
exit(0)

View File

@@ -19,12 +19,14 @@
# #
# Sets the bootloader defined in the keyboard's/keymap's rules.mk # Sets the bootloader defined in the keyboard's/keymap's rules.mk
# Current options: # Current options:
# atmel-dfu #
# lufa-dfu # halfkay PJRC Teensy
# qmk-dfu # caterina Pro Micro (Sparkfun/generic)
# halfkay # atmel-dfu Atmel factory DFU
# caterina # lufa-dfu LUFA DFU
# bootloadHID # qmk-dfu QMK DFU (LUFA + blinkenlight)
# bootloadHID HIDBootFlash compatible (ATmega32A)
# USBasp USBaspLoader (ATmega328P)
# #
# BOOTLOADER_SIZE can still be defined manually, but it's recommended # BOOTLOADER_SIZE can still be defined manually, but it's recommended
# you add any possible configuration to this list # you add any possible configuration to this list
@@ -32,7 +34,7 @@
ifeq ($(strip $(BOOTLOADER)), atmel-dfu) ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
OPT_DEFS += -DBOOTLOADER_ATMEL_DFU OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
OPT_DEFS += -DBOOTLOADER_DFU OPT_DEFS += -DBOOTLOADER_DFU
ifeq ($(strip $(MCU)), atmega32u4) ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
BOOTLOADER_SIZE = 4096 BOOTLOADER_SIZE = 4096
endif endif
ifeq ($(strip $(MCU)), at90usb1286) ifeq ($(strip $(MCU)), at90usb1286)
@@ -42,7 +44,7 @@ endif
ifeq ($(strip $(BOOTLOADER)), lufa-dfu) ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
OPT_DEFS += -DBOOTLOADER_LUFA_DFU OPT_DEFS += -DBOOTLOADER_LUFA_DFU
OPT_DEFS += -DBOOTLOADER_DFU OPT_DEFS += -DBOOTLOADER_DFU
ifeq ($(strip $(MCU)), atmega32u4) ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
BOOTLOADER_SIZE = 4096 BOOTLOADER_SIZE = 4096
endif endif
ifeq ($(strip $(MCU)), at90usb1286) ifeq ($(strip $(MCU)), at90usb1286)
@@ -52,7 +54,7 @@ endif
ifeq ($(strip $(BOOTLOADER)), qmk-dfu) ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
OPT_DEFS += -DBOOTLOADER_QMK_DFU OPT_DEFS += -DBOOTLOADER_QMK_DFU
OPT_DEFS += -DBOOTLOADER_DFU OPT_DEFS += -DBOOTLOADER_DFU
ifeq ($(strip $(MCU)), atmega32u4) ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
BOOTLOADER_SIZE = 4096 BOOTLOADER_SIZE = 4096
endif endif
ifeq ($(strip $(MCU)), at90usb1286) ifeq ($(strip $(MCU)), at90usb1286)

View File

@@ -267,20 +267,21 @@ ifeq ($(strip $(ENCODER_ENABLE)), yes)
OPT_DEFS += -DENCODER_ENABLE OPT_DEFS += -DENCODER_ENABLE
endif endif
ifeq ($(strip $(HAPTIC_ENABLE)), DRV2605L) HAPTIC_ENABLE ?= no
ifneq ($(strip $(HAPTIC_ENABLE)),no)
COMMON_VPATH += $(DRIVER_PATH)/haptic COMMON_VPATH += $(DRIVER_PATH)/haptic
SRC += haptic.c SRC += haptic.c
OPT_DEFS += -DHAPTIC_ENABLE
endif
ifneq ($(filter DRV2605L, $(HAPTIC_ENABLE)), )
SRC += DRV2605L.c SRC += DRV2605L.c
QUANTUM_LIB_SRC += i2c_master.c QUANTUM_LIB_SRC += i2c_master.c
OPT_DEFS += -DHAPTIC_ENABLE
OPT_DEFS += -DDRV2605L OPT_DEFS += -DDRV2605L
endif endif
ifeq ($(strip $(HAPTIC_ENABLE)), SOLENOID) ifneq ($(filter SOLENOID, $(HAPTIC_ENABLE)), )
COMMON_VPATH += $(DRIVER_PATH)/haptic
SRC += haptic.c
SRC += solenoid.c SRC += solenoid.c
OPT_DEFS += -DHAPTIC_ENABLE
OPT_DEFS += -DSOLENOID_ENABLE OPT_DEFS += -DSOLENOID_ENABLE
endif endif
@@ -358,3 +359,9 @@ ifeq ($(strip $(SPACE_CADET_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_space_cadet.c SRC += $(QUANTUM_DIR)/process_keycode/process_space_cadet.c
OPT_DEFS += -DSPACE_CADET_ENABLE OPT_DEFS += -DSPACE_CADET_ENABLE
endif endif
ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/dip_switch.c
OPT_DEFS += -DDIP_SWITCH_ENABLE
endif

View File

@@ -0,0 +1,53 @@
# QMK Breaking Change - 2019 Aug 30
Four times a year QMK runs a process for merging Breaking Changes. A Breaking Change is any change which modifies how QMK behaves in a way that is incompatible or potentially dangerous. We limit these changes to 4 times per year so that users can have confidence that updating their QMK tree will not break their keymaps.
This document marks the inaugural Breaking Change merge. A list of changes follows.
## Core code formatting with clang-format
* All core files (`drivers/`, `quantum/`, `tests/`, and `tmk_core/`) have been formatted with clang-format
* A travis process to reformat PR's on merge has been instituted
* You can use the new CLI command `qmk cformat` to format before submitting your PR if you wish.
## LUFA USB descriptor cleanup
* Some code cleanups related to the USB HID descriptors on AVR keyboards, to make them easier to read and understand
* More information: see https://github.com/qmk/qmk_firmware/pull/4871
* No behaviour changes anticipated and no keymaps modified
## Migrating `ACTION_LAYER_MOMENTARY()` entries in `fn_actions` to `MO()` keycodes
* `fn_actions` is deprecated, and its functionality has been superseded by direct keycodes and `process_record_user()`
* The end result of removing this obsolete feature should result in a decent reduction in firmware size and code complexity
* All keymaps affected are recommended to switch away from `fn_actions` in favour of the [custom keycode](https://docs.qmk.fm/#/custom_quantum_functions) and [macro](https://docs.qmk.fm/#/feature_macros) features
## Update Atreus to current code conventions
* Duplicate include guards have bypassed the expected header processing behavior
* All keymaps affected are recommended to remove duplication of `<keyboard>/config.h` to `<keyboard>/keymaps/<user>/config.h` and only provide overrides at the keymap level
## Backport changes to keymap language files from ZSA fork
* Fixes an issue in the `keymap_br_abnt2.h` file that includes the wrong source (`keymap_common.h` instead of `keymap.h`)
* Updates the `keymap_swedish.h` file to be specific to swedish, and not just "nordic" in general.
* Any keymaps using this will need to remove `NO_*` and replace it with `SE_*`.
## Update repo to use LUFA as a git submodule
* `/lib/LUFA` removed from the repo
* LUFA set as a submodule, pointing to qmk/lufa
* This should allow more flexibility with LUFA, and allow us to keep the sub-module up to date, a lot more easily. It was ~2 years out of date with no easy path to fix that. This prevents that from being an issue in the future
## Migrating `ACTION_BACKLIGHT_*()` entries in `fn_actions` to `BL_` keycodes
* `fn_actions` is deprecated, and its functionality has been superseded by direct keycodes and `process_record_user()`
* All keymaps using these actions have had the relevant `KC_FN*` keys replaced with the equivalent `BL_*` keys
* If you currently use `KC_FN*` you will need to replace `fn_actions` with the [custom keycode](https://docs.qmk.fm/#/custom_quantum_functions) and [macro](https://docs.qmk.fm/#/feature_macros) features
## Remove `KC_DELT` alias in favor of `KC_DEL`
* `KC_DELT` was a redundant, undocumented alias for `KC_DELETE`
* It has been removed and all its uses replaced with the more common `KC_DEL` alias
* Around 90 keymaps (mostly for ErgoDox boards) have been modified as a result

View File

@@ -13,6 +13,9 @@
* [How to Use Github](getting_started_github.md) * [How to Use Github](getting_started_github.md)
* [Getting Help](getting_started_getting_help.md) * [Getting Help](getting_started_getting_help.md)
* [Breaking Changes](breaking_changes.md)
* [2019 Aug 30](ChangeLog/20190830.md)
* [FAQ](faq.md) * [FAQ](faq.md)
* [General FAQ](faq_general.md) * [General FAQ](faq_general.md)
* [Build/Compile QMK](faq_build.md) * [Build/Compile QMK](faq_build.md)
@@ -60,6 +63,7 @@
* [Combos](feature_combo.md) * [Combos](feature_combo.md)
* [Command](feature_command.md) * [Command](feature_command.md)
* [Debounce API](feature_debounce_type.md) * [Debounce API](feature_debounce_type.md)
* [DIP Switch](feature_dip_switch.md)
* [Dynamic Macros](feature_dynamic_macros.md) * [Dynamic Macros](feature_dynamic_macros.md)
* [Encoders](feature_encoders.md) * [Encoders](feature_encoders.md)
* [Grave Escape](feature_grave_esc.md) * [Grave Escape](feature_grave_esc.md)

108
docs/breaking_changes.md Normal file
View File

@@ -0,0 +1,108 @@
# Breaking Changes
This document describes QMK's Breaking Change process. A Breaking Change is any change which modifies how QMK behaves in a way that in incompatible or potentially dangerous. We limit these changes so that users can have confidence that updating their QMK tree will not break their keymaps.
The breaking change period is when we will merge PR's that change QMK in dangerous or unexpected ways. There is a built-in period of testing so we are confident that any problems caused are rare or unable to be predicted.
## What has been included in past Breaking Changes?
* [2019 Aug 30](ChangeLog/20190830.md)
## When is the next Breaking Change?
The next Breaking Change is scheduled for Nov 29.
### Important Dates
* [ ] 2019 Oct 04 - `future` is created. It will be rebased weekly.
* [ ] 2019 Nov 01 - `future` closed to new PR's.
* [ ] 2019 Nov 01 - Call for testers.
* [ ] 2019 Nov 27 - `master` is locked, no PR's merged.
* [ ] 2019 Nov 29 - Merge `future` to `master`.
* [ ] 2019 Nov 30 - `master` is unlocked. PR's can be merged again.
## What changes will be included?
To see a list of breaking change candidates you can look at the [`breaking_change` label](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+label%3Abreaking_change+is%3Apr). New changes might be added between now and when `future` is closed, and a PR with that label applied is not guaranteed to be merged.
If you want your breaking change to be included in this round you need to create a PR with the `breaking_change` label and have it accepted before `future` closes. After `future` closes no new breaking changes will be accepted.
Criteria for acceptance:
* PR is complete and ready to merge
* PR has a ChangeLog
# Checklists
This section documents various processes we use when running the Breaking Changes process.
## Rebase `future` from `master`
This is run every Friday while `future` is open.
Process:
```
cd qmk_firmware
git checkout master
git pull --ff-only
git checkout future
git rebase master
git push --force
```
## 8 Weeks Before Merge
* `qmk_firmware` git commands
* [ ] `git checkout master`
* [ ] `git pull --ff-only`
* [ ] `git checkout -b future`
* [ ] Edit `readme.md`
* [ ] Add a big notice at the top that this is a testing branch.
* [ ] Include a link to this document
* [ ] `git commit -m 'Branch point for <DATE> Breaking Change'`
* [ ] `git tag breakpoint_<YYYY>_<MM>_<DD>`
* [ ] `git tag <next_version>` # Prevent the breakpoint tag from confusing version incrementing
* [ ] `git push origin future`
* [ ] `git push --tags`
* GitHub Actions
* [ ] Switch all [breaking_change PR's](https://github.com/qmk/qmk_firmware/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3Abreaking_change) to `future`
* [ ] Any that have a ChangeLog entry may be merged immediately.
## 4 Weeks Before Merge
* `future` is now closed to new PR's, only fixes for current PR's may be merged
* Post call for testers
* [ ] Discord
* [ ] GitHub PR
* [ ] https://reddit.com/r/olkb
## 1 Week Before Merge
* Announce that master will be closed from <2 Days Before> to <Day of Merge>
* [ ] Discord
* [ ] GitHub PR
* [ ] https://reddit.com/r/olkb
## 2 Days Before Merge
* Announce that master is closed for 2 days
* [ ] Discord
* [ ] GitHub PR
* [ ] https://reddit.com/r/olkb
## Day Of Merge
* `qmk_firmware` git commands
* [ ] `git checkout future`
* [ ] `git pull --ff-only`
* [ ] `git rebase origin/master`
* [ ] Edit `readme.md`
* [ ] Remove the notes about `future`
* [ ] Roll up the ChangeLog into one file.
* [ ] `git commit -m 'Merge point for <DATE> Breaking Change'`
* [ ] `git push origin future`
* Github Actions
* [ ] Create a PR for `future`
* [ ] Make sure travis comes back clean
* [ ] Merge `future` PR

View File

@@ -6,7 +6,8 @@ This page describes how to setup and use the QMK CLI.
The QMK CLI makes building and working with QMK keyboards easier. We have provided a number of commands to help you work with QMK: The QMK CLI makes building and working with QMK keyboards easier. We have provided a number of commands to help you work with QMK:
* `qmk compile-json` * `qmk compile`
* `qmk doctor`
# Setup # Setup
@@ -20,12 +21,28 @@ You may want to add this to your `.profile`, `.bash_profile`, `.zsh_profile`, or
# Commands # Commands
## `qmk compile-json` ## `qmk compile`
This command allows you to compile JSON files you have downloaded from <https://config.qmk.fm>. This command allows you to compile firmware from any directory. You can compile JSON exports from <https://config.qmk.fm> or compile keymaps in the repo.
**Usage for Configurator Exports**:
```
qmk compile <configuratorExport.json>
```
**Usage for Keymaps**:
```
qmk compile -kb <keyboard_name> -km <keymap_name>
```
## `qmk cformat`
This command formats C code using clang-format. Run it with no arguments to format all core code, or pass filenames on the command line to run it on specific files.
**Usage**: **Usage**:
``` ```
qmk compile-json mine.json qmk cformat [file1] [file2] [...] [fileN]
``` ```

View File

@@ -91,8 +91,10 @@ This is a C header file that is one of the first things included, and will persi
* tries to keep switch state consistent with keyboard LED state * tries to keep switch state consistent with keyboard LED state
* `#define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)` * `#define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)`
* key combination that allows the use of magic commands (useful for debugging) * key combination that allows the use of magic commands (useful for debugging)
* `#define USB_MAX_POWER_CONSUMPTION` * `#define USB_MAX_POWER_CONSUMPTION 500`
* sets the maximum power (in mA) over USB for the device (default: 500) * sets the maximum power (in mA) over USB for the device (default: 500)
* `#define USB_POLLING_INTERVAL_MS 10`
* sets the USB polling rate in milliseconds for the keyboard, mouse, and shared (NKRO/media keys) interfaces
* `#define F_SCL 100000L` * `#define F_SCL 100000L`
* sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`. * sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`.

View File

@@ -8,10 +8,14 @@ We recommend the use of the [Zadig](https://zadig.akeo.ie/) utility. If you have
## Installation ## Installation
Place your keyboard into the bootloader mode, either by hitting the `RESET` keycode (which may be on a different layer), or by pressing the reset switch usually located on the underside of the board. If your keyboard has neither, try holding Escape, or Space+`B`, as you plug it in (see the [Bootmagic](feature_bootmagic.md) docs for more details). Put your keyboard into bootloader mode, either by hitting the `RESET` keycode (which may be on a different layer), or by pressing the reset switch that's usually located on the underside of the board. If your keyboard has neither, try holding Escape or Space+`B` as you plug it in (see the [Bootmagic](feature_bootmagic.md) docs for more details). Some boards use [Command](feature_command.md) instead of Bootmagic; in this case, you can enter bootloader mode by hitting Left Shift+Right Shift+`B` or Left Shift+Right Shift+Escape at any point while the keyboard is plugged in.
Some keyboards may have specific instructions for entering the bootloader, for example the [Bootmagic Lite](feature_bootmagic.md#bootmagic-lite) key (Escape) might be on a different key, such as Left Control. Refer to the board's README if you are unsure. Some keyboards may have specific instructions for entering the bootloader. For example, the [Bootmagic Lite](feature_bootmagic.md#bootmagic-lite) key (default: Escape) might be on a different key, e.g. Left Control; or the magic combination for Command (default: Left Shift+Right Shift) might require you to hold something else, e.g. Left Control+Right Control. Refer to the board's README file if you are unsure.
To put a device in bootloader mode with USBaspLoader, tap the `RESET` button while holding down the `BOOT` button.
Alternatively, hold `BOOT` while inserting the USB cable.
Zadig will automatically detect the bootloader device. You may sometimes need to check **Options → List All Devices**.
Zadig will automatically detect the bootloader device. You may sometimes need to check **Options -> List All Devices**.
- For keyboards with Atmel AVR MCUs, the bootloader will be named something similar to `ATm32U4DFU`, and have a Vendor ID of `03EB`. - For keyboards with Atmel AVR MCUs, the bootloader will be named something similar to `ATm32U4DFU`, and have a Vendor ID of `03EB`.
- USBasp bootloaders will appear as `USBasp`, with a VID/PID of `16C0:05DC`. - USBasp bootloaders will appear as `USBasp`, with a VID/PID of `16C0:05DC`.
- AVR keyboards flashed with the QMK-DFU bootloader will be named `<keyboard name> Bootloader` and will also have the VID `03EB`. - AVR keyboards flashed with the QMK-DFU bootloader will be named `<keyboard name> Bootloader` and will also have the VID `03EB`.
@@ -19,7 +23,7 @@ Zadig will automatically detect the bootloader device. You may sometimes need to
!> If Zadig lists one or more devices with the `HidUsb` driver, your keyboard is probably not in bootloader mode. The arrow will be colored orange and you will be asked to confirm modifying a system driver. **Do not** proceed if this is the case! !> If Zadig lists one or more devices with the `HidUsb` driver, your keyboard is probably not in bootloader mode. The arrow will be colored orange and you will be asked to confirm modifying a system driver. **Do not** proceed if this is the case!
If the arrow appears green, select the driver, and click **Install Driver**. The `libusb-win32` driver will usually work for AVR, and `WinUSB` for ARM, but if you still cannot flash the board, try installing a different driver from the list. If the arrow appears green, select the driver, and click **Install Driver**. The `libusb-win32` driver will usually work for AVR, and `WinUSB` for ARM, but if you still cannot flash the board, try installing a different driver from the list. For flashing a USBaspLoader device via command line with msys2, the `libusbk` driver is recommended, otherwise `libusb-win32` will work fine if you are using QMK Toolbox for flashing.
![Zadig with a bootloader driver correctly installed](https://i.imgur.com/b8VgXzx.png) ![Zadig with a bootloader driver correctly installed](https://i.imgur.com/b8VgXzx.png)
@@ -39,4 +43,4 @@ Right-click it and hit **Uninstall device**. Make sure to tick **Delete the driv
![The Device Uninstall dialog, with the "delete driver" checkbox ticked](https://i.imgur.com/aEs2RuA.png) ![The Device Uninstall dialog, with the "delete driver" checkbox ticked](https://i.imgur.com/aEs2RuA.png)
Click **Action -> Scan for hardware changes**. At this point, you should be able to type again. Double check in Zadig that the keyboard device(s) are using the `HidUsb` driver. If so, you're all done, and your board should be functional again! Click **Action Scan for hardware changes**. At this point, you should be able to type again. Double check in Zadig that the keyboard device(s) are using the `HidUsb` driver. If so, you're all done, and your board should be functional again!

View File

@@ -32,16 +32,18 @@ This feature is distinct from both the [RGB underglow](feature_rgblight.md) and
Hardware PWM is supported according to the following table: Hardware PWM is supported according to the following table:
|Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A| |Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328P|
|-------------|-------------|-------------|-------------|---------| |-------------|-------------|-------------|-------------|---------|----------|
|`B5` |Timer 1 |Timer 1 | | | |`B1` | | | | |Timer 1 |
|`B6` |Timer 1 |Timer 1 | | | |`B2` | | | | |Timer 1 |
|`B7` |Timer 1 |Timer 1 |Timer 1 | | |`B5` |Timer 1 |Timer 1 | | | |
|`C4` |Timer 3 | | | | |`B6` |Timer 1 |Timer 1 | | | |
|`C5` |Timer 3 | |Timer 1 | | |`B7` |Timer 1 |Timer 1 |Timer 1 | | |
|`C6` |Timer 3 |Timer 3 |Timer 1 | | |`C4` |Timer 3 | | | | |
|`D4` | | | |Timer 1 | |`C5` |Timer 3 | |Timer 1 | | |
|`D5` | | | |Timer 1 | |`C6` |Timer 3 |Timer 3 |Timer 1 | | |
|`D4` | | | |Timer 1 | |
|`D5` | | | |Timer 1 | |
All other pins will use software PWM. If the [Audio](feature_audio.md) feature is disabled or only using one timer, the backlight PWM can be triggered by a hardware timer: All other pins will use software PWM. If the [Audio](feature_audio.md) feature is disabled or only using one timer, the backlight PWM can be triggered by a hardware timer:
@@ -119,7 +121,8 @@ The breathing effect is the same as in the hardware PWM implementation.
|`backlight_step()` |Cycle through backlight levels | |`backlight_step()` |Cycle through backlight levels |
|`backlight_increase()` |Increase the backlight level | |`backlight_increase()` |Increase the backlight level |
|`backlight_decrease()` |Decrease the backlight level | |`backlight_decrease()` |Decrease the backlight level |
|`backlight_level(x)` |Sets the backlight level to specified level | |`backlight_level(x)` |Sets the backlight level, from 0 to |
| |`BACKLIGHT_LEVELS` |
|`get_backlight_level()` |Return the current backlight level | |`get_backlight_level()` |Return the current backlight level |
|`is_backlight_enabled()`|Return whether the backlight is currently on | |`is_backlight_enabled()`|Return whether the backlight is currently on |

View File

@@ -0,0 +1,90 @@
# DIP Switches
DIP switches are supported by adding this to your `rules.mk`:
DIP_SWITCH_ENABLE = yes
and this to your `config.h`:
```c
#define DIP_SWITCH_PINS { B14, A15, A10, B9 }
```
## Callbacks
The callback functions can be inserted into your `<keyboard>.c`:
```c
void dip_switch_update_kb(uint8_t index, bool active) {
dip_switch_update_user(index, active);
}
```
or `keymap.c`:
```c
void dip_switch_update_user(uint8_t index, bool active) {
switch (index) {
case 0:
if(active) { audio_on(); } else { audio_off(); }
break;
case 1:
if(active) { clicky_on(); } else { clicky_off(); }
break;
case 2:
if(active) { music_on(); } else { music_off(); }
break;
case 3:
if (active) {
#ifdef AUDIO_ENABLE
PLAY_SONG(plover_song);
#endif
layer_on(_PLOVER);
} else {
#ifdef AUDIO_ENABLE
PLAY_SONG(plover_gb_song);
#endif
layer_off(_PLOVER);
}
break;
}
}
```
Additionally, we support bit mask functions which allow for more complex handling.
```c
void dip_switch_update_mask_kb(uint32_t state) {
dip_switch_update_mask_user(state);
}
```
or `keymap.c`:
```c
void dip_switch_update_mask_user(uint32_t state) {
if (state & (1UL<<0) && state & (1UL<<1)) {
layer_on(_ADJUST); // C on esc
} else {
layer_off(_ADJUST);
}
if (state & (1UL<<0)) {
layer_on(_TEST_A); // A on ESC
} else {
layer_off(_TEST_A);
}
if (state & (1UL<<1)) {
layer_on(_TEST_B); // B on esc
} else {
layer_off(_TEST_B);
}
}
```
## Hardware
One side of the DIP switch should be wired directly to the pin on the MCU, and the other side to ground. It should not matter which side is connected to which, as it should be functionally the same.

View File

@@ -29,6 +29,9 @@ Not all keycodes below will work depending on which haptic mechanism you have ch
|`HPT_BUZ` | Toggle solenoid buzz on/off | |`HPT_BUZ` | Toggle solenoid buzz on/off |
|`HPT_MODI` | Go to next DRV2605L waveform | |`HPT_MODI` | Go to next DRV2605L waveform |
|`HPT_MODD` | Go to previous DRV2605L waveform | |`HPT_MODD` | Go to previous DRV2605L waveform |
|`HPT_CONT` | Toggle continuous haptic mode on/off |
|`HPT_CONI` | Increase DRV2605L continous haptic strength |
|`HPT_COND` | Decrease DRV2605L continous haptic strength |
|`HPT_DWLI` | Increase Solenoid dwell time | |`HPT_DWLI` | Increase Solenoid dwell time |
|`HPT_DWLD` | Decrease Solenoid dwell time | |`HPT_DWLD` | Decrease Solenoid dwell time |
@@ -145,3 +148,7 @@ If haptic feedback is enabled, the keyboard will vibrate to a specific sqeuence
#define DRV_MODE_DEFAULT *sequence name or number* #define DRV_MODE_DEFAULT *sequence name or number*
``` ```
This will set what sequence HPT_RST will set as the active mode. If not defined, mode will be set to 1 when HPT_RST is pressed. This will set what sequence HPT_RST will set as the active mode. If not defined, mode will be set to 1 when HPT_RST is pressed.
### DRV2605L Continuous Haptic Mode
This mode sets continuous haptic feedback with the option to increase or decrease strength.

View File

@@ -97,14 +97,16 @@ void oled_task_user(void) {
## Basic Configuration ## Basic Configuration
| Define | Default | Description | | Define | Default | Description |
|------------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------| |----------------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------|
| `OLED_DISPLAY_ADDRESS` | `0x3C` | The i2c address of the OLED Display | | `OLED_DISPLAY_ADDRESS` | `0x3C` | The i2c address of the OLED Display |
| `OLED_FONT_H` | `"glcdfont.c"` | The font code file to use for custom fonts | | `OLED_FONT_H` | `"glcdfont.c"` | The font code file to use for custom fonts |
| `OLED_FONT_START` | `0` | The starting characer index for custom fonts | | `OLED_FONT_START` | `0` | The starting characer index for custom fonts |
| `OLED_FONT_END` | `224` | The ending characer index for custom fonts | | `OLED_FONT_END` | `224` | The ending characer index for custom fonts |
| `OLED_FONT_WIDTH` | `6` | The font width | | `OLED_FONT_WIDTH` | `6` | The font width |
| `OLED_FONT_HEIGHT` | `8` | The font height (untested) | | `OLED_FONT_HEIGHT` | `8` | The font height (untested) |
| `OLED_DISABLE_TIMEOUT` | *Not defined* | Disables the built in OLED timeout feature. Useful when implementing custom timeout rules. | | `OLED_TIMEOUT` | `60000` | Turns off the OLED screen after 60000ms of keyboard inactivity. Helps reduce OLED Burn-in. Set to 0 to disable. |
| `OLED_SCROLL_TIMEOUT` | `0` | Scrolls the OLED screen after 0ms of OLED inactivity. Helps reduce OLED Burn-in. Set to 0 to disable. |
| `OLED_SCROLL_TIMEOUT_RIGHT`| *Not defined* | Scroll timeout direction is right when defined, left when undefined. |
| `OLED_IC` | `OLED_IC_SSD1306` | Set to `OLED_IC_SH1106` if you're using the SH1106 OLED controller. | | `OLED_IC` | `OLED_IC_SSD1306` | Set to `OLED_IC_SH1106` if you're using the SH1106 OLED controller. |
| `OLED_COLUMN_OFFSET` | `0` | (SH1106 only.) Shift output to the right this many pixels.<br />Useful for 128x64 displays centered on a 132x64 SH1106 IC. | | `OLED_COLUMN_OFFSET` | `0` | (SH1106 only.) Shift output to the right this many pixels.<br />Useful for 128x64 displays centered on a 132x64 SH1106 IC. |

View File

@@ -30,7 +30,9 @@ Next, you will want to define some tap-dance keys, which is easiest to do with t
After this, you'll want to use the `tap_dance_actions` array to specify what actions shall be taken when a tap-dance key is in action. Currently, there are five possible options: After this, you'll want to use the `tap_dance_actions` array to specify what actions shall be taken when a tap-dance key is in action. Currently, there are five possible options:
* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held. * `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held.
* `ACTION_TAP_DANCE_DUAL_ROLE(kc, layer)`: Sends the `kc` keycode when tapped once, or moves to `layer`. (this functions like the `TO` layer keycode). * `ACTION_TAP_DANCE_LAYER_MOVE(kc, layer)`: Sends the `kc` keycode when tapped once, or moves to `layer`. (this functions like the `TO` layer keycode).
* This is the same as `ACTION_TAP_DANCE_DUAL_ROLE`, but renamed to something that is clearer about its functionality. Both names will work.
* `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: Sends the `kc` keycode when tapped once, or toggles the state of `layer`. (this functions like the `TG` layer keycode).
* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. * `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets. * `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
* `ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`. * `ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`.

View File

@@ -12,6 +12,7 @@ QMK has a staggering number of features for building your keyboard. It can take
* [Combos](feature_combo.md) - Custom actions for multiple key holds. * [Combos](feature_combo.md) - Custom actions for multiple key holds.
* [Command](feature_command.md) - Runtime version of bootmagic (Formerly known as "Magic"). * [Command](feature_command.md) - Runtime version of bootmagic (Formerly known as "Magic").
* [Debounce API](feature_debounce_type.md) - Customization of debouncing algorithms, and the ability to add more/custom debouncing. * [Debounce API](feature_debounce_type.md) - Customization of debouncing algorithms, and the ability to add more/custom debouncing.
* [DIP Switch](feature_dip_switch.md) - Toggle switches for customizing board function.
* [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself. * [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself.
* [Encoders](feature_encoders.md) - Rotary encoders! * [Encoders](feature_encoders.md) - Rotary encoders!
* [Grave Escape](feature_grave_esc.md) - Lets you use a single key for Esc and Grave. * [Grave Escape](feature_grave_esc.md) - Lets you use a single key for Esc and Grave.

View File

@@ -10,11 +10,17 @@ Atmel's DFU bootloader comes on all atmega32u4 chips by default, and is used by
To ensure compatibility with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead): To ensure compatibility with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead):
# Bootloader ```make
# This definition is optional, and if your keyboard supports multiple bootloaders of # Bootloader selection
# different sizes, comment this out, and the correct address will be loaded # Teensy halfkay
# automatically (+60). See bootloader.mk for all options. # Pro Micro caterina
BOOTLOADER = atmel-dfu # Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu
```
Compatible flashers: Compatible flashers:
@@ -64,11 +70,17 @@ Arduino boards and their clones use the [Caterina bootloader](https://github.com
To ensure compatibility with the Caterina bootloader, make sure this block is present your `rules.mk`: To ensure compatibility with the Caterina bootloader, make sure this block is present your `rules.mk`:
# Bootloader ```make
# This definition is optional, and if your keyboard supports multiple bootloaders of # Bootloader selection
# different sizes, comment this out, and the correct address will be loaded # Teensy halfkay
# automatically (+60). See bootloader.mk for all options. # Pro Micro caterina
BOOTLOADER = caterina # Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = caterina
```
Compatible flashers: Compatible flashers:
@@ -100,11 +112,17 @@ Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on al
To ensure compatibility with the Halfkay bootloader, make sure this block is present your `rules.mk`: To ensure compatibility with the Halfkay bootloader, make sure this block is present your `rules.mk`:
# Bootloader ```make
# This definition is optional, and if your keyboard supports multiple bootloaders of # Bootloader selection
# different sizes, comment this out, and the correct address will be loaded # Teensy halfkay
# automatically (+60). See bootloader.mk for all options. # Pro Micro caterina
BOOTLOADER = halfkay # Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = halfkay
```
Compatible flashers: Compatible flashers:
@@ -125,11 +143,17 @@ USBasploader is a bootloader developed by matrixstorm. It is used in some non-US
To ensure compatibility with the USBasploader bootloader, make sure this block is present in your `rules.mk`: To ensure compatibility with the USBasploader bootloader, make sure this block is present in your `rules.mk`:
# Bootloader ```make
# This definition is optional, and if your keyboard supports multiple bootloaders of # Bootloader selection
# different sizes, comment this out, and the correct address will be loaded # Teensy halfkay
# automatically (+60). See bootloader.mk for all options. # Pro Micro caterina
BOOTLOADER = USBasp # Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = USBasp
```
Compatible flashers: Compatible flashers:
@@ -150,11 +174,17 @@ BootloadHID is a USB bootloader for AVR microcontrollers. The uploader tool requ
To ensure compatibility with the bootloadHID bootloader, make sure this block is present your `rules.mk`: To ensure compatibility with the bootloadHID bootloader, make sure this block is present your `rules.mk`:
# Bootloader ```make
# This definition is optional, and if your keyboard supports multiple bootloaders of # Bootloader selection
# different sizes, comment this out, and the correct address will be loaded # Teensy halfkay
# automatically (+60). See bootloader.mk for all options. # Pro Micro caterina
BOOTLOADER = bootloadHID # Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = bootloadHID
```
Compatible flashers: Compatible flashers:

View File

@@ -7,7 +7,7 @@ The I2C Master drivers used in QMK have a set of common functions to allow porta
|Function |Description | |Function |Description |
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|`void i2c_init(void);` |Initializes the I2C driver. This function should be called once before any transaction is initiated. | |`void i2c_init(void);` |Initializes the I2C driver. This function should be called once before any transaction is initiated. |
|`uint8_t i2c_start(uint8_t address);` |Starts an I2C transaction. Address is the 7-bit slave address without the direction bit. | |`uint8_t i2c_start(uint8_t address, uint16_t timeout);` |Starts an I2C transaction. Address is the 7-bit slave address without the direction bit. |
|`uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Transmit data over I2C. Address is the 7-bit slave address without the direction. Returns status of transaction. | |`uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Transmit data over I2C. Address is the 7-bit slave address without the direction. Returns status of transaction. |
|`uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Receive data over I2C. Address is the 7-bit slave address without the direction. Saves number of bytes specified by `length` in `data` array. Returns status of transaction. | |`uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Receive data over I2C. Address is the 7-bit slave address without the direction. Saves number of bytes specified by `length` in `data` array. Returns status of transaction. |
|`uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` |Same as the `i2c_transmit` function but `regaddr` sets where in the slave the data will be written. | |`uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` |Same as the `i2c_transmit` function but `regaddr` sets where in the slave the data will be written. |
@@ -34,7 +34,6 @@ The following defines can be used to configure the I2C master driver.
|Variable |Description |Default| |Variable |Description |Default|
|------------------|---------------------------------------------------|-------| |------------------|---------------------------------------------------|-------|
|`F_SCL` |Clock frequency in Hz |400KHz | |`F_SCL` |Clock frequency in Hz |400KHz |
|`Prescaler` |Divides master clock to aid in I2C clock selection |1 |
AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required. AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required.

View File

@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta property="og:title" content="QMK Firmware Docs"> <meta property="og:title" content="QMK Firmware Docs">
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta property="og:description" content="The full documenation of the open-source firmware"> <meta property="og:description" content="The full documentation of the open-source firmware">
<meta property="og:image" content="https://i.imgur.com/svjvIrw.jpg"> <meta property="og:image" content="https://i.imgur.com/svjvIrw.jpg">
<meta property="og:url" content="https://docs.qmk.fm"> <meta property="og:url" content="https://docs.qmk.fm">
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">

View File

@@ -54,6 +54,7 @@
* [热改键](feature_bootmagic.md) * [热改键](feature_bootmagic.md)
* [组合](feature_combo) * [组合](feature_combo)
* [命令](feature_command.md) * [命令](feature_command.md)
* [拨动开关](feature_dip_switch.md)
* [动态宏指令](feature_dynamic_macros.md) * [动态宏指令](feature_dynamic_macros.md)
* [编码器](feature_encoders.md) * [编码器](feature_encoders.md)
* [重音号Esc复合键](feature_grave_esc.md) * [重音号Esc复合键](feature_grave_esc.md)

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);
@@ -75,41 +69,36 @@ void i2c_init(void)
palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
#endif #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_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,71 +27,70 @@
#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
#ifdef I2C1_BANK #ifdef I2C1_BANK
#define I2C1_SCL_BANK I2C1_BANK # define I2C1_SCL_BANK I2C1_BANK
#define I2C1_SDA_BANK I2C1_BANK # define I2C1_SDA_BANK I2C1_BANK
#endif #endif
#ifndef I2C1_SCL_BANK #ifndef I2C1_SCL_BANK
#define I2C1_SCL_BANK GPIOB # define I2C1_SCL_BANK GPIOB
#endif #endif
#ifndef I2C1_SDA_BANK #ifndef I2C1_SDA_BANK
#define I2C1_SDA_BANK GPIOB # define I2C1_SDA_BANK GPIOB
#endif #endif
#ifndef I2C1_SCL #ifndef I2C1_SCL
#define I2C1_SCL 6 # define I2C1_SCL 6
#endif #endif
#ifndef I2C1_SDA #ifndef I2C1_SDA
#define I2C1_SDA 7 # define I2C1_SDA 7
#endif #endif
#ifdef USE_I2CV1 #ifdef USE_I2CV1
#ifndef I2C1_OPMODE # ifndef I2C1_OPMODE
#define I2C1_OPMODE OPMODE_I2C # define I2C1_OPMODE OPMODE_I2C
#endif # endif
#ifndef I2C1_CLOCK_SPEED # ifndef I2C1_CLOCK_SPEED
#define I2C1_CLOCK_SPEED 100000 /* 400000 */ # define I2C1_CLOCK_SPEED 100000 /* 400000 */
#endif # endif
#ifndef I2C1_DUTY_CYCLE # ifndef I2C1_DUTY_CYCLE
#define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */ # define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */
#endif # endif
#else #else
// The default PAL alternate modes are used to signal that the pins are used for I2C // The default PAL alternate modes are used to signal that the pins are used for I2C
#ifndef I2C1_SCL_PAL_MODE # ifndef I2C1_SCL_PAL_MODE
#define I2C1_SCL_PAL_MODE 4 # define I2C1_SCL_PAL_MODE 4
#endif # endif
#ifndef I2C1_SDA_PAL_MODE # ifndef I2C1_SDA_PAL_MODE
#define I2C1_SDA_PAL_MODE 4 # define I2C1_SDA_PAL_MODE 4
#endif # endif
// The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock // 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 // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html
#ifndef I2C1_TIMINGR_PRESC # ifndef I2C1_TIMINGR_PRESC
#define I2C1_TIMINGR_PRESC 15U # define I2C1_TIMINGR_PRESC 15U
#endif # endif
#ifndef I2C1_TIMINGR_SCLDEL # ifndef I2C1_TIMINGR_SCLDEL
#define I2C1_TIMINGR_SCLDEL 4U # define I2C1_TIMINGR_SCLDEL 4U
#endif # endif
#ifndef I2C1_TIMINGR_SDADEL # ifndef I2C1_TIMINGR_SDADEL
#define I2C1_TIMINGR_SDADEL 2U # define I2C1_TIMINGR_SDADEL 2U
#endif # endif
#ifndef I2C1_TIMINGR_SCLH # ifndef I2C1_TIMINGR_SCLH
#define I2C1_TIMINGR_SCLH 15U # define I2C1_TIMINGR_SCLH 15U
#endif # endif
#ifndef I2C1_TIMINGR_SCLL # ifndef I2C1_TIMINGR_SCLL
#define I2C1_TIMINGR_SCLL 21U # define I2C1_TIMINGR_SCLL 21U
#endif # endif
#endif #endif
#ifndef I2C_DRIVER #ifndef I2C_DRIVER
#define I2C_DRIVER I2CD1 # define I2C_DRIVER I2CD1
#endif #endif
typedef int16_t i2c_status_t; typedef int16_t i2c_status_t;
@@ -104,7 +103,7 @@ void i2c_init(void);
i2c_status_t i2c_start(uint8_t address); 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_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_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_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); 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);

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,21 +40,19 @@ 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
uint8_t low; uint8_t low;
ADCSRA = (1<<ADEN) | ADC_PRESCALER; // enable ADC ADCSRA = (1 << ADEN) | ADC_PRESCALER; // enable ADC
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
} }

View File

@@ -19,34 +19,40 @@
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void analogReference(uint8_t mode); void analogReference(uint8_t mode);
int16_t analogRead(uint8_t pin); int16_t analogRead(uint8_t pin);
int16_t adc_read(uint8_t mux); int16_t adc_read(uint8_t mux);
#ifdef __cplusplus
}
#endif
#define ADC_REF_POWER (1<<REFS0) #define ADC_REF_POWER (1 << REFS0)
#define ADC_REF_INTERNAL ((1<<REFS1) | (1<<REFS0)) #define ADC_REF_INTERNAL ((1 << REFS1) | (1 << REFS0))
#define ADC_REF_EXTERNAL (0) #define ADC_REF_EXTERNAL (0)
// These prescaler values are for high speed mode, ADHSM = 1 // These prescaler values are for high speed mode, ADHSM = 1
#if F_CPU == 16000000L #if F_CPU == 16000000L
#define ADC_PRESCALER ((1<<ADPS2) | (1<<ADPS1)) # define ADC_PRESCALER ((1 << ADPS2) | (1 << ADPS1))
#elif F_CPU == 8000000L #elif F_CPU == 8000000L
#define ADC_PRESCALER ((1<<ADPS2) | (1<<ADPS0)) # define ADC_PRESCALER ((1 << ADPS2) | (1 << ADPS0))
#elif F_CPU == 4000000L #elif F_CPU == 4000000L
#define ADC_PRESCALER ((1<<ADPS2)) # define ADC_PRESCALER ((1 << ADPS2))
#elif F_CPU == 2000000L #elif F_CPU == 2000000L
#define ADC_PRESCALER ((1<<ADPS1) | (1<<ADPS0)) # define ADC_PRESCALER ((1 << ADPS1) | (1 << ADPS0))
#elif F_CPU == 1000000L #elif F_CPU == 1000000L
#define ADC_PRESCALER ((1<<ADPS1)) # define ADC_PRESCALER ((1 << ADPS1))
#else #else
#define ADC_PRESCALER ((1<<ADPS0)) # define ADC_PRESCALER ((1 << ADPS0))
#endif #endif
// some avr-libc versions do not properly define ADHSM // some avr-libc versions do not properly define ADHSM
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#if !defined(ADHSM) # if !defined(ADHSM)
#define ADHSM (7) # define ADHSM (7)
#endif # endif
#endif #endif
#endif #endif

69
drivers/avr/apa102.c Executable file → Normal file
View File

@@ -1,24 +1,24 @@
/* /*
* APA102 lib V1.0a * APA102 lib V1.0a
* *
* Controls APA102 RGB-LEDs * Controls APA102 RGB-LEDs
* Author: Mikkel (Duckle29 on github) * Author: Mikkel (Duckle29 on github)
* *
* Dec 22th, 2017 v1.0a Initial Version * Dec 22th, 2017 v1.0a Initial Version
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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 "apa102.h" #include "apa102.h"
#include <avr/interrupt.h> #include <avr/interrupt.h>
@@ -27,39 +27,34 @@
#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);
pinMode(RGB_CLK_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 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(); apa102_start_frame();
while(leds--){ while (leds--) {
apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r); apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r);
data++; data++;
} }
apa102_end_frame(leds); apa102_end_frame(leds);
} }
void apa102_send_frame(uint32_t frame){ void apa102_send_frame(uint32_t frame) {
for(uint32_t i=0xFF; i>0;){ for (uint32_t i = 0xFF; i > 0;) {
apa102_send_byte(frame & i); apa102_send_byte(frame & i);
i = i << 8; i = i << 8;
} }
} }
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?
@@ -87,14 +82,14 @@ void apa102_end_frame(uint16_t leds)
// start displaying their new colors right away. // start displaying their new colors right away.
apa102_send_byte(0xFF); apa102_send_byte(0xFF);
for (uint16_t i = 0; i < 5 + leds / 16; i++){ for (uint16_t i = 0; i < 5 + leds / 16; i++) {
apa102_send_byte(0); apa102_send_byte(0);
} }
} }
void apa102_send_byte(uint8_t byte){ void apa102_send_byte(uint8_t byte) {
uint8_t i; uint8_t i;
for (i = 0; i < 8; i++){ for (i = 0; i < 8; i++) {
digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i))); digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i)));
digitalWrite(RGB_CLK_PIN, PinLevelHigh); digitalWrite(RGB_CLK_PIN, PinLevelHigh);
} }

5
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:
@@ -41,6 +40,6 @@
* - Wait 50<35>s to reset the LEDs * - Wait 50<35>s to reset the LEDs
*/ */
void apa102_setleds (LED_TYPE *ledarray, uint16_t number_of_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_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pinmask);
void apa102_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); void apa102_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);

View File

@@ -5,272 +5,30 @@
#define FONT5X7_H #define FONT5X7_H
#ifdef __AVR__ #ifdef __AVR__
#include <avr/io.h> # include <avr/io.h>
#include <avr/pgmspace.h> # include <avr/pgmspace.h>
#elif defined(ESP8266) #elif defined(ESP8266)
#include <pgmspace.h> # include <pgmspace.h>
#else #else
#define PROGMEM # define PROGMEM
#endif #endif
// 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

@@ -34,46 +34,45 @@
*/ */
#define DDR(x) (*(&x - 1)) /* address of data direction register of port x */ #define DDR(x) (*(&x - 1)) /* address of data direction register of port x */
#if defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) #if defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
/* on ATmega64/128 PINF is on port 0x00 and not 0x60 */ /* on ATmega64/128 PINF is on port 0x00 and not 0x60 */
#define PIN(x) ( &PORTF==&(x) ? _SFR_IO8(0x00) : (*(&x - 2)) ) # define PIN(x) (&PORTF == &(x) ? _SFR_IO8(0x00) : (*(&x - 2)))
#else #else
#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
#if LCD_IO_MODE
#define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
#define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
#define lcd_e_low() LCD_E_PORT &= ~_BV(LCD_E_PIN);
#define lcd_e_toggle() toggle_e()
#define lcd_rw_high() LCD_RW_PORT |= _BV(LCD_RW_PIN)
#define lcd_rw_low() LCD_RW_PORT &= ~_BV(LCD_RW_PIN)
#define lcd_rs_high() LCD_RS_PORT |= _BV(LCD_RS_PIN)
#define lcd_rs_low() LCD_RS_PORT &= ~_BV(LCD_RS_PIN)
#endif #endif
#if LCD_IO_MODE #if LCD_IO_MODE
#if LCD_LINES==1 # define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_1LINE # define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
#else # define lcd_e_low() LCD_E_PORT &= ~_BV(LCD_E_PIN);
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_2LINES # define lcd_e_toggle() toggle_e()
# define lcd_rw_high() LCD_RW_PORT |= _BV(LCD_RW_PIN)
# define lcd_rw_low() LCD_RW_PORT &= ~_BV(LCD_RW_PIN)
# define lcd_rs_high() LCD_RS_PORT |= _BV(LCD_RS_PIN)
# define lcd_rs_low() LCD_RS_PORT &= ~_BV(LCD_RS_PIN)
#endif #endif
#if LCD_IO_MODE
# if LCD_LINES == 1
# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_1LINE
# else
# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_2LINES
# endif
#else #else
#if LCD_LINES==1 # if LCD_LINES == 1
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_1LINE # define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_1LINE
#else # else
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_2LINES # define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_2LINES
#endif # endif
#endif #endif
#if LCD_CONTROLLER_KS0073 #if LCD_CONTROLLER_KS0073
#if LCD_LINES==4 # if LCD_LINES == 4
#define KS0073_EXTENDED_FUNCTION_REGISTER_ON 0x2C /* |0|010|1100 4-bit mode, extension-bit RE = 1 */ # define KS0073_EXTENDED_FUNCTION_REGISTER_ON 0x2C /* |0|010|1100 4-bit mode, extension-bit RE = 1 */
#define KS0073_EXTENDED_FUNCTION_REGISTER_OFF 0x28 /* |0|010|1000 4-bit mode, extension-bit RE = 0 */ # define KS0073_EXTENDED_FUNCTION_REGISTER_OFF 0x28 /* |0|010|1000 4-bit mode, extension-bit RE = 0 */
#define KS0073_4LINES_MODE 0x09 /* |0|000|1001 4 lines mode */ # define KS0073_4LINES_MODE 0x09 /* |0|000|1001 4 lines mode */
#endif # endif
#endif #endif
/* /*
@@ -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,10 +109,8 @@ 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();
@@ -126,26 +119,22 @@ 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;
/* output high nibble first */ /* output high nibble first */
dataBits = LCD_DATA0_PORT & 0xF0; dataBits = LCD_DATA0_PORT & 0xF0;
LCD_DATA0_PORT = dataBits |((data>>4)&0x0F); LCD_DATA0_PORT = dataBits | ((data >> 4) & 0x0F);
lcd_e_toggle(); lcd_e_toggle();
/* output low nibble */ /* output low nibble */
LCD_DATA0_PORT = dataBits | (data&0x0F); LCD_DATA0_PORT = dataBits | (data & 0x0F);
lcd_e_toggle(); lcd_e_toggle();
/* 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);
@@ -157,10 +146,10 @@ static void lcd_write(uint8_t data,uint8_t rs)
LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN); LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN);
LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN); LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN);
LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN); LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN);
if(data & 0x80) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN); if (data & 0x80) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
if(data & 0x40) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN); if (data & 0x40) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
if(data & 0x20) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN); if (data & 0x20) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
if(data & 0x10) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN); if (data & 0x10) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
lcd_e_toggle(); lcd_e_toggle();
/* output low nibble */ /* output low nibble */
@@ -168,10 +157,10 @@ static void lcd_write(uint8_t data,uint8_t rs)
LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN); LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN);
LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN); LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN);
LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN); LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN);
if(data & 0x08) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN); if (data & 0x08) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
if(data & 0x04) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN); if (data & 0x04) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
if(data & 0x02) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN); if (data & 0x02) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
if(data & 0x01) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN); if (data & 0x01) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
lcd_e_toggle(); lcd_e_toggle();
/* all data pins high (inactive) */ /* all data pins high (inactive) */
@@ -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();
@@ -220,11 +208,9 @@ static uint8_t lcd_read(uint8_t rs)
lcd_e_high(); lcd_e_high();
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);
@@ -235,10 +221,10 @@ static uint8_t lcd_read(uint8_t rs)
lcd_e_high(); lcd_e_high();
lcd_e_delay(); lcd_e_delay();
data = 0; data = 0;
if ( PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN) ) data |= 0x10; if (PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN)) data |= 0x10;
if ( PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN) ) data |= 0x20; if (PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN)) data |= 0x20;
if ( PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN) ) data |= 0x40; if (PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN)) data |= 0x40;
if ( PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN) ) data |= 0x80; if (PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN)) data |= 0x80;
lcd_e_low(); lcd_e_low();
lcd_e_delay(); /* Enable 500ns low */ lcd_e_delay(); /* Enable 500ns low */
@@ -246,21 +232,20 @@ static uint8_t lcd_read(uint8_t rs)
/* read low nibble */ /* read low nibble */
lcd_e_high(); lcd_e_high();
lcd_e_delay(); lcd_e_delay();
if ( PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN) ) data |= 0x01; if (PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN)) data |= 0x01;
if ( PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN) ) data |= 0x02; if (PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN)) data |= 0x02;
if ( PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN) ) data |= 0x04; if (PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN)) data |= 0x04;
if ( PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN) ) data |= 0x08; if (PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN)) data |= 0x08;
lcd_e_low(); lcd_e_low();
} }
return data; return data;
} }
#else #else
#define lcd_read(rs) (rs) ? *(volatile uint8_t*)(LCD_IO_DATA+LCD_IO_READ) : *(volatile uint8_t*)(LCD_IO_FUNCTION+LCD_IO_READ) # define lcd_read(rs) (rs) ? *(volatile uint8_t *)(LCD_IO_DATA + LCD_IO_READ) : *(volatile uint8_t *)(LCD_IO_FUNCTION + LCD_IO_READ)
/* rs==0 -> read instruction from LCD_IO_FUNCTION */ /* rs==0 -> read instruction from LCD_IO_FUNCTION */
/* 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);
@@ -278,52 +264,48 @@ static uint8_t lcd_waitbusy(void)
/* now read the address counter */ /* now read the address counter */
return (lcd_read(0)); // return address counter return (lcd_read(0)); // return address counter
}/* 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
#if LCD_LINES==2 #if LCD_LINES == 2
if ( pos < (LCD_START_LINE2) ) if (pos < (LCD_START_LINE2))
addressCounter = LCD_START_LINE2; addressCounter = LCD_START_LINE2;
else else
addressCounter = LCD_START_LINE1; addressCounter = LCD_START_LINE1;
#endif #endif
#if LCD_LINES==4 #if LCD_LINES == 4
#if KS0073_4LINES_MODE # if KS0073_4LINES_MODE
if ( pos < LCD_START_LINE2 ) if (pos < LCD_START_LINE2)
addressCounter = LCD_START_LINE2; addressCounter = LCD_START_LINE2;
else if ( (pos >= LCD_START_LINE2) && (pos < LCD_START_LINE3) ) else if ((pos >= LCD_START_LINE2) && (pos < LCD_START_LINE3))
addressCounter = LCD_START_LINE3; addressCounter = LCD_START_LINE3;
else if ( (pos >= LCD_START_LINE3) && (pos < LCD_START_LINE4) ) else if ((pos >= LCD_START_LINE3) && (pos < LCD_START_LINE4))
addressCounter = LCD_START_LINE4; addressCounter = LCD_START_LINE4;
else else
addressCounter = LCD_START_LINE1; addressCounter = LCD_START_LINE1;
#else # else
if ( pos < LCD_START_LINE3 ) if (pos < LCD_START_LINE3)
addressCounter = LCD_START_LINE2; addressCounter = LCD_START_LINE2;
else if ( (pos >= LCD_START_LINE2) && (pos < LCD_START_LINE4) ) else if ((pos >= LCD_START_LINE2) && (pos < LCD_START_LINE4))
addressCounter = LCD_START_LINE3; addressCounter = LCD_START_LINE3;
else if ( (pos >= LCD_START_LINE3) && (pos < LCD_START_LINE2) ) else if ((pos >= LCD_START_LINE3) && (pos < LCD_START_LINE2))
addressCounter = LCD_START_LINE4; addressCounter = LCD_START_LINE4;
else else
addressCounter = LCD_START_LINE1; addressCounter = LCD_START_LINE1;
# endif
#endif #endif
#endif lcd_command((1 << LCD_DDRAM) + addressCounter);
lcd_command((1<<LCD_DDRAM)+addressCounter);
}/* lcd_newline */
} /* lcd_newline */
/* /*
** PUBLIC FUNCTIONS ** PUBLIC FUNCTIONS
@@ -334,129 +316,104 @@ 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
#if LCD_LINES==2 #if LCD_LINES == 2
if ( y==0 ) if (y == 0)
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE1+x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x);
else else
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE2+x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE2 + x);
#endif #endif
#if LCD_LINES==4 #if LCD_LINES == 4
if ( y==0 ) if (y == 0)
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE1+x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x);
else if ( y==1) else if (y == 1)
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE2+x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE2 + x);
else if ( y==2) else if (y == 2)
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE3+x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE3 + x);
else /* y==3 */ else /* y==3 */
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE4+x); lcd_command((1 << LCD_DDRAM) + LCD_START_LINE4 + x);
#endif #endif
}/* 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 {
#if LCD_WRAP_LINES == 1
# if LCD_LINES == 1
if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
lcd_write((1 << LCD_DDRAM) + LCD_START_LINE1, 0);
} }
else # elif LCD_LINES == 2
{ if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
#if LCD_WRAP_LINES==1 lcd_write((1 << LCD_DDRAM) + LCD_START_LINE2, 0);
#if LCD_LINES==1 } else if (pos == LCD_START_LINE2 + LCD_DISP_LENGTH) {
if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) { lcd_write((1 << LCD_DDRAM) + LCD_START_LINE1, 0);
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
} }
#elif LCD_LINES==2 # elif LCD_LINES == 4
if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) { if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE2,0); lcd_write((1 << LCD_DDRAM) + LCD_START_LINE2, 0);
}else if ( pos == LCD_START_LINE2+LCD_DISP_LENGTH ){ } else if (pos == LCD_START_LINE2 + LCD_DISP_LENGTH) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0); lcd_write((1 << LCD_DDRAM) + LCD_START_LINE3, 0);
} else if (pos == LCD_START_LINE3 + LCD_DISP_LENGTH) {
lcd_write((1 << LCD_DDRAM) + LCD_START_LINE4, 0);
} else if (pos == LCD_START_LINE4 + LCD_DISP_LENGTH) {
lcd_write((1 << LCD_DDRAM) + LCD_START_LINE1, 0);
} }
#elif LCD_LINES==4 # endif
if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE2,0);
}else if ( pos == LCD_START_LINE2+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE3,0);
}else if ( pos == LCD_START_LINE3+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE4,0);
}else if ( pos == LCD_START_LINE4+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
}
#endif
lcd_waitbusy(); lcd_waitbusy();
#endif #endif
lcd_write(c, 1); lcd_write(c, 1);
} }
}/* lcd_putc */ } /* lcd_putc */
/************************************************************************* /*************************************************************************
Display string without auto linefeed Display string without auto linefeed
@@ -468,12 +425,11 @@ void lcd_puts(const char *s)
{ {
register char c; register char c;
while ( (c = *s++) ) { while ((c = *s++)) {
lcd_putc(c); lcd_putc(c);
} }
}/* lcd_puts */ } /* lcd_puts */
/************************************************************************* /*************************************************************************
Display string from program memory without auto linefeed Display string from program memory without auto linefeed
@@ -485,12 +441,11 @@ void lcd_puts_p(const char *progmem_s)
{ {
register char c; register char c;
while ( (c = pgm_read_byte(progmem_s++)) ) { while ((c = pgm_read_byte(progmem_s++))) {
lcd_putc(c); lcd_putc(c);
} }
}/* lcd_puts_p */ } /* lcd_puts_p */
/************************************************************************* /*************************************************************************
Initialize display and select type of cursor Initialize display and select type of cursor
@@ -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);
@@ -567,11 +512,11 @@ void lcd_init(uint8_t dispAttr)
/* reset LCD */ /* reset LCD */
delay(LCD_DELAY_BOOTUP); /* wait 16ms after power-on */ delay(LCD_DELAY_BOOTUP); /* wait 16ms after power-on */
lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit interface */ lcd_write(LCD_FUNCTION_8BIT_1LINE, 0); /* function set: 8bit interface */
delay(LCD_DELAY_INIT); /* wait 5ms */ delay(LCD_DELAY_INIT); /* wait 5ms */
lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit interface */ lcd_write(LCD_FUNCTION_8BIT_1LINE, 0); /* function set: 8bit interface */
delay(LCD_DELAY_INIT_REP); /* wait 64us */ delay(LCD_DELAY_INIT_REP); /* wait 64us */
lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit interface */ lcd_write(LCD_FUNCTION_8BIT_1LINE, 0); /* function set: 8bit interface */
delay(LCD_DELAY_INIT_REP); /* wait 64us */ delay(LCD_DELAY_INIT_REP); /* wait 64us */
#endif #endif
@@ -588,5 +533,4 @@ void lcd_init(uint8_t dispAttr)
lcd_command(LCD_MODE_DEFAULT); /* set entry mode */ lcd_command(LCD_MODE_DEFAULT); /* set entry mode */
lcd_command(dispAttr); /* display/cursor control */ lcd_command(dispAttr); /* display/cursor control */
}/* lcd_init */ } /* lcd_init */

View File

@@ -47,10 +47,9 @@
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 405 #if (__GNUC__ * 100 + __GNUC_MINOR__) < 405
#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
/**@{*/ /**@{*/
/* /*
@@ -59,16 +58,15 @@
* All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
*/ */
#ifdef _LCD_DEFINITIONS_FILE #ifdef _LCD_DEFINITIONS_FILE
#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.
*/ */
#ifndef LCD_CONTROLLER_KS0073 #ifndef LCD_CONTROLLER_KS0073
#define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */ # define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */
#endif #endif
/** /**
@@ -81,31 +79,30 @@
* *
*/ */
#ifndef LCD_LINES #ifndef LCD_LINES
#define LCD_LINES 2 /**< number of visible lines of the display */ # define LCD_LINES 2 /**< number of visible lines of the display */
#endif #endif
#ifndef LCD_DISP_LENGTH #ifndef LCD_DISP_LENGTH
#define LCD_DISP_LENGTH 16 /**< visibles characters per line of the display */ # define LCD_DISP_LENGTH 16 /**< visibles characters per line of the display */
#endif #endif
#ifndef LCD_LINE_LENGTH #ifndef LCD_LINE_LENGTH
#define LCD_LINE_LENGTH 0x40 /**< internal line length of the display */ # define LCD_LINE_LENGTH 0x40 /**< internal line length of the display */
#endif #endif
#ifndef LCD_START_LINE1 #ifndef LCD_START_LINE1
#define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */ # define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */
#endif #endif
#ifndef LCD_START_LINE2 #ifndef LCD_START_LINE2
#define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */ # define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */
#endif #endif
#ifndef LCD_START_LINE3 #ifndef LCD_START_LINE3
#define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */ # define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */
#endif #endif
#ifndef LCD_START_LINE4 #ifndef LCD_START_LINE4
#define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */ # define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */
#endif #endif
#ifndef LCD_WRAP_LINES #ifndef LCD_WRAP_LINES
#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
* *
@@ -128,68 +125,65 @@
#if LCD_IO_MODE #if LCD_IO_MODE
#ifndef LCD_PORT # ifndef LCD_PORT
#define LCD_PORT PORTA /**< port for the LCD lines */ # define LCD_PORT PORTA /**< port for the LCD lines */
#endif # endif
#ifndef LCD_DATA0_PORT # ifndef LCD_DATA0_PORT
#define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */ # define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */
#endif # endif
#ifndef LCD_DATA1_PORT # ifndef LCD_DATA1_PORT
#define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */ # define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */
#endif # endif
#ifndef LCD_DATA2_PORT # ifndef LCD_DATA2_PORT
#define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */ # define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */
#endif # endif
#ifndef LCD_DATA3_PORT # ifndef LCD_DATA3_PORT
#define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */ # define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */
#endif # endif
#ifndef LCD_DATA0_PIN # ifndef LCD_DATA0_PIN
#define LCD_DATA0_PIN 4 /**< pin for 4bit data bit 0 */ # define LCD_DATA0_PIN 4 /**< pin for 4bit data bit 0 */
#endif # endif
#ifndef LCD_DATA1_PIN # ifndef LCD_DATA1_PIN
#define LCD_DATA1_PIN 5 /**< pin for 4bit data bit 1 */ # define LCD_DATA1_PIN 5 /**< pin for 4bit data bit 1 */
#endif # endif
#ifndef LCD_DATA2_PIN # ifndef LCD_DATA2_PIN
#define LCD_DATA2_PIN 6 /**< pin for 4bit data bit 2 */ # define LCD_DATA2_PIN 6 /**< pin for 4bit data bit 2 */
#endif # endif
#ifndef LCD_DATA3_PIN # ifndef LCD_DATA3_PIN
#define LCD_DATA3_PIN 7 /**< pin for 4bit data bit 3 */ # define LCD_DATA3_PIN 7 /**< pin for 4bit data bit 3 */
#endif # endif
#ifndef LCD_RS_PORT # ifndef LCD_RS_PORT
#define LCD_RS_PORT LCD_PORT /**< port for RS line */ # define LCD_RS_PORT LCD_PORT /**< port for RS line */
#endif # endif
#ifndef LCD_RS_PIN # ifndef LCD_RS_PIN
#define LCD_RS_PIN 3 /**< pin for RS line */ # define LCD_RS_PIN 3 /**< pin for RS line */
#endif # endif
#ifndef LCD_RW_PORT # ifndef LCD_RW_PORT
#define LCD_RW_PORT LCD_PORT /**< port for RW line */ # define LCD_RW_PORT LCD_PORT /**< port for RW line */
#endif # endif
#ifndef LCD_RW_PIN # ifndef LCD_RW_PIN
#define LCD_RW_PIN 2 /**< pin for RW line */ # define LCD_RW_PIN 2 /**< pin for RW line */
#endif # endif
#ifndef LCD_E_PORT # ifndef LCD_E_PORT
#define LCD_E_PORT LCD_PORT /**< port for Enable line */ # define LCD_E_PORT LCD_PORT /**< port for Enable line */
#endif # endif
#ifndef LCD_E_PIN # ifndef LCD_E_PIN
#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
*/ */
#define LCD_IO_DATA 0xC000 /* A15=E=1, A14=RS=1 */ # define LCD_IO_DATA 0xC000 /* A15=E=1, A14=RS=1 */
#define LCD_IO_FUNCTION 0x8000 /* A15=E=1, A14=RS=0 */ # define LCD_IO_FUNCTION 0x8000 /* A15=E=1, A14=RS=0 */
#define LCD_IO_READ 0x0100 /* A8 =R/W=1 (R/W: 1=Read, 0=Write */ # define LCD_IO_READ 0x0100 /* A8 =R/W=1 (R/W: 1=Read, 0=Write */
#else #else
#error "external data memory interface not available for this device, use 4-bit IO port mode" # error "external data memory interface not available for this device, use 4-bit IO port mode"
#endif #endif
/** /**
* @name Definitions of delays * @name Definitions of delays
* Used to calculate delay timers. * Used to calculate delay timers.
@@ -201,25 +195,24 @@
* All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
*/ */
#ifndef LCD_DELAY_BOOTUP #ifndef LCD_DELAY_BOOTUP
#define LCD_DELAY_BOOTUP 16000 /**< delay in micro seconds after power-on */ # define LCD_DELAY_BOOTUP 16000 /**< delay in micro seconds after power-on */
#endif #endif
#ifndef LCD_DELAY_INIT #ifndef LCD_DELAY_INIT
#define LCD_DELAY_INIT 5000 /**< delay in micro seconds after initialization command sent */ # define LCD_DELAY_INIT 5000 /**< delay in micro seconds after initialization command sent */
#endif #endif
#ifndef LCD_DELAY_INIT_REP #ifndef LCD_DELAY_INIT_REP
#define LCD_DELAY_INIT_REP 64 /**< delay in micro seconds after initialization command repeated */ # define LCD_DELAY_INIT_REP 64 /**< delay in micro seconds after initialization command repeated */
#endif #endif
#ifndef LCD_DELAY_INIT_4BIT #ifndef LCD_DELAY_INIT_4BIT
#define LCD_DELAY_INIT_4BIT 64 /**< delay in micro seconds after setting 4-bit mode */ # define LCD_DELAY_INIT_4BIT 64 /**< delay in micro seconds after setting 4-bit mode */
#endif #endif
#ifndef LCD_DELAY_BUSY_FLAG #ifndef LCD_DELAY_BUSY_FLAG
#define LCD_DELAY_BUSY_FLAG 4 /**< time in micro seconds the address counter is updated after busy flag is cleared */ # define LCD_DELAY_BUSY_FLAG 4 /**< time in micro seconds the address counter is updated after busy flag is cleared */
#endif #endif
#ifndef LCD_DELAY_ENABLE_PULSE #ifndef LCD_DELAY_ENABLE_PULSE
#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
*/ */
@@ -367,5 +347,4 @@ extern void lcd_data(uint8_t data);
/**@}*/ /**@}*/
#endif //LCD_H #endif // LCD_H

8
drivers/avr/i2c_master.c Executable file → Normal file
View File

@@ -27,14 +27,14 @@
#ifndef F_SCL #ifndef F_SCL
# define F_SCL 400000UL // SCL frequency # define F_SCL 400000UL // SCL frequency
#endif #endif
#define Prescaler 1
#define TWBR_val ((((F_CPU / F_SCL) / Prescaler) - 16) / 2) #define TWBR_val (((F_CPU / F_SCL) - 16) / 2)
void i2c_init(void) { void i2c_init(void) {
TWSR = 0; /* no prescaler */ TWSR = 0; /* no prescaler */
TWBR = (uint8_t)TWBR_val; TWBR = (uint8_t)TWBR_val;
#ifdef __AVR_ATmega32A__ #ifdef __AVR_ATmega32A__
// set pull-up resistors on I2C bus pins // set pull-up resistors on I2C bus pins
PORTC |= 0b11; PORTC |= 0b11;
@@ -44,7 +44,7 @@ void i2c_init(void) {
// enable TWI interrupt and slave address ACK // enable TWI interrupt and slave address ACK
TWCR |= (1 << TWIE); TWCR |= (1 << TWIE);
TWCR |= (1 << TWEA); TWCR |= (1 << TWEA);
#endif #endif
} }
i2c_status_t i2c_start(uint8_t address, uint16_t timeout) { i2c_status_t i2c_start(uint8_t address, uint16_t timeout) {

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

10
drivers/avr/i2c_slave.c Executable file → Normal file
View File

@@ -29,22 +29,22 @@ volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
static volatile uint8_t buffer_address; static volatile uint8_t buffer_address;
static volatile bool slave_has_register_set = false; static volatile bool slave_has_register_set = false;
void i2c_slave_init(uint8_t address){ void i2c_slave_init(uint8_t address) {
// load address into TWI address register // load address into TWI address register
TWAR = address; TWAR = address;
// set the TWCR to enable address matching and enable TWI, clear TWINT, enable TWI interrupt // set the TWCR to enable address matching and enable TWI, clear TWINT, enable TWI interrupt
TWCR = (1 << TWIE) | (1 << TWEA) | (1 << TWINT) | (1 << TWEN); TWCR = (1 << TWIE) | (1 << TWEA) | (1 << TWINT) | (1 << TWEN);
} }
void i2c_slave_stop(void){ void i2c_slave_stop(void) {
// clear acknowledge and enable bits // clear acknowledge and enable bits
TWCR &= ~((1 << TWEA) | (1 << TWEN)); TWCR &= ~((1 << TWEA) | (1 << TWEN));
} }
ISR(TWI_vect){ ISR(TWI_vect) {
uint8_t ack = 1; uint8_t ack = 1;
switch(TW_STATUS){ switch (TW_STATUS) {
case TW_SR_SLA_ACK: case TW_SR_SLA_ACK:
// The device is now a slave receiver // The device is now a slave receiver
slave_has_register_set = false; slave_has_register_set = false;
@@ -53,7 +53,7 @@ ISR(TWI_vect){
case TW_SR_DATA_ACK: case TW_SR_DATA_ACK:
// This device is a slave receiver and has received data // This device is a slave receiver and has received data
// First byte is the location then the bytes will be writen in buffer with auto-incriment // First byte is the location then the bytes will be writen in buffer with auto-incriment
if(!slave_has_register_set){ if (!slave_has_register_set) {
buffer_address = TWDR; buffer_address = TWDR;
if (buffer_address >= I2C_SLAVE_REG_COUNT) { // address out of bounds dont ack if (buffer_address >= I2C_SLAVE_REG_COUNT) { // address out of bounds dont ack

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

View File

@@ -93,11 +93,11 @@
#define NUM_DIGITAL_PINS 30 #define NUM_DIGITAL_PINS 30
#define NUM_ANALOG_INPUTS 12 #define NUM_ANALOG_INPUTS 12
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) #define TX_RX_LED_INIT DDRD |= (1 << 5), DDRB |= (1 << 0)
#define TXLED0 PORTD |= (1<<5) #define TXLED0 PORTD |= (1 << 5)
#define TXLED1 PORTD &= ~(1<<5) #define TXLED1 PORTD &= ~(1 << 5)
#define RXLED0 PORTB |= (1<<0) #define RXLED0 PORTB |= (1 << 0)
#define RXLED1 PORTB &= ~(1<<0) #define RXLED1 PORTB &= ~(1 << 0)
static const uint8_t SDA = 2; static const uint8_t SDA = 2;
static const uint8_t SCL = 3; static const uint8_t SCL = 3;
@@ -127,11 +127,11 @@ static const uint8_t ADC11 = 29; // D12
#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) 0 #define digitalPinToPCICRbit(p) 0
#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) #define digitalPinToPCMSKbit(p) (((p) >= 8 && (p) <= 11) ? (p)-4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels // __AVR_ATmega32U4__ has an unusual mapping of pins to channels
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) #define analogPinToChannel(P) (pgm_read_byte(analog_pin_to_channel_PGM + (P)))
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
@@ -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

@@ -1,32 +1,32 @@
#ifdef SSD1306OLED #ifdef SSD1306OLED
#include "ssd1306.h" # include "ssd1306.h"
#include "i2c.h" # include "i2c.h"
#include <string.h> # include <string.h>
#include "print.h" # include "print.h"
#include "glcdfont.c" # include "glcdfont.c"
#ifdef ADAFRUIT_BLE_ENABLE # ifdef ADAFRUIT_BLE_ENABLE
#include "adafruit_ble.h" # include "adafruit_ble.h"
#endif # endif
#ifdef PROTOCOL_LUFA # ifdef PROTOCOL_LUFA
#include "lufa.h" # include "lufa.h"
#endif # endif
#include "sendchar.h" # include "sendchar.h"
#include "timer.h" # include "timer.h"
// Set this to 1 to help diagnose early startup problems // Set this to 1 to help diagnose early startup problems
// when testing power-on with ble. Turn it off otherwise, // when testing power-on with ble. Turn it off otherwise,
// as the latency of printing most of the debug info messes // as the latency of printing most of the debug info messes
// with the matrix scan, causing keys to drop. // with the matrix scan, causing keys to drop.
#define DEBUG_TO_SCREEN 0 # define DEBUG_TO_SCREEN 0
//static uint16_t last_battery_update; // static uint16_t last_battery_update;
//static uint32_t vbat; // static uint32_t vbat;
//#define BatteryUpdateInterval 10000 /* milliseconds */ //#define BatteryUpdateInterval 10000 /* milliseconds */
#define ScreenOffInterval 300000 /* milliseconds */ # define ScreenOffInterval 300000 /* milliseconds */
#if DEBUG_TO_SCREEN # if DEBUG_TO_SCREEN
static uint8_t displaying; static uint8_t displaying;
#endif # endif
static uint16_t last_flush; static uint16_t last_flush;
// Write command sequence. // Write command sequence.
@@ -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);
@@ -107,8 +116,8 @@ done:
i2c_master_stop(); i2c_master_stop();
} }
#if DEBUG_TO_SCREEN # if DEBUG_TO_SCREEN
#undef sendchar # undef sendchar
static int8_t capture_sendchar(uint8_t c) { static int8_t capture_sendchar(uint8_t c) {
sendchar(c); sendchar(c);
iota_gfx_write_char(c); iota_gfx_write_char(c);
@@ -118,7 +127,7 @@ static int8_t capture_sendchar(uint8_t c) {
} }
return 0; return 0;
} }
#endif # endif
bool iota_gfx_init(void) { bool iota_gfx_init(void) {
bool success = false; bool success = false;
@@ -129,21 +138,20 @@ 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 */);
#ifdef OLED_ROTATE180 # ifdef OLED_ROTATE180
// the following Flip the display orientation 180 degrees // the following Flip the display orientation 180 degrees
send_cmd1(SegRemap); send_cmd1(SegRemap);
send_cmd1(ComScanInc); send_cmd1(ComScanInc);
#endif # endif
#ifndef OLED_ROTATE180 # ifndef OLED_ROTATE180
// Flips the display orientation 0 degrees // Flips the display orientation 0 degrees
send_cmd1(SegRemap | 0x1); send_cmd1(SegRemap | 0x1);
send_cmd1(ComScanDec); send_cmd1(ComScanDec);
#endif # endif
send_cmd2(SetComPins, 0x2); send_cmd2(SetComPins, 0x2);
send_cmd2(SetContrast, 0x8f); send_cmd2(SetContrast, 0x8f);
@@ -162,9 +170,9 @@ bool iota_gfx_init(void) {
iota_gfx_flush(); iota_gfx_flush();
#if DEBUG_TO_SCREEN # if DEBUG_TO_SCREEN
print_set_sendchar(capture_sendchar); print_set_sendchar(capture_sendchar);
#endif # endif
done: done:
return success; return success;
@@ -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,16 +258,14 @@ 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();
iota_gfx_on(); iota_gfx_on();
#if DEBUG_TO_SCREEN # if DEBUG_TO_SCREEN
++displaying; ++displaying;
#endif # endif
// Move to the home position // Move to the home position
send_cmd3(PageAddr, 0, MatrixRows - 1); send_cmd3(PageAddr, 0, MatrixRows - 1);
@@ -298,18 +297,14 @@ void matrix_render(struct CharacterMatrix *matrix) {
done: done:
i2c_master_stop(); i2c_master_stop();
#if DEBUG_TO_SCREEN # if DEBUG_TO_SCREEN
--displaying; --displaying;
#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

@@ -49,7 +49,7 @@ enum ssd1306_cmds {
// Controls the SSD1306 128x32 OLED display via i2c // Controls the SSD1306 128x32 OLED display via i2c
#ifndef SSD1306_ADDRESS #ifndef SSD1306_ADDRESS
#define SSD1306_ADDRESS 0x3C # define SSD1306_ADDRESS 0x3C
#endif #endif
#define DisplayHeight 32 #define DisplayHeight 32
@@ -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

@@ -1,25 +1,25 @@
/* /*
* light weight WS2812 lib V2.0b * light weight WS2812 lib V2.0b
* *
* Controls WS2811/WS2812/WS2812B RGB-LEDs * Controls WS2811/WS2812/WS2812B RGB-LEDs
* Author: Tim (cpldcpu@gmail.com) * Author: Tim (cpldcpu@gmail.com)
* *
* Jan 18th, 2014 v2.0b Initial Version * Jan 18th, 2014 v2.0b Initial Version
* Nov 29th, 2015 v2.3 Added SK6812RGBW support * Nov 29th, 2015 v2.3 Added SK6812RGBW support
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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 "ws2812.h" #include "ws2812.h"
#include <avr/interrupt.h> #include <avr/interrupt.h>
@@ -30,44 +30,40 @@
#if !defined(LED_ARRAY) && defined(RGB_MATRIX_ENABLE) #if !defined(LED_ARRAY) && defined(RGB_MATRIX_ENABLE)
// LED color buffer // LED color buffer
LED_TYPE led[DRIVER_LED_TOTAL]; LED_TYPE led[DRIVER_LED_TOTAL];
#define LED_ARRAY led # define LED_ARRAY led
#endif #endif
#ifdef RGBW_BB_TWI #ifdef RGBW_BB_TWI
// Port for the I2C // Port for the I2C
#define I2C_DDR DDRD # define I2C_DDR DDRD
#define I2C_PIN PIND # define I2C_PIN PIND
#define I2C_PORT PORTD # define I2C_PORT PORTD
// Pins to be used in the bit banging // Pins to be used in the bit banging
#define I2C_CLK 0 # define I2C_CLK 0
#define I2C_DAT 1 # define I2C_DAT 1
#define I2C_DATA_HI()\ # define I2C_DATA_HI() \
I2C_DDR &= ~ (1 << I2C_DAT);\ I2C_DDR &= ~(1 << I2C_DAT); \
I2C_PORT |= (1 << I2C_DAT); I2C_PORT |= (1 << I2C_DAT);
#define I2C_DATA_LO()\ # define I2C_DATA_LO() \
I2C_DDR |= (1 << I2C_DAT);\ I2C_DDR |= (1 << I2C_DAT); \
I2C_PORT &= ~ (1 << I2C_DAT); I2C_PORT &= ~(1 << I2C_DAT);
#define I2C_CLOCK_HI()\ # define I2C_CLOCK_HI() \
I2C_DDR &= ~ (1 << I2C_CLK);\ I2C_DDR &= ~(1 << I2C_CLK); \
I2C_PORT |= (1 << I2C_CLK); I2C_PORT |= (1 << I2C_CLK);
#define I2C_CLOCK_LO()\ # define I2C_CLOCK_LO() \
I2C_DDR |= (1 << I2C_CLK);\ I2C_DDR |= (1 << I2C_CLK); \
I2C_PORT &= ~ (1 << I2C_CLK); 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,9 +82,8 @@ 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();
I2C_DATA_HI(); I2C_DATA_HI();
@@ -99,10 +93,9 @@ 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);
I2C_DATA_LO(); I2C_DATA_LO();
@@ -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,40 +117,34 @@ 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);
// _delay_us(I2C_DELAY); // _delay_us(I2C_DELAY);
//return I2C_ReadBit(); // return I2C_ReadBit();
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;
led[i].b = b; led[i].b = b;
@@ -167,64 +153,55 @@ 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;
ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask); ws2812_sendarray_mask((uint8_t *)ledarray, leds + leds + leds, pinmask);
_delay_us(50); _delay_us(50);
} }
// 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;
twcr_prev=TWCR; twcr_prev = TWCR;
cli(); cli();
TWCR &= ~(1<<TWEN); TWCR &= ~(1 << TWEN);
I2C_Init(); I2C_Init();
I2C_Start(); I2C_Start();
I2C_Write(0x84); I2C_Write(0x84);
uint16_t datlen = leds<<2; uint16_t datlen = leds << 2;
uint8_t curbyte; uint8_t curbyte;
uint8_t * data = (uint8_t*)ledarray; uint8_t *data = (uint8_t *)ledarray;
while (datlen--) { while (datlen--) {
curbyte=*data++; curbyte = *data++;
I2C_Write(curbyte); I2C_Write(curbyte);
} }
I2C_Stop(); I2C_Stop();
SREG=sreg_prev; SREG = sreg_prev;
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
@@ -242,43 +219,43 @@ void ws2812_sendarray(uint8_t *data,uint16_t datlen)
#define w_fixedtotal 8 #define w_fixedtotal 8
// Insert NOPs to match the timing, if possible // Insert NOPs to match the timing, if possible
#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000) #define w_zerocycles (((F_CPU / 1000) * w_zeropulse) / 1000000)
#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000) #define w_onecycles (((F_CPU / 1000) * w_onepulse + 500000) / 1000000)
#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000) #define w_totalcycles (((F_CPU / 1000) * w_totalperiod + 500000) / 1000000)
// w1 - nops between rising edge and falling edge - low // w1 - nops between rising edge and falling edge - low
#define w1 (w_zerocycles-w_fixedlow) #define w1 (w_zerocycles - w_fixedlow)
// w2 nops between fe low and fe high // w2 nops between fe low and fe high
#define w2 (w_onecycles-w_fixedhigh-w1) #define w2 (w_onecycles - w_fixedhigh - w1)
// w3 nops to complete loop // w3 nops to complete loop
#define w3 (w_totalcycles-w_fixedtotal-w1-w2) #define w3 (w_totalcycles - w_fixedtotal - w1 - w2)
#if w1>0 #if w1 > 0
#define w1_nops w1 # define w1_nops w1
#else #else
#define w1_nops 0 # define w1_nops 0
#endif #endif
// The only critical timing parameter is the minimum pulse length of the "0" // The only critical timing parameter is the minimum pulse length of the "0"
// Warn or throw error if this timing can not be met with current F_CPU settings. // Warn or throw error if this timing can not be met with current F_CPU settings.
#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000) #define w_lowtime ((w1_nops + w_fixedlow) * 1000000) / (F_CPU / 1000)
#if w_lowtime>550 #if w_lowtime > 550
#error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?" # error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?"
#elif w_lowtime>450 #elif w_lowtime > 450
#warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)." # warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)."
#warning "Please consider a higher clockspeed, if possible" # warning "Please consider a higher clockspeed, if possible"
#endif #endif
#if w2>0 #if w2 > 0
#define w2_nops w2 # define w2_nops w2
#else #else
#define w2_nops 0 # define w2_nops 0
#endif #endif
#if w3>0 #if w3 > 0
#define w3_nops w3 # define w3_nops w3
#else #else
#define w3_nops 0 # define w3_nops 0
#endif #endif
#define w_nop1 "nop \n\t" #define w_nop1 "nop \n\t"
@@ -287,81 +264,78 @@ 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;
// masklo =~maskhi&ws2812_PORTREG; // masklo =~maskhi&ws2812_PORTREG;
// maskhi |= ws2812_PORTREG; // maskhi |= ws2812_PORTREG;
masklo =~maskhi&_SFR_IO8((RGB_DI_PIN >> 4) + 2); masklo = ~maskhi & _SFR_IO8((RGB_DI_PIN >> 4) + 2);
maskhi |= _SFR_IO8((RGB_DI_PIN >> 4) + 2); maskhi |= _SFR_IO8((RGB_DI_PIN >> 4) + 2);
sreg_prev=SREG; sreg_prev = SREG;
cli(); cli();
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)
w_nop1 w_nop1
#endif #endif
#if (w1_nops&2) #if (w1_nops & 2)
w_nop2 w_nop2
#endif #endif
#if (w1_nops&4) #if (w1_nops & 4)
w_nop4 w_nop4
#endif #endif
#if (w1_nops&8) #if (w1_nops & 8)
w_nop8 w_nop8
#endif #endif
#if (w1_nops&16) #if (w1_nops & 16)
w_nop16 w_nop16
#endif #endif
" sbrs %1,7 \n\t" // '1' [03] '0' [02] " sbrs %1,7 \n\t" // '1' [03] '0' [02]
" out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low
" lsl %1 \n\t" // '1' [04] '0' [04] " lsl %1 \n\t" // '1' [04] '0' [04]
#if (w2_nops&1) #if (w2_nops & 1)
w_nop1 w_nop1
#endif #endif
#if (w2_nops&2) #if (w2_nops & 2)
w_nop2 w_nop2
#endif #endif
#if (w2_nops&4) #if (w2_nops & 4)
w_nop4 w_nop4
#endif #endif
#if (w2_nops&8) #if (w2_nops & 8)
w_nop8 w_nop8
#endif #endif
#if (w2_nops&16) #if (w2_nops & 16)
w_nop16 w_nop16
#endif #endif
" out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high
#if (w3_nops&1) #if (w3_nops & 1)
w_nop1 w_nop1
#endif #endif
#if (w3_nops&2) #if (w3_nops & 2)
w_nop2 w_nop2
#endif #endif
#if (w3_nops&4) #if (w3_nops & 4)
w_nop4 w_nop4
#endif #endif
#if (w3_nops&8) #if (w3_nops & 8)
w_nop8 w_nop8
#endif #endif
#if (w3_nops&16) #if (w3_nops & 16)
w_nop16 w_nop16
#endif #endif
" 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

@@ -43,12 +43,12 @@
* - Wait 50<35>s to reset the LEDs * - Wait 50<35>s to reset the LEDs
*/ */
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
void ws2812_setled (int index, uint8_t r, uint8_t g, uint8_t b); void ws2812_setled(int index, uint8_t r, uint8_t g, uint8_t 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);
#endif #endif
void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds); void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask); void ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pinmask);
void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
/* /*
@@ -58,18 +58,17 @@ void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
* The length is the number of bytes to send - three per LED. * The length is the number of bytes to send - three per LED.
*/ */
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
*/ */
#ifndef CONCAT #ifndef CONCAT
#define CONCAT(a, b) a ## b # define CONCAT(a, b) a##b
#endif #endif
#ifndef CONCAT_EXP #ifndef CONCAT_EXP
#define CONCAT_EXP(a, b) CONCAT(a, b) # define CONCAT_EXP(a, b) CONCAT(a, b)
#endif #endif
#endif /* LIGHT_WS2812_H_ */ #endif /* LIGHT_WS2812_H_ */

View File

@@ -23,42 +23,33 @@
* 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 = {
#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_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, # endif
VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, # if STM32_HAS_GPIOC
#endif {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
#if STM32_HAS_GPIOC # endif
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, # if STM32_HAS_GPIOD
VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
#endif # endif
#if STM32_HAS_GPIOD # if STM32_HAS_GPIOE
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, # endif
#endif # if STM32_HAS_GPIOF
#if STM32_HAS_GPIOE {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, # endif
VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, # if STM32_HAS_GPIOG
#endif {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
#if STM32_HAS_GPIOF # endif
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, # if STM32_HAS_GPIOH
VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
#endif # endif
#if STM32_HAS_GPIOG # if STM32_HAS_GPIOI
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, # endif
#endif
#if STM32_HAS_GPIOH
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
#endif
#if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
#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

@@ -32,13 +32,13 @@
* NOTE: LSE not fitted. * NOTE: LSE not fitted.
*/ */
#if !defined(STM32_LSECLK) #if !defined(STM32_LSECLK)
#define STM32_LSECLK 0U # define STM32_LSECLK 0U
#endif #endif
#define STM32_LSEDRV (3U << 3U) #define STM32_LSEDRV (3U << 3U)
#if !defined(STM32_HSECLK) #if !defined(STM32_HSECLK)
#define STM32_HSECLK 8000000U # define STM32_HSECLK 8000000U
#endif #endif
// #define STM32_HSE_BYPASS // #define STM32_HSE_BYPASS
@@ -201,27 +201,26 @@
#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.
* Please refer to the STM32 Reference Manual for details. * Please refer to the STM32 Reference Manual for details.
*/ */
#define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) #define PIN_MODE_INPUT(n) (0U << ((n)*2U))
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) #define PIN_MODE_OUTPUT(n) (1U << ((n)*2U))
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) #define PIN_MODE_ALTERNATE(n) (2U << ((n)*2U))
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) #define PIN_MODE_ANALOG(n) (3U << ((n)*2U))
#define PIN_ODR_LOW(n) (0U << (n)) #define PIN_ODR_LOW(n) (0U << (n))
#define PIN_ODR_HIGH(n) (1U << (n)) #define PIN_ODR_HIGH(n) (1U << (n))
#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) #define PIN_OSPEED_VERYLOW(n) (0U << ((n)*2U))
#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) #define PIN_OSPEED_LOW(n) (1U << ((n)*2U))
#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) #define PIN_OSPEED_MEDIUM(n) (2U << ((n)*2U))
#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) #define PIN_OSPEED_HIGH(n) (3U << ((n)*2U))
#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) #define PIN_PUPDR_FLOATING(n) (0U << ((n)*2U))
#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) #define PIN_PUPDR_PULLUP(n) (1U << ((n)*2U))
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) #define PIN_PUPDR_PULLDOWN(n) (2U << ((n)*2U))
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
/* /*
@@ -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,17 +457,19 @@
* 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_)
#ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
#endif # endif
void boardInit(void); void boardInit(void);
#ifdef __cplusplus # ifdef __cplusplus
} }
#endif # endif
#endif /* _FROM_ASM_ */ #endif /* _FROM_ASM_ */
#endif /* _BOARD_H_ */ #endif /* _BOARD_H_ */

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

@@ -31,7 +31,7 @@
#define KINETIS_XTAL_FREQUENCY 16000000UL #define KINETIS_XTAL_FREQUENCY 16000000UL
/* Use internal capacitors for the crystal */ /* Use internal capacitors for the crystal */
#define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P #define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P | OSC_CR_SC2P
/* /*
* MCU type * MCU type
@@ -283,13 +283,13 @@
#define LINE_LED LINE_PIN13 #define LINE_LED LINE_PIN13
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
#endif # endif
void boardInit(void); void boardInit(void);
#ifdef __cplusplus # ifdef __cplusplus
} }
#endif # endif
#endif /* _FROM_ASM_ */ #endif /* _FROM_ASM_ */
#endif /* _BOARD_H_ */ #endif /* _BOARD_H_ */

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,65 +33,60 @@ 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];
#endif #endif
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);
// DRV_write(DRV_FEEDBACK_CTRL,0xB6); // DRV_write(DRV_FEEDBACK_CTRL,0xB6);
#if FB_ERM_LRA == 0 #if FB_ERM_LRA == 0
/* ERM settings */ /* ERM settings */
DRV_write(DRV_RATED_VOLT, (RATED_VOLTAGE/21.33)*1000); DRV_write(DRV_RATED_VOLT, (RATED_VOLTAGE / 21.33) * 1000);
#if ERM_OPEN_LOOP == 0 # if ERM_OPEN_LOOP == 0
DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (((V_PEAK*(DRIVE_TIME+BLANKING_TIME+IDISS_TIME))/0.02133)/(DRIVE_TIME-0.0003))); DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (((V_PEAK * (DRIVE_TIME + BLANKING_TIME + IDISS_TIME)) / 0.02133) / (DRIVE_TIME - 0.0003)));
#elif ERM_OPEN_LOOP == 1 # elif ERM_OPEN_LOOP == 1
DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK/0.02196)); DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK / 0.02196));
#endif # endif
#elif FB_ERM_LRA == 1 #elif FB_ERM_LRA == 1
DRV_write(DRV_RATED_VOLT, ((V_RMS * sqrt(1 - ((4 * ((150+(SAMPLE_TIME*50))*0.000001)) + 0.0003)* F_LRA)/0.02071))); DRV_write(DRV_RATED_VOLT, ((V_RMS * sqrt(1 - ((4 * ((150 + (SAMPLE_TIME * 50)) * 0.000001)) + 0.0003) * F_LRA) / 0.02071)));
#if LRA_OPEN_LOOP == 0 # if LRA_OPEN_LOOP == 0
DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, ((V_PEAK/sqrt(1-(F_LRA*0.0008))/0.02133))); DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, ((V_PEAK / sqrt(1 - (F_LRA * 0.0008)) / 0.02133)));
#elif LRA_OPEN_LOOP == 1 # elif LRA_OPEN_LOOP == 1
DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK/0.02196)); DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK / 0.02196));
#endif # endif
#endif #endif
DRVREG_FBR FB_SET; DRVREG_FBR FB_SET;
FB_SET.Bits.ERM_LRA = FB_ERM_LRA; FB_SET.Bits.ERM_LRA = FB_ERM_LRA;
FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR; FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR;
FB_SET.Bits.LOOP_GAIN =FB_LOOPGAIN; FB_SET.Bits.LOOP_GAIN = FB_LOOPGAIN;
FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/ FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/
DRV_write(DRV_FEEDBACK_CTRL, (uint8_t) FB_SET.Byte); DRV_write(DRV_FEEDBACK_CTRL, (uint8_t)FB_SET.Byte);
DRVREG_CTRL1 C1_SET; DRVREG_CTRL1 C1_SET;
C1_SET.Bits.C1_DRIVE_TIME = DRIVE_TIME; C1_SET.Bits.C1_DRIVE_TIME = DRIVE_TIME;
C1_SET.Bits.C1_AC_COUPLE = AC_COUPLE; C1_SET.Bits.C1_AC_COUPLE = AC_COUPLE;
C1_SET.Bits.C1_STARTUP_BOOST = STARTUP_BOOST; C1_SET.Bits.C1_STARTUP_BOOST = STARTUP_BOOST;
DRV_write(DRV_CTRL_1, (uint8_t) C1_SET.Byte); DRV_write(DRV_CTRL_1, (uint8_t)C1_SET.Byte);
DRVREG_CTRL2 C2_SET; DRVREG_CTRL2 C2_SET;
C2_SET.Bits.C2_BIDIR_INPUT = BIDIR_INPUT; C2_SET.Bits.C2_BIDIR_INPUT = BIDIR_INPUT;
C2_SET.Bits.C2_BRAKE_STAB = BRAKE_STAB; C2_SET.Bits.C2_BRAKE_STAB = BRAKE_STAB;
C2_SET.Bits.C2_SAMPLE_TIME = SAMPLE_TIME; C2_SET.Bits.C2_SAMPLE_TIME = SAMPLE_TIME;
C2_SET.Bits.C2_BLANKING_TIME = BLANKING_TIME; C2_SET.Bits.C2_BLANKING_TIME = BLANKING_TIME;
C2_SET.Bits.C2_IDISS_TIME = IDISS_TIME; C2_SET.Bits.C2_IDISS_TIME = IDISS_TIME;
DRV_write(DRV_CTRL_2, (uint8_t) C2_SET.Byte); DRV_write(DRV_CTRL_2, (uint8_t)C2_SET.Byte);
DRVREG_CTRL3 C3_SET; DRVREG_CTRL3 C3_SET;
C3_SET.Bits.C3_LRA_OPEN_LOOP = LRA_OPEN_LOOP; C3_SET.Bits.C3_LRA_OPEN_LOOP = LRA_OPEN_LOOP;
C3_SET.Bits.C3_N_PWM_ANALOG = N_PWM_ANALOG; C3_SET.Bits.C3_N_PWM_ANALOG = N_PWM_ANALOG;
@@ -102,27 +95,37 @@ void DRV_init(void)
C3_SET.Bits.C3_SUPPLY_COMP_DIS = SUPPLY_COMP_DIS; C3_SET.Bits.C3_SUPPLY_COMP_DIS = SUPPLY_COMP_DIS;
C3_SET.Bits.C3_ERM_OPEN_LOOP = ERM_OPEN_LOOP; C3_SET.Bits.C3_ERM_OPEN_LOOP = ERM_OPEN_LOOP;
C3_SET.Bits.C3_NG_THRESH = NG_THRESH; C3_SET.Bits.C3_NG_THRESH = NG_THRESH;
DRV_write(DRV_CTRL_3, (uint8_t) C3_SET.Byte); DRV_write(DRV_CTRL_3, (uint8_t)C3_SET.Byte);
DRVREG_CTRL4 C4_SET; DRVREG_CTRL4 C4_SET;
C4_SET.Bits.C4_ZC_DET_TIME = ZC_DET_TIME; C4_SET.Bits.C4_ZC_DET_TIME = ZC_DET_TIME;
C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME; C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME;
DRV_write(DRV_CTRL_4, (uint8_t) C4_SET.Byte); DRV_write(DRV_CTRL_4, (uint8_t)C4_SET.Byte);
DRV_write(DRV_LIB_SELECTION,LIB_SELECTION); DRV_write(DRV_LIB_SELECTION, LIB_SELECTION);
DRV_write(DRV_GO, 0x01); DRV_write(DRV_GO, 0x01);
/* 0x00 sets DRV2605 out of standby and to use internal trigger /* 0x00 sets DRV2605 out of standby and to use internal trigger
* 0x01 sets DRV2605 out of standby and to use external trigger */ * 0x01 sets DRV2605 out of standby and to use external trigger */
DRV_write(DRV_MODE,0x00); DRV_write(DRV_MODE, 0x00);
//Play greeting sequence // Play greeting sequence
DRV_write(DRV_GO, 0x00); DRV_write(DRV_GO, 0x00);
DRV_write(DRV_WAVEFORM_SEQ_1, DRV_GREETING); DRV_write(DRV_WAVEFORM_SEQ_1, DRV_GREETING);
DRV_write(DRV_GO, 0x01); DRV_write(DRV_GO, 0x01);
} }
void DRV_pulse(uint8_t sequence) void DRV_rtp_init(void) {
{ DRV_write(DRV_GO, 0x00);
DRV_write(DRV_RTP_INPUT, 20); //20 is the lowest value I've found where haptics can still be felt.
DRV_write(DRV_MODE, 0x05);
DRV_write(DRV_GO, 0x01);
}
void DRV_amplitude(uint8_t amplitude) {
DRV_write(DRV_RTP_INPUT, amplitude);
}
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

@@ -22,111 +22,111 @@
* Feedback Control Settings */ * Feedback Control Settings */
#ifndef FB_ERM_LRA #ifndef FB_ERM_LRA
#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ # define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
#endif #endif
#ifndef FB_BRAKEFACTOR #ifndef FB_BRAKEFACTOR
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ # define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
#endif #endif
#ifndef FB_LOOPGAIN #ifndef FB_LOOPGAIN
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ # define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
#endif #endif
/* LRA specific settings */ /* LRA specific settings */
#if FB_ERM_LRA == 1 #if FB_ERM_LRA == 1
#ifndef V_RMS # ifndef V_RMS
#define V_RMS 2.0 # define V_RMS 2.0
#endif # endif
#ifndef V_PEAK # ifndef V_PEAK
#define V_PEAK 2.1 # define V_PEAK 2.1
#endif # endif
#ifndef F_LRA # ifndef F_LRA
#define F_LRA 205 # define F_LRA 205
#endif # endif
#ifndef RATED_VOLTAGE # ifndef RATED_VOLTAGE
#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ # define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
#endif # endif
#endif #endif
#ifndef RATED_VOLTAGE #ifndef RATED_VOLTAGE
#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ # define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
#endif #endif
#ifndef V_PEAK #ifndef V_PEAK
#define V_PEAK 2.8 # define V_PEAK 2.8
#endif #endif
/* Library Selection */ /* Library Selection */
#ifndef LIB_SELECTION #ifndef LIB_SELECTION
#if FB_ERM_LRA == 1 # if FB_ERM_LRA == 1
#define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ # define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
#else # else
#define LIB_SELECTION 1 # define LIB_SELECTION 1
#endif # endif
#endif #endif
#ifndef DRV_GREETING #ifndef DRV_GREETING
#define DRV_GREETING alert_750ms # define DRV_GREETING alert_750ms
#endif #endif
#ifndef DRV_MODE_DEFAULT #ifndef DRV_MODE_DEFAULT
#define DRV_MODE_DEFAULT strong_click1 # define DRV_MODE_DEFAULT strong_click1
#endif #endif
/* Control 1 register settings */ /* Control 1 register settings */
#ifndef DRIVE_TIME #ifndef DRIVE_TIME
#define DRIVE_TIME 25 # define DRIVE_TIME 25
#endif #endif
#ifndef AC_COUPLE #ifndef AC_COUPLE
#define AC_COUPLE 0 # define AC_COUPLE 0
#endif #endif
#ifndef STARTUP_BOOST #ifndef STARTUP_BOOST
#define STARTUP_BOOST 1 # define STARTUP_BOOST 1
#endif #endif
/* Control 2 Settings */ /* Control 2 Settings */
#ifndef BIDIR_INPUT #ifndef BIDIR_INPUT
#define BIDIR_INPUT 1 # define BIDIR_INPUT 1
#endif #endif
#ifndef BRAKE_STAB #ifndef BRAKE_STAB
#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ # define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
#endif #endif
#ifndef SAMPLE_TIME #ifndef SAMPLE_TIME
#define SAMPLE_TIME 3 # define SAMPLE_TIME 3
#endif #endif
#ifndef BLANKING_TIME #ifndef BLANKING_TIME
#define BLANKING_TIME 1 # define BLANKING_TIME 1
#endif #endif
#ifndef IDISS_TIME #ifndef IDISS_TIME
#define IDISS_TIME 1 # define IDISS_TIME 1
#endif #endif
/* Control 3 settings */ /* Control 3 settings */
#ifndef NG_THRESH #ifndef NG_THRESH
#define NG_THRESH 2 # define NG_THRESH 2
#endif #endif
#ifndef ERM_OPEN_LOOP #ifndef ERM_OPEN_LOOP
#define ERM_OPEN_LOOP 1 # define ERM_OPEN_LOOP 1
#endif #endif
#ifndef SUPPLY_COMP_DIS #ifndef SUPPLY_COMP_DIS
#define SUPPLY_COMP_DIS 0 # define SUPPLY_COMP_DIS 0
#endif #endif
#ifndef DATA_FORMAT_RTO #ifndef DATA_FORMAT_RTO
#define DATA_FORMAT_RTO 0 # define DATA_FORMAT_RTO 0
#endif #endif
#ifndef LRA_DRIVE_MODE #ifndef LRA_DRIVE_MODE
#define LRA_DRIVE_MODE 0 # define LRA_DRIVE_MODE 0
#endif #endif
#ifndef N_PWM_ANALOG #ifndef N_PWM_ANALOG
#define N_PWM_ANALOG 0 # define N_PWM_ANALOG 0
#endif #endif
#ifndef LRA_OPEN_LOOP #ifndef LRA_OPEN_LOOP
#define LRA_OPEN_LOOP 0 # define LRA_OPEN_LOOP 0
#endif #endif
/* Control 4 settings */ /* Control 4 settings */
#ifndef ZC_DET_TIME #ifndef ZC_DET_TIME
#define ZC_DET_TIME 0 # define ZC_DET_TIME 0
#endif #endif
#ifndef AUTO_CAL_TIME #ifndef AUTO_CAL_TIME
#define AUTO_CAL_TIME 3 # define AUTO_CAL_TIME 3
#endif #endif
/* register defines -------------------------------------------------------- */ /* register defines -------------------------------------------------------- */
@@ -170,9 +170,11 @@
void DRV_init(void); void DRV_init(void);
void DRV_write(const uint8_t drv_register, const uint8_t settings); void DRV_write(const uint8_t drv_register, const uint8_t settings);
uint8_t DRV_read(const uint8_t regaddress); uint8_t DRV_read(const uint8_t regaddress);
void DRV_rtp_init(void);
void DRV_amplitude(const uint8_t amplitude);
void DRV_pulse(const uint8_t sequence); void DRV_pulse(const uint8_t sequence);
typedef enum DRV_EFFECT{ typedef enum DRV_EFFECT {
clear_sequence = 0, clear_sequence = 0,
strong_click = 1, strong_click = 1,
strong_click_60 = 2, strong_click_60 = 2,
@@ -305,100 +307,100 @@ typedef enum DRV_EFFECT{
typedef union DRVREG_STATUS { /* register 0x00 */ typedef union DRVREG_STATUS { /* register 0x00 */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t OC_DETECT :1; /* set to 1 when overcurrent event is detected */ uint8_t OC_DETECT : 1; /* set to 1 when overcurrent event is detected */
uint8_t OVER_TEMP :1; /* set to 1 when device exceeds temp threshold */ uint8_t OVER_TEMP : 1; /* set to 1 when device exceeds temp threshold */
uint8_t FB_STS :1; /* set to 1 when feedback controller has timed out */ uint8_t FB_STS : 1; /* set to 1 when feedback controller has timed out */
/* auto-calibration routine and diagnostic result /* auto-calibration routine and diagnostic result
* result | auto-calibation | diagnostic | * result | auto-calibation | diagnostic |
* 0 | passed | actuator func normal | * 0 | passed | actuator func normal |
* 1 | failed | actuator func fault* | * 1 | failed | actuator func fault* |
* * actuator is not present or is shorted, timing out, or giving outof-range back-EMF */ * * actuator is not present or is shorted, timing out, or giving outof-range back-EMF */
uint8_t DIAG_RESULT :1; uint8_t DIAG_RESULT : 1;
uint8_t :1; uint8_t : 1;
uint8_t DEVICE_ID :3; /* Device IDs 3: DRV2605 4: DRV2604 5: DRV2604L 6: DRV2605L */ uint8_t DEVICE_ID : 3; /* Device IDs 3: DRV2605 4: DRV2604 5: DRV2604L 6: DRV2605L */
} Bits; } Bits;
} DRVREG_STATUS; } DRVREG_STATUS;
typedef union DRVREG_MODE { /* register 0x01 */ typedef union DRVREG_MODE { /* register 0x01 */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t MODE :3; /* Mode setting */ uint8_t MODE : 3; /* Mode setting */
uint8_t :3; uint8_t : 3;
uint8_t STANDBY :1; /* 0:standby 1:ready */ uint8_t STANDBY : 1; /* 0:standby 1:ready */
} Bits; } Bits;
} DRVREG_MODE; } DRVREG_MODE;
typedef union DRVREG_WAIT { typedef union DRVREG_WAIT {
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t WAIT_MODE :1; /* Set to 1 to interpret as wait for next 7 bits x10ms */ uint8_t WAIT_MODE : 1; /* Set to 1 to interpret as wait for next 7 bits x10ms */
uint8_t WAIT_TIME :7; uint8_t WAIT_TIME : 7;
} Bits; } Bits;
} DRVREG_WAIT; } DRVREG_WAIT;
typedef union DRVREG_FBR{ /* register 0x1A */ typedef union DRVREG_FBR { /* register 0x1A */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t BEMF_GAIN :2; uint8_t BEMF_GAIN : 2;
uint8_t LOOP_GAIN :2; uint8_t LOOP_GAIN : 2;
uint8_t BRAKE_FACTOR :3; uint8_t BRAKE_FACTOR : 3;
uint8_t ERM_LRA :1; uint8_t ERM_LRA : 1;
} Bits; } Bits;
} DRVREG_FBR; } DRVREG_FBR;
typedef union DRVREG_CTRL1{ /* register 0x1B */ typedef union DRVREG_CTRL1 { /* register 0x1B */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t C1_DRIVE_TIME :5; uint8_t C1_DRIVE_TIME : 5;
uint8_t C1_AC_COUPLE :1; uint8_t C1_AC_COUPLE : 1;
uint8_t :1; uint8_t : 1;
uint8_t C1_STARTUP_BOOST :1; uint8_t C1_STARTUP_BOOST : 1;
} Bits; } Bits;
} DRVREG_CTRL1; } DRVREG_CTRL1;
typedef union DRVREG_CTRL2{ /* register 0x1C */ typedef union DRVREG_CTRL2 { /* register 0x1C */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t C2_IDISS_TIME :2; uint8_t C2_IDISS_TIME : 2;
uint8_t C2_BLANKING_TIME :2; uint8_t C2_BLANKING_TIME : 2;
uint8_t C2_SAMPLE_TIME :2; uint8_t C2_SAMPLE_TIME : 2;
uint8_t C2_BRAKE_STAB :1; uint8_t C2_BRAKE_STAB : 1;
uint8_t C2_BIDIR_INPUT :1; uint8_t C2_BIDIR_INPUT : 1;
} Bits; } Bits;
} DRVREG_CTRL2; } DRVREG_CTRL2;
typedef union DRVREG_CTRL3{ /* register 0x1D */ typedef union DRVREG_CTRL3 { /* register 0x1D */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t C3_LRA_OPEN_LOOP :1; uint8_t C3_LRA_OPEN_LOOP : 1;
uint8_t C3_N_PWM_ANALOG :1; uint8_t C3_N_PWM_ANALOG : 1;
uint8_t C3_LRA_DRIVE_MODE :1; uint8_t C3_LRA_DRIVE_MODE : 1;
uint8_t C3_DATA_FORMAT_RTO :1; uint8_t C3_DATA_FORMAT_RTO : 1;
uint8_t C3_SUPPLY_COMP_DIS :1; uint8_t C3_SUPPLY_COMP_DIS : 1;
uint8_t C3_ERM_OPEN_LOOP :1; uint8_t C3_ERM_OPEN_LOOP : 1;
uint8_t C3_NG_THRESH :2; uint8_t C3_NG_THRESH : 2;
} Bits; } Bits;
} DRVREG_CTRL3; } DRVREG_CTRL3;
typedef union DRVREG_CTRL4{ /* register 0x1E */ typedef union DRVREG_CTRL4 { /* register 0x1E */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t C4_OTP_PROGRAM :1; uint8_t C4_OTP_PROGRAM : 1;
uint8_t :1; uint8_t : 1;
uint8_t C4_OTP_STATUS :1; uint8_t C4_OTP_STATUS : 1;
uint8_t :1; uint8_t : 1;
uint8_t C4_AUTO_CAL_TIME :2; uint8_t C4_AUTO_CAL_TIME : 2;
uint8_t C4_ZC_DET_TIME :2; uint8_t C4_ZC_DET_TIME : 2;
} Bits; } Bits;
} DRVREG_CTRL4; } DRVREG_CTRL4;
typedef union DRVREG_CTRL5{ /* register 0x1F */ typedef union DRVREG_CTRL5 { /* register 0x1F */
uint8_t Byte; uint8_t Byte;
struct { struct {
uint8_t C5_IDISS_TIME :2; uint8_t C5_IDISS_TIME : 2;
uint8_t C5_BLANKING_TIME :2; uint8_t C5_BLANKING_TIME : 2;
uint8_t C5_PLAYBACK_INTERVAL :1; uint8_t C5_PLAYBACK_INTERVAL : 1;
uint8_t C5_LRA_AUTO_OPEN_LOOP :1; uint8_t C5_LRA_AUTO_OPEN_LOOP : 1;
uint8_t C5_AUTO_OL_CNT :2; uint8_t C5_AUTO_OL_CNT : 2;
} Bits; } Bits;
} DRVREG_CTRL5; } DRVREG_CTRL5;

View File

@@ -19,42 +19,42 @@
#include "progmem.h" #include "progmem.h"
#include "debug.h" #include "debug.h"
#ifdef DRV2605L #ifdef DRV2605L
#include "DRV2605L.h" # include "DRV2605L.h"
#endif #endif
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
#include "solenoid.h" # include "solenoid.h"
#endif #endif
haptic_config_t haptic_config; haptic_config_t haptic_config;
void haptic_init(void) { void haptic_init(void) {
debug_enable = 1; //Debug is ON! debug_enable = 1; // Debug is ON!
if (!eeconfig_is_enabled()) { if (!eeconfig_is_enabled()) {
eeconfig_init(); eeconfig_init();
} }
haptic_config.raw = eeconfig_read_haptic(); haptic_config.raw = eeconfig_read_haptic();
if (haptic_config.mode < 1){ if (haptic_config.mode < 1) {
haptic_config.mode = 1; haptic_config.mode = 1;
} }
if (!haptic_config.mode){ if (!haptic_config.mode) {
dprintf("No haptic config found in eeprom, setting default configs\n"); dprintf("No haptic config found in eeprom, setting default configs\n");
haptic_reset(); haptic_reset();
} }
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
solenoid_setup(); solenoid_setup();
dprintf("Solenoid driver initialized\n"); dprintf("Solenoid driver initialized\n");
#endif #endif
#ifdef DRV2605L #ifdef DRV2605L
DRV_init(); DRV_init();
dprintf("DRV2605 driver initialized\n"); dprintf("DRV2605 driver initialized\n");
#endif #endif
eeconfig_debug_haptic(); eeconfig_debug_haptic();
} }
void haptic_task(void) { void haptic_task(void) {
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
solenoid_check(); solenoid_check();
#endif #endif
} }
void eeconfig_debug_haptic(void) { void eeconfig_debug_haptic(void) {
@@ -76,7 +76,7 @@ void haptic_disable(void) {
} }
void haptic_toggle(void) { void haptic_toggle(void) {
if (haptic_config.enable) { if (haptic_config.enable) {
haptic_disable(); haptic_disable();
} else { } else {
haptic_enable(); haptic_enable();
@@ -84,10 +84,9 @@ if (haptic_config.enable) {
eeconfig_update_haptic(haptic_config.raw); eeconfig_update_haptic(haptic_config.raw);
} }
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);
} }
@@ -100,58 +99,58 @@ void haptic_buzz_toggle(void) {
void haptic_mode_increase(void) { void haptic_mode_increase(void) {
uint8_t mode = haptic_config.mode + 1; uint8_t mode = haptic_config.mode + 1;
#ifdef DRV2605L #ifdef DRV2605L
if (haptic_config.mode >= drv_effect_max) { if (haptic_config.mode >= drv_effect_max) {
mode = 1; mode = 1;
} }
#endif #endif
haptic_set_mode(mode); haptic_set_mode(mode);
} }
void haptic_mode_decrease(void) { void haptic_mode_decrease(void) {
uint8_t mode = haptic_config.mode -1; uint8_t mode = haptic_config.mode - 1;
#ifdef DRV2605L #ifdef DRV2605L
if (haptic_config.mode < 1) { if (haptic_config.mode < 1) {
mode = (drv_effect_max - 1); mode = (drv_effect_max - 1);
} }
#endif #endif
haptic_set_mode(mode); haptic_set_mode(mode);
} }
void haptic_dwell_increase(void) { void haptic_dwell_increase(void) {
uint8_t dwell = haptic_config.dwell + 1; uint8_t dwell = haptic_config.dwell + 1;
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
if (haptic_config.dwell >= SOLENOID_MAX_DWELL) { if (haptic_config.dwell >= SOLENOID_MAX_DWELL) {
dwell = 1; dwell = 1;
} }
solenoid_set_dwell(dwell); solenoid_set_dwell(dwell);
#endif #endif
haptic_set_dwell(dwell); haptic_set_dwell(dwell);
} }
void haptic_dwell_decrease(void) { void haptic_dwell_decrease(void) {
uint8_t dwell = haptic_config.dwell -1; uint8_t dwell = haptic_config.dwell - 1;
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
if (haptic_config.dwell < SOLENOID_MIN_DWELL) { if (haptic_config.dwell < SOLENOID_MIN_DWELL) {
dwell = SOLENOID_MAX_DWELL; dwell = SOLENOID_MAX_DWELL;
} }
solenoid_set_dwell(dwell); solenoid_set_dwell(dwell);
#endif #endif
haptic_set_dwell(dwell); haptic_set_dwell(dwell);
} }
void haptic_reset(void){ void haptic_reset(void) {
haptic_config.enable = true; haptic_config.enable = true;
uint8_t feedback = HAPTIC_FEEDBACK_DEFAULT; uint8_t feedback = HAPTIC_FEEDBACK_DEFAULT;
haptic_config.feedback = feedback; haptic_config.feedback = feedback;
#ifdef DRV2605L #ifdef DRV2605L
uint8_t mode = HAPTIC_MODE_DEFAULT; uint8_t mode = HAPTIC_MODE_DEFAULT;
haptic_config.mode = mode; haptic_config.mode = mode;
#endif #endif
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
uint8_t dwell = SOLENOID_DEFAULT_DWELL; uint8_t dwell = SOLENOID_DEFAULT_DWELL;
haptic_config.dwell = dwell; haptic_config.dwell = dwell;
#endif #endif
eeconfig_update_haptic(haptic_config.raw); eeconfig_update_haptic(haptic_config.raw);
xprintf("haptic_config.feedback = %u\n", haptic_config.feedback); xprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
xprintf("haptic_config.mode = %u\n", haptic_config.mode); xprintf("haptic_config.mode = %u\n", haptic_config.mode);
@@ -169,6 +168,15 @@ void haptic_set_mode(uint8_t mode) {
xprintf("haptic_config.mode = %u\n", haptic_config.mode); xprintf("haptic_config.mode = %u\n", haptic_config.mode);
} }
void haptic_set_amplitude(uint8_t amp) {
haptic_config.amplitude = amp;
eeconfig_update_haptic(haptic_config.raw);
xprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude);
#ifdef DRV2605L
DRV_amplitude(amp);
#endif
}
void haptic_set_buzz(uint8_t buzz) { void haptic_set_buzz(uint8_t buzz) {
haptic_config.buzz = buzz; haptic_config.buzz = buzz;
eeconfig_update_haptic(haptic_config.raw); eeconfig_update_haptic(haptic_config.raw);
@@ -182,56 +190,134 @@ void haptic_set_dwell(uint8_t dwell) {
} }
uint8_t haptic_get_mode(void) { uint8_t haptic_get_mode(void) {
if (!haptic_config.enable){ if (!haptic_config.enable) {
return false; return false;
} }
return haptic_config.mode; return haptic_config.mode;
} }
uint8_t haptic_get_feedback(void) { uint8_t haptic_get_feedback(void) {
if (!haptic_config.enable){ if (!haptic_config.enable) {
return false; return false;
} }
return haptic_config.feedback; return haptic_config.feedback;
} }
uint8_t haptic_get_dwell(void) { uint8_t haptic_get_dwell(void) {
if (!haptic_config.enable){ if (!haptic_config.enable) {
return false; return false;
} }
return haptic_config.dwell; return haptic_config.dwell;
} }
void haptic_play(void) { void haptic_enable_continuous(void) {
haptic_config.cont = 1;
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
#ifdef DRV2605L #ifdef DRV2605L
uint8_t play_eff = 0; DRV_rtp_init();
play_eff = haptic_config.mode;
DRV_pulse(play_eff);
#endif
#ifdef SOLENOID_ENABLE
solenoid_fire();
#endif #endif
} }
void haptic_disable_continuous(void) {
haptic_config.cont = 0;
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
#ifdef DRV2605L
DRV_write(DRV_MODE,0x00);
#endif
}
void haptic_toggle_continuous(void) {
#ifdef DRV2605L
if (haptic_config.cont) {
haptic_disable_continuous();
} else {
haptic_enable_continuous();
}
eeconfig_update_haptic(haptic_config.raw);
#endif
}
void haptic_cont_increase(void) {
uint8_t amp = haptic_config.amplitude + 10;
if (haptic_config.amplitude >= 120) {
amp = 120;
}
haptic_set_amplitude(amp);
}
void haptic_cont_decrease(void) {
uint8_t amp = haptic_config.amplitude - 10;
if (haptic_config.amplitude < 20) {
amp = 20;
}
haptic_set_amplitude(amp);
}
void haptic_play(void) {
#ifdef DRV2605L
uint8_t play_eff = 0;
play_eff = haptic_config.mode;
DRV_pulse(play_eff);
#endif
#ifdef SOLENOID_ENABLE
solenoid_fire();
#endif
}
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_OFF && record->event.pressed) { haptic_disable(); } if (keycode == HPT_ON && record->event.pressed) {
if (keycode == HPT_TOG && record->event.pressed) { haptic_toggle(); } haptic_enable();
if (keycode == HPT_RST && record->event.pressed) { haptic_reset(); } }
if (keycode == HPT_FBK && record->event.pressed) { haptic_feedback_toggle(); } if (keycode == HPT_OFF && record->event.pressed) {
if (keycode == HPT_BUZ && record->event.pressed) { haptic_buzz_toggle(); } haptic_disable();
if (keycode == HPT_MODI && record->event.pressed) { haptic_mode_increase(); } }
if (keycode == HPT_MODD && record->event.pressed) { haptic_mode_decrease(); } if (keycode == HPT_TOG && record->event.pressed) {
if (keycode == HPT_DWLI && record->event.pressed) { haptic_dwell_increase(); } haptic_toggle();
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 (keycode == HPT_CONT && record->event.pressed) {
haptic_toggle_continuous();
}
if (keycode == HPT_CONI && record->event.pressed) {
haptic_cont_increase();
}
if (keycode == HPT_COND && record->event.pressed) {
haptic_cont_decrease();
}
if (haptic_config.enable) { if (haptic_config.enable) {
if ( record->event.pressed ) { if (record->event.pressed) {
// keypress // keypress
if (haptic_config.feedback < 2) { if (haptic_config.feedback < 2) {
haptic_play(); haptic_play();
} }
} else { } else {
//keyrelease // keyrelease
if (haptic_config.feedback > 0) { if (haptic_config.feedback > 0) {
haptic_play(); haptic_play();
} }
@@ -241,8 +327,7 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) {
} }
void haptic_shutdown(void) { void haptic_shutdown(void) {
#ifdef SOLENOID_ENABLE #ifdef SOLENOID_ENABLE
solenoid_shutdown(); solenoid_shutdown();
#endif #endif
} }

View File

@@ -20,15 +20,14 @@
#include <stdbool.h> #include <stdbool.h>
#include "quantum.h" #include "quantum.h"
#ifdef DRV2605L #ifdef DRV2605L
#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
#ifndef HAPTIC_MODE_DEFAULT #ifndef HAPTIC_MODE_DEFAULT
#define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT # define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
#endif #endif
/* EEPROM config settings */ /* EEPROM config settings */
@@ -40,11 +39,13 @@ typedef union {
uint8_t mode :7; uint8_t mode :7;
bool buzz :1; bool buzz :1;
uint8_t dwell :7; uint8_t dwell :7;
uint16_t reserved :16; bool cont :1;
uint8_t amplitude :8;
uint16_t reserved :7;
}; };
} haptic_config_t; } haptic_config_t;
typedef enum HAPTIC_FEEDBACK{ typedef enum HAPTIC_FEEDBACK {
KEY_PRESS, KEY_PRESS,
KEY_PRESS_RELEASE, KEY_PRESS_RELEASE,
KEY_RELEASE, KEY_RELEASE,
@@ -72,11 +73,9 @@ uint8_t haptic_get_mode(void);
uint8_t haptic_get_feedback(void); uint8_t haptic_get_feedback(void);
void haptic_dwell_increase(void); void haptic_dwell_increase(void);
void haptic_dwell_decrease(void); void haptic_dwell_decrease(void);
void haptic_toggle_continuous(void);
void haptic_cont_increase(void);
void haptic_cont_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);
@@ -75,21 +65,20 @@ void solenoid_check(void) {
elapsed = timer_elapsed(solenoid_start); elapsed = timer_elapsed(solenoid_start);
//Check if it's time to finish this solenoid click cycle // Check if it's time to finish this solenoid click cycle
if (elapsed > solenoid_dwell) { if (elapsed > solenoid_dwell) {
solenoid_stop(); solenoid_stop();
return; return;
} }
//Check whether to buzz the solenoid on and off // Check whether to buzz the solenoid on and off
if (haptic_config.buzz) { if (haptic_config.buzz) {
if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){ if (elapsed / SOLENOID_MIN_DWELL % 2 == 0) {
if (!solenoid_buzzing) { if (!solenoid_buzzing) {
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

@@ -18,23 +18,23 @@
#pragma once #pragma once
#ifndef SOLENOID_DEFAULT_DWELL #ifndef SOLENOID_DEFAULT_DWELL
#define SOLENOID_DEFAULT_DWELL 12 # define SOLENOID_DEFAULT_DWELL 12
#endif #endif
#ifndef SOLENOID_MAX_DWELL #ifndef SOLENOID_MAX_DWELL
#define SOLENOID_MAX_DWELL 100 # define SOLENOID_MAX_DWELL 100
#endif #endif
#ifndef SOLENOID_MIN_DWELL #ifndef SOLENOID_MIN_DWELL
#define SOLENOID_MIN_DWELL 4 # define SOLENOID_MIN_DWELL 4
#endif #endif
#ifndef SOLENOID_ACTIVE #ifndef SOLENOID_ACTIVE
#define SOLENOID_ACTIVE false # define SOLENOID_ACTIVE false
#endif #endif
#ifndef SOLENOID_PIN #ifndef SOLENOID_PIN
#define SOLENOID_PIN F6 # define SOLENOID_PIN F6
#endif #endif
void solenoid_buzz_on(void); void solenoid_buzz_on(void);

View File

@@ -37,66 +37,60 @@ 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];
} }
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);
// Turn off software shutdown // Turn off software shutdown
IS31FL3218_write_register( ISSI_REG_SHUTDOWN, 0x01 ); IS31FL3218_write_register(ISSI_REG_SHUTDOWN, 0x01);
// Set all PWM values to zero // Set all PWM values to zero
for ( uint8_t i = 0; i < 18; i++ ) { for (uint8_t i = 0; i < 18; i++) {
IS31FL3218_write_register( ISSI_REG_PWM+i, 0x00 ); IS31FL3218_write_register(ISSI_REG_PWM + i, 0x00);
} }
// Enable all channels // Enable all channels
for ( uint8_t i = 0; i < 3; i++ ) { for (uint8_t i = 0; i < 3; i++) {
IS31FL3218_write_register( ISSI_REG_CONTROL+i, 0b00111111 ); IS31FL3218_write_register(ISSI_REG_CONTROL + i, 0b00111111);
} }
// Load PWM registers and LED Control register data // Load PWM registers and LED Control register data
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
IS31FL3218_write_register( ISSI_REG_UPDATE, 0x01 ); IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
} }
g_pwm_buffer_update_required = false; g_pwm_buffer_update_required = false;
} }

View File

@@ -19,6 +19,6 @@
#include <stdbool.h> #include <stdbool.h>
void IS31FL3218_init(void); void IS31FL3218_init(void);
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);
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);
void IS31FL3218_update_pwm_buffers(void); void IS31FL3218_update_pwm_buffers(void);

View File

@@ -17,11 +17,11 @@
*/ */
#ifdef __AVR__ #ifdef __AVR__
#include <avr/interrupt.h> # include <avr/interrupt.h>
#include <avr/io.h> # include <avr/io.h>
#include <util/delay.h> # include <util/delay.h>
#else #else
#include "wait.h" # include "wait.h"
#endif #endif
#include <stdint.h> #include <stdint.h>
@@ -59,11 +59,11 @@
#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine' #define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
#ifndef ISSI_TIMEOUT #ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 100 # define ISSI_TIMEOUT 100
#endif #endif
#ifndef ISSI_PERSISTENCE #ifndef ISSI_PERSISTENCE
#define ISSI_PERSISTENCE 0 # define ISSI_PERSISTENCE 0
#endif #endif
// Transfer buffer for TWITransmitData() // Transfer buffer for TWITransmitData()
@@ -79,13 +79,13 @@ bool g_pwm_buffer_update_required = false;
/* There's probably a better way to init this... */ /* There's probably a better way to init this... */
#if LED_DRIVER_COUNT == 1 #if LED_DRIVER_COUNT == 1
uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}}; uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}};
#elif LED_DRIVER_COUNT == 2 #elif LED_DRIVER_COUNT == 2
uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}}; uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}};
#elif LED_DRIVER_COUNT == 3 #elif LED_DRIVER_COUNT == 3
uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}}; uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
#elif LED_DRIVER_COUNT == 4 #elif LED_DRIVER_COUNT == 4
uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}}; uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
#endif #endif
bool g_led_control_registers_update_required = false; bool g_led_control_registers_update_required = false;
@@ -103,20 +103,19 @@ 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;
#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) {
@@ -136,14 +135,13 @@ void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j]; g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
} }
#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);
#endif #endif
} }
} }
@@ -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) {
@@ -239,7 +236,7 @@ void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
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) { if (g_led_control_registers_update_required) {
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

@@ -16,13 +16,11 @@
* 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;
} __attribute__((packed)) is31_led; } __attribute__((packed)) is31_led;
@@ -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

@@ -16,11 +16,11 @@
*/ */
#ifdef __AVR__ #ifdef __AVR__
#include <avr/interrupt.h> # include <avr/interrupt.h>
#include <avr/io.h> # include <avr/io.h>
#include <util/delay.h> # include <util/delay.h>
#else #else
#include "wait.h" # include "wait.h"
#endif #endif
#include "is31fl3731.h" #include "is31fl3731.h"
@@ -55,11 +55,11 @@
#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine' #define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
#ifndef ISSI_TIMEOUT #ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 100 # define ISSI_TIMEOUT 100
#endif #endif
#ifndef ISSI_PERSISTENCE #ifndef ISSI_PERSISTENCE
#define ISSI_PERSISTENCE 0 # define ISSI_PERSISTENCE 0
#endif #endif
// Transfer buffer for TWITransmitData() // Transfer buffer for TWITransmitData()
@@ -71,10 +71,10 @@ uint8_t g_twi_transfer_buffer[20];
// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's // buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][144]; uint8_t g_pwm_buffer[DRIVER_COUNT][144];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false }; bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[DRIVER_COUNT][18] = { { 0 }, { 0 } }; uint8_t g_led_control_registers[DRIVER_COUNT][18] = {{0}, {0}};
bool g_led_control_registers_update_required[DRIVER_COUNT] = { false }; bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
// This is the bit pattern in the LED control registers // This is the bit pattern in the LED control registers
// (for matrix A, add one to register for matrix B) // (for matrix A, add one to register for matrix B)
@@ -90,114 +90,103 @@ 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
// g_twi_transfer_buffer[] is 20 bytes // g_twi_transfer_buffer[] is 20 bytes
// iterate over the pwm_buffer contents at 16 byte intervals // iterate over the pwm_buffer contents at 16 byte intervals
for ( int i = 0; i < 144; i += 16 ) { for (int i = 0; i < 144; i += 16) {
// set the first register, e.g. 0x24, 0x34, 0x44, etc. // set the first register, e.g. 0x24, 0x34, 0x44, etc.
g_twi_transfer_buffer[0] = 0x24 + i; g_twi_transfer_buffer[0] = 0x24 + i;
// copy the data from i to i+15 // copy the data from i to i+15
// device will auto-increment register for data after the first byte // device will auto-increment register for data after the first byte
// thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
for ( int j = 0; j < 16; j++ ) { for (int j = 0; j < 16; j++) {
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j]; g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
} }
#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);
#endif #endif
} }
} }
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,
// then disable software shutdown. // then disable software shutdown.
// select "function register" bank // select "function register" bank
IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
// enable software shutdown // enable software shutdown
IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x00 ); IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
// this delay was copied from other drivers, might not be needed // this delay was copied from other drivers, might not be needed
#ifdef __AVR__ #ifdef __AVR__
_delay_ms( 10 ); _delay_ms(10);
#else #else
wait_ms(10); wait_ms(10);
#endif #endif
// picture mode // picture mode
IS31FL3731_write_register( addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE ); IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
// display frame 0 // display frame 0
IS31FL3731_write_register( addr, ISSI_REG_PICTUREFRAME, 0x00 ); IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
// audio sync off // audio sync off
IS31FL3731_write_register( addr, ISSI_REG_AUDIOSYNC, 0x00 ); IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
// select bank 0 // select bank 0
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 );
} }
// select "function register" bank // select "function register" bank
IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
// disable software shutdown // disable software shutdown
IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x01 ); IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
// select bank 0 and leave it selected. // select bank 0 and leave it selected.
// 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];
// Subtract 0x24 to get the second index of g_pwm_buffer // Subtract 0x24 to get the second index of g_pwm_buffer
@@ -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;
@@ -227,42 +213,36 @@ void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, b
uint8_t bit_g = (led.g - 0x24) % 8; uint8_t bit_g = (led.g - 0x24) % 8;
uint8_t bit_b = (led.b - 0x24) % 8; uint8_t bit_b = (led.b - 0x24) % 8;
if ( red ) { if (red) {
g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
} else { } else {
g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r); g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
} }
if ( green ) { if (green) {
g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g); g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
} else { } else {
g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g); g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
} }
if ( blue ) { if (blue) {
g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b); g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
} else { } else {
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_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++) {
{ IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
for ( int i=0; i<18; 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
@@ -23,7 +22,7 @@
#include <stdbool.h> #include <stdbool.h>
typedef struct is31_led { typedef struct is31_led {
uint8_t driver:2; uint8_t driver : 2;
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
@@ -31,21 +30,21 @@ typedef struct is31_led {
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3731_init( uint8_t addr ); void IS31FL3731_init(uint8_t addr);
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);
void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
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);
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);
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);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3731_update_pwm_buffers( uint8_t addr, uint8_t index ); void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3731_update_led_control_registers( uint8_t addr, uint8_t index ); void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
#define C1_1 0x24 #define C1_1 0x24
#define C1_2 0x25 #define C1_2 0x25
@@ -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

@@ -17,11 +17,11 @@
*/ */
#ifdef __AVR__ #ifdef __AVR__
#include <avr/interrupt.h> # include <avr/interrupt.h>
#include <avr/io.h> # include <avr/io.h>
#include <util/delay.h> # include <util/delay.h>
#else #else
#include "wait.h" # include "wait.h"
#endif #endif
#include "is31fl3733.h" #include "is31fl3733.h"
@@ -46,23 +46,23 @@
#define ISSI_INTERRUPTMASKREGISTER 0xF0 #define ISSI_INTERRUPTMASKREGISTER 0xF0
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1 #define ISSI_INTERRUPTSTATUSREGISTER 0xF1
#define ISSI_PAGE_LEDCONTROL 0x00 //PG0 #define ISSI_PAGE_LEDCONTROL 0x00 // PG0
#define ISSI_PAGE_PWM 0x01 //PG1 #define ISSI_PAGE_PWM 0x01 // PG1
#define ISSI_PAGE_AUTOBREATH 0x02 //PG2 #define ISSI_PAGE_AUTOBREATH 0x02 // PG2
#define ISSI_PAGE_FUNCTION 0x03 //PG3 #define ISSI_PAGE_FUNCTION 0x03 // PG3
#define ISSI_REG_CONFIGURATION 0x00 //PG3 #define ISSI_REG_CONFIGURATION 0x00 // PG3
#define ISSI_REG_GLOBALCURRENT 0x01 //PG3 #define ISSI_REG_GLOBALCURRENT 0x01 // PG3
#define ISSI_REG_RESET 0x11// PG3 #define ISSI_REG_RESET 0x11 // PG3
#define ISSI_REG_SWPULLUP 0x0F //PG3 #define ISSI_REG_SWPULLUP 0x0F // PG3
#define ISSI_REG_CSPULLUP 0x10 //PG3 #define ISSI_REG_CSPULLUP 0x10 // PG3
#ifndef ISSI_TIMEOUT #ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 100 # define ISSI_TIMEOUT 100
#endif #endif
#ifndef ISSI_PERSISTENCE #ifndef ISSI_PERSISTENCE
#define ISSI_PERSISTENCE 0 # define ISSI_PERSISTENCE 0
#endif #endif
// Transfer buffer for TWITransmitData() // Transfer buffer for TWITransmitData()
@@ -75,56 +75,51 @@ uint8_t g_twi_transfer_buffer[20];
// buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's // buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's
// probably not worth the extra complexity. // probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false }; 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
// g_twi_transfer_buffer[] is 20 bytes // g_twi_transfer_buffer[] is 20 bytes
// iterate over the pwm_buffer contents at 16 byte intervals // iterate over the pwm_buffer contents at 16 byte intervals
for ( int i = 0; i < 192; i += 16 ) { for (int i = 0; i < 192; i += 16) {
g_twi_transfer_buffer[0] = i; g_twi_transfer_buffer[0] = i;
// copy the data from i to i+15 // copy the data from i to i+15
// device will auto-increment register for data after the first byte // device will auto-increment register for data after the first byte
// thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
for ( int j = 0; j < 16; j++ ) { for (int j = 0; j < 16; j++) {
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j]; g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
} }
#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);
#endif #endif
} }
} }
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,
@@ -132,49 +127,46 @@ void IS31FL3733_init( uint8_t addr, uint8_t sync)
// Sync is passed so set it according to the datasheet. // Sync is passed so set it according to the datasheet.
// Unlock the command register. // Unlock the command register.
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// 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 );
} }
// Unlock the command register. // Unlock the command register.
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG1 // Select PG1
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 );
} }
// Unlock the command register. // Unlock the command register.
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG3 // Select PG3
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION ); IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set global current to maximum. // Set global current to maximum.
IS31FL3733_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF ); IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
// Disable software shutdown. // Disable software shutdown.
IS31FL3733_write_register( addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01 ); IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
#ifdef __AVR__ #ifdef __AVR__
_delay_ms( 10 ); _delay_ms(10);
#else #else
wait_ms(10); wait_ms(10);
#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];
g_pwm_buffer[led.driver][led.r] = red; g_pwm_buffer[led.driver][led.r] = red;
@@ -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;
@@ -203,49 +192,43 @@ void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, b
uint8_t bit_g = led.g % 8; uint8_t bit_g = led.g % 8;
uint8_t bit_b = led.b % 8; uint8_t bit_b = led.b % 8;
if ( red ) { if (red) {
g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
} else { } else {
g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r); g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
} }
if ( green ) { if (green) {
g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g); g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
} else { } else {
g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g); g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
} }
if ( blue ) { if (blue) {
g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b); g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
} else { } else {
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_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);
IS31FL3733_write_pwm_buffer( addr, g_pwm_buffer[index] ); IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[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] );
} }
} }
g_led_control_registers_update_required[index] = false; g_led_control_registers_update_required[index] = false;

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
@@ -24,7 +23,7 @@
#include <stdbool.h> #include <stdbool.h>
typedef struct is31_led { typedef struct is31_led {
uint8_t driver:2; uint8_t driver : 2;
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
@@ -32,21 +31,21 @@ typedef struct is31_led {
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3733_init( uint8_t addr, uint8_t sync ); void IS31FL3733_init(uint8_t addr, uint8_t sync);
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);
void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); void IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
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);
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);
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);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index ); void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index ); void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
#define A_1 0x00 #define A_1 0x00
#define A_2 0x01 #define A_2 0x01

View File

@@ -14,13 +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/>.
*/ */
#ifdef __AVR__ #ifdef __AVR__
#include <avr/interrupt.h> # include <avr/interrupt.h>
#include <avr/io.h> # include <avr/io.h>
#include <util/delay.h> # include <util/delay.h>
#else #else
#include "wait.h" # include "wait.h"
#endif #endif
#include "is31fl3736.h" #include "is31fl3736.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:
@@ -47,23 +44,23 @@
#define ISSI_INTERRUPTMASKREGISTER 0xF0 #define ISSI_INTERRUPTMASKREGISTER 0xF0
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1 #define ISSI_INTERRUPTSTATUSREGISTER 0xF1
#define ISSI_PAGE_LEDCONTROL 0x00 //PG0 #define ISSI_PAGE_LEDCONTROL 0x00 // PG0
#define ISSI_PAGE_PWM 0x01 //PG1 #define ISSI_PAGE_PWM 0x01 // PG1
#define ISSI_PAGE_AUTOBREATH 0x02 //PG2 #define ISSI_PAGE_AUTOBREATH 0x02 // PG2
#define ISSI_PAGE_FUNCTION 0x03 //PG3 #define ISSI_PAGE_FUNCTION 0x03 // PG3
#define ISSI_REG_CONFIGURATION 0x00 //PG3 #define ISSI_REG_CONFIGURATION 0x00 // PG3
#define ISSI_REG_GLOBALCURRENT 0x01 //PG3 #define ISSI_REG_GLOBALCURRENT 0x01 // PG3
#define ISSI_REG_RESET 0x11// PG3 #define ISSI_REG_RESET 0x11 // PG3
#define ISSI_REG_SWPULLUP 0x0F //PG3 #define ISSI_REG_SWPULLUP 0x0F // PG3
#define ISSI_REG_CSPULLUP 0x10 //PG3 #define ISSI_REG_CSPULLUP 0x10 // PG3
#ifndef ISSI_TIMEOUT #ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 100 # define ISSI_TIMEOUT 100
#endif #endif
#ifndef ISSI_PERSISTENCE #ifndef ISSI_PERSISTENCE
#define ISSI_PERSISTENCE 0 # define ISSI_PERSISTENCE 0
#endif #endif
// Transfer buffer for TWITransmitData() // Transfer buffer for TWITransmitData()
@@ -78,103 +75,95 @@ uint8_t g_twi_transfer_buffer[20];
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required = false; 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
// g_twi_transfer_buffer[] is 20 bytes // g_twi_transfer_buffer[] is 20 bytes
// iterate over the pwm_buffer contents at 16 byte intervals // iterate over the pwm_buffer contents at 16 byte intervals
for ( int i = 0; i < 192; i += 16 ) { for (int i = 0; i < 192; i += 16) {
g_twi_transfer_buffer[0] = i; g_twi_transfer_buffer[0] = i;
// copy the data from i to i+15 // copy the data from i to i+15
// device will auto-increment register for data after the first byte // device will auto-increment register for data after the first byte
// thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
for ( int j = 0; j < 16; j++ ) { for (int j = 0; j < 16; j++) {
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j]; g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
} }
#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);
#endif #endif
} }
} }
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,
// then disable software shutdown. // then disable software shutdown.
// Unlock the command register. // Unlock the command register.
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// 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 );
} }
// Unlock the command register. // Unlock the command register.
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG1 // Select PG1
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 );
} }
// Unlock the command register. // Unlock the command register.
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG3 // Select PG3
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION ); IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set global current to maximum. // Set global current to maximum.
IS31FL3736_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF ); IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
// Disable software shutdown. // Disable software shutdown.
IS31FL3736_write_register( addr, ISSI_REG_CONFIGURATION, 0x01 ); IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
#ifdef __AVR__ #ifdef __AVR__
_delay_ms( 10 ); _delay_ms(10);
#else #else
wait_ms(10); wait_ms(10);
#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];
g_pwm_buffer[led.driver][led.r] = red; g_pwm_buffer[led.driver][led.r] = red;
@@ -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
@@ -217,29 +203,27 @@ void IS31FL3736_set_led_control_register( uint8_t index, bool red, bool green, b
uint8_t bit_g = led.g % 8; uint8_t bit_g = led.g % 8;
uint8_t bit_b = led.b % 8; uint8_t bit_b = led.b % 8;
if ( red ) { if (red) {
g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
} else { } else {
g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r); g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
} }
if ( green ) { if (green) {
g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g); g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
} else { } else {
g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g); g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
} }
if ( blue ) { if (blue) {
g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b); g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
} else { } else {
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_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)
uint8_t pwm_register = index * 2; uint8_t pwm_register = index * 2;
@@ -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)
@@ -266,7 +247,7 @@ void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled )
uint8_t control_register = pwm_register / 8; uint8_t control_register = pwm_register / 8;
uint8_t bit = pwm_register % 8; uint8_t bit = pwm_register % 8;
if ( enabled ) { if (enabled) {
g_led_control_registers[0][control_register] |= (1 << bit); g_led_control_registers[0][control_register] |= (1 << bit);
} else { } else {
g_led_control_registers[0][control_register] &= ~(1 << bit); g_led_control_registers[0][control_register] &= ~(1 << bit);
@@ -275,32 +256,26 @@ 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);
IS31FL3736_write_pwm_buffer( addr1, g_pwm_buffer[0] ); IS31FL3736_write_pwm_buffer(addr1, g_pwm_buffer[0]);
//IS31FL3736_write_pwm_buffer( addr2, g_pwm_buffer[1] ); // IS31FL3736_write_pwm_buffer( addr2, g_pwm_buffer[1] );
} }
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,22 +19,19 @@
#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
#ifndef DRIVER_LED_TOTAL #ifndef DRIVER_LED_TOTAL
#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;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
@@ -42,25 +39,25 @@ typedef struct is31_led {
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3736_init( uint8_t addr ); void IS31FL3736_init(uint8_t addr);
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);
void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
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);
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);
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);
void IS31FL3736_mono_set_brightness( int index, uint8_t value ); 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);
void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled ); void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3736_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
void IS31FL3736_update_led_control_registers( uint8_t addr1, uint8_t addr2 ); void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2);
#define A_1 0x00 #define A_1 0x00
#define A_2 0x02 #define A_2 0x02
@@ -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

@@ -17,11 +17,11 @@
*/ */
#ifdef __AVR__ #ifdef __AVR__
#include <avr/interrupt.h> # include <avr/interrupt.h>
#include <avr/io.h> # include <avr/io.h>
#include <util/delay.h> # include <util/delay.h>
#else #else
#include "wait.h" # include "wait.h"
#endif #endif
#include <string.h> #include <string.h>
@@ -46,23 +46,23 @@
#define ISSI_INTERRUPTMASKREGISTER 0xF0 #define ISSI_INTERRUPTMASKREGISTER 0xF0
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1 #define ISSI_INTERRUPTSTATUSREGISTER 0xF1
#define ISSI_PAGE_LEDCONTROL 0x00 //PG0 #define ISSI_PAGE_LEDCONTROL 0x00 // PG0
#define ISSI_PAGE_PWM 0x01 //PG1 #define ISSI_PAGE_PWM 0x01 // PG1
#define ISSI_PAGE_AUTOBREATH 0x02 //PG2 #define ISSI_PAGE_AUTOBREATH 0x02 // PG2
#define ISSI_PAGE_FUNCTION 0x03 //PG3 #define ISSI_PAGE_FUNCTION 0x03 // PG3
#define ISSI_REG_CONFIGURATION 0x00 //PG3 #define ISSI_REG_CONFIGURATION 0x00 // PG3
#define ISSI_REG_GLOBALCURRENT 0x01 //PG3 #define ISSI_REG_GLOBALCURRENT 0x01 // PG3
#define ISSI_REG_RESET 0x11// PG3 #define ISSI_REG_RESET 0x11 // PG3
#define ISSI_REG_SWPULLUP 0x0F //PG3 #define ISSI_REG_SWPULLUP 0x0F // PG3
#define ISSI_REG_CSPULLUP 0x10 //PG3 #define ISSI_REG_CSPULLUP 0x10 // PG3
#ifndef ISSI_TIMEOUT #ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 100 # define ISSI_TIMEOUT 100
#endif #endif
#ifndef ISSI_PERSISTENCE #ifndef ISSI_PERSISTENCE
#define ISSI_PERSISTENCE 0 # define ISSI_PERSISTENCE 0
#endif #endif
// Transfer buffer for TWITransmitData() // Transfer buffer for TWITransmitData()
@@ -77,103 +77,95 @@ uint8_t g_twi_transfer_buffer[20];
uint8_t g_pwm_buffer[DRIVER_COUNT][192]; uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required = false; 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
// g_twi_transfer_buffer[] is 20 bytes // g_twi_transfer_buffer[] is 20 bytes
// iterate over the pwm_buffer contents at 16 byte intervals // iterate over the pwm_buffer contents at 16 byte intervals
for ( int i = 0; i < 192; i += 16 ) { for (int i = 0; i < 192; i += 16) {
g_twi_transfer_buffer[0] = i; g_twi_transfer_buffer[0] = i;
// copy the data from i to i+15 // copy the data from i to i+15
// device will auto-increment register for data after the first byte // device will auto-increment register for data after the first byte
// thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
for ( int j = 0; j < 16; j++ ) { for (int j = 0; j < 16; j++) {
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j]; g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
} }
#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);
#endif #endif
} }
} }
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,
// then disable software shutdown. // then disable software shutdown.
// Unlock the command register. // Unlock the command register.
IS31FL3737_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// 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 );
} }
// Unlock the command register. // Unlock the command register.
IS31FL3737_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG1 // Select PG1
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 );
} }
// Unlock the command register. // Unlock the command register.
IS31FL3737_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
// Select PG3 // Select PG3
IS31FL3737_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION ); IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
// Set global current to maximum. // Set global current to maximum.
IS31FL3737_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF ); IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
// Disable software shutdown. // Disable software shutdown.
IS31FL3737_write_register( addr, ISSI_REG_CONFIGURATION, 0x01 ); IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
// Wait 10ms to ensure the device has woken up. // Wait 10ms to ensure the device has woken up.
#ifdef __AVR__ #ifdef __AVR__
_delay_ms( 10 ); _delay_ms(10);
#else #else
wait_ms(10); wait_ms(10);
#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];
g_pwm_buffer[led.driver][led.r] = red; g_pwm_buffer[led.driver][led.r] = red;
@@ -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;
@@ -202,51 +191,45 @@ void IS31FL3737_set_led_control_register( uint8_t index, bool red, bool green, b
uint8_t bit_g = led.g % 8; uint8_t bit_g = led.g % 8;
uint8_t bit_b = led.b % 8; uint8_t bit_b = led.b % 8;
if ( red ) { if (red) {
g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
} else { } else {
g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r); g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
} }
if ( green ) { if (green) {
g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g); g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
} else { } else {
g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g); g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
} }
if ( blue ) { if (blue) {
g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b); g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
} else { } else {
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_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);
IS31FL3737_write_pwm_buffer( addr1, g_pwm_buffer[0] ); IS31FL3737_write_pwm_buffer(addr1, g_pwm_buffer[0]);
//IS31FL3737_write_pwm_buffer( addr2, g_pwm_buffer[1] ); // IS31FL3737_write_pwm_buffer( addr2, g_pwm_buffer[1] );
} }
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
@@ -24,7 +23,7 @@
#include <stdbool.h> #include <stdbool.h>
typedef struct is31_led { typedef struct is31_led {
uint8_t driver:2; uint8_t driver : 2;
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
@@ -32,21 +31,21 @@ typedef struct is31_led {
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3737_init( uint8_t addr ); void IS31FL3737_init(uint8_t addr);
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);
void IS31FL3737_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
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);
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);
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);
// This should not be called from an interrupt // This should not be called from an interrupt
// (eg. from a timer interrupt). // (eg. from a timer interrupt).
// Call this while idle (in between matrix scans). // Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer. // If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3737_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
void IS31FL3737_update_led_control_registers( uint8_t addr1, uint8_t addr2 ); void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
#define A_1 0x00 #define A_1 0x00
#define A_2 0x01 #define A_2 0x01

View File

@@ -1,240 +1,25 @@
#pragma once #pragma once
#ifdef __AVR__ #ifdef __AVR__
#include <avr/io.h> # include <avr/io.h>
#include <avr/pgmspace.h> # include <avr/pgmspace.h>
#elif defined(ESP8266) #elif defined(ESP8266)
#include <pgmspace.h> # include <pgmspace.h>
#else #else
#define PROGMEM # define PROGMEM
#endif #endif
// Helidox 8x6 font with QMK Firmware Logo // Helidox 8x6 font with QMK Firmware Logo
// 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

@@ -23,13 +23,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h> #include <string.h>
#if defined(__AVR__) #if defined(__AVR__)
#include <avr/io.h> # include <avr/io.h>
#include <avr/pgmspace.h> # include <avr/pgmspace.h>
#elif defined(ESP8266) #elif defined(ESP8266)
#include <pgmspace.h> # include <pgmspace.h>
#else // defined(ESP8266) #else // defined(ESP8266)
#define PROGMEM # define PROGMEM
#define memcpy_P(des, src, len) memcpy(des, src, len) # define memcpy_P(des, src, len) memcpy(des, src, len)
#endif // defined(__AVR__) #endif // defined(__AVR__)
// Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf // Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
@@ -83,7 +83,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define CHARGE_PUMP 0x8D #define CHARGE_PUMP 0x8D
// Misc defines // Misc defines
#define OLED_TIMEOUT 60000
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8)
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)
@@ -91,11 +90,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define I2C_CMD 0x00 #define I2C_CMD 0x00
#define I2C_DATA 0x40 #define I2C_DATA 0x40
#if defined(__AVR__) #if defined(__AVR__)
// already defined on ARM // already defined on ARM
#define I2C_TIMEOUT 100 # define I2C_TIMEOUT 100
#define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT) # define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT)
#else // defined(__AVR__) #else // defined(__AVR__)
#define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT) # define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT)
#endif // defined(__AVR__) #endif // defined(__AVR__)
#define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT) #define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), I2C_TIMEOUT)
#define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, I2C_TIMEOUT) #define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, I2C_TIMEOUT)
@@ -107,15 +106,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// parts of the display unusable or don't get cleared correctly // parts of the display unusable or don't get cleared correctly
// and also allows for drawing & inverting // and also allows for drawing & inverting
uint8_t oled_buffer[OLED_MATRIX_SIZE]; uint8_t oled_buffer[OLED_MATRIX_SIZE];
uint8_t* oled_cursor; uint8_t * oled_cursor;
OLED_BLOCK_TYPE oled_dirty = 0; OLED_BLOCK_TYPE oled_dirty = 0;
bool oled_initialized = false; bool oled_initialized = false;
bool oled_active = false; bool oled_active = false;
bool oled_scrolling = false; bool oled_scrolling = false;
uint8_t oled_rotation = 0; uint8_t oled_rotation = 0;
uint8_t oled_rotation_width = 0; uint8_t oled_rotation_width = 0;
#if !defined(OLED_DISABLE_TIMEOUT) #if OLED_TIMEOUT > 0
uint16_t oled_last_activity; uint32_t oled_timeout;
#endif
#if OLED_SCROLL_TIMEOUT > 0
uint32_t oled_scroll_timeout;
#endif #endif
// Internal variables to reduce math instructions // Internal variables to reduce math instructions
@@ -123,11 +125,11 @@ uint8_t oled_rotation_width = 0;
#if defined(__AVR__) #if defined(__AVR__)
// identical to i2c_transmit, but for PROGMEM since all initialization is in PROGMEM arrays currently // identical to i2c_transmit, but for PROGMEM since all initialization is in PROGMEM arrays currently
// probably should move this into i2c_master... // probably should move this into i2c_master...
static i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { static i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t *data, uint16_t length, uint16_t timeout) {
i2c_status_t status = i2c_start(address | I2C_WRITE, timeout); i2c_status_t status = i2c_start(address | I2C_WRITE, timeout);
for (uint16_t i = 0; i < length && status >= 0; i++) { for (uint16_t i = 0; i < length && status >= 0; i++) {
status = i2c_write(pgm_read_byte((const char*)data++), timeout); status = i2c_write(pgm_read_byte((const char *)data++), timeout);
if (status) break; if (status) break;
} }
@@ -138,8 +140,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);
@@ -159,14 +160,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) {
@@ -175,40 +181,32 @@ 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;
} }
#if OLED_TIMEOUT > 0
oled_timeout = timer_read32() + OLED_TIMEOUT;
#endif
#if OLED_SCROLL_TIMEOUT > 0
oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT;
#endif
oled_clear(); oled_clear();
oled_initialized = true; oled_initialized = true;
oled_active = true; oled_active = true;
@@ -216,10 +214,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));
@@ -227,8 +222,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;
@@ -250,23 +244,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) {
@@ -283,13 +275,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 {
@@ -315,7 +306,7 @@ void oled_render(void) {
static uint8_t temp_buffer[OLED_BLOCK_SIZE]; static uint8_t temp_buffer[OLED_BLOCK_SIZE];
memset(temp_buffer, 0, sizeof(temp_buffer)); memset(temp_buffer, 0, sizeof(temp_buffer));
for(uint8_t i = 0; i < sizeof(source_map); ++i) { for (uint8_t i = 0; i < sizeof(source_map); ++i) {
rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]); rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]);
} }
@@ -353,8 +344,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) {
@@ -457,11 +447,11 @@ void oled_write_ln_P(const char *data, bool invert) {
#endif // defined(__AVR__) #endif // defined(__AVR__)
bool oled_on(void) { bool oled_on(void) {
#if !defined(OLED_DISABLE_TIMEOUT) #if OLED_TIMEOUT > 0
oled_last_activity = timer_read(); oled_timeout = timer_read32() + OLED_TIMEOUT;
#endif #endif
static const uint8_t PROGMEM display_on[] = { I2C_CMD, DISPLAY_ON }; static const uint8_t PROGMEM display_on[] = {I2C_CMD, DISPLAY_ON};
if (!oled_active) { if (!oled_active) {
if (I2C_TRANSMIT_P(display_on) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_on) != I2C_STATUS_SUCCESS) {
print("oled_on cmd failed\n"); print("oled_on cmd failed\n");
@@ -473,7 +463,7 @@ bool oled_on(void) {
} }
bool oled_off(void) { bool oled_off(void) {
static const uint8_t PROGMEM display_off[] = { I2C_CMD, DISPLAY_OFF }; static const uint8_t PROGMEM display_off[] = {I2C_CMD, DISPLAY_OFF};
if (oled_active) { if (oled_active) {
if (I2C_TRANSMIT_P(display_off) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_off) != I2C_STATUS_SUCCESS) {
print("oled_off cmd failed\n"); print("oled_off cmd failed\n");
@@ -488,8 +478,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;
@@ -503,8 +492,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;
@@ -516,12 +504,13 @@ bool oled_scroll_left(void) {
bool oled_scroll_off(void) { bool oled_scroll_off(void) {
if (oled_scrolling) { if (oled_scrolling) {
static const uint8_t PROGMEM display_scroll_off[] = { I2C_CMD, DEACTIVATE_SCROLL }; static const uint8_t PROGMEM display_scroll_off[] = {I2C_CMD, DEACTIVATE_SCROLL};
if (I2C_TRANSMIT_P(display_scroll_off) != I2C_STATUS_SUCCESS) { if (I2C_TRANSMIT_P(display_scroll_off) != I2C_STATUS_SUCCESS) {
print("oled_scroll_off cmd failed\n"); print("oled_scroll_off cmd failed\n");
return oled_scrolling; return oled_scrolling;
} }
oled_scrolling = false; oled_scrolling = false;
oled_dirty = -1;
} }
return !oled_scrolling; return !oled_scrolling;
} }
@@ -549,17 +538,32 @@ void oled_task(void) {
oled_task_user(); oled_task_user();
#if OLED_SCROLL_TIMEOUT > 0
if (oled_dirty && oled_scrolling) {
oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT;
oled_scroll_off();
}
#endif
// Smart render system, no need to check for dirty // Smart render system, no need to check for dirty
oled_render(); oled_render();
// Display timeout check // Display timeout check
#if !defined(OLED_DISABLE_TIMEOUT) #if OLED_TIMEOUT > 0
if (oled_active && timer_elapsed(oled_last_activity) > OLED_TIMEOUT) { if (oled_active && timer_expired32(timer_read32(), oled_timeout)) {
oled_off(); oled_off();
} }
#endif #endif
#if OLED_SCROLL_TIMEOUT > 0
if (!oled_scrolling && timer_expired32(timer_read32(), oled_scroll_timeout)) {
# ifdef OLED_SCROLL_TIMEOUT_RIGHT
oled_scroll_right();
# else
oled_scroll_left();
# endif
}
#endif
} }
__attribute__((weak)) __attribute__((weak)) void oled_task_user(void) {}
void oled_task_user(void) {
}

View File

@@ -24,118 +24,130 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define OLED_IC_SH1106 1 #define OLED_IC_SH1106 1
#if defined(OLED_DISPLAY_CUSTOM) #if defined(OLED_DISPLAY_CUSTOM)
// Expected user to implement the necessary defines // Expected user to implement the necessary defines
#elif defined(OLED_DISPLAY_128X64) #elif defined(OLED_DISPLAY_128X64)
// Double height 128x64 // Double height 128x64
#ifndef OLED_DISPLAY_WIDTH # ifndef OLED_DISPLAY_WIDTH
#define OLED_DISPLAY_WIDTH 128 # define OLED_DISPLAY_WIDTH 128
#endif # endif
#ifndef OLED_DISPLAY_HEIGHT # ifndef OLED_DISPLAY_HEIGHT
#define OLED_DISPLAY_HEIGHT 64 # define OLED_DISPLAY_HEIGHT 64
#endif # endif
#ifndef OLED_MATRIX_SIZE # ifndef OLED_MATRIX_SIZE
#define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed) # define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed)
#endif # endif
#ifndef OLED_BLOCK_TYPE # ifndef OLED_BLOCK_TYPE
#define OLED_BLOCK_TYPE uint16_t # define OLED_BLOCK_TYPE uint16_t
#endif # endif
#ifndef OLED_BLOCK_COUNT # ifndef OLED_BLOCK_COUNT
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed) # define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed)
#endif # endif
#ifndef OLED_BLOCK_SIZE # ifndef OLED_BLOCK_SIZE
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed) # define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
#endif # endif
#ifndef OLED_COM_PINS # ifndef OLED_COM_PINS
#define OLED_COM_PINS COM_PINS_ALT # define OLED_COM_PINS COM_PINS_ALT
#endif # endif
// 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 \
#endif { 0, 8, 16, 24, 32, 40, 48, 56 }
#ifndef OLED_TARGET_MAP # endif
#define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 } # ifndef OLED_TARGET_MAP
#endif # define OLED_TARGET_MAP \
// If OLED_BLOCK_TYPE is uint32_t, these tables would look like: { 56, 48, 40, 32, 24, 16, 8, 0 }
// #define OLED_SOURCE_MAP { 32, 40, 48, 56 } # endif
// #define OLED_TARGET_MAP { 24, 16, 8, 0 } // If OLED_BLOCK_TYPE is uint32_t, these tables would look like:
// If OLED_BLOCK_TYPE is uint16_t, these tables would look like: // #define OLED_SOURCE_MAP { 32, 40, 48, 56 }
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } // #define OLED_TARGET_MAP { 24, 16, 8, 0 }
// #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 } // If OLED_BLOCK_TYPE is uint16_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, 64, 72, 80, 88, 96, 104, 112, 120 } // #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
// #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 } // If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }
// #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 }
#else // defined(OLED_DISPLAY_128X64) #else // defined(OLED_DISPLAY_128X64)
// Default 128x32 // Default 128x32
#ifndef OLED_DISPLAY_WIDTH # ifndef OLED_DISPLAY_WIDTH
#define OLED_DISPLAY_WIDTH 128 # define OLED_DISPLAY_WIDTH 128
#endif # endif
#ifndef OLED_DISPLAY_HEIGHT # ifndef OLED_DISPLAY_HEIGHT
#define OLED_DISPLAY_HEIGHT 32 # define OLED_DISPLAY_HEIGHT 32
#endif # endif
#ifndef OLED_MATRIX_SIZE # ifndef OLED_MATRIX_SIZE
#define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed) # define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
#endif # endif
#ifndef OLED_BLOCK_TYPE # ifndef OLED_BLOCK_TYPE
#define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only # define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
#endif # endif
#ifndef OLED_BLOCK_COUNT # ifndef OLED_BLOCK_COUNT
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed) # define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed)
#endif # endif
#ifndef OLED_BLOCK_SIZE # ifndef OLED_BLOCK_SIZE
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed) # define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
#endif # endif
#ifndef OLED_COM_PINS # ifndef OLED_COM_PINS
#define OLED_COM_PINS COM_PINS_SEQ # define OLED_COM_PINS COM_PINS_SEQ
#endif # endif
// 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 \
#endif { 0, 8, 16, 24 }
#ifndef OLED_TARGET_MAP # endif
#define OLED_TARGET_MAP { 24, 16, 8, 0 } # ifndef OLED_TARGET_MAP
#endif # define OLED_TARGET_MAP \
// If OLED_BLOCK_TYPE is uint8_t, these tables would look like: { 24, 16, 8, 0 }
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 } # endif
// #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 } // If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
// #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 }
#endif // defined(OLED_DISPLAY_CUSTOM) #endif // defined(OLED_DISPLAY_CUSTOM)
#if !defined(OLED_IC) #if !defined(OLED_IC)
#define OLED_IC OLED_IC_SSD1306 # define OLED_IC OLED_IC_SSD1306
#endif #endif
// the column address corresponding to the first column in the display hardware // the column address corresponding to the first column in the display hardware
#if !defined(OLED_COLUMN_OFFSET) #if !defined(OLED_COLUMN_OFFSET)
#define OLED_COLUMN_OFFSET 0 # define OLED_COLUMN_OFFSET 0
#endif #endif
// Address to use for the i2c oled communication // Address to use for the i2c oled communication
#if !defined(OLED_DISPLAY_ADDRESS) #if !defined(OLED_DISPLAY_ADDRESS)
#define OLED_DISPLAY_ADDRESS 0x3C # define OLED_DISPLAY_ADDRESS 0x3C
#endif #endif
// Custom font file to use // Custom font file to use
#if !defined(OLED_FONT_H) #if !defined(OLED_FONT_H)
#define OLED_FONT_H "glcdfont.c" # define OLED_FONT_H "glcdfont.c"
#endif #endif
// unsigned char value of the first character in the font file // unsigned char value of the first character in the font file
#if !defined(OLED_FONT_START) #if !defined(OLED_FONT_START)
#define OLED_FONT_START 0 # define OLED_FONT_START 0
#endif #endif
// unsigned char value of the last character in the font file // unsigned char value of the last character in the font file
#if !defined(OLED_FONT_END) #if !defined(OLED_FONT_END)
#define OLED_FONT_END 224 # define OLED_FONT_END 224
#endif #endif
// Font render width // Font render width
#if !defined(OLED_FONT_WIDTH) #if !defined(OLED_FONT_WIDTH)
#define OLED_FONT_WIDTH 6 # define OLED_FONT_WIDTH 6
#endif #endif
// Font render height // Font render height
#if !defined(OLED_FONT_HEIGHT) #if !defined(OLED_FONT_HEIGHT)
#define OLED_FONT_HEIGHT 8 # define OLED_FONT_HEIGHT 8
#endif
#if !defined(OLED_TIMEOUT)
# if defined(OLED_DISABLE_TIMEOUT)
# define OLED_TIMEOUT 0
# else
# define OLED_TIMEOUT 60000
# endif
#endif #endif
// OLED Rotation enum values are flags // OLED Rotation enum values are flags
@@ -200,14 +212,14 @@ void oled_write_P(const char *data, bool invert);
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM // Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
void oled_write_ln_P(const char *data, bool invert); void oled_write_ln_P(const char *data, bool invert);
#else #else
// Writes a string to the buffer at current cursor position // Writes a string to the buffer at current cursor position
// Advances the cursor while writing, inverts the pixels if true // Advances the cursor while writing, inverts the pixels if true
#define oled_write_P(data, invert) oled_write(data, invert) # define oled_write_P(data, invert) oled_write(data, invert)
// Writes a string to the buffer at current cursor position // Writes a string to the buffer at current cursor position
// Advances the cursor while writing, inverts the pixels if true // Advances the cursor while writing, inverts the pixels if true
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page // Advances the cursor to the next page, wiring ' ' to the remainder of the current page
#define oled_write_ln_P(data, invert) oled_write(data, invert) # define oled_write_ln_P(data, invert) oled_write(data, invert)
#endif // defined(__AVR__) #endif // defined(__AVR__)
// Can be used to manually turn on the screen if it is off // Can be used to manually turn on the screen if it is off

View File

@@ -35,16 +35,21 @@
#include "string.h" #include "string.h"
#define TOTALFONTS 2 #define TOTALFONTS 2
const unsigned char * fonts_pointer[]= { font5x7, font8x16 }; const unsigned char* fonts_pointer[] = {font5x7, font8x16};
uint8_t foreColor,drawMode,fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY; uint8_t foreColor, drawMode, fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY;
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};
/* LCD Memory organised in 64 horizontal pixel and 6 rows of byte /* LCD Memory organised in 64 horizontal pixel and 6 rows of byte
B B .............B ----- B B .............B -----
@@ -64,256 +69,39 @@ static uint8_t micro_oled_screen_current[LCDWIDTH*LCDWIDTH/8] = { 0 };
*/ */
#if LCDWIDTH == 64 #if LCDWIDTH == 64
#if LCDWIDTH == 48 # if LCDWIDTH == 48
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, # endif
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
#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, # elif LCDHEIGHT == 64
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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,
0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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,
0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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,
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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, // TODO: generate bitmap of QMK logo here
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03, # endif
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
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,
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
#endif
#else #else
//catchall for custom screen szies // catchall for custom screen szies
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);
@@ -338,11 +126,11 @@ void micro_oled_init(void) {
send_command(NORMALDISPLAY); // 0xA6 send_command(NORMALDISPLAY); // 0xA6
send_command(DISPLAYALLONRESUME); // 0xA4 send_command(DISPLAYALLONRESUME); // 0xA4
//display at regular orientation // display at regular orientation
send_command(SEGREMAP | 0x1); send_command(SEGREMAP | 0x1);
send_command(COMSCANDEC); send_command(COMSCANDEC);
//rotate display 180 // rotate display 180
#ifdef micro_oled_rotate_180 #ifdef micro_oled_rotate_180
send_command(SEGREMAP); send_command(SEGREMAP);
send_command(COMSCANINC); send_command(COMSCANINC);
@@ -352,11 +140,11 @@ void micro_oled_init(void) {
send_command(0x10); send_command(0x10);
send_command(SETCOMPINS); // 0xDA send_command(SETCOMPINS); // 0xDA
if (LCDHEIGHT > 32) { if (LCDHEIGHT > 32) {
send_command(0x12); send_command(0x12);
} else { } else {
send_command(0x02); send_command(0x02);
} }
send_command(SETCONTRAST); // 0x81 send_command(SETCONTRAST); // 0x81
send_command(0x8F); send_command(0x8F);
@@ -395,18 +183,18 @@ void set_page_address(uint8_t address) {
Send column address command and address to the SSD1306 OLED controller. Send column address command and address to the SSD1306 OLED controller.
*/ */
void set_column_address(uint8_t address) { void set_column_address(uint8_t address) {
send_command( ( 0x10 | (address >> 4) ) + ((128 - LCDWIDTH) >> 8) ); send_command((0x10 | (address >> 4)) + ((128 - LCDWIDTH) >> 8));
send_command( 0x0F & address ); send_command(0x0F & address);
} }
/** \brief Clear SSD1306's memory. /** \brief Clear SSD1306's memory.
To clear GDRAM inside the LCD controller. To clear GDRAM inside the LCD controller.
*/ */
void clear_screen(void) { void clear_screen(void) {
for (int i=0;i<8; i++) { for (int i = 0; i < 8; i++) {
set_page_address(i); set_page_address(i);
set_column_address(0); set_column_address(0);
for (int j=0; j<0x80; j++) { for (int j = 0; j < 0x80; j++) {
send_data(0); send_data(0);
} }
} }
@@ -416,8 +204,8 @@ void clear_screen(void) {
To clear GDRAM inside the LCD controller. To clear GDRAM inside the LCD controller.
*/ */
void clear_buffer(void) { void clear_buffer(void) {
//384 // 384
memset(micro_oled_screen_buffer, 0, LCDWIDTH*LCDWIDTH/8); memset(micro_oled_screen_buffer, 0, LCDWIDTH * LCDWIDTH / 8);
} }
/** \brief Invert display. /** \brief Invert display.
@@ -446,18 +234,18 @@ void send_buffer(void) {
uint8_t i, j; uint8_t i, j;
uint8_t page_addr = 0xFF; uint8_t page_addr = 0xFF;
for (i = 0; i < LCDHEIGHT/8; i++) { for (i = 0; i < LCDHEIGHT / 8; i++) {
uint8_t col_addr = 0xFF; uint8_t col_addr = 0xFF;
for (j = 0; j < LCDWIDTH; j++) { for (j = 0; j < LCDWIDTH; j++) {
if (micro_oled_screen_buffer[i*LCDWIDTH+j] != micro_oled_screen_current[i*LCDWIDTH+j]) { if (micro_oled_screen_buffer[i * LCDWIDTH + j] != micro_oled_screen_current[i * LCDWIDTH + j]) {
if (page_addr != i) { if (page_addr != i) {
set_page_address(i); set_page_address(i);
} }
if (col_addr != j) { if (col_addr != j) {
set_column_address(j); set_column_address(j);
} }
send_data(micro_oled_screen_buffer[i*LCDWIDTH+j]); send_data(micro_oled_screen_buffer[i * LCDWIDTH + j]);
micro_oled_screen_current[i*LCDWIDTH+j] = micro_oled_screen_buffer[i*LCDWIDTH+j]; micro_oled_screen_current[i * LCDWIDTH + j] = micro_oled_screen_buffer[i * LCDWIDTH + j];
col_addr = j + 1; col_addr = j + 1;
} }
} }
@@ -468,17 +256,15 @@ 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));
else else
micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] &= ~_BV((y%8)); micro_oled_screen_buffer[x + (y / 8) * LCDWIDTH] &= ~_BV((y % 8));
} }
} }
@@ -507,9 +293,10 @@ 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) {
draw_pixel(y0, x0, color, mode); draw_pixel(y0, x0, color, mode);
} else { } else {
@@ -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.
@@ -543,17 +326,17 @@ Draw rectangle using color and mode from x,y to x+width,y+height of the screen b
void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
uint8_t tempHeight; uint8_t tempHeight;
draw_line_hori(x,y, width, color, mode); draw_line_hori(x, y, width, color, mode);
draw_line_hori(x,y+height-1, width, color, mode); draw_line_hori(x, y + height - 1, width, color, mode);
tempHeight=height-2; tempHeight = height - 2;
// skip drawing vertical lines to avoid overlapping of pixel that will // skip drawing vertical lines to avoid overlapping of pixel that will
// affect XOR plot if no pixel in between horizontal lines // affect XOR plot if no pixel in between horizontal lines
if (tempHeight<1) return; if (tempHeight < 1) return;
draw_line_vert(x,y+1, tempHeight, color, mode); draw_line_vert(x, y + 1, tempHeight, color, mode);
draw_line_vert(x+width-1, y+1, tempHeight, color, mode); draw_line_vert(x + width - 1, y + 1, tempHeight, color, mode);
} }
/** \brief Draw rectangle with color and mode. /** \brief Draw rectangle with color and mode.
@@ -562,17 +345,17 @@ Draw rectangle using color and mode from x,y to x+width,y+height of the screen b
void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
uint8_t tempHeight; uint8_t tempHeight;
draw_line_hori(x+1,y, width-2, color, mode); draw_line_hori(x + 1, y, width - 2, color, mode);
draw_line_hori(x+1,y+height-1, width-2, color, mode); draw_line_hori(x + 1, y + height - 1, width - 2, color, mode);
tempHeight=height-2; tempHeight = height - 2;
// skip drawing vertical lines to avoid overlapping of pixel that will // skip drawing vertical lines to avoid overlapping of pixel that will
// affect XOR plot if no pixel in between horizontal lines // affect XOR plot if no pixel in between horizontal lines
if (tempHeight<1) return; if (tempHeight < 1) return;
draw_line_vert(x,y+1, tempHeight, color, mode); draw_line_vert(x, y + 1, tempHeight, color, mode);
draw_line_vert(x+width-1, y+1, tempHeight, color, mode); draw_line_vert(x + width - 1, y + 1, tempHeight, color, mode);
} }
/** \brief Draw filled rectangle with color and mode. /** \brief Draw filled rectangle with color and mode.
@@ -580,8 +363,8 @@ Draw filled rectangle using color and mode from x,y to x+width,y+height of the s
*/ */
void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
// TODO - need to optimise the memory map draw so that this function will not call pixel one by one // TODO - need to optimise the memory map draw so that this function will not call pixel one by one
for (int i=x; i<x+width;i++) { for (int i = x; i < x + width; i++) {
draw_line_vert(i,y, height, color, mode); draw_line_vert(i, y, height, color, mode);
} }
} }
@@ -590,9 +373,9 @@ Draw filled rectangle using color and mode from x,y to x+width,y+height of the s
*/ */
void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) {
// TODO - need to optimise the memory map draw so that this function will not call pixel one by one // TODO - need to optimise the memory map draw so that this function will not call pixel one by one
for (int i=x; i<x+width;i++) { for (int i = x; i < x + width; i++) {
if (i == x || i == (x + width - 1)) if (i == x || i == (x + width - 1))
draw_line_vert(i, y+1, height-2, color, mode); draw_line_vert(i, y + 1, height - 2, color, mode);
else else
draw_line_vert(i, y, height, color, mode); draw_line_vert(i, y, height, color, mode);
} }
@@ -604,46 +387,44 @@ void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height,
void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font) { void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font) {
// TODO - New routine to take font of any height, at the moment limited to font height in multiple of 8 pixels // TODO - New routine to take font of any height, at the moment limited to font height in multiple of 8 pixels
uint8_t rowsToDraw,row, tempC; uint8_t rowsToDraw, row, tempC;
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);
uint8_t fontHeight = pgm_read_byte(fonts_pointer[fontType]+1); uint8_t fontHeight = pgm_read_byte(fonts_pointer[fontType] + 1);
uint8_t fontStartChar = pgm_read_byte(fonts_pointer[fontType]+2); uint8_t fontStartChar = pgm_read_byte(fonts_pointer[fontType] + 2);
uint8_t fontTotalChar = pgm_read_byte(fonts_pointer[fontType]+3); uint8_t fontTotalChar = pgm_read_byte(fonts_pointer[fontType] + 3);
uint16_t fontMapWidth = (pgm_read_byte(fonts_pointer[fontType]+4)*100)+pgm_read_byte(fonts_pointer[fontType]+5); // two bytes values into integer 16 uint16_t fontMapWidth = (pgm_read_byte(fonts_pointer[fontType] + 4) * 100) + pgm_read_byte(fonts_pointer[fontType] + 5); // two bytes values into integer 16
if ((c<fontStartChar) || (c>(fontStartChar+fontTotalChar-1))) // no bitmap for the required c if ((c < fontStartChar) || (c > (fontStartChar + fontTotalChar - 1))) // no bitmap for the required c
return; return;
tempC=c-fontStartChar; tempC = c - fontStartChar;
// each row (in datasheet is call page) is 8 bits high, 16 bit high character will have 2 rows to be drawn // each row (in datasheet is call page) is 8 bits high, 16 bit high character will have 2 rows to be drawn
rowsToDraw=fontHeight/8; // 8 is LCD's page size, see SSD1306 datasheet rowsToDraw = fontHeight / 8; // 8 is LCD's page size, see SSD1306 datasheet
if (rowsToDraw<=1) rowsToDraw=1; if (rowsToDraw <= 1) rowsToDraw = 1;
// the following draw function can draw anywhere on the screen, but SLOW pixel by pixel draw // the following draw function can draw anywhere on the screen, but SLOW pixel by pixel draw
if (rowsToDraw==1) { if (rowsToDraw == 1) {
for (i=0;i<fontWidth+1;i++) { for (i = 0; i < fontWidth + 1; i++) {
if (i==fontWidth) // this is done in a weird way because for 5x7 font, there is no margin, this code add a margin after col 5 if (i == fontWidth) // this is done in a weird way because for 5x7 font, there is no margin, this code add a margin after col 5
temp=0; temp = 0;
else else
temp=pgm_read_byte(fonts_pointer[fontType]+FONTHEADERSIZE+(tempC*fontWidth)+i); temp = pgm_read_byte(fonts_pointer[fontType] + FONTHEADERSIZE + (tempC * fontWidth) + i);
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);
} }
temp >>=1; temp >>= 1;
} }
} }
return; return;
@@ -651,41 +432,36 @@ void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uin
// font height over 8 bit // font height over 8 bit
// take character "0" ASCII 48 as example // take character "0" ASCII 48 as example
charPerBitmapRow = fontMapWidth/fontWidth; // 256/8 =32 char per row charPerBitmapRow = fontMapWidth / fontWidth; // 256/8 =32 char per row
charColPositionOnBitmap = tempC % charPerBitmapRow; // =16 charColPositionOnBitmap = tempC % charPerBitmapRow; // =16
charRowPositionOnBitmap = (int)(tempC/charPerBitmapRow); // =1 charRowPositionOnBitmap = (int)(tempC / charPerBitmapRow); // =1
charBitmapStartPosition = (charRowPositionOnBitmap * fontMapWidth * (fontHeight/8)) + (charColPositionOnBitmap * fontWidth) ; charBitmapStartPosition = (charRowPositionOnBitmap * fontMapWidth * (fontHeight / 8)) + (charColPositionOnBitmap * fontWidth);
// each row on LCD is 8 bit height (see datasheet for explanation) // each row on LCD is 8 bit height (see datasheet for explanation)
for(row=0;row<rowsToDraw;row++) { for (row = 0; row < rowsToDraw; row++) {
for (i=0; i<fontWidth;i++) { for (i = 0; i < fontWidth; i++) {
temp=pgm_read_byte(fonts_pointer[fontType]+FONTHEADERSIZE+(charBitmapStartPosition+i+(row*fontMapWidth))); temp = pgm_read_byte(fonts_pointer[fontType] + FONTHEADERSIZE + (charBitmapStartPosition + i + (row * fontMapWidth)));
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 {
draw_pixel(x + i, y + j + (row * 8), !color, mode);
} }
else { temp >>= 1;
draw_pixel(x+i,y+j+(row*8), !color, mode);
}
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);
uint8_t cur_x = x; uint8_t cur_x = x;
for (int i = 0; i < strlen(string); i++) { for (int i = 0; i < strlen(string); i++) {
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

@@ -49,11 +49,11 @@ void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t
void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode); void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode); void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font); void draw_char(uint8_t x, uint8_t y, uint8_t c, 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); void draw_string(uint8_t x, uint8_t y, char* string, uint8_t color, uint8_t mode, uint8_t font);
#define I2C_ADDRESS_SA0_0 0b0111100 #define I2C_ADDRESS_SA0_0 0b0111100
#ifndef I2C_ADDRESS_SA0_1 #ifndef I2C_ADDRESS_SA0_1
#define I2C_ADDRESS_SA0_1 0b0111101 # define I2C_ADDRESS_SA0_1 0b0111101
#endif #endif
#define I2C_COMMAND 0x00 #define I2C_COMMAND 0x00
#define I2C_DATA 0x40 #define I2C_DATA 0x40
@@ -61,10 +61,10 @@ void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mod
#define PIXEL_ON 1 #define PIXEL_ON 1
#ifndef LCDWIDTH #ifndef LCDWIDTH
#define LCDWIDTH 64 # define LCDWIDTH 64
#endif #endif
#ifndef LCDWIDTH #ifndef LCDWIDTH
#define LCDHEIGHT 48 # define LCDHEIGHT 48
#endif #endif
#define FONTHEADERSIZE 6 #define FONTHEADERSIZE 6
@@ -112,23 +112,23 @@ void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mod
#define VERTICALLEFTHORIZONTALSCROLL 0x2A #define VERTICALLEFTHORIZONTALSCROLL 0x2A
typedef enum CMD { typedef enum CMD {
CMD_CLEAR, //0 CMD_CLEAR, // 0
CMD_INVERT, //1 CMD_INVERT, // 1
CMD_CONTRAST, //2 CMD_CONTRAST, // 2
CMD_DISPLAY, //3 CMD_DISPLAY, // 3
CMD_SETCURSOR, //4 CMD_SETCURSOR, // 4
CMD_PIXEL, //5 CMD_PIXEL, // 5
CMD_LINE, //6 CMD_LINE, // 6
CMD_LINEH, //7 CMD_LINEH, // 7
CMD_LINEV, //8 CMD_LINEV, // 8
CMD_RECT, //9 CMD_RECT, // 9
CMD_RECTFILL, //10 CMD_RECTFILL, // 10
CMD_CIRCLE, //11 CMD_CIRCLE, // 11
CMD_CIRCLEFILL, //12 CMD_CIRCLEFILL, // 12
CMD_DRAWCHAR, //13 CMD_DRAWCHAR, // 13
CMD_DRAWBITMAP, //14 CMD_DRAWBITMAP, // 14
CMD_GETLCDWIDTH, //15 CMD_GETLCDWIDTH, // 15
CMD_GETLCDHEIGHT, //16 CMD_GETLCDHEIGHT, // 16
CMD_SETCOLOR, //17 CMD_SETCOLOR, // 17
CMD_SETDRAWMODE //18 CMD_SETDRAWMODE // 18
} commCommand_t; } commCommand_t;

View File

@@ -16,16 +16,16 @@
#include "qwiic.h" #include "qwiic.h"
void qwiic_init(void) { void qwiic_init(void) {
#ifdef QWIIC_JOYSTIIC_ENABLE #ifdef QWIIC_JOYSTIIC_ENABLE
joystiic_init(); joystiic_init();
#endif #endif
#ifdef QWIIC_MICRO_OLED_ENABLE #ifdef QWIIC_MICRO_OLED_ENABLE
micro_oled_init(); micro_oled_init();
#endif #endif
} }
void qwiic_task(void) { void qwiic_task(void) {
#ifdef QWIIC_JOYSTIIC_ENABLE #ifdef QWIIC_JOYSTIIC_ENABLE
joystiic_task(); joystiic_task();
#endif #endif
} }

View File

@@ -18,10 +18,10 @@
#include "i2c_master.h" #include "i2c_master.h"
#ifdef QWIIC_JOYSTIIC_ENABLE #ifdef QWIIC_JOYSTIIC_ENABLE
#include "joystiic.h" # include "joystiic.h"
#endif #endif
#ifdef QWIIC_MICRO_OLED_ENABLE #ifdef QWIIC_MICRO_OLED_ENABLE
#include "micro_oled.h" # include "micro_oled.h"
#endif #endif
void qwiic_init(void); void qwiic_init(void);

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

@@ -35,35 +35,34 @@ static const uint8_t led_mask[] = {
}; };
// The address of the LED // The address of the LED
#define LA(c, r) (c + r * 16 ) #define LA(c, r) (c + r * 16)
// Need to be an address that is not mapped, but inside the range of the controller matrix // Need to be an address that is not mapped, but inside the range of the controller matrix
#define NA LA(8, 8) #define NA LA(8, 8)
// The numbers in the comments are the led numbers DXX on the PCB // The numbers in the comments are the led numbers DXX on the PCB
// The mapping is taken from the schematic of left hand side // The mapping is taken from the schematic of left hand side
static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = { static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
// 45 44 43 42 41 40 39 // 45 44 43 42 41 40 39
{ LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)}, {LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)},
// 52 51 50 49 48 47 46 // 52 51 50 49 48 47 46
{ LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) }, {LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2)},
// 58 57 56 55 54 53 N/A // 58 57 56 55 54 53 N/A
{ LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA }, {LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA},
// 67 66 65 64 63 62 61 // 67 66 65 64 63 62 61
{ LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) }, {LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2)},
// 76 75 74 73 72 60 59 // 76 75 74 73 72 60 59
{ LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) }, {LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0)},
// N/A N/A N/A N/A N/A N/A 68 // N/A N/A N/A N/A N/A N/A 68
{ NA, NA, NA, NA, NA, NA, LA(5, 4) }, {NA, NA, NA, NA, NA, NA, LA(5, 4)},
// N/A N/A N/A N/A 71 70 69 // N/A N/A N/A N/A 71 70 69
{ 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
static GFXINLINE void init_board(GDisplay *g) { static GFXINLINE void init_board(GDisplay* g) {
(void) g; (void)g;
/* I2C pins */ /* I2C pins */
palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
@@ -77,33 +76,29 @@ 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];
} }
static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) { 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);
} }
} }
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;
i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT)); i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
} }

View File

@@ -19,15 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if GFX_USE_GDISP #if GFX_USE_GDISP
#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK # define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
#define GDISP_SCREEN_HEIGHT LED_HEIGHT # define GDISP_SCREEN_HEIGHT LED_HEIGHT
#define GDISP_SCREEN_WIDTH LED_WIDTH # define GDISP_SCREEN_WIDTH LED_WIDTH
#include "gdisp_lld_config.h" # include "gdisp_lld_config.h"
#include "src/gdisp/gdisp_driver.h" # include "src/gdisp/gdisp_driver.h"
#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[];
@@ -36,96 +35,96 @@ extern const uint8_t CIE1931_CURVE[];
/* Driver local definitions. */ /* Driver local definitions. */
/*===========================================================================*/ /*===========================================================================*/
#ifndef GDISP_INITIAL_CONTRAST # ifndef GDISP_INITIAL_CONTRAST
#define GDISP_INITIAL_CONTRAST 0 # define GDISP_INITIAL_CONTRAST 0
#endif # endif
#ifndef GDISP_INITIAL_BACKLIGHT # ifndef GDISP_INITIAL_BACKLIGHT
#define GDISP_INITIAL_BACKLIGHT 0 # define GDISP_INITIAL_BACKLIGHT 0
#endif # endif
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) # define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER << 0)
#define IS31_ADDR_DEFAULT 0x74 # define IS31_ADDR_DEFAULT 0x74
#define IS31_REG_CONFIG 0x00 # define IS31_REG_CONFIG 0x00
// bits in reg // bits in reg
#define IS31_REG_CONFIG_PICTUREMODE 0x00 # define IS31_REG_CONFIG_PICTUREMODE 0x00
#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08 # define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18 # define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
// D2:D0 bits are starting frame for autoplay mode // D2:D0 bits are starting frame for autoplay mode
#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode # define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
#define IS31_REG_AUTOPLAYCTRL1 0x02 # define IS31_REG_AUTOPLAYCTRL1 0x02
// D6:D4 number of loops (000=infty) // D6:D4 number of loops (000=infty)
// D2:D0 number of frames to be used // D2:D0 number of frames to be used
#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms) # define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
#define IS31_REG_DISPLAYOPT 0x05 # define IS31_REG_DISPLAYOPT 0x05
#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames # define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8 # define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
// D2:D0 bits blink period time (*0.27s) // D2:D0 bits blink period time (*0.27s)
#define IS31_REG_AUDIOSYNC 0x06 # define IS31_REG_AUDIOSYNC 0x06
#define IS31_REG_AUDIOSYNC_ENABLE 0x1 # define IS31_REG_AUDIOSYNC_ENABLE 0x1
#define IS31_REG_FRAMESTATE 0x07 # define IS31_REG_FRAMESTATE 0x07
#define IS31_REG_BREATHCTRL1 0x08 # define IS31_REG_BREATHCTRL1 0x08
// D6:D4 fade out time (26ms*2^i) // D6:D4 fade out time (26ms*2^i)
// D2:D0 fade in time (26ms*2^i) // D2:D0 fade in time (26ms*2^i)
#define IS31_REG_BREATHCTRL2 0x09 # define IS31_REG_BREATHCTRL2 0x09
#define IS31_REG_BREATHCTRL2_ENABLE 0x10 # define IS31_REG_BREATHCTRL2_ENABLE 0x10
// D2:D0 extinguish time (3.5ms*2^i) // D2:D0 extinguish time (3.5ms*2^i)
#define IS31_REG_SHUTDOWN 0x0A # define IS31_REG_SHUTDOWN 0x0A
#define IS31_REG_SHUTDOWN_OFF 0x0 # define IS31_REG_SHUTDOWN_OFF 0x0
#define IS31_REG_SHUTDOWN_ON 0x1 # define IS31_REG_SHUTDOWN_ON 0x1
#define IS31_REG_AGCCTRL 0x0B # define IS31_REG_AGCCTRL 0x0B
#define IS31_REG_ADCRATE 0x0C # define IS31_REG_ADCRATE 0x0C
#define IS31_COMMANDREGISTER 0xFD # define IS31_COMMANDREGISTER 0xFD
#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine' # define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
#define IS31_FUNCTIONREG_SIZE 0xD # define IS31_FUNCTIONREG_SIZE 0xD
#define IS31_FRAME_SIZE 0xB4 # define IS31_FRAME_SIZE 0xB4
#define IS31_PWM_REG 0x24 # define IS31_PWM_REG 0x24
#define IS31_PWM_SIZE 0x90 # define IS31_PWM_SIZE 0x90
#define IS31_LED_MASK_SIZE 0x12 # define IS31_LED_MASK_SIZE 0x12
#define IS31 # define IS31
/*===========================================================================*/ /*===========================================================================*/
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
typedef struct{ typedef struct {
uint8_t write_buffer_offset; uint8_t write_buffer_offset;
uint8_t write_buffer[IS31_FRAME_SIZE]; uint8_t write_buffer[IS31_FRAME_SIZE];
uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH]; uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
uint8_t page; uint8_t page;
}__attribute__((__packed__)) PrivData; } __attribute__((__packed__)) PrivData;
// Some common routines and macros // Some common routines and macros
#define PRIV(g) ((PrivData*)g->priv) # define PRIV(g) ((PrivData *)g->priv)
/*===========================================================================*/ /*===========================================================================*/
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
static GFXINLINE void write_page(GDisplay* g, uint8_t page) { static GFXINLINE void write_page(GDisplay *g, uint8_t page) {
uint8_t tx[2] __attribute__((aligned(2))); uint8_t tx[2] __attribute__((aligned(2)));
tx[0] = IS31_COMMANDREGISTER; tx[0] = IS31_COMMANDREGISTER;
tx[1] = page; tx[1] = page;
write_data(g, tx, 2); write_data(g, tx, 2);
} }
static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) { static GFXINLINE void write_register(GDisplay *g, uint8_t page, uint8_t reg, uint8_t data) {
uint8_t tx[2] __attribute__((aligned(2))); uint8_t tx[2] __attribute__((aligned(2)));
tx[0] = reg; tx[0] = reg;
tx[1] = data; tx[1] = data;
@@ -136,7 +135,7 @@ static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uin
static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) { static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
PRIV(g)->write_buffer_offset = offset; PRIV(g)->write_buffer_offset = offset;
write_page(g, page); write_page(g, page);
write_data(g, (uint8_t*)PRIV(g), length + 1); write_data(g, (uint8_t *)PRIV(g), length + 1);
} }
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
@@ -160,10 +159,9 @@ 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++) {
write_ram(g, i, 0, IS31_FRAME_SIZE); write_ram(g, i, 0, IS31_FRAME_SIZE);
gfxSleepMilliseconds(1); gfxSleepMilliseconds(1);
} }
@@ -185,11 +183,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
return TRUE; return TRUE;
} }
#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;
@@ -197,11 +194,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// We should run only one physical page at a time // We should run only one physical page at a time
// This way we don't need to send so much data, and // This way we don't need to send so much data, and
// we could use slightly less memory // we could use slightly less memory
uint8_t* src = PRIV(g)->frame_buffer; uint8_t *src = PRIV(g)->frame_buffer;
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { for (int y = 0; y < GDISP_SCREEN_HEIGHT; y++) {
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { for (int x = 0; x < GDISP_SCREEN_WIDTH; x++) {
uint8_t val = (uint16_t)*src * g->g.Backlight / 100; uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val]; PRIV(g)->write_buffer[get_led_address(g, x, y)] = CIE1931_CURVE[val];
++src; ++src;
} }
} }
@@ -210,55 +207,54 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page); write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
g->flags &= ~GDISP_FLG_NEEDFLUSH; g->flags &= ~GDISP_FLG_NEEDFLUSH;
} }
#endif # endif
#if GDISP_HARDWARE_DRAWPIXEL # if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
coord_t x, y; coord_t x, y;
switch(g->g.Orientation) { switch (g->g.Orientation) {
default: default:
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
x = g->p.x; x = g->p.x;
y = g->p.y; y = g->p.y;
break; break;
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
x = GDISP_SCREEN_WIDTH-1 - g->p.x; x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
y = g->p.y; y = g->p.y;
break; break;
} }
PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color); PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
g->flags |= GDISP_FLG_NEEDFLUSH; g->flags |= GDISP_FLG_NEEDFLUSH;
} }
#endif # endif
#if GDISP_HARDWARE_PIXELREAD # if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
coord_t x, y; coord_t x, y;
switch(g->g.Orientation) { switch (g->g.Orientation) {
default: default:
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
x = g->p.x; x = g->p.x;
y = g->p.y; y = g->p.y;
break; break;
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
x = GDISP_SCREEN_WIDTH-1 - g->p.x; x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
y = g->p.y; y = g->p.y;
break; break;
} }
return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]); return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
} }
#endif # endif
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL # if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
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:
case powerDeepSleep: case powerDeepSleep:
@@ -274,9 +270,8 @@ 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:
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
@@ -295,14 +290,13 @@ 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;
return; return;
} }
} }
#endif // GDISP_NEED_CONTROL # endif // GDISP_NEED_CONTROL
#endif // GFX_USE_GDISP #endif // GFX_USE_GDISP

View File

@@ -24,12 +24,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Driver hardware support. */ /* Driver hardware support. */
/*===========================================================================*/ /*===========================================================================*/
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing # define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE # define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE # define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE # define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256 # define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
#endif /* GFX_USE_GDISP */ #endif /* GFX_USE_GDISP */

View File

@@ -11,7 +11,7 @@
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6 #define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
#define ST7565_ADC ST7565_ADC_NORMAL #define ST7565_ADC ST7565_ADC_NORMAL
#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC #define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
#define ST7565_PAGE_ORDER 0,1,2,3 #define ST7565_PAGE_ORDER 0, 1, 2, 3
/* /*
* Custom page order for several LCD boards, e.g. HEM12864-99 * Custom page order for several LCD boards, e.g. HEM12864-99
* #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3 * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
@@ -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
@@ -39,13 +37,12 @@
static const SPIConfig spi1config = { static const SPIConfig spi1config = {
// Operation complete callback or @p NULL. // Operation complete callback or @p NULL.
.end_cb = NULL, .end_cb = NULL,
//The chip select line port - when not using pcs. // The chip select line port - when not using pcs.
.ssport = ST7565_GPIOPORT, .ssport = ST7565_GPIOPORT,
// 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
@@ -54,21 +51,21 @@ static const SPIConfig spi1config = {
}; };
static GFXINLINE void acquire_bus(GDisplay *g) { static GFXINLINE void acquire_bus(GDisplay *g) {
(void) g; (void)g;
// Only the LCD is using the SPI bus, so no need to acquire // Only the LCD is using the SPI bus, so no need to acquire
// spiAcquireBus(&SPID1); // spiAcquireBus(&SPID1);
spiSelect(&SPID1); spiSelect(&SPID1);
} }
static GFXINLINE void release_bus(GDisplay *g) { static GFXINLINE void release_bus(GDisplay *g) {
(void) g; (void)g;
// Only the LCD is using the SPI bus, so no need to release // Only the LCD is using the SPI bus, so no need to release
//spiReleaseBus(&SPID1); // spiReleaseBus(&SPID1);
spiUnselect(&SPID1); spiUnselect(&SPID1);
} }
static GFXINLINE void init_board(GDisplay *g) { static GFXINLINE void init_board(GDisplay *g) {
(void) g; (void)g;
palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL); palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
@@ -82,31 +79,23 @@ 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) { static GFXINLINE void enter_cmd_mode(GDisplay *g) { palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN); }
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;
spiSend(&SPID1, length, data); spiSend(&SPID1, length, data);
} }

View File

@@ -9,82 +9,89 @@
#if GFX_USE_GDISP #if GFX_USE_GDISP
#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK # define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
#include "gdisp_lld_config.h" # include "gdisp_lld_config.h"
#include "src/gdisp/gdisp_driver.h" # include "src/gdisp/gdisp_driver.h"
#include "board_st7565.h" # include "board_st7565.h"
/*===========================================================================*/ /*===========================================================================*/
/* Driver local definitions. */ /* Driver local definitions. */
/*===========================================================================*/ /*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT # ifndef GDISP_SCREEN_HEIGHT
#define GDISP_SCREEN_HEIGHT LCD_HEIGHT # define GDISP_SCREEN_HEIGHT LCD_HEIGHT
#endif # endif
#ifndef GDISP_SCREEN_WIDTH # ifndef GDISP_SCREEN_WIDTH
#define GDISP_SCREEN_WIDTH LCD_WIDTH # define GDISP_SCREEN_WIDTH LCD_WIDTH
#endif # endif
#ifndef GDISP_INITIAL_CONTRAST # ifndef GDISP_INITIAL_CONTRAST
#define GDISP_INITIAL_CONTRAST 35 # define GDISP_INITIAL_CONTRAST 35
#endif # endif
#ifndef GDISP_INITIAL_BACKLIGHT # ifndef GDISP_INITIAL_BACKLIGHT
#define GDISP_INITIAL_BACKLIGHT 100 # define GDISP_INITIAL_BACKLIGHT 100
#endif # endif
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) # define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER << 0)
#include "st7565.h" # include "st7565.h"
/*===========================================================================*/ /*===========================================================================*/
/* Driver config defaults for backward compatibility. */ /* Driver config defaults for backward compatibility. */
/*===========================================================================*/ /*===========================================================================*/
#ifndef ST7565_LCD_BIAS # ifndef ST7565_LCD_BIAS
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 # define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
#endif # endif
#ifndef ST7565_ADC # ifndef ST7565_ADC
#define ST7565_ADC ST7565_ADC_NORMAL # define ST7565_ADC ST7565_ADC_NORMAL
#endif # endif
#ifndef ST7565_COM_SCAN # ifndef ST7565_COM_SCAN
#define ST7565_COM_SCAN ST7565_COM_SCAN_INC # define ST7565_COM_SCAN ST7565_COM_SCAN_INC
#endif # endif
#ifndef ST7565_PAGE_ORDER # ifndef ST7565_PAGE_ORDER
#define ST7565_PAGE_ORDER 0,1,2,3 # define ST7565_PAGE_ORDER 0, 1, 2, 3
#endif # endif
/*===========================================================================*/ /*===========================================================================*/
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
typedef struct{ typedef struct {
bool_t buffer2; bool_t buffer2;
uint8_t data_pos; uint8_t data_pos;
uint8_t data[16]; uint8_t data[16];
uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8]; uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8];
}PrivData; } PrivData;
// Some common routines and macros // Some common routines and macros
#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)
#define delay_ms(ms) gfxSleepMilliseconds(ms) # define delay_ms(ms) gfxSleepMilliseconds(ms)
#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH) # define xyaddr(x, y) ((x) + ((y) >> 3) * GDISP_SCREEN_WIDTH)
#define xybit(y) (1<<((y)&7)) # define xybit(y) (1 << ((y)&7))
/*===========================================================================*/ /*===========================================================================*/
/* Driver exported functions. */ /* Driver exported functions. */
@@ -148,13 +155,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
return TRUE; return TRUE;
} }
#if GDISP_HARDWARE_FLUSH # if GDISP_HARDWARE_FLUSH
LLDSPEC void gdisp_lld_flush(GDisplay *g) { 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);
@@ -166,7 +172,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
write_cmd(g, ST7565_RMW); write_cmd(g, ST7565_RMW);
flush_cmd(g); flush_cmd(g);
enter_data_mode(g); enter_data_mode(g);
write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH); write_data(g, RAM(g) + (p * GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
enter_cmd_mode(g); enter_cmd_mode(g);
} }
unsigned line = (PRIV(g)->buffer2 ? 32 : 0); unsigned line = (PRIV(g)->buffer2 ? 32 : 0);
@@ -177,13 +183,13 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
g->flags &= ~GDISP_FLG_NEEDFLUSH; g->flags &= ~GDISP_FLG_NEEDFLUSH;
} }
#endif # endif
#if GDISP_HARDWARE_DRAWPIXEL # if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
coord_t x, y; coord_t x, y;
switch(g->g.Orientation) { switch (g->g.Orientation) {
default: default:
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
x = g->p.x; x = g->p.x;
@@ -191,14 +197,14 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
break; break;
case GDISP_ROTATE_90: case GDISP_ROTATE_90:
x = g->p.y; x = g->p.y;
y = GDISP_SCREEN_HEIGHT-1 - g->p.x; y = GDISP_SCREEN_HEIGHT - 1 - g->p.x;
break; break;
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
x = GDISP_SCREEN_WIDTH-1 - g->p.x; x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
y = GDISP_SCREEN_HEIGHT-1 - g->p.y; y = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
break; break;
case GDISP_ROTATE_270: case GDISP_ROTATE_270:
x = GDISP_SCREEN_HEIGHT-1 - g->p.y; x = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
y = g->p.x; y = g->p.x;
break; break;
} }
@@ -208,13 +214,13 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
RAM(g)[xyaddr(x, y)] &= ~xybit(y); RAM(g)[xyaddr(x, y)] &= ~xybit(y);
g->flags |= GDISP_FLG_NEEDFLUSH; g->flags |= GDISP_FLG_NEEDFLUSH;
} }
#endif # endif
#if GDISP_HARDWARE_PIXELREAD # if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
coord_t x, y; coord_t x, y;
switch(g->g.Orientation) { switch (g->g.Orientation) {
default: default:
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
x = g->p.x; x = g->p.x;
@@ -222,23 +228,23 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
break; break;
case GDISP_ROTATE_90: case GDISP_ROTATE_90:
x = g->p.y; x = g->p.y;
y = GDISP_SCREEN_HEIGHT-1 - g->p.x; y = GDISP_SCREEN_HEIGHT - 1 - g->p.x;
break; break;
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
x = GDISP_SCREEN_WIDTH-1 - g->p.x; x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
y = GDISP_SCREEN_HEIGHT-1 - g->p.y; y = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
break; break;
case GDISP_ROTATE_270: case GDISP_ROTATE_270:
x = GDISP_SCREEN_HEIGHT-1 - g->p.y; x = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
y = g->p.x; y = g->p.x;
break; break;
} }
return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black; return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
} }
#endif # endif
LLDSPEC void gdisp_lld_blit_area(GDisplay *g) { LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
uint8_t* buffer = (uint8_t*)g->p.ptr; uint8_t *buffer = (uint8_t *)g->p.ptr;
int linelength = g->p.cx; int linelength = g->p.cx;
for (int i = 0; i < g->p.cy; i++) { for (int i = 0; i < g->p.cy; i++) {
unsigned dstx = g->p.x; unsigned dstx = g->p.x;
@@ -246,15 +252,14 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
unsigned srcx = g->p.x1; unsigned srcx = g->p.x1;
unsigned srcy = g->p.y1 + i; unsigned srcy = g->p.y1 + i;
unsigned srcbit = srcy * g->p.x2 + srcx; unsigned srcbit = srcy * g->p.x2 + srcx;
for(int j=0; j < linelength; j++) { for (int j = 0; j < linelength; j++) {
uint8_t src = buffer[srcbit / 8]; uint8_t src = buffer[srcbit / 8];
uint8_t bit = 7-(srcbit % 8); uint8_t bit = 7 - (srcbit % 8);
uint8_t bitset = (src >> bit) & 1; uint8_t bitset = (src >> bit) & 1;
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++;
@@ -264,13 +269,12 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
g->flags |= GDISP_FLG_NEEDFLUSH; g->flags |= GDISP_FLG_NEEDFLUSH;
} }
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL # if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
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:
case powerDeepSleep: case powerDeepSleep:
@@ -294,9 +298,8 @@ 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:
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
@@ -324,6 +327,6 @@ LLDSPEC void gdisp_lld_control(GDisplay *g) {
return; return;
} }
} }
#endif // GDISP_NEED_CONTROL # endif // GDISP_NEED_CONTROL
#endif // GFX_USE_GDISP #endif // GFX_USE_GDISP

View File

@@ -14,13 +14,13 @@
/* Driver hardware support. */ /* Driver hardware support. */
/*===========================================================================*/ /*===========================================================================*/
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing # define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE # define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE # define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE # define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_HARDWARE_BITFILLS TRUE # define GDISP_HARDWARE_BITFILLS TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO # define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
#endif /* GFX_USE_GDISP */ #endif /* GFX_USE_GDISP */

View File

@@ -16,3 +16,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "1up60hte.h" #include "1up60hte.h"
void keyboard_pre_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
setPinOutput(B6);
keyboard_pre_init_user();
}
void led_set_kb(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
writePinLow(B6);
} else {
writePinHigh(B6);
}
led_set_user(usb_led);
}

View File

@@ -31,22 +31,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
}; };
void matrix_init_user(void) {
setPinOutput(B6);
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
writePinLow(B6);
} else {
writePinHigh(B6);
}
}

View File

@@ -31,22 +31,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
}; };
void matrix_init_user(void) {
setPinOutput(B6);
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
writePinLow(B6);
} else {
writePinHigh(B6);
}
}

View File

@@ -8,7 +8,6 @@ A 60% PCB with USB C, RGB underglow, backlighting, hotswappable switches, and a
Keyboard Maintainer: [Bubnick](https://github.com/bubnick) Keyboard Maintainer: [Bubnick](https://github.com/bubnick)
Hardware Supported: 1up60hte 60% PCB Hardware Supported: 1up60hte 60% PCB
Hardware Availability: [1upkeyboards.com](https://www.1upkeyboards.com/shop/controllers/1up-rgb-60-pcb-hte/) Hardware Availability: [1upkeyboards.com](https://www.1upkeyboards.com/shop/controllers/1up-rgb-60-pcb-hte/)
Make example for this keyboard (after setting up your build environment): Make example for this keyboard (after setting up your build environment):

View File

@@ -1,50 +1,12 @@
# MCU name # MCU name
MCU = atmega32u4 MCU = atmega32u4
# Processor frequency. BOOTLOADER = atmel-dfu
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400) CONSOLE_ENABLE = no # Console for debug(+400)
@@ -54,6 +16,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https:/
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
AUDIO_ENABLE = no AUDIO_ENABLE = no
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
EXTRAFLAGS += -flto
LAYOUTS = 60_hhkb LAYOUTS = 60_hhkb

View File

@@ -0,0 +1 @@
#include "2key2crawl.h"

View File

@@ -0,0 +1,12 @@
#pragma once
#include "quantum.h"
#define LAYOUT( \
K00, K01, K02, K03, K15, \
K10, K11, K12, K13, K14, K16 \
) { \
{ K00, K01, K02, K03, KC_NO, KC_NO, KC_NO }, \
{ K10, K11, K12, K13, K14, K15, K16 }, \
}

View File

@@ -0,0 +1,44 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6090
#define DEVICE_VER 0x0002
#define MANUFACTURER WoodKeys.click
#define PRODUCT 2Key2Crawl
#define DESCRIPTION ATX Keycrawl 2018
/* key matrix size */
#define MATRIX_ROWS 2
#define MATRIX_COLS 7
/* key matrix pins */
#define MATRIX_ROW_PINS { C4, C5 }
#define MATRIX_COL_PINS { B3, B4, B5, B6, B7, C7, B2 }
#define UNUSED_PINS
#define ENCODERS_PAD_A { D0 }
#define ENCODERS_PAD_B { D1 }
#define ENCODER_RESOLUTION 1
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
#ifdef RGBLIGHT_ENABLE
#define RGB_DI_PIN C6
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 3
#endif

View File

@@ -0,0 +1,28 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
KC_1, KC_2, KC_3, KC_4, KC_5,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_ENTER),
};
void matrix_init_user(void) {
debug_config.matrix = 1;
debug_config.keyboard = 1;
debug_config.enable = 1;
}
void encoder_update_user(int8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_PGUP);
} else {
tap_code(KC_PGDN);
}
}
}

View File

@@ -0,0 +1,26 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
KC_1, KC_2, KC_3, KC_4, KC_5,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_ENTER),
};
void matrix_init_user(void) {
debug_config.matrix = 1;
debug_config.keyboard = 1;
debug_config.enable = 1;
}
void encoder_update_user(int8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code16(C(KC_T));
} else {
tap_code16(C(KC_W));
}
}
}

View File

@@ -0,0 +1,25 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
KC_1, KC_2, KC_3, KC_4, KC_5,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_ENTER),
};
void matrix_init_user(void) {
debug_config.matrix = 1;
debug_config.keyboard = 1;
debug_config.enable = 1;
}
void encoder_update_user(int8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
}

View File

@@ -0,0 +1,16 @@
# 2Key2CrawlPad
![2Key2CrawlPad](https://i.imgur.com/ON7m7RI.jpg)
A 2x5 macropad/numpad with a rotary encoder, exclusively available at Austin Keycrawl 2018 (12-01-2018).
Keyboard Maintainer: QMK Community
Keyboard Designer: [Cole Markham](https://github.com/colemarkham)
Hardware Supported: Crawlpad
Hardware Availability: Exclusive to Keycrawl events, contact [awwwwwwyeaahhhhhh](https://www.reddit.com/user/awwwwwwyeaahhhhhh) for more details.
Make example for this keyboard (after setting up your build environment):
make 2key2crawl:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

View File

@@ -0,0 +1,27 @@
# MCU name
MCU = atmega32u2
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # [Crawlpad] Custom backlighting code is used, so this should not be enabled
AUDIO_ENABLE = no # [Crawlpad] This can be enabled if a speaker is connected to the expansion port. Not compatible with RGBLIGHT below
RGBLIGHT_ENABLE = no # [Crawlpad] This can be enabled if a ws2812 strip is connected to the expansion port.
ENCODER_ENABLE = yes # [2Key2crawl] Make the knobs turn

View File

@@ -0,0 +1,3 @@
#pragma once
#define GRAVE_ESC_ALT_OVERRIDE

View File

@@ -0,0 +1,55 @@
#include QMK_KEYBOARD_H
#define _QWERTY 0
#define _FN1 1
#define _FN2 2
#define X0 LT(_FN2, KC_CAPS)
#define X1 MO(_FN1)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Default layer */
[_QWERTY] = LAYOUT_68_ansi(
KC_GESC, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,KC_MINS, KC_EQL, KC_BSPC, KC_INS ,KC_PGUP,
KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_LBRC,KC_RBRC, KC_BSLS, KC_DEL ,KC_PGDN,
X0 , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_QUOT, KC_ENTER,
KC_LSFT , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M ,KC_COMM,KC_DOT ,KC_SLSH, KC_RSFT, KC_UP ,
KC_LCTL ,KC_LALT ,KC_LGUI , KC_SPACE , X1 ,KC_RALT ,KC_RCTL , KC_LEFT,KC_DOWN,KC_RGHT
),
/* FN Layer */
[_FN1] = LAYOUT_68_ansi(
KC_GRV , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 , KC_BSPC, _______,KC_HOME,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_PSCR,KC_SLCK,KC_PAUS,_______, _______,KC_END,
X0 ,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MRWD,KC_MFFD, _______,
_______ ,_______,KC_MPLY,KC_MSTP,KC_MPRV,KC_MNXT,KC_VOLD,KC_VOLU,KC_MUTE,_______,_______, _______, _______,
_______ ,_______ ,_______ , _______, _______,_______,_______, _______,_______,_______
),
/* CAPS LOCK layer */
[_FN2] = LAYOUT_68_ansi(
KC_GRV , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 , KC_BSPC, KC_VOLU,KC_HOME,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_VOLD,KC_END,
_______,_______,_______,_______,_______,_______,KC_LEFT,KC_DOWN, KC_UP ,KC_RGHT,_______,_______, _______,
_______ ,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_MUTE,
_______ ,_______ ,_______ , _______, _______,_______,_______, KC_MPRV,KC_MPLY,KC_MNXT
)
};
void led_set_user(uint8_t usb_led){
//turn on the Pro Micro's on board LEDs for CAPS LOCK
if(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)){
//set led pins to low
setPinOutput(B0);
writePinLow(B0);
setPinOutput(B5);
writePinLow(B5);
} else {
//set to Hi-Z
setPinInput(B0);
writePinLow(B0);
setPinInput(B5);
writePinLow(B5);
}
}

View File

@@ -0,0 +1,13 @@
# emdarcher's MF68 Layout
A layout mostly based off the factory layout, but with some modifications. Designed for use in a MAC or Unix environment, and has some VIM inspiration.
- Utilizes the Pro Micro's on board LED's to show the CAPS LOCK status.
- Added Caps Lock for an extra FN layer with VIM like control on hjlk keys.
- Made the ESC key use GESC for functionality for Grave and Tilde with shift or GUI modifiers.
- Added Print Screen, Scroll Lock, and Pause keys on P,[,] keys to add Mac screen brightness control.
* On Mac, Scroll Lock is Brightness Down and Pause is Brightness Up, so with this FN+[ = brighness down, FN+] = brightness up
- Has Mac Fast-forward and Rewind keys mapped for changing media tracks. FN+; = Rewind, FN+' = Fast-forward
- Moved LGUI to the default MAC Command key position.
Note: By default, this keymap doesn't utilize the backlighting.

View File

@@ -0,0 +1,3 @@
BACKLIGHT_ENABLE = no

View File

@@ -0,0 +1,26 @@
#include QMK_KEYBOARD_H
enum layer {
LAYER_DEFAULT,
LAYER_FUNCTION,
};
/* Switch to function layer when held. */
#define LY_FUNC MO(LAYER_FUNCTION)
/* Send Ctrl+Alt+L (Cinnamon screen lock shortcut) when pressed. */
#define KY_LOCK LCA(KC_L)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[LAYER_DEFAULT] = LAYOUT(
KC_MPLY, KC_VOLU, KC_MSTP,
KC_MPRV, KC_VOLD, KC_MNXT,
KY_LOCK, KC_MUTE, LY_FUNC
),
[LAYER_FUNCTION] = LAYOUT(
EEP_RST, _______, RESET,
_______, _______, _______,
_______, _______, _______
),
};

View File

@@ -0,0 +1,5 @@
# bcat's 9-Key layout
This is a super simple PCB-mount macropad with nine keys, used at work for
media keys and quick access to screen lock on Linux (Cinnamon desktop
environment).

View File

@@ -0,0 +1 @@
BOOTLOADER = caterina # Pro Micro

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