summaryrefslogtreecommitdiff
path: root/firmware/s1224/src/common/ptt.c
blob: f54f2215f9e0e1a65da2109df7dc0f165ee572fa (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
/*
 * PTT via Pico GPIO — host asserts over USB CDC (Type-A Path B), not softmodem.
 * PIN_PTT_DRV = keying (required). PIN_LED_PTT = optional/spare TX LED mirror.
 * SPDX-License-Identifier: GPL-3.0-or-later
 */
#include "ptt.h"
#include "board_pins.h"
#include "hardware/gpio.h"

static bool g_ptt;

void ptt_init(void)
{
    gpio_init(PIN_PTT_DRV);
    gpio_set_dir(PIN_PTT_DRV, GPIO_OUT);
    gpio_put(PIN_PTT_DRV, 0);
    g_ptt = false;
    gpio_put(PIN_LED_PTT, 0);
}

void ptt_set(bool on)
{
    g_ptt = on;
    gpio_put(PIN_PTT_DRV, on ? 1 : 0);
    gpio_put(PIN_LED_PTT, on ? 1 : 0);
}

bool ptt_get(void)
{
    return g_ptt;
}
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com