blob: b25160c759d78b09d1ca35dfcbb033cb6abc5241 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <stdint.h>
#include "compiler_support.h"
#include "util.h"
/**
* \enum connection_host_t
*
* An enumeration of the possible hosts.
*/
typedef enum connection_host_t {
CONNECTION_HOST_AUTO,
CONNECTION_HOST_NONE,
CONNECTION_HOST_USB,
CONNECTION_HOST_BLUETOOTH,
CONNECTION_HOST_2P4GHZ
} connection_host_t;
/**
* \union connection_config_t
*
* Configuration structure for the connection subsystem.
*/
typedef union connection_config_t {
uint8_t raw;
connection_host_t desired_host : 8;
} PACKED connection_config_t;
STATIC_ASSERT(sizeof(connection_config_t) == sizeof(uint8_t), "Connection EECONFIG out of spec.");
/**
* \brief Initialize the subsystem.
*
* This function must be called only once, before any of the below functions can be called.
*/
void connection_init(void);
/**
* \brief Get currently configured host. Does not resolve 'CONNECTION_HOST_AUTO'.
*
* \return 'connection_host_t' of the configured host.
*/
connection_host_t connection_get_host_raw(void);
/**
* \brief Get current active host.
*
* \return 'connection_host_t' of the configured host.
*/
connection_host_t connection_auto_detect_host(void);
/**
* \brief Get currently configured host. Resolves 'CONNECTION_HOST_AUTO' using 'connection_auto_detect_host()'.
*
* \return 'connection_host_t' of the configured host.
*/
connection_host_t connection_get_host(void);
/**
* \brief Get current host. New state is not written to EEPROM.
*
* \param host The host to configure.
*/
void connection_set_host_noeeprom(connection_host_t host);
/**
* \brief Get current host.
*
* \param host The host to configure.
*/
void connection_set_host(connection_host_t host);
/**
* \brief Move to the next potential host. New state is not written to EEPROM.
*
*/
void connection_next_host_noeeprom(void);
/**
* \brief Move to the next potential host.
*
*/
void connection_next_host(void);
/**
* \brief Move to the previous potential host. New state is not written to EEPROM.
*
*/
void connection_prev_host_noeeprom(void);
/**
* \brief Move to the previous potential host.
*
*/
void connection_prev_host(void);
/**
* \brief user hook called when changing configured host
*
*/
void connection_host_changed_user(connection_host_t host);
/**
* \brief keyboard hook called when changing configured host
*
*/
void connection_host_changed_kb(connection_host_t host);
|