mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-10-31 22:47:05 +01:00
36 lines
696 B
Bash
Executable File
36 lines
696 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# doorlock-avr, AVR code of Binary Kitchen's doorlock
|
|
#
|
|
# Copyright (c) Binary Kitchen, 2019
|
|
#
|
|
# Authors:
|
|
# Ralf Ramsauer <ralf@binary-kitchen.de>
|
|
#
|
|
# This work is licensed under the terms of the GNU GPL, version 2. See
|
|
# the COPYING file in the top-level directory.
|
|
|
|
PROTOCOL_H=$1
|
|
|
|
function find_defines() {
|
|
header=$1
|
|
prefix=$2
|
|
search="#define\s\+${prefix}\(\S*\)\s\+\(\S*\).*"
|
|
replace=" \1\t= b\2"
|
|
|
|
grep $prefix $header | sed -e "s/$search/$replace/"
|
|
}
|
|
|
|
AVR_COMM=$(find_defines $PROTOCOL_H AVR_)
|
|
|
|
cat <<END
|
|
# This file is autogenerated. If you need to change it, edit
|
|
# scripts/gen_protocol.sh instead.
|
|
|
|
from enum import Enum
|
|
|
|
|
|
class Protocol(Enum):
|
|
${AVR_COMM}
|
|
END
|