Commit Graph

212 Commits

Author SHA1 Message Date
Gergely Nagy
2a7edbce6f Light up LEDs on the display when switching layers
When switching layers, light up the appropriate LED on the display. For this
purpose, start led_display.[ch], which as a start, has a function to set the
brightness of a layer led.

The function will also turn all other LEDs off, and turn all of them off when on
the base layer.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-13 20:34:43 +01:00
Gergely Nagy
d98955a947 Move ActiveLayer back to keyboard_layout.c too
That is the only place we use it from, no need to expose it outside of that.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-13 19:59:06 +01:00
Gergely Nagy
c77027992b Move layer handling back to keyboard_layout.c
And while there, also drop the helper functions, and just do the activation in
the handler function. This simplifies the code a bit, as there is little point
in lifting out an assignment into a function at this time.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-13 19:54:34 +01:00
Gergely Nagy
04eb1bab74 Move layer handling to a separate file
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-13 18:42:32 +01:00
Gergely Nagy
6a502924d2 Simplify the layer handling
There can only be one layer active at any one time, simplify the code
accordingly.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-13 18:39:05 +01:00
Gergely Nagy
690addefd9 Coding style fixes
Don't put a space between the function and the opening parens.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-13 12:52:03 +01:00
Gergely Nagy
9f61c3227c Changes based on the review notes
This does a lot of things - all of this together, because it would have been
much harder to split them up into many small commits.

We get rid of the helper macros used in default_layout.c, drop the .raw member
of uhk_key_t, use a singleton keymap, and prepare the prevKeyStates to handle
all slots. Also drops the TRNS macro.

With these changes, default_layout.h became obsolete, and was deleted too.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-12 23:16:26 +01:00
Gergely Nagy
0b09fb0055 Remove some now obsolete defines
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-12 21:55:30 +01:00
Gergely Nagy
265988ee25 Better key state tracking
We need to store the previous state of the keys, to figure out when a specific
key is released, as opposed to simply not being pressed. This is required for
layer keys such as `Mod` and `Fn` to work properly when there are more than one
of them on the keymap.

Without being able to tell when a key is released, we would not be able to turn
a layer off only when no layer key is held. Not easily, anyway: we'd have to
track the state of all layer keys... but then it is easier to just track them
all.

Thankfully, the memcpy at the end is fast, as it only needs to copy 70 bytes.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-12 20:14:09 +01:00
Gergely Nagy
6aedaf7074 Big Keymap Refactor(tm)
This changes the keymap layout to be as described in #17, and updates the
default layout to follow. (Also adds the missing Space and Mod keys on the two
keys below the bottom row)

The layout itself was considerably simplified by introducing a few local macros
to hide some of the uglier details.

