Author Topic: Building Phantom Hardware and Firmware Mods  (Read 179514 times)

0 Members and 1 Guest are viewing this topic.

Offline Batmann

  • Posts: 531
  • Location: France
Building Phantom Hardware and Firmware Mods
« Reply #300 on: Tue, 25 December 2012, 17:53:42 »
Any chance we can design a bent plate to add cases choice for the phantom?
« Last Edit: Tue, 25 December 2012, 17:55:28 by Batmann »

Offline TheProfosist

  • Posts: 3671
  • Location: Wisconsin, USA
  • Custom Layouts Only!
Re: Building Phantom Hardware and Firmware Mods
« Reply #301 on: Tue, 25 December 2012, 18:48:19 »
Um, do you have to push the Teensy button to start the loader, or is there another way? I did push it before, and I'm writing this on my Phantom, but I can't load new firmware onto it because the Teensy application only tells me to "Press Button To Activate". :D
do you have the driver for the ATMega32u4?

Offline WhiteFireDragon

  • Posts: 2276
    • youtube
Re: Building Phantom Hardware and Firmware Mods
« Reply #302 on: Tue, 25 December 2012, 19:25:00 »
Any chance we can design a bent plate to add cases choice for the phantom?

The only thing the small 90degree bend at the front and back does it make it compatible with vortex case. No other case requires this bend. Having two bends like this for each case might add significant costs.

Offline Batmann

  • Posts: 531
  • Location: France
Building Phantom Hardware and Firmware Mods
« Reply #303 on: Wed, 26 December 2012, 03:08:18 »
Ok got it, thx WFD, I'll see if I can mod the plate when I get one

Offline fruktstund

  • Posts: 194
  • Location: Swedish woods
  • !
Re: Building Phantom Hardware and Firmware Mods
« Reply #304 on: Wed, 26 December 2012, 16:29:58 »
Um, do you have to push the Teensy button to start the loader, or is there another way? I did push it before, and I'm writing this on my Phantom, but I can't load new firmware onto it because the Teensy application only tells me to "Press Button To Activate". :D
do you have the driver for the ATMega32u4?
Pretty sure I do, otherwise the keyboard wouldn't be working, or am I thinking crazy now?

Anyway, I don't think what I was asking for should work, but I realized the Jump to Bootloader thing is what I'm looking for. In bpiphany's firmware it was as easy as pressing both shifts at the same time, but since I'm using hasu's (and Tranquilite's?) awesome firmware, the keybinding is something different if there's one. Would anyone happen to know this binding? :>

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: Building Phantom Hardware and Firmware Mods
« Reply #305 on: Wed, 26 December 2012, 16:35:51 »
With hasu's there are a number of commands possible and in the stock build they are initiated with both shifts and an additional key depending on what you need to do.  To start the bootloader, it's dbl-shift+Pause
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline fruktstund

  • Posts: 194
  • Location: Swedish woods
  • !
Re: Building Phantom Hardware and Firmware Mods
« Reply #306 on: Wed, 26 December 2012, 17:16:16 »
Ah, thank you very much! Now I'm a happy man.

I guess there are only two more things regarding this firmware I'm wondering about; is it possible to make the LEDs brighter, and does the mouse stuff in the firmware work? I could mention I'm using Windows for the time being.

Offline Tranquilite

  • Posts: 144
Re: Building Phantom Hardware and Firmware Mods
« Reply #307 on: Thu, 27 December 2012, 01:57:16 »
To make the LEDs brighter? Most folks want to make them dimmer because they chose LED/resister combos that were really bright. I don't think there are any options in the firmware to make them brighter, but assuming you are using hasu's firmware, make sure that these lines in matrix.c are this way, and haven't been lowered:
Code: [Select]
  OCR1B = 250; // Output compare register 1B
  OCR1C = 250; // Output compare register 1C
To tell you the truth, I have no idea if the PWM LED brightness code is even working properly in this firmware...

No matter, assuming you have those right, then your only option is to change the change the  LED/resistor combo on the board by either putting in lower-ohm resistors, or brighter LEDs. This requires soldering, and I have no idea if the plate gets in the way.

As for mousekeys, once again assuming you are using hasu's firmware, just uncomment
Code: [Select]
#MOUSEKEY_ENABLE = yes # Mouse keys in your makefile. You will also need to place mousekeys-specific codes in your keymap.

Offline fruktstund

  • Posts: 194
  • Location: Swedish woods
  • !
Re: Building Phantom Hardware and Firmware Mods
« Reply #308 on: Sun, 30 December 2012, 08:14:41 »
Well, actually, I think the LEDs are too dim with hasu's firmware, but the ones not seated at the caps lock and scroll lock switches are too bright instead with bpiphany's firmware. Pretty sure I prefer them brighter though, since it looks better with windowed keycaps.
Yeah, checked both of those lines, and they are set to 250. I did check this before too, and this is what has me perplexed. Can't find anything else regarding the brightness of the LEDs.

Uncommented that line, and at first it wasn't working, but when I tried to disable the extrakeys (EXTRAKEY_ENABLE) and that didn't work I noticed something was wrong. Did a clean make and it solved everything. Thanks!

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #309 on: Sun, 30 December 2012, 09:06:08 »
I don't know about PWM and phantom hardware very much, though this patch may cure your LED problem.
Where can I find phantom schematic?

Code: [Select]
diff --git a/keyboard/phantom/led.c b/keyboard/phantom/led.c
index 3523cb7..109004b 100644
--- a/keyboard/phantom/led.c
+++ b/keyboard/phantom/led.c
@@ -23,12 +23,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 void led_set(uint8_t usb_led)
 {
     if (!(usb_led & (1<<USB_LED_CAPS_LOCK)))
-        PORTB &= ~(1<<6);
+        DDRB &= ~(1<<6);
     else
-        PORTB |= (1<<6);
+        DDRB |= (1<<6);

     if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)))
-        PORTB &= ~(1<<7);
+        DDRB &= ~(1<<7);
     else
-        PORTB |= (1<<7);
+        DDRB |= (1<<7);
 }

Offline Glod

  • * Elevated Elder
  • Posts: 1998
  • Location: Virginia, USA
  • Also Known As Ergonomech
    • YouTube Channel
Re: Building Phantom Hardware and Firmware Mods
« Reply #310 on: Thu, 03 January 2013, 14:02:30 »
is there photos floating around anywhere that gives a close up of the teensy soldered flat/flush with the switch side of the PCB (without a plate and switches on yet) and the distance between the teensy and the pcb on the opposite side?

i know it will be a while before i have to do this myself but i'm really really curious how this looks.

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: Building Phantom Hardware and Firmware Mods
« Reply #311 on: Thu, 03 January 2013, 14:38:11 »
Not sure what you meant... here's the official build doc:  http://deskthority.net/wiki/Phantom_Instruction

Sounds like you want the teensy between the plate and PCB.  It won't fit.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Glod

  • * Elevated Elder
  • Posts: 1998
  • Location: Virginia, USA
  • Also Known As Ergonomech
    • YouTube Channel
Re: Building Phantom Hardware and Firmware Mods
« Reply #312 on: Thu, 03 January 2013, 15:23:48 »
i think you misunderstood, i know where the teensy goes, ive read the instructions on DT wiki

i want to see close up pictures of the teensy soldered in on both sides of the board

basically these steps

Quote
12.  Insert Teensy with pins on to PCB. Push Teensy as far in as possible without forcing it, without bending the pins, and make sure Teensy circuit board is not touching Phantom PCB. While the legs are sticking though the Phantom PCB, cut the pins flush to the Phantom PCB. This must be done in this way so the pins don't interfere with switches at these locations: F3, F4, 4, 5.

13. Once the Teensy pins are cut flush to the Phantom PCB, solder the Teensy on to the PCB. Make sure the solder is not sticking out of the PCB when cooled. The solder joints must be flat. FLAT!

"The solder joints must be flat. FLAT!" <- is what i am most interested in
« Last Edit: Thu, 03 January 2013, 15:25:30 by Glod »

Offline damorgue

  • Posts: 1176
  • Location: Sweden
    • Personal portfolio
Re: Building Phantom Hardware and Firmware Mods
« Reply #313 on: Thu, 03 January 2013, 15:27:35 »
I had some pics posted elsewhere.

http://i.imgur.com/TeuTc.jpg
http://i.imgur.com/rX0wI.jpg

Edit: Here is a better pic of it. I had to modify it a bit as the solder spots where a tad bit too high in this pic: http://i.imgur.com/95MBNh.jpg
Make them not stick out from the PCB. Flat (flush) side cutters were a great help.
« Last Edit: Thu, 03 January 2013, 15:32:33 by damorgue »

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: Building Phantom Hardware and Firmware Mods
« Reply #314 on: Thu, 03 January 2013, 15:33:16 »
That last pic of damorgue's has 2 spots that are pretty much perfect... To the right of U1 and under the 1 of U1.

Also, this:
i want to see close up pictures of the teensy soldered in on both sides of the board

Reads as: 'Pictures of the teensy soldered to the top of the PCB and soldered to the bottom of the PCB' as far as my education takes me. 
« Last Edit: Thu, 03 January 2013, 15:36:50 by alaricljs »
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Glod

  • * Elevated Elder
  • Posts: 1998
  • Location: Virginia, USA
  • Also Known As Ergonomech
    • YouTube Channel
Re: Building Phantom Hardware and Firmware Mods
« Reply #315 on: Thu, 03 January 2013, 15:35:08 »
I had some pics posted elsewhere.

http://i.imgur.com/TeuTc.jpg
http://i.imgur.com/rX0wI.jpg

Edit: Here is a better pic of it. I had to modify it a bit as the solder spots where a tad bit too high in this pic: http://i.imgur.com/95MBNh.jpg
Make them not stick out from the PCB. Flat (flush) side cutters were a great help.

That last pic of damorgue's has 2 spots that are pretty much perfect... To the right of U1 and under the 1 of U1.

Thanks Guys, this is exactly what i needed to know/see

Offline damorgue

  • Posts: 1176
  • Location: Sweden
    • Personal portfolio
Re: Building Phantom Hardware and Firmware Mods
« Reply #316 on: Thu, 03 January 2013, 15:36:14 »
After you have cut the teensy's legs to the right lengths, the only way you can muck it up is when you pull the solder iron away which can create these little pointy extrusions.

I ended up cutting them away (as well as removing a bit of excess solder from some) with a flush side cutter. Cutting after soldering isn't very professional, but meh.
« Last Edit: Thu, 03 January 2013, 15:38:27 by damorgue »

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: Building Phantom Hardware and Firmware Mods
« Reply #317 on: Thu, 03 January 2013, 15:37:25 »
A good way to avoid Hershey kisses is to slide the iron off across the PCB in stead of lifting.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline esoomenona

  • Gnillort?
  • Posts: 5323
