Author Topic: [TMK] HHKB Alt Controller with Mini-B connector  (Read 385162 times)

0 Members and 1 Guest are viewing this topic.

Offline zhaochenhan1992

  • Posts: 0
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #650 on: Sun, 21 March 2021, 22:38:02 »
Hi Hasu.
Recently I am working on a project, that need to use led light on alt controller of hhkb to show which key is pressed. I have a question of your firmware code. When in BT pairing mode, the right led light flash into red once per second, how can I change this, for example flash twice per second or not flash at all. I just tried to adjust all the corresponding code snippet about DDRE6 and PORTE6 in rn42_task.c, rn42.c. Unluckily, none of them works. Could you please tell me which part of the code related to the BT led light and how can I change the code to achieve turn off the led light during pairing mode. Thanks a lot.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3315
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #651 on: Sun, 21 March 2021, 22:53:33 »
Hi,
In sort answer, you can't change the behaviour basically from keyboard firmware, the red LED(D9) is controled directly by GPIO5(22) of RN42 module.

But I may be able to change or disable the GPIO5 using module commands. Check datasheet and references.
https://ww1.microchip.com/downloads/en/DeviceDoc/bluetooth_cr_UG-v1.0r.pdf
https://www.microchip.com/wwwproducts/en/RN42


EDIT:
what the PE6 pin controls is green(yellow) part(D9) of the dual color LED.
D9 is actually red/green dual LED. D10 is not populated on PCB, btw.

You can find schematics here.
https://github.com/tmk/HHKB_controller/blob/master/schematic/HHKB_controller_revG.pdf
« Last Edit: Sun, 21 March 2021, 23:02:59 by hasu »

Offline zhaochenhan1992

  • Posts: 0
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #652 on: Mon, 22 March 2021, 08:09:09 »
Thanks Hasu! Do I need some extra cable to connect to RN42 in order to visit the command mode? Or I can just connect keyboard via usb cable to my pc and use uart terminal interacting with RN42? 
Hi,
In sort answer, you can't change the behaviour basically from keyboard firmware, the red LED(D9) is controled directly by GPIO5(22) of RN42 module.

But I may be able to change or disable the GPIO5 using module commands. Check datasheet and references.
https://ww1.microchip.com/downloads/en/DeviceDoc/bluetooth_cr_UG-v1.0r.pdf
https://www.microchip.com/wwwproducts/en/RN42


EDIT:
what the PE6 pin controls is green(yellow) part(D9) of the dual color LED.
D9 is actually red/green dual LED. D10 is not populated on PCB, btw.

You can find schematics here.
https://github.com/tmk/HHKB_controller/blob/master/schematic/HHKB_controller_revG.pdf

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3315
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #653 on: Mon, 22 March 2021, 09:41:59 »
I think you can access to config mode of RN42 with hid_listen console. But this function is not be fully supported, you may have some trouble. Refer to this.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/rn42/RN42.txt#L102-L122

If this doesn't work you need to connect 3.3V-level UART cable to pinouts(RX,TX) on the pcb.

Offline zhaochenhan1992

  • Posts: 0
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #654 on: Mon, 22 March 2021, 13:23:15 »
Thanks Hasu. For the battery led, is it possible to turn it off by changing the firmware? While in the firmware Battery_led(off) seems to let the led always on in green.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3315
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #655 on: Mon, 22 March 2021, 18:25:52 »
Kind of. The batery LED is another green/red dual LED(D3). Green one is connected directly to USB power or Lipo battery, you can't control it at all. Red one always turns on during battery charging, you can control it by PF5 otherwise.

Offline zhaochenhan1992

  • Posts: 0
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #656 on: Wed, 24 March 2021, 17:42:05 »
Hi, Hasu. Sorry to bother you again. I met a bug of the hook_matrix_change() function. If I randomly press a key which leads to a matrix  change, the hook_matrix_change() function would be excuted twiced. Have you ever met this problem when using hook?

Offline zhaochenhan1992

  • Posts: 0
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #657 on: Wed, 24 March 2021, 18:22:12 »
Hi, Hasu. Sorry to bother you again. I met a bug of the hook_matrix_change() function. If I randomly press a key which leads to a matrix  change, the hook_matrix_change() function would be excuted twiced. Have you ever met this problem when using hook?
Hasu, I know where the problem is, maybe you could update the code and fix the bug. https://github.com/tmk/tmk_keyboard/blob/6271878a021fcf578b71e2b7e97cd43786efa7dd/tmk_core/common/keyboard.c Line 137 and 138. In fact, the line 137 corresponds to the function
Code: [Select]
void action_exec(keyevent_t event)
{
    if (!IS_NOEVENT(event)) {
        dprint("\n---- action_exec: start -----\n");
        dprint("EVENT: "); debug_event(event); dprintln();
        hook_matrix_change(event);
    }
there is already a hook_matrix _change(event),but in line 138 hook_matrix _change(event) is excuted again.
So just delete either of them.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3315
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #658 on: Wed, 24 March 2021, 18:25:11 »
Great! Open the issue on github.
I'll fix it later.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3315
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] HHKB Alt Controller with Mini-B connector
« Reply #659 on: Sun, 11 April 2021, 19:38:09 »
Revised price of controller and shipping rate