Fixes #17.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-12 20:10:42 +01:00
László Monda
1f8fc560e4 Clean up some concepts regarding slots and modules. 2016-12-12 01:01:36 +01:00
László Monda
871a0ec84a Remove variables because they yield warnings which shouldn't happen according to our contributing guide. 2016-12-12 00:25:13 +01:00
László Monda
f66eb06712 Coding style fixes. 2016-12-12 00:21:39 +01:00
László Monda
de6218ce0c Convert tabs to 4 spaces. 2016-12-11 23:59:28 +01:00
Gergely Nagy
e758e088a7 Rework the keyboard layout handling
We now use a 32-bit structure to describe each key, and an `uhk_key_t` type that
wraps all the supported things into a union. But this is not the only change: to
be able to move the Fn/Mod keys anywhere, instead of hardcoding their location,
they are now proper layer keys. To make it easier to handle turning a layer off,
key releases can be handled explicitly, too.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-11 19:22:31 +01:00
Gergely Nagy
5ee11c2f8f LEDs: Add a method to set all LEDs to a given brightness
Mostly for testing purposes, but can be used later for backlight up/down stuff,
too.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2016-12-11 09:57:48 +01:00
Robert Csordas
f2c750cdf9 Refactoring 2016-11-14 22:41:39 +01:00
Robert Csordas
5cf1da0cfe Fixes the bug of additional characters when mod key is released before the other key 2016-11-14 22:09:33 +01:00
Robert Csordas
fc434c7857 Remove keyboard scanning from USB interrupt. Fix initial blink of LEDs when initializing. Coding style fixes. 2016-11-13 15:50:49 +01:00
Robert Csordas
f2d3963b14 Remove eclipse's bullshit. 2016-11-13 11:29:02 +01:00
Robert Csordas
190d555221 Refactoring and bugfixes. 2016-11-13 11:25:29 +01:00
Robert Csordas
b3bc436bbb Fix typo+basic power management 2016-11-12 20:31:59 +01:00
Robert Csordas
d232e774b7 Fixes+mod keys 2016-11-12 20:25:15 +01:00
Robert Csordas
6dc6c43238 Able to type. 2016-11-12 19:07:39 +01:00
László Monda
f961260443 Expose ISO jumper state over USB. 2016-10-20 00:14:01 +02:00
László Monda
7a6e5523fb Make bidirectional communication work between the keyboard halves. Make the set test LED USB command set the test LED of the left half, too. 2016-10-19 19:39:00 +02:00
László Monda
5a32ff743c Expose the LED jumper via USB. 2016-10-18 18:58:00 +02:00
László Monda
0ed30b4591 Expose the merge sensor via USB. 2016-10-17 23:21:37 +02:00
László Monda
2d31c3e5ce Add API for the merge sensor. 2016-10-17 23:06:09 +02:00
László Monda
cb7c4d68dd Fix indentation. 2016-10-17 22:54:06 +02:00
László Monda
3bd2c7f18e Extract RESET_BUTTON_IS_PRESSED 2016-10-17 22:51:17 +02:00
László Monda
ab3d8b92f0 Remove commented out code. 2016-10-17 22:47:45 +02:00
László Monda
32b5484b31 Fix TEST_LED_{ON,OFF} macros to function as they should. Enable the test LEDs of both halves by default. 2016-10-15 00:41:37 +02:00
László Monda
9436be444c Implement read EEPROM and write EEPROM USB commands. 2016-10-12 12:51:22 +02:00
László Monda
80ddf397fd Make the left keyboard half send the state of the keys to the right half via I2C and make the right half send the relevant scancodes to the host via USB. 2016-10-12 03:03:59 +02:00
László Monda
cbe8c953a0 Remove unused variable. 2016-10-12 00:27:58 +02:00
László Monda
2dd260e84b Fix and use KeyMatrix_Scan() 2016-10-11 21:56:24 +02:00
László Monda
7d3abdffef Don't send erroneous scancodes to the host by including delays for the pins to stabilize. Thanks @santiagogf89 for the idea! 2016-10-11 20:47:56 +02:00
László Monda
c8284fcd6f Add KeyMatrix_Scan() although don't use it yet. Send every detected scancode to the host of which there are false positives for some reason. 2016-10-10 22:39:22 +02:00
László Monda
56b8609187 Let KDS update org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR 2016-10-10 17:39:38 +02:00
László Monda
5588aecb78 Extract KeyMatrix_Init() and create related typedefs. 2016-10-10 17:33:11 +02:00
László Monda
188faacdb2 Replace the KSDK_2.0_FRDM-K22F submodule with KSDK_2.0_MK22FN512xxx12. 2016-10-06 21:47:24 +02:00
László Monda
4742a0c661 Initialize clocks where they're actually needed. 2016-10-05 23:12:22 +02:00
László Monda
4830c98d50 Initialize the I2C bus of the EEPROM. Organize related macros neatly. 2016-10-05 21:27:49 +02:00
László Monda
f0b63a6f7b Add reset_button.c and test_led.c. Clean up init_peripherials.c 2016-10-05 02:05:05 +02:00
László Monda
5936129ebc Remove the include directory. Add init_clock.[ch] 2016-10-04 18:36:01 +02:00
László Monda
f4f7fd72d9 Move the lufa directory one level upwards. 2016-10-04 17:29:06 +02:00
László Monda
db8f1ff691 Rename include/usb to ksdk_usb. 2016-10-04 17:12:34 +02:00
László Monda
5f1c85147b Remove pin_mux.[ch], add init_peripherials.[ch], add reset_button.h which I forgot to add previously. 2016-10-04 17:02:46 +02:00
László Monda
0550c19cf5 Delete board.[ch]. Add reset_button.h 2016-10-04 16:44:16 +02:00