Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fruitbar-R2 board. #868

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8a5df34
first pass at keymap and config
newts Jul 9, 2023
0b6d90c
working keyboard but buggered maps
newts Jul 10, 2023
2900dc1
no GP29 in adafruit
newts Jul 10, 2023
d357f5f
Update README.md
newts Jul 12, 2023
435b6c1
Update README.md
newts Jul 12, 2023
4c13636
base layer mostly working now
newts Jul 13, 2023
02cdd63
NO
newts Jul 13, 2023
b9e2283
my fruitbar
newts Jul 16, 2023
2524127
Merge branch 'master' of github.com:newts/fruity-oaty-bar
newts Jul 16, 2023
1908af7
icecream
newts Jul 16, 2023
1d606fd
wip
newts Jul 31, 2023
ac9e154
working layer 2 needs more testing
newts Aug 1, 2023
edf2d62
add libraries for oled and enable oled but not it isn't working
newts Aug 24, 2023
825e793
OLED works better with the correct i2c pins assigned
newts Aug 25, 2023
e69c06a
add modules to the md documentation
newts Aug 25, 2023
c940323
Update keys.py
newts Aug 25, 2023
93c1eef
black on fruitbar files
newts Sep 3, 2023
138929d
ran the make test and more fixing happened
newts Sep 3, 2023
5256269
remove some commented json that was causing pylint grief on github
newts Sep 21, 2023
92bf074
all tests passing now
newts Sep 21, 2023
ee3bd7d
Update boards/fruitbar/README.md
newts Sep 29, 2023
22d1da3
Update boards/fruitbar/README.md
newts Sep 29, 2023
5047791
Update boards/fruitbar/README.md
newts Sep 29, 2023
2913e89
Update boards/fruitbar/README.md
newts Sep 29, 2023
ecdc026
Update boards/fruitbar/README.md
newts Sep 29, 2023
d9832f5
Update boards/fruitbar/main.py
newts Sep 30, 2023
d2e5b8e
Update boards/fruitbar/main.py
newts Sep 30, 2023
ce35b0a
cleaning up for pr
newts Sep 30, 2023
8b6235a
need the keyboard class i2c definitions
newts Sep 30, 2023
45d06c3
Merge branch 'KMKfw:master' into jv
newts Oct 18, 2023
6e01904
Update README.md
newts Oct 18, 2023
dd5ad4f
Merge pull request #1 from newts/jv
newts Oct 18, 2023
1f1d932
Update README.md
newts Oct 18, 2023
17a7d4f
Update kb.py
newts Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions boards/fruitbar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Fruitbar R2

![Fruitbar](fruitbar-icecream.jpg)

Fruitbar R2 with IPS Display

0. Remove the back plate to access the boot button on the back of the board. It is the button closest to the USB. Press and hold the button, plug the board in, then release the button. You will see a R PI drive. Drag or copy the nuke Flash UF2 to it from here:
https://cdn-learn.adafruit.com/assets/assets/000/099/419/original/flash_nuke.uf2 after a few moments the R PI drive will reappear.
newts marked this conversation as resolved.
Show resolved Hide resolved
1. Install Circuitpython for the Solder Party Stamp board from here: https://circuitpython.org/board/solderparty_rp2040_stamp/ by dragging or copying the UF2 to the drive like the previous step.
2. After about 20 seconds it will reboot again and now a CIRCUITPYTHON drive will show up. Delete the code.py file
newts marked this conversation as resolved.
Show resolved Hide resolved
3. Copy the kmk folder to the drive
newts marked this conversation as resolved.
Show resolved Hide resolved
4. Copy the two .py files in the boards/fruitbar folder to the drive.
newts marked this conversation as resolved.
Show resolved Hide resolved
5. Use circup to install adafruit_displayio_ssd1306 and adafruit_display_text modules for the OLED
newts marked this conversation as resolved.
Show resolved Hide resolved
6. After a few seconds you should have a keyboard! To change your options or keymaps just edit or copy new keymap.py file to the board.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6. After a few seconds you should have a keyboard! To change your options or keymaps just edit or copy new keymap.py file to the board.
6. After a few seconds you should have a keyboard! To change your options or keymaps just edit or copy new `keymap.py` file to the board.


That's it!


Extensions enabled by default
- [Layers](/docs/en/layers.md) Need more keys than switches? Use layers.


Common Extensions


Comment on lines +20 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Common Extensions

Binary file added boards/fruitbar/fruitbar-icecream.jpg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a link instead. We won't add pictures or other binary blobs to the repository.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions boards/fruitbar/kb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import board

from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
# from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins

from kmk.scanners import DiodeOrientation

# needed to get GP29 when not using the adafruit board
# ph0enix designed by shockdesign & pelrun
# https://github.com/shockdesign/ph0enix-keyboard
Comment on lines +7 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this?



class KMKKeyboard(_KMKKeyboard):
row_pins = (
board.GP29,
board.GP18,
board.GP10,
board.GP6,
)
col_pins = (
board.GP25,
board.GP24,
board.GP23,
board.GP22,
board.GP21,
board.GP20,
board.GP17,
board.GP16,
board.GP15,
board.GP13,
board.GP12,
board.GP11,
board.GP9,
board.GP8,
board.GP7,
board.GP3,
)
diode_orientation = DiodeOrientation.COLUMNS
# led_pin = board.pins[11]
# rgb_pixel_pin = board.pins[10]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here? If it's commented out, then it's clearly not needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

future use, but yes.

rgb_num_pixels = 1

debug_enabled = True


# i2c = board.I2C
SCL = board.GP4
SDA = board.GP5
Comment on lines +41 to +45
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do anything

Suggested change
# i2c = board.I2C
SCL = board.GP4
SDA = board.GP5

284 changes: 284 additions & 0 deletions boards/fruitbar/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
import board

from kb import KMKKeyboard

from kmk.extensions.peg_oled_Display import (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recommend you use the display extension instead of peg_oled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will give it a try.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I don't know what to do here. I used peg_oled as an example and it works. If I change it, what board do you suggest to use as a model?

Oled,
OledData,
OledDisplayMode,
OledReactionType,
)
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.scanners import DiodeOrientation

keyboard = KMKKeyboard()

keyboard.SCL = board.GP27
keyboard.SDA = board.GP26

Comment on lines +19 to +21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not part of the keyboard class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of the process until I got it to work. yeeting now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I didn't chase it down but these are needed for the OLED to work. I remember when I did this a few months ago I had a hella time figuring out how to configure the OLED.

Is there a better place to define it? There is no circuitpython board defined for it so I found the stamp as the most generic board to use.

# oled_ext = Oled(OledData(image={0:OledReactionType.LAYER,1:['1.bmp','2.bmp','1.bmp','2.bmp']}),toDisplay=OledDisplayMode.IMG,flip=False)
newts marked this conversation as resolved.
Show resolved Hide resolved
oled_ext = Oled(
OledData(
corner_one={0: OledReactionType.STATIC, 1: ['layer']},
corner_two={0: OledReactionType.LAYER, 1: ['1', '2', '3', '4']},
corner_three={
0: OledReactionType.LAYER,
1: ['base', 'raise', 'lower', 'adjust'],
},
corner_four={
0: OledReactionType.LAYER,
1: ['qwerty', 'nums', 'shifted', 'leds'],
},
),
toDisplay=OledDisplayMode.TXT,
flip=False,
)

_______ = KC.TRNS
XXXXXXX = KC.NO

layers = Layers()
keyboard.extensions.append(oled_ext)

# keyboard.extensions = [rgb_ext, led]
newts marked this conversation as resolved.
Show resolved Hide resolved
keyboard.modules = [layers]

BASE = 0
FN1 = KC.MO(1)
FN2 = KC.MO(2)
KC_NEXT = KC.MEDIA_NEXT_TRACK

keyboard.keymap = [
# Qwerty
# ,---------------------------------------------------------------------------------------------------------------.
# | ESC | Q | W | E | R | T | Y | U | I | O | P | ( | ) | \ | Next| Media|
# |------+------+------+------+------+------+------+------+------+------+------|------+------+------+------+------|
# | Tab | A | S | D | F | G | H | J | K | L | ; | ' | Enter|
# |------+------+------+------+------+-------------+------+------+------+------|------+------+------+------+------|
# | Shift| Z | X | C | V | B | N | M | , | . | / | - | = | | Up |
# |------+------+------+------+------+------+------+------+------+------+------|------+------+------+------+------|
# | Ctrl | GUI | Alt | | Bksp | | | Space| FN1 | FN2 | | | | Left | Down | Right|
# `---------------------------------------------------------------------------------------------------------------'
[
KC.ESC,
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_NEXT,
KC.NO,
KC.TAB,
KC.A,
KC.S,
KC.D,
KC.F,
KC.G,
KC.H,
KC.J,
KC.K,
KC.L,
KC.SCLN,
KC.QUOT,
KC.ENT,
KC.ENT,
KC.NO,
KC.NO,
KC.LSFT,
KC.NO,
KC.Z,
KC.X,
KC.C,
KC.V,
KC.B,
KC.N,
KC.M,
KC.COMM,
KC.DOT,
KC.SLSH,
KC.MINS,
KC.EQL,
KC.UP,
KC.X,
KC.LCTRL,
KC.LGUI,
KC.LALT,
KC.NO,
KC.BSPC,
KC.NO,
KC.NO,
KC.SPC,
KC.NO,
FN1,
FN2,
KC.NO,
KC.NO,
KC.LEFT,
KC.DOWN,
KC.RGHT,
],
# Alt
# ,---------------------------------------------------------------------------------------------------------------.
# | Grave| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | | | | |
# |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
# | Trans| ! | @ | # | $ | % | ^ | & | * | = | - | | | | | |
# |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------+------|
# | Trans| { | [ | ( | _ | ) | ] | } | | ; | ` | | | | Pg Up| |
# |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
# | Trans| Trans| Trans| Trans| Del | Trans| \ | | | | | | | Home | Pg Dn| End |
# `---------------------------------------------------------------------------------------------------------------'
[
KC.GRV,
KC.N1,
KC.N2,
KC.N3,
KC.N4,
KC.N5,
KC.N6,
KC.N7,
KC.N8,
KC.N9,
KC.N0,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.EXLM,
KC.AT,
KC.HASH,
KC.DLR,
KC.PERC,
KC.CIRC,
KC.AMPR,
KC.ASTR,
KC.EQL,
KC.MINS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.LCBR,
KC.LBRC,
KC.LPRN,
KC.UNDS,
KC.RPRN,
KC.RBRC,
KC.RCBR,
KC.NO,
KC.SCLN,
KC.QUOT,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.PGUP,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.DEL,
KC.TRNS,
KC.BSLS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.HOME,
KC.PGDN,
KC.END,
],
# Alt 2
# ,---------------------------------------------------------------------------------------------------------------.
# | Trans| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | | | | | |
# |------+------+------+------+------+------+------+------+------+------+------|------+------+------+------+------|
# | Trans| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | | | | |
# |------+------+------+------+------+-------------+------+------+------+------|------+------+------+------+------|
# | Trans| F2 | F4 | F6 | F8 | F10 | F12 | = | ( | Pg Up| ) | | | | | |
# |------+------+------+------+------+------+------+------+------+------+------|------+------+------+------+------|
# | Trans| Trans| Trans| Trans| Trans| Trans| \ | Home | Pg Dn| End | Del | | | | | |
# `---------------------------------------------------------------------------------------------------------------'
[
KC.TRNS,
KC.F1,
KC.F2,
KC.F3,
KC.F4,
KC.F5,
KC.F6,
KC.F7,
KC.F8,
KC.F9,
KC.F10,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.GRV,
KC.N1,
KC.N2,
KC.N3,
KC.N4,
KC.N5,
KC.N6,
KC.N7,
KC.N8,
KC.N9,
KC.N0,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.F2,
KC.F4,
KC.F6,
KC.N8,
KC.F10,
KC.F12,
KC.EQL,
KC.LBRC,
KC.PGUP,
KC.RBRC,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.BSLS,
KC.HOME,
KC.PGDN,
KC.END,
KC.DEL,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
KC.TRNS,
],
]

if __name__ == '__main__':
keyboard.go()