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 Model-B keyboard #24681

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add Model-B keyboard #24681

wants to merge 8 commits into from

Conversation

TrojanPinata
Copy link

Description

Addition of Model-B, a 75% keyboard. Supports SSD1306 displays and rotary encoders. Six sample screens are baked in for simplicity.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

  • Added support for Model-B

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

keyboards/trojan_pinata/model_b/rules.mk Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/readme.md Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/config.h Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/config.h Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/config.h Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/config.h Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/config.h Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/keyboard.json Outdated Show resolved Hide resolved
Comment on lines 19 to 24
#define MTNS 0
#define INFO 1
#define LOGO 2
#define MEW 3
#define CEL 4
#define RAY 5
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#define MTNS 0
#define INFO 1
#define LOGO 2
#define MEW 3
#define CEL 4
#define RAY 5
enum oled_modes {
MTNS, INFO, LOGO, MEW, CEL, RAY
};

}

// run this whenever the oled needs to update
bool oled_task_user(void) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bool oled_task_user(void) {
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}

keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
Comment on lines 550 to 554

// what happens on sleep/power down
void suspend_power_down_user(void) {
oled_off();
}
Copy link
Member

Choose a reason for hiding this comment

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

This is handled internally.

Suggested change
// what happens on sleep/power down
void suspend_power_down_user(void) {
oled_off();
}

}

// run this on boot/reset
bool shutdown_user(bool jump_to_bootloader) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bool shutdown_user(bool jump_to_bootloader) {
bool shutdown_kb(bool jump_to_bootloader) {
if (!shutdown_user(jump_to_bootloader) {
return false;
}

}

// change depending on if OLED_MOD is pressed
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}

@TrojanPinata TrojanPinata requested a review from waffle87 December 7, 2024 01:31
keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.c Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.c Outdated Show resolved Hide resolved
keyboards/trojan_pinata/model_b/rev0/rev0.h Outdated Show resolved Hide resolved
Comment on lines 272 to 282
switch (get_highest_layer(layer_state)) {
case 0:
oled_invert(false);
break;
case 1:
oled_invert(true);
break;
default:
oled_invert(false);
break;
}
Copy link
Member

Choose a reason for hiding this comment

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

For most of these switches, you don't need to explicitly define each case. Eg, since case 0 and default are the same, you can specify just case 1 and default. Case 0 will be covered by "default", and you have less code.

This isn't a required change, just a suggestion.


void eeconfig_init_kb(void) {
keyboard_config.raw = 0;
keyboard_config.display_mode_saved = 2;
Copy link
Member

Choose a reason for hiding this comment

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

I think you wanted info as the default? So this is probably from my suggestion.

Suggested change
keyboard_config.display_mode_saved = 2;
keyboard_config.display_mode_saved = INFO;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants