aboutsummaryrefslogtreecommitdiff
path: root/modules/qmk/hello_world/hello_world.c
blob: dcabfc60ea25be49afd67c2b9be074cccdcece94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2025 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H

#include "introspection.h"

ASSERT_COMMUNITY_MODULES_MIN_API_VERSION(1, 0, 0);

uint32_t delayed_hello_world(uint32_t trigger_time, void *cb_arg) {
    dprintf("Hello, world! I'm a QMK based keyboard! The keymap array size is %d bytes.\n", (int)hello_world_introspection().total_size);
    return 0;
}

void keyboard_post_init_hello_world(void) {
    keyboard_post_init_hello_world_kb();
    defer_exec(10000, delayed_hello_world, NULL);
}

bool process_record_hello_world(uint16_t keycode, keyrecord_t *record) {
    if (!process_record_hello_world_kb(keycode, record)) {
        return false;
    }

    switch (keycode) {
        case COMMUNITY_MODULE_HELLO:
            if (record->event.pressed) {
                SEND_STRING("Hello there.");
                break;
            }
    }

    return true;
}