summaryrefslogtreecommitdiff
path: root/firmware/c1224/include/afsk_bitbang.h
blob: 886b91280d9cb510d98ad93e485ffda3e1a478c1 (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
/**
 * Bitbang / timed NRZI on TCM3105 TXD (GP6) and RXD (GP7).
 * Rate matches stuffed crystal — compile C1224_BITRATE=1200|2400.
 * SPDX-License-Identifier: GPL-3.0-or-later
 */
#ifndef C1224_AFSK_BITBANG_H
#define C1224_AFSK_BITBANG_H

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

#ifndef C1224_BITRATE
#define C1224_BITRATE 1200
#endif

void afsk_bitbang_init(void);

/** Transmit HDLC info payload (AX.25 frame without flags/FCS). Auto-PTT. */
bool afsk_tx_frame(const uint8_t *info, size_t info_len);

/** Poll RX sampler; call often from main loop. May emit via callback. */
typedef void (*afsk_rx_frame_fn)(const uint8_t *info, size_t len);
void afsk_rx_set_callback(afsk_rx_frame_fn fn);
void afsk_rx_poll(void);

bool afsk_tx_busy(void);
unsigned afsk_bitrate(void);

#endif /* C1224_AFSK_BITBANG_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com