Skip to content

Commit

Permalink
include cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Apr 28, 2024
1 parent 0aee673 commit 75ceff1
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 69 deletions.
22 changes: 12 additions & 10 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ src_user = [
# PLATFORM

inc_platform_sh68f90a = [
'src/plaform/sh68f90a',
'src/platform/sh68f90a',
]

src_platform_sh68f90a = [
Expand All @@ -71,15 +71,15 @@ inc_user_example = [
]

src_user_example = [
'src/keyboards/example/smatrix.c',
'src/keyboards/example/user_matrix.c',
]

inc_user_nuphy_air60 = [
'src/keyboards/nuphy-air60',
]

src_user_nuphy_air60 = [
'src/keyboards/nuphy-air60/smatrix.c',
'src/keyboards/nuphy-air60/user_matrix.c',
]

# USER LAYOUTS
Expand Down Expand Up @@ -150,6 +150,8 @@ foreach part : parts
if platform == 'sh68f90a'
src_main += src_platform_sh68f90a
inc_dirs += inc_platform_sh68f90a
else
error('unsupported platform: @0@'.format(platform))
endif

if keyboard == 'nuphy-air60'
Expand All @@ -167,10 +169,10 @@ foreach part : parts
src_main += src_user_example_default
endif
else
error('unsupported keyboard: ' + keyboard)
error('unsupported keyboard: @0@'.format(keyboard))
endif

prefix = keyboard + '_' + layout + '_'
prefix = '@0@_@1@_'.format(keyboard, layout)

cc_args = cc_base_args + [
'-DFREQ_SYS=@0@'.format(options['freq_sys']),
Expand All @@ -190,23 +192,23 @@ foreach part : parts
)

rel_main = compiler.process(src_main)
ihx_smk = custom_target(prefix + 'smk.ihx',
ihx_smk = custom_target('@0@smk.ihx'.format(prefix),
input : rel_main,
output : prefix + 'smk.ihx',
output : '@0@smk.ihx'.format(prefix),
depends: [lib_user],
command : [cc, cc_args, '-o', '@OUTPUT@', '@INPUT@', '-l' + lib_user.full_path()],
)

hex_smk = custom_target(prefix + 'smk.hex',
hex_smk = custom_target('@0@smk.hex'.format(prefix),
input : ihx_smk,
output : prefix + 'smk.hex',
output : '@0@smk.hex'.format(prefix),
capture: true,
install : true,
install_dir : 'firmware',
command : [packihx, '@INPUT@'],
)

flash = run_target(prefix + 'flash',
flash = run_target('@0@flash'.format(prefix),
command : [skbt, 'write', '-p', keyboard, hex_smk.full_path()],
depends : hex_smk,
)
Expand Down
2 changes: 1 addition & 1 deletion src/keyboards/example/kbdef.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef KBDEF_H
#define KBDEF_H

#include "../../platform/sh68f90a/sh68f90a.h"
#include "sh68f90a.h"

#define MATRIX_ROWS 5
#define MATRIX_COLS 16
Expand Down
14 changes: 0 additions & 14 deletions src/keyboards/example/smatrix.c

This file was deleted.

14 changes: 14 additions & 0 deletions src/keyboards/example/user_matrix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "user_matrix.h"

void user_matrix_pre_scan(uint8_t col)
{
col;
}

uint8_t user_matrix_scan_col(uint8_t col)
{
col;
return 0;
}

void user_matrix_post_scan() {}
2 changes: 1 addition & 1 deletion src/keyboards/nuphy-air60/kbdef.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef KBDEF_H
#define KBDEF_H

#include "../../platform/sh68f90a/sh68f90a.h"
#include "sh68f90a.h"

#define MATRIX_ROWS 5
#define MATRIX_COLS 16
Expand Down
6 changes: 3 additions & 3 deletions src/keyboards/nuphy-air60/layouts/default/indicators.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../../../../user/indicators.h"
#include "../../../../platform/sh68f90a/sh68f90a.h"
#include "../../../../platform/sh68f90a/pwm.h"
#include "indicators.h"
#include "sh68f90a.h"
#include "pwm.h"
#include <stdlib.h>

void indicators_pre_update()
Expand Down
6 changes: 3 additions & 3 deletions src/keyboards/nuphy-air60/layouts/default/layout.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../../kbdef.h"
#include "../../../../user/layout.h"
#include "../../../../smk/report.h"
#include "kbdef.h"
#include "layout.h"
#include "report.h"
#include <stdint.h>

// clang-format off
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "kbdef.h"
#include "user_matrix.h"

void matrix_pre_scan(uint8_t col)
void user_matrix_pre_scan(uint8_t col)
{
// set all columns to high
P1 |= (uint8_t)(_P1_5);
Expand Down Expand Up @@ -76,7 +77,7 @@ void matrix_pre_scan(uint8_t col)
}
}

uint8_t matrix_scan_col(uint8_t col)
uint8_t user_matrix_scan_col(uint8_t col)
{
col;
// grab key for the column state
Expand All @@ -88,7 +89,7 @@ uint8_t matrix_scan_col(uint8_t col)
return (((P7 >> 1) & 0x07) | (P5 & 0x18)) | 0xe0;
}

void matrix_post_scan()
void user_matrix_post_scan()
{
// set all columns down to low
P1 &= (uint8_t) ~(_P1_5);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/sh68f90a/delay.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "delay.h"
#include "watchdog.h"
#include "../../smk/utils.h"
#include "utils.h"
#include <stdint.h>

// very naive implementation, not very accurate or optimized
Expand Down
4 changes: 2 additions & 2 deletions src/platform/sh68f90a/keyboard.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "sh68f90a.h"
#include "../../smk/keyboard.h"
#include "../../smk/debug.h"
#include "keyboard.h"
#include "debug.h"

__xdata keyboard_state_t keyboard_state;

Expand Down
12 changes: 6 additions & 6 deletions src/platform/sh68f90a/usb.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "usb.h"
#include "watchdog.h"
#include "isp.h"
#include "../../smk/usbdef.h"
#include "usbdef.h"
#include "usbregs.h"
#include "../../smk/debug.h"
#include "../../smk/utils.h"
#include "../../smk/usbhidreport.h"
#include "../../smk/keyboard.h"
#include "../../platform/sh68f90a/delay.h"
#include "debug.h"
#include "utils.h"
#include "usbhidreport.h"
#include "keyboard.h"
#include "delay.h"
#include <stdint.h>
#include <string.h>

Expand Down
2 changes: 1 addition & 1 deletion src/platform/sh68f90a/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define USB_H

#include "sh68f90a.h"
#include "../../smk/report.h"
#include "report.h"
#include <stdint.h>

void usb_init();
Expand Down
2 changes: 1 addition & 1 deletion src/smk/host.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "host.h"
#include "debug.h"
#include "../platform/sh68f90a/usb.h"
#include "usb.h"

/* send report */
void host_keyboard_send(report_keyboard_t *report)
Expand Down
15 changes: 6 additions & 9 deletions src/smk/matrix.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#include "matrix.h"
#include "report.h"
#include "debug.h"
#include "../platform/sh68f90a/sh68f90a.h"
#include "../platform/sh68f90a/pwm.h"
#include "../platform/sh68f90a/delay.h"
#include "../user/layout.h"
#include "../user/indicators.h"
#include "../user/matrix.h"
#include "layout.h"
#include "indicators.h"
#include "user_matrix.h"
#include <stdlib.h>
#include <stdbool.h>

Expand Down Expand Up @@ -148,11 +145,11 @@ inline void matrix_scan_step()

// ignore until updated matrix has been read/flushed
if (!matrix_updated) {
matrix_pre_scan(current_step);
user_matrix_pre_scan(current_step);

uint8_t column_state = matrix_scan_col(current_step);
uint8_t column_state = user_matrix_scan_col(current_step);

matrix_post_scan();
user_matrix_post_scan();

matrix[current_step] = ~column_state;

Expand Down
2 changes: 1 addition & 1 deletion src/smk/report.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "report.h"
#include "host.h"
#include "../user/layout.h"
#include "layout.h"
#include <string.h>

static uint8_t real_mods = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/user/indicators.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef INDICATORS_H
#define INDICATORS_H

#include "../smk/keyboard.h"
#include "keyboard.h"
#include <stdint.h>
#include <stdbool.h>

Expand Down
4 changes: 2 additions & 2 deletions src/user/layout.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef LAYOUT_H
#define LAYOUT_H

#include "../smk/matrix.h"
#include "../smk/keycodes.h"
#include "matrix.h"
#include "keycodes.h"
#include <stdbool.h>

extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
Expand Down
10 changes: 0 additions & 10 deletions src/user/matrix.h

This file was deleted.

10 changes: 10 additions & 0 deletions src/user/user_matrix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef USER_MATRIX_H
#define USER_MATRIX_H

#include <stdint.h>

void user_matrix_pre_scan(uint8_t col);
uint8_t user_matrix_scan_col(uint8_t col);
void user_matrix_post_scan();

#endif

0 comments on commit 75ceff1

Please sign in to comment.