This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gccでは...で表した可変長引数を__VA_ARGS__で指定できる | |
// 可変長引数を全て__VA_ARGS__とマップする | |
#define DEBUG_PRINT(...) printf(__VA_ARGS__); fflush(stdout) | |
// fmt以降の可変長引数を__VA_ARGS__とマップする | |
#define DEBUG_PRINT2(fmt, ...) printf(fmt, __VA_ARGS__); fflush(stdout) | |
// _1,_2,_3,の部分・・・引数の個数だけ用意する | |
// NAME・・・この部分に、目的の引数個数用の関数名が入る | |
#define GET_MACRO(_1,_2,_3,NAME,...) NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
cmake_minimum_required(VERSION 3.20.0) | |
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | |
project(button) | |
target_sources(app PRIVATE src/main.c src/remap.c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
// zephyr-latest/zephyr-proj/zephyr/include/zephyr/sys/util_macro.h | |
/** @brief Extract the Least Significant Bit from @p value. */ | |
#define LSB_GET(value) ((value) & -(value)) | |
/** | |
* @brief Extract a bitfield element from @p value corresponding to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zephyr/samples/basic/button/boards/custom.conf | |
# | |
# "static" pinctrl to use external-uart breakout (AE-FT2232 / FTDI FT2232D) as /dev/ttyUSB0 | |
# this file is to switch USB-CDC-ACM (/dev/ttyACM0) --> external uart (/dev/ttyUSB0) | |
# disable USB CDC ACM | |
CONFIG_USB_DEVICE_STACK=n | |
CONFIG_USB_DEVICE_STACK_NEXT=n | |
CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// zephyr/samples/basic/button/boards/xiao_ble.overlay | |
// | |
// adopt from zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52810.dts | |
/{ | |
buttons { | |
compatible = "gpio-keys"; | |
button0: button_0 { | |
label = "Push button switch 0"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2020 The ZMK Contributors | |
* | |
* SPDX-License-Identifier: MIT | |
*/ | |
#include <zephyr/kernel.h> | |
#include <zephyr/device.h> | |
#include <zephyr/devicetree.h> | |
#include <zephyr/settings/settings.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int fun(int x) { return x * 10; } | |
// inline int fun_inline(int x) { return x * 100; } // --> causes undefined reference | |
extern inline int fun_inline(int x) { return x * 100; } // ok | |
// static inline int fun_inline(int x) { return x * 1000; } // ok, but this .c file local | |
int main(void) { | |
printf("%d, %d\n", fun(2), fun_inline(2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int fun0(void) { return 5; } | |
int fun1(int x) { return x * 10; } | |
// inline int fun1_inline(int x) { return x * 100; } // => undefined reference | |
extern inline int fun1_inline_extern(int x) { return x * 100; } | |
static inline int fun1_inline_static(int x) { return x * 1000; } | |
#define OVERRIDE 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int fun0(void) { return 5; } | |
int fun1(int x) { return x * 2; } | |
#define OVERRIDE 1 | |
#if OVERRIDE == 1 | |
#define fun0() (9) | |
#define fun1(x) (99) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# Example usage: | |
# dmesg -w | myfilter.py -x foo bar baz | |
# | |
import sys | |
import re | |
import argparse |
NewerOlder