Re: Building Phantom Hardware and Firmware Mods
« Reply #318 on: Thu, 03 January 2013, 15:39:58 »
i want to see close up pictures of the teensy soldered in on both sides of the board

Reads as: 'Pictures of the teensy soldered to the top of the PCB and soldered to the bottom of the PCB' as far as my education takes me. 
I agree. Better wording: I'd like to see pictures of the top and bottom of how the PCB should look after the teensy is soldered on.

Offline TheProfosist

  • Posts: 3671
  • Location: Wisconsin, USA
  • Custom Layouts Only!
Re: Building Phantom Hardware and Firmware Mods
« Reply #319 on: Thu, 03 January 2013, 15:59:13 »
i want to see close up pictures of the teensy soldered in on both sides of the board

Reads as: 'Pictures of the teensy soldered to the top of the PCB and soldered to the bottom of the PCB' as far as my education takes me. 
I agree. Better wording: I'd like to see pictures of the top and bottom of how the PCB should look after the teensy is soldered on.
do yo uguys want me to build one of the extras that IO have around and take pics? i am how ever missing a plate...

Offline Glod

  • * Elevated Elder
  • Posts: 1998
  • Location: Virginia, USA
  • Also Known As Ergonomech
    • YouTube Channel
Re: Building Phantom Hardware and Firmware Mods
« Reply #320 on: Thu, 03 January 2013, 16:06:23 »
do yo uguys want me to build one of the extras that IO have around and take pics? i am how ever missing a plate...

your pics seem to always be excellent and highly instructional  :D


Offline TheProfosist

  • Posts: 3671
  • Location: Wisconsin, USA
  • Custom Layouts Only!
Re: Building Phantom Hardware and Firmware Mods
« Reply #321 on: Thu, 03 January 2013, 16:09:55 »
do yo uguys want me to build one of the extras that IO have around and take pics? i am how ever missing a plate...

your pics seem to always be excellent and highly instructional  :D


thanks I build one of mine right away once i get a plate (which will probably be with the ones with my GB)

Offline jdcarpe

  • * Curator
  • Posts: 8852
  • Location: Odessa, TX
  • Live long, and prosper.
Re: Building Phantom Hardware and Firmware Mods
« Reply #322 on: Thu, 03 January 2013, 21:43:15 »
I should have taken pics of mine with the stupid spacers left on there. You know, to show you what NOT to do. The solder joints on top of the PCB looked AWESOME, but I don't think the PCB would have fit in the case with the Teensy so far from being flush with the board.

Then I could have taken photos of my shoddy desoldering job and the traces I wrecked after going to the Teensy legs with diagonal cutters. But that would just be cruel. I was frustrated that day.

However, I am now really well versed in exactly what NOT to do when assembling a Phantom. Sometimes you just gotta learn the hard way. That was kind of an expensive way to learn something, though. Luckily, bavman was willing to do the R2 GB after we got permission.

KMAC :: LZ-GH :: WASD CODE :: WASD v2 :: GH60 :: Alps64 :: JD45 :: IBM Model M :: IBM 4704 "Pingmaster"

http://jd40.info :: http://jd45.info


in memoriam

"When I was a kid, I used to take things apart and never put them back together."

Offline TheProfosist

  • Posts: 3671
  • Location: Wisconsin, USA
  • Custom Layouts Only!
Re: Building Phantom Hardware and Firmware Mods
« Reply #323 on: Thu, 03 January 2013, 21:45:52 »
well mine fit in PLU cases fine with the spacers on....its better if their on too.

Offline Glod

  • * Elevated Elder
  • Posts: 1998
  • Location: Virginia, USA
  • Also Known As Ergonomech
    • YouTube Channel
Re: Building Phantom Hardware and Firmware Mods
« Reply #324 on: Thu, 03 January 2013, 23:45:41 »
I should have taken pics of mine with the stupid spacers left on there. You know, to show you what NOT to do. The solder joints on top of the PCB looked AWESOME, but I don't think the PCB would have fit in the case with the Teensy so far from being flush with the board.

Then I could have taken photos of my shoddy desoldering job and the traces I wrecked after going to the Teensy legs with diagonal cutters. But that would just be cruel. I was frustrated that day.

However, I am now really well versed in exactly what NOT to do when assembling a Phantom. Sometimes you just gotta learn the hard way. That was kind of an expensive way to learn something, though. Luckily, bavman was willing to do the R2 GB after we got permission.

i would have loved to see the photos of the mistakes  :-X

i plan on building 2 of these, 1 for me and 1 for somebody else; hopefully ill get 1 out of 2 right   :)

Offline fruktstund

  • Posts: 194
  • Location: Swedish woods
  • !
Re: Building Phantom Hardware and Firmware Mods
« Reply #325 on: Fri, 11 January 2013, 13:02:29 »
I don't know about PWM and phantom hardware very much, though this patch may cure your LED problem.
Where can I find phantom schematic?
Thank you very much, it worked! :)

I have no idea about the Phantom schematic though. I can't recall seeing it around, publicly available, but bpiphany could probably help you out on this.

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: Building Phantom Hardware and Firmware Mods
« Reply #326 on: Fri, 11 January 2013, 14:19:12 »
There really isn't much to see, and I don't think the schematic have been uploaded anywhere.

The LEDs are connected to B6 (CapsLock) and B7 (ScrollLock) on the Teensy.

The rows are on B0 through B5 and the columns on the remaining pins =)

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #327 on: Fri, 11 January 2013, 19:27:41 »
frukstund, great. I pushed this fix into github now.

bpiphany, I wanted to know just whether anode or cathode is connected on that port.  Cathode, right?

Offline bpiphany

  • Posts: 1033
  • Location: Stockholm, Sweden
  • bpiph is a special type of crazy. //mkawa
Re: Building Phantom Hardware and Firmware Mods
« Reply #328 on: Fri, 11 January 2013, 23:00:13 »
Ah no, I am not a backwards electronics guy... and besides ground planes are around everywhere. The anode of the LEDs are hooked up to the controller, and the resistors are between the controller and the LEDs.

11603-0

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #329 on: Sat, 12 January 2013, 02:22:23 »
Got it. Thanks.
It made clear why old code didn't work properly.

Offline Leslieann

  • * Elevated Elder
  • Posts: 4519
Re: Building Phantom Hardware and Firmware Mods
« Reply #330 on: Sun, 13 January 2013, 16:13:35 »
The only thing the small 90degree bend at the front and back does it make it compatible with vortex case. No other case requires this bend. Having two bends like this for each case might add significant costs.

It also adds significant rigidity to the plate, the need however is still questionable.
Novelkeys NK65AE w/62g Zilents/39g springs
More
62g Zilents/lubed/Novelkeys 39g springs, HK Gaming Thick PBT caps, Netdot Gen10 magnetic cable, pic
| Filco MJ2 L.E. Vortex Case, Jailhouse Blues, heavily customized
More
Vortex case squared up/blasted finish removed/custom feet/paint/winkey blockoff plate, HID Liberator, stainless steel universal plate, 3d printed adapters, Type C, Netdot Gen10 magnetic cable, foam sound dampened, HK Gaming Thick PBT caps (o-ringed), Cherry Jailhouse Blues w/lubed/clipped Cherry light springs, 40g actuation
| GMMK TKL
More
w/ Kailh Purple Pros/lubed/Novelkeys 39g springs, HK Gaming Thick PBT caps, Netdot Gen10 Magnetic cable
| PF65 3d printed 65% w/LCD and hot swap
More
Box Jades, Interchangeable trim, mini lcd, QMK, underglow, HK Gaming Thick PBT caps, O-rings, Netdot Gen10 magnetic cable, in progress link
| Magicforce 68
More
MF68 pcb, Outemu Blues, in progress
| YMDK75 Jail Housed Gateron Blues
More
J-spacers, YMDK Thick PBT, O-rings, SIP sockets
| KBT Race S L.E.
More
Ergo Clears, custom WASD caps
| Das Pro
More
Costar model with browns
| GH60
More
Cherry Blacks, custom 3d printed case
| Logitech Illumininated | IBM Model M (x2)
Definitive Omron Guide. | 3d printed Keyboard FAQ/Discussion

Offline Acetrak

  • ssk.ℜ
  • Posts: 1079
  • Location: West
  • gnawm_
Re: Building Phantom Hardware and Firmware Mods
« Reply #331 on: Sun, 03 February 2013, 16:12:20 »
Can anyone confirm that with the right plate built, is it possible to have a 1.5/1/1.5/6/1.5/1/1/1.5 bottom row?

Offline TheProfosist

  • Posts: 3671
  • Location: Wisconsin, USA
  • Custom Layouts Only!
Re: Building Phantom Hardware and Firmware Mods
« Reply #332 on: Sun, 03 February 2013, 19:12:24 »
Can anyone confirm that with the right plate built, is it possible to have a 1.5/1/1.5/6/1.5/1/1/1.5 bottom row?
bpiphany confirmed that once i dont know in which thread exactly though

Offline Acetrak

  • ssk.ℜ
  • Posts: 1079
  • Location: West
  • gnawm_
Re: Building Phantom Hardware and Firmware Mods
« Reply #333 on: Mon, 04 February 2013, 08:30:51 »
I was trying to draft up a custom plate but the spacing has me slightly confused and I wasn't sure if this was a possible option :eek:

Offline Findecanor

  • Posts: 5036
  • Location: Koriko
Re: Building Phantom Hardware and Firmware Mods
« Reply #334 on: Wed, 06 February 2013, 18:27:24 »
Can anyone confirm that with the right plate built, is it possible to have a 1.5/1/1.5/6/1.5/1/1/1.5 bottom row?
Yes. I have modified a PHISO plate to have this layout for the bottom row. There are positions on the circuit board for the right Alt and Windows keys. The position of the space bar switch is the same for 7-unit and 6-unit space bars, as long as you use a space bar from a winkeyful Cherry G80-1800, G80-11800 or G80-11900.
I don't think that a space bar that is not from Cherry would work.

From my earlier post:

For this picture, I had placed my modified plate on top of a unmodified one to make it easier to see what I had cut away.
To make the mod, I used first a small hacksaw (careful!), then a small file and last needle files for the fine work.
This plate was made of aluminium. I figure this would not be as easy to do on a steel plate, though ...

A long time ago, bpiphany posted the qcad files for the plates and I modified the plate in qcad first before I dared modify it in real life. If you want to, I could clean it up and post it.
« Last Edit: Wed, 06 February 2013, 18:38:09 by Findecanor »

Offline Acetrak

  • ssk.ℜ
  • Posts: 1079
  • Location: West
  • gnawm_
Re: Building Phantom Hardware and Firmware Mods
« Reply #335 on: Wed, 06 February 2013, 18:58:07 »
Yes that would be pretty cool! I think I just need the measurements or the location of the bottom right cluster, even just their location in relation to the alpha keys would do ;D

Offline laden3

  • Posts: 594
Re: Building Phantom Hardware and Firmware Mods
« Reply #336 on: Thu, 21 February 2013, 02:26:33 »
Can someone help me with the programming?
I rrrove brrracks.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #337 on: Thu, 21 February 2013, 05:11:38 »
Hi, laden3. You PM'd me. So I'm posting here.

I'm not sure how I can help you. Anyway you should read README at first.
https://github.com/tmk/tmk_keyboard

What did you do so far and what is actually your problem?

Offline laden3

  • Posts: 594
Re: Building Phantom Hardware and Firmware Mods
« Reply #338 on: Thu, 21 February 2013, 05:27:40 »
I am trying to create a HEX file with my own layout.

At first I was stuck at the 2. of building firmware. Somehow I managed to make progression after reading this http://geekhack.org/index.php?topic=26742.msg664507#msg664507

However, the makefile thing is confusing and I made a bunch of stuffs including a HEX file in the tmk_keyboard-master>keyboard>phantom folder by typing make -f makefile.pjrc following the instructions in the link above.

Right now, I am not sure how I should proceed with the keymap.c, config.h, led.c, makefile.lufa, makefile.pjrc, and the matrix.c in the  tmk_keyboard-master>keyboard>phantom folder.
Can I just replace the desired keys with keycodes in the keymap in keymap.c and proceed to create the HEX file like what I did before?

Thanks in advance@!@!@!
I rrrove brrracks.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #339 on: Thu, 21 February 2013, 06:39:02 »
Yes. After you do 'make' you'll get phantom_pjrc.hex file and many other unknown pedantic files. But don't worry, you need only its hex file. I don't also know about those files at all except for hex :)

To tweak keymap you need to just edit keymap.c then do 'make -f Makefile.pjrc clean' and 'make -f Makefile.pjrc' to get new hex file.

Offline laden3

  • Posts: 594
Re: Building Phantom Hardware and Firmware Mods
« Reply #340 on: Thu, 21 February 2013, 06:57:44 »
First of all, I can't create the HEX file with some errors...

I left the config.h, Makefile.lufa, Makefile,pjrc, and matrix.c untouched.

I am trying to use a default layer with volume up, volume down, mute, mouse button 1, 2, and 3 and a macro (alt+F4) and the numlock will replace the 3X5 with a keypad. I am using 1.5X modifier too. I tried to mimic the last lines in the HHKB example in hasu's git.

This is my keymap.c, pretty sure something is wrong as I get lots of errors when I tried make -f makefile.pjrc
Code: [Select]
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
 * Keymap for Phantom controller
 */
#include <stdint.h>
#include <stdbool.h>
#include <avr/pgmspace.h>
#include "keycode.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "keymap.h"


// Convert physical keyboard layout to matrix array.
// This is a macro to define keymap easily in keyboard layout form.
#define KEYMAP( \
    K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N,           K5O, K5P, K5Q, \
    K5B, K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4N,      K4O, K4P, K4Q, \
    K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N,      K3O, K3P, K3Q, \
    K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N,           K2O, K2P, K2Q, \
    K1A,      K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N,           K1O, K1P, K1Q, \
    K0A, K0B, K0C,           K0H,                     K0K, K0L, K0M, K0N,      K0O, K0P, K0Q  \
) { \
/*             A         B         C         D         E         F         G         H         I         J         K         L          M        N          O         P         Q    */  \
/* 0 */   { KC_##K0A, KC_##K0B, KC_##K0C, KC_NO   , KC_NO   , KC_NO   , KC_NO   , KC_##K0H, KC_NO   , KC_NO   , KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0O, KC_##K0P, KC_##K0Q}, \
/* 1 */   { KC_##K1A, KC_NO   , KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_NO   , KC_##K1N, KC_##K1O, KC_##K1P, KC_##K1Q}, \
/* 2 */   { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_NO   , KC_##K2N, KC_##K2O, KC_##K2P, KC_##K2Q}, \
/* 3 */   { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3O, KC_##K3P, KC_##K3Q}, \
/* 4 */   { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_NO   , KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q}, \
/* 5 */   { KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5G, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q}, \
}

#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))


// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
static const uint8_t PROGMEM fn_layer[] = {
    0,              // Fn0
    1,              // Fn1
    2,              // Fn2
    3,              // Fn3
    4,              // Fn4
    5,              // Fn5
    6,              // Fn6
    7               // Fn7
};

// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
// See layer.c for details.
static const uint8_t PROGMEM fn_keycode[] = {
    KC_NO,          // Fn0
    KC_NO,          // Fn1
    KC_NO,          // Fn2
    KC_NO,          // Fn3
    KC_NO,          // Fn4
    KC_NO,          // Fn5
    KC_NO,          // Fn6
    KC_NO           // Fn7
};

/*
 * Phantom keyboard layout with winkeys and 7bit style editing block. I am
 * Not in the mood to implement full 7-bit keymap.
 *
 *
 * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
 * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
 * `---'   `---------------' `---------------' `---------------' `-----------'
 * ,-----------------------------------------------------------. ,-----------.
 * |~  |  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backsp | |Ins|Hom|PgU|
 * |-----------------------------------------------------------| |-----------|
 * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD|
 * |-----------------------------------------------------------| |---|---|---|
 * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  | |???|???|???|
 * |-----------------------------------------------------------| |---|---|---|
 * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift     | |???|Up |???|
 * |-----------------------------------------------------------| |-----------|
 * |Ctl|Gui|Alt|          Space                |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
 * `-----------------------------------------------------------' `-----------'
 */


static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
 *
 * ANSI:
 *
 * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
 * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|Nlk|Mac|
 * `---'   `---------------' `---------------' `---------------' `-----------'
 * ,-----------------------------------------------------------. ,-----------.
 * |~  |  1|  2|  3|  4|  5|  6|  7|  8|  9|  -|  =|V+ |Backsp | |Cap|Hom|PgU|
 * |-----------------------------------------------------------| |-----------|
 * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD|
 * |-----------------------------------------------------------| |-----------|
 * |Btn1  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  | |Bt2|Mut|VlU|
 * |-----------------------------------------------------------| |-----------|
 * |Shft    |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Caps      | |Bt3|Up |VlD|
 * |-----------------------------------------------------------| |-----------|
 * |Ctl|Gui|Alt|          Space                |???|Alt|App|Ctl| |Lef|Dow|Rig|
 * `-----------------------------------------------------------' `-----------'
 */

  KEYMAP(\
    ESC,  F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9, F10,  F11,  F12,       PSCR, SLCK, MACRO( MD(LALT), D(F4), END ), \
    GRV,   1,   2,   3,   4,   5,   6,   7,   8,   9,   0, MINS,  EQL, BSPC,  CAPS, HOME, PGUP, \
    TAB,   Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P, LBRC, RBRC, BSLS,  DEL,  END, PGDN, \
    BTN1,   A,   S,   D,   F,   G,   H,   J,   K,   L, SCLN, QUOT,       ENT,    BTN2,    MUTE,    VOLUP, \
    LSFT,       Z,   X,   C,   V,   B,   N,   M, COMM, DOT, SLSH,      CAPS,    BTN3,   UP,    VOLDOWN, \
    LCTL, LGUI, LALT,             SPC,                0, RALT, APP, RCTL, LEFT, DOWN, RGHT),


/*  Layer 1: Numlock mode (Numlock)
 * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
 * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|Nlk|Mac|
 * `---'   `---------------' `---------------' `---------------' `-----------'
 * ,-----------------------------------------------------------. ,-----------.
 * |~  |  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backsp | |  /|  *|  -|
 * |-----------------------------------------------------------| |-----------|
 * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |P_7|P_8|P_9|
 * |-----------------------------------------------------------| |---|---|---|
 * |Btn1  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  | |P_4|P_5|P_6|
 * |-----------------------------------------------------------| |---|---|---|
 * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift     | |P_1|P_2|P_3|
 * |-----------------------------------------------------------| |-----------|
 * |Ctl|Gui|Alt|          Space                |???|Alt|App|Ctl| |P_0|Pdt|Pls|
 * `-----------------------------------------------------------' `-----------'
 */

 KEYMAP(\
    ESC,  F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9, F10,  F11,  F12,       PSCR, NLCK,  MACRO( MD(LALT), D(F4), END ), \
    GRV,   1,   2,   3,   4,   5,   6,   7,   8,   9,   0, MINS,  EQL, BSPC,  PSLS, PAST, PMNS, \
    TAB,   Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P, LBRC, RBRC, BSLS,  P7,  P8, P9, \
    BTN1,   A,   S,   D,   F,   G,   H,   J,   K,   L, SCLN, QUOT,       ENT,    P4,    P5,    P6, \
    LSFT,       Z,   X,   C,   V,   B,   N,   M, COMM,  DOT, SLSH,      RSFT,   P1,   P2,    P3, \
    LCTL, LGUI, LALT,             SPC,                0, RALT, APP, RCTL, P0, PDOT, PPLS),


};

static const unit16_t PROGMEM fn_actions[] = {
ACTION_LAYER_DEFAULT,        // FN0
ACTION_LAYER_SET_TOGGLE(1)   // NLCK
};


uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
{
    return KEYCODE(layer, row, col);
}

uint8_t keymap_fn_layer(uint8_t index)
{
    return pgm_read_byte(&fn_layer[index]);
}

uint8_t keymap_fn_keycode(uint8_t index)
{
    return pgm_read_byte(&fn_keycode[index]);
}


This is my led.c
Code: [Select]
*
Copyright 2012 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <avr/io.h>
#include "stdint.h"
#include "led.h"


void led_set(uint8_t usb_led)
{
    if (!(usb_led & (1<<USB_LED_CAPS_LOCK)))
        DDRB &= ~(1<<6);
    else
        DDRB |= (1<<6);

    if (!(usb_led & (1<<USB_LED_NUM_LOCK)))
        DDRB &= ~(1<<7);
    else
        DDRB |= (1<<7);
}

« Last Edit: Thu, 21 February 2013, 07:54:17 by laden3 »
I rrrove brrracks.

Offline laden3

  • Posts: 594
Re: Building Phantom Hardware and Firmware Mods
« Reply #341 on: Thu, 21 February 2013, 07:33:28 »
Just realized that the macro action and function action are not fixed yet.

It seems like the mouse keys and the system & media keys only work under the Fn layer. Could this be fixed by replacing the default layer with FN1?

I am not familiar with programming and maybe I do not know what I was talking about...
I rrrove brrracks.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #342 on: Thu, 21 February 2013, 08:15:38 »
At this time Phantom uses legacy keymap. But to use  layer toggle  and key macro feature you need to move new keymap framework. I rewrote your keymap using new keymap framework. But I'm not sure if this works for you. This framework is still experimental unfortunately.

This new keymap framework will be replaced completely with another new framework before too long. So, you may not want to learn this tentative framework. You can stay with legacy keymap until newer framework becomes available.

I think there is no problem in led.c  but you use numlock key as layer toggle key, this means you don't have usual numlock key, so numlock LED may not be useful for you.

Code: [Select]
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
 * Keymap for Phantom controller
 */
#include <stdint.h>
#include <stdbool.h>
#include <avr/pgmspace.h>
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "keymap.h"


// Convert physical keyboard layout to matrix array.
// This is a macro to define keymap easily in keyboard layout form.
#define KEYMAP( \
    K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N,           K5O, K5P, K5Q, \
    K5B, K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4N,      K4O, K4P, K4Q, \
    K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N,      K3O, K3P, K3Q, \
    K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N,           K2O, K2P, K2Q, \
    K1A,      K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N,           K1O, K1P, K1Q, \
    K0A, K0B, K0C,           K0H,                     K0K, K0L, K0M, K0N,      K0O, K0P, K0Q  \
) { \
/*             A         B         C         D         E         F         G         H         I         J         K         L          M        N          O         P         Q    */  \
/* 0 */   { KC_##K0A, KC_##K0B, KC_##K0C, KC_NO   , KC_NO   , KC_NO   , KC_NO   , KC_##K0H, KC_NO   , KC_NO   , KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0O, KC_##K0P, KC_##K0Q}, \
/* 1 */   { KC_##K1A, KC_NO   , KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_NO   , KC_##K1N, KC_##K1O, KC_##K1P, KC_##K1Q}, \
/* 2 */   { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_NO   , KC_##K2N, KC_##K2O, KC_##K2P, KC_##K2Q}, \
/* 3 */   { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3O, KC_##K3P, KC_##K3Q}, \
/* 4 */   { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_NO   , KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q}, \
/* 5 */   { KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5G, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q}, \
}


static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
 *
 * ANSI:
 *
 * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
 * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|Nlk|Mac|
 * `---'   `---------------' `---------------' `---------------' `-----------'
 * ,-----------------------------------------------------------. ,-----------.
 * |~  |  1|  2|  3|  4|  5|  6|  7|  8|  9|  -|  =|V+ |Backsp | |Cap|Hom|PgU|
 * |-----------------------------------------------------------| |-----------|
 * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD|
 * |-----------------------------------------------------------| |-----------|
 * |Btn1  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  | |Bt2|Mut|VlU|
 * |-----------------------------------------------------------| |-----------|
 * |Shft    |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Caps      | |Bt3|Up |VlD|
 * |-----------------------------------------------------------| |-----------|
 * |Ctl|Gui|Alt|          Space                |???|Alt|App|Ctl| |Lef|Dow|Rig|
 * `-----------------------------------------------------------' `-----------'
 */

  KEYMAP(\
    ESC,   F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9, F10, F11, F12,         PSCR, FN1, FN2, \
    GRV,    1,   2,   3,   4,   5,   6,   7,   8,   9,   0,MINS, EQL,BSPC,    CAPS,HOME,PGUP, \
    TAB,    Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,LBRC,RBRC,BSLS,     DEL, END,PGDN, \
    BTN1,   A,   S,   D,   F,   G,   H,   J,   K,   L,SCLN,QUOT,      ENT,    BTN2,MUTE,VOLU, \
    LSFT,        Z,   X,   C,   V,   B,   N,   M,COMM, DOT,SLSH,     CAPS,    BTN3,  UP,VOLD, \
    LCTL,LGUI,LALT,               SPC,                  NO,RALT, APP,RCTL,    LEFT,DOWN,RGHT),


/*  Layer 1: Numlock mode (Numlock)
 * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
 * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|Nlk|Mac|
 * `---'   `---------------' `---------------' `---------------' `-----------'
 * ,-----------------------------------------------------------. ,-----------.
 * |~  |  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backsp | |  /|  *|  -|
 * |-----------------------------------------------------------| |-----------|
 * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |P_7|P_8|P_9|
 * |-----------------------------------------------------------| |---|---|---|
 * |Btn1  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  | |P_4|P_5|P_6|
 * |-----------------------------------------------------------| |---|---|---|
 * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift     | |P_1|P_2|P_3|
 * |-----------------------------------------------------------| |-----------|
 * |Ctl|Gui|Alt|          Space                |???|Alt|App|Ctl| |P_0|Pdt|Pls|
 * `-----------------------------------------------------------' `-----------'
 */

 KEYMAP(\
    ESC,   F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9, F10, F11, F12,         PSCR, FN0, FN2, \
    GRV,    1,   2,   3,   4,   5,   6,   7,   8,   9,   0,MINS, EQL,BSPC,    PSLS,PAST,PMNS, \
    TAB,    Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,LBRC,RBRC,BSLS,      P7,  P8,  P9, \
    BTN1,   A,   S,   D,   F,   G,   H,   J,   K,   L,SCLN,QUOT,      ENT,      P4,  P5,  P6, \
    LSFT,        Z,   X,   C,   V,   B,   N,   M,COMM, DOT,SLSH,     RSFT,      P1,  P2,  P3, \
    LCTL,LGUI,LALT,                SPC,                 NO,RALT, APP,RCTL,      P0,PDOT,PPLS),


};



/* id for user defined functions */
enum function_id {
    MACRO                   = 0xff
};

static const uint16_t PROGMEM fn_actions[] = {
    ACTION_LAYER_DEFAULT,        // FN0
    ACTION_LAYER_SET_TOGGLE(1),  // FN1 NLCK
    ACTION_FUNCTION(MACRO, 0),   // FN2
};


/*
 * Macro definition
 */
#define MACRO(...) ({ static prog_macro_t _m[] PROGMEM = { __VA_ARGS__ }; _m; })
#define MACRO_NONE  0
static const prog_macro_t *get_macro(uint8_t id, bool pressed)
{
    switch (id) {
        case 0:
            return (pressed ?
                    MACRO( MD(LALT), D(F4), END ) :
                    MACRO( U(F4), MU(LALT), END ) );
    }
    return MACRO_NONE;
}



/*
 * user defined action function
 */
void keymap_call_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    keyevent_t event = record->event;
    uint8_t tap_count = record->tap_count;

    debug("action_call_function: ");
    if (event.pressed) debug("pressed"); else debug("released");
    debug(" id: "); debug_hex(id);
    debug(" tap_count: "); debug_dec(tap_count);
    debug("\n");

    switch (id) {
        case MACRO:
            action_macro_play(get_macro(opt, event.pressed));
            break;
    }
}



/* translates key to keycode */
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
{
    return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}

/* translates Fn index to action */
action_t keymap_fn_to_action(uint8_t keycode)
{
    action_t action;
    if (FN_INDEX(keycode) < sizeof(fn_actions) / sizeof(fn_actions[0])) {
        action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
    } else {
        action.code = ACTION_NO;
    }
    return action;
}

/* convert key to action */
action_t action_for_key(uint8_t layer, key_t key)
{
    uint8_t keycode = keymap_key_to_keycode(layer, key);
    switch (keycode) {
        case KC_FN0 ... KC_FN31:
            return keymap_fn_to_action(keycode);
        default:
            return keymap_keycode_to_action(keycode);
    }
}

Offline Findecanor

  • Posts: 5036
  • Location: Koriko
Re: Building Phantom Hardware and Firmware Mods
« Reply #343 on: Thu, 21 February 2013, 18:24:57 »
Yes that would be pretty cool! I think I just need the measurements or the location of the bottom right cluster, even just their location in relation to the alpha keys would do ;D
Sorry for the late reply, but I have been in a mess the past few days. Actually, my old modified file wasn't clean enough, so I had to redo it. I assumed you wanted ANSI.
The right Alt is under . and the keys to the right of it are aligned with [ ] and \ .
« Last Edit: Thu, 21 February 2013, 18:26:45 by Findecanor »

Offline jdcarpe

  • * Curator
  • Posts: 8852
  • Location: Odessa, TX
  • Live long, and prosper.
Re: Building Phantom Hardware and Firmware Mods
« Reply #344 on: Thu, 21 February 2013, 19:16:29 »
Yes that would be pretty cool! I think I just need the measurements or the location of the bottom right cluster, even just their location in relation to the alpha keys would do ;D
Sorry for the late reply, but I have been in a mess the past few days. Actually, my old modified file wasn't clean enough, so I had to redo it. I assumed you wanted ANSI.
The right Alt is under . and the keys to the right of it are aligned with [ ] and \ .

Yay! I did it right, then. I tried to help Acetrak with this, and hoped for the best.
KMAC :: LZ-GH :: WASD CODE :: WASD v2 :: GH60 :: Alps64 :: JD45 :: IBM Model M :: IBM 4704 "Pingmaster"

http://jd40.info :: http://jd45.info


in memoriam

"When I was a kid, I used to take things apart and never put them back together."

Offline laden3

  • Posts: 594
Re: Building Phantom Hardware and Firmware Mods
« Reply #345 on: Fri, 22 February 2013, 03:35:00 »
hasu, for some reason, the entire row16 doesn't work for me and I really do not know how to troubleshoot that.

So, I use the AVR-keyboard firmware from here http://wiki.geekhack.org/index.php?title=AVR-Keyboard

Now the problem is, how do I create a normal layout with media functions that can be replaced by a numpad when num lock is pressed.
It seems like the using the keycodes designated for the numpad will produce keystrokes when num lock is deactivated.

How do I make the LED B light up when num lock is pressed instead on scroll lock (I plan to totally remove scroll lock).

Someone please help, thanks in advance@!@!@!
« Last Edit: Fri, 22 February 2013, 07:55:17 by laden3 »
I rrrove brrracks.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #346 on: Fri, 22 February 2013, 11:22:49 »
hmm, weird. row 16? which keys actually?
They worked with my firmware before?

Offline laden3

  • Posts: 594
Re: Building Phantom Hardware and Firmware Mods
« Reply #347 on: Fri, 22 February 2013, 15:52:38 »
They are the pause/break, page up, page down, and -> arrow key. Thanks.
I rrrove brrracks.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Building Phantom Hardware and Firmware Mods
« Reply #348 on: Sun, 24 February 2013, 09:34:39 »
Mebe, this patch will fix the problem.

Code: [Select]
diff --git a/common/keyboard.c b/common/keyboard.c
index e4bc3dc..432ea89 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -86,7 +86,7 @@ void keyboard_task(void)
                 if (matrix_change & ((matrix_row_t)1<<c)) {
                     action_exec((keyevent_t){
                         .key = (key_t){ .row = r, .col = c },
-                        .pressed = (matrix_row & (1<<c)),
+                        .pressed = (matrix_row & ((matrix_row_t)1<<c)),
                         .time = (timer_read() | 1) /* time should not be 0 */
                     });
                     // record a processed key

Offline Tranquilite

  • Posts: 144
Re: Building Phantom Hardware and Firmware Mods
« Reply #349 on: Mon, 25 February 2013, 00:08:24 »
I can confirm that the patch you posted fixes the non-working 16th column (or row, i cant remember which it would be). Those tricky bit-shifts...