clang-format changes
This commit is contained in:
parent
61af76a10d
commit
b624f32f94
502 changed files with 32259 additions and 39062 deletions
File diff suppressed because it is too large
Load diff
|
@ -4,16 +4,16 @@
|
|||
*/
|
||||
#pragma once
|
||||
#ifdef MODULE_ADAFRUIT_BLE
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
# include <stdbool.h>
|
||||
# include <stdint.h>
|
||||
# include <string.h>
|
||||
|
||||
#include "config_common.h"
|
||||
#include "progmem.h"
|
||||
# include "config_common.h"
|
||||
# include "progmem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Instruct the module to enable HID keyboard support and reset */
|
||||
extern bool adafruit_ble_enable_keyboard(void);
|
||||
|
@ -34,20 +34,18 @@ extern void adafruit_ble_task(void);
|
|||
* this set of keys.
|
||||
* Also sends a key release indicator, so that the keys do not remain
|
||||
* held down. */
|
||||
extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys,
|
||||
uint8_t nkeys);
|
||||
extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys);
|
||||
|
||||
/* Send a consumer keycode, holding it down for the specified duration
|
||||
* (milliseconds) */
|
||||
extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration);
|
||||
|
||||
#ifdef MOUSE_ENABLE
|
||||
# ifdef MOUSE_ENABLE
|
||||
/* Send a mouse/wheel movement report.
|
||||
* The parameters are signed and indicate positive of negative direction
|
||||
* change. */
|
||||
extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
|
||||
int8_t pan, uint8_t buttons);
|
||||
#endif
|
||||
extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons);
|
||||
# endif
|
||||
|
||||
/* Compute battery voltage by reading an analog pin.
|
||||
* Returns the integer number of millivolts */
|
||||
|
@ -56,8 +54,8 @@ extern uint32_t adafruit_ble_read_battery_voltage(void);
|
|||
extern bool adafruit_ble_set_mode_leds(bool on);
|
||||
extern bool adafruit_ble_set_power_level(int8_t level);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif // MODULE_ADAFRUIT_BLE
|
||||
#endif // MODULE_ADAFRUIT_BLE
|
||||
|
|
|
@ -21,16 +21,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "debug.h"
|
||||
#include "bluetooth.h"
|
||||
|
||||
void bluefruit_keyboard_print_report(report_keyboard_t *report)
|
||||
{
|
||||
void bluefruit_keyboard_print_report(report_keyboard_t *report) {
|
||||
if (!debug_keyboard) return;
|
||||
dprintf("keys: "); for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { debug_hex8(report->keys[i]); dprintf(" "); }
|
||||
dprintf(" mods: "); debug_hex8(report->mods);
|
||||
dprintf(" reserved: "); debug_hex8(report->reserved);
|
||||
dprintf("keys: ");
|
||||
for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||
debug_hex8(report->keys[i]);
|
||||
dprintf(" ");
|
||||
}
|
||||
dprintf(" mods: ");
|
||||
debug_hex8(report->mods);
|
||||
dprintf(" reserved: ");
|
||||
debug_hex8(report->reserved);
|
||||
dprintf("\n");
|
||||
}
|
||||
|
||||
void bluefruit_serial_send(uint8_t data)
|
||||
{
|
||||
serial_send(data);
|
||||
}
|
||||
void bluefruit_serial_send(uint8_t data) { serial_send(data); }
|
|
@ -41,39 +41,8 @@ void bluefruit_serial_send(uint8_t data);
|
|||
| Stop | 00000000 00010000 | 00 10 |
|
||||
+-------------------------------------+-------+
|
||||
*/
|
||||
#define CONSUMER2BLUEFRUIT(usage) \
|
||||
(usage == AUDIO_MUTE ? 0x0000 : \
|
||||
(usage == AUDIO_VOL_UP ? 0x1000 : \
|
||||
(usage == AUDIO_VOL_DOWN ? 0x2000 : \
|
||||
(usage == TRANSPORT_NEXT_TRACK ? 0x0002 : \
|
||||
(usage == TRANSPORT_PREV_TRACK ? 0x0004 : \
|
||||
(usage == TRANSPORT_STOP ? 0x0010 : \
|
||||
(usage == TRANSPORT_STOP_EJECT ? 0x0000 : \
|
||||
(usage == TRANSPORT_PLAY_PAUSE ? 0x4000 : \
|
||||
(usage == AL_CC_CONFIG ? 0x0000 : \
|
||||
(usage == AL_EMAIL ? 0x0000 : \
|
||||
(usage == AL_CALCULATOR ? 0x0000 : \
|
||||
(usage == AL_LOCAL_BROWSER ? 0x0000 : \
|
||||
(usage == AC_SEARCH ? 0x0400 : \
|
||||
(usage == AC_HOME ? 0x0100 : \
|
||||
(usage == AC_BACK ? 0x0000 : \
|
||||
(usage == AC_FORWARD ? 0x0000 : \
|
||||
(usage == AC_STOP ? 0x0000 : \
|
||||
(usage == AC_REFRESH ? 0x0000 : \
|
||||
(usage == AC_BOOKMARKS ? 0x0000 : 0)))))))))))))))))))
|
||||
#define CONSUMER2BLUEFRUIT(usage) (usage == AUDIO_MUTE ? 0x0000 : (usage == AUDIO_VOL_UP ? 0x1000 : (usage == AUDIO_VOL_DOWN ? 0x2000 : (usage == TRANSPORT_NEXT_TRACK ? 0x0002 : (usage == TRANSPORT_PREV_TRACK ? 0x0004 : (usage == TRANSPORT_STOP ? 0x0010 : (usage == TRANSPORT_STOP_EJECT ? 0x0000 : (usage == TRANSPORT_PLAY_PAUSE ? 0x4000 : (usage == AL_CC_CONFIG ? 0x0000 : (usage == AL_EMAIL ? 0x0000 : (usage == AL_CALCULATOR ? 0x0000 : (usage == AL_LOCAL_BROWSER ? 0x0000 : (usage == AC_SEARCH ? 0x0400 : (usage == AC_HOME ? 0x0100 : (usage == AC_BACK ? 0x0000 : (usage == AC_FORWARD ? 0x0000 : (usage == AC_STOP ? 0x0000 : (usage == AC_REFRESH ? 0x0000 : (usage == AC_BOOKMARKS ? 0x0000 : 0)))))))))))))))))))
|
||||
|
||||
#define CONSUMER2RN42(usage) \
|
||||
(usage == AUDIO_MUTE ? 0x0040 : \
|
||||
(usage == AUDIO_VOL_UP ? 0x0010 : \
|
||||
(usage == AUDIO_VOL_DOWN ? 0x0020 : \
|
||||
(usage == TRANSPORT_NEXT_TRACK ? 0x0100 : \
|
||||
(usage == TRANSPORT_PREV_TRACK ? 0x0200 : \
|
||||
(usage == TRANSPORT_STOP ? 0x0400 : \
|
||||
(usage == TRANSPORT_STOP_EJECT ? 0x0800 : \
|
||||
(usage == TRANSPORT_PLAY_PAUSE ? 0x0080 : \
|
||||
(usage == AL_EMAIL ? 0x0200 : \
|
||||
(usage == AL_LOCAL_BROWSER ? 0x8000 : \
|
||||
(usage == AC_SEARCH ? 0x0400 : \
|
||||
(usage == AC_HOME ? 0x0100 : 0))))))))))))
|
||||
#define CONSUMER2RN42(usage) (usage == AUDIO_MUTE ? 0x0040 : (usage == AUDIO_VOL_UP ? 0x0010 : (usage == AUDIO_VOL_DOWN ? 0x0020 : (usage == TRANSPORT_NEXT_TRACK ? 0x0100 : (usage == TRANSPORT_PREV_TRACK ? 0x0200 : (usage == TRANSPORT_STOP ? 0x0400 : (usage == TRANSPORT_STOP_EJECT ? 0x0800 : (usage == TRANSPORT_PLAY_PAUSE ? 0x0080 : (usage == AL_EMAIL ? 0x0200 : (usage == AL_LOCAL_BROWSER ? 0x8000 : (usage == AC_SEARCH ? 0x0400 : (usage == AC_HOME ? 0x0100 : 0))))))))))))
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,27 +62,27 @@ extern host_driver_t lufa_driver;
|
|||
typedef struct {
|
||||
uint8_t report_id;
|
||||
uint16_t usage;
|
||||
} __attribute__ ((packed)) report_extra_t;
|
||||
} __attribute__((packed)) report_extra_t;
|
||||
|
||||
#ifdef API_ENABLE
|
||||
#include "api.h"
|
||||
# include "api.h"
|
||||
#endif
|
||||
|
||||
#ifdef API_SYSEX_ENABLE
|
||||
#include "api_sysex.h"
|
||||
// Allocate space for encoding overhead.
|
||||
//The header and terminator are not stored to save a few bytes of precious ram
|
||||
#define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0))
|
||||
# include "api_sysex.h"
|
||||
// Allocate space for encoding overhead.
|
||||
// The header and terminator are not stored to save a few bytes of precious ram
|
||||
# define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0))
|
||||
#endif
|
||||
|
||||
// #if LUFA_VERSION_INTEGER < 0x120730
|
||||
// /* old API 120219 */
|
||||
// #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank)
|
||||
// #else
|
||||
/* new API >= 120730 */
|
||||
#define ENDPOINT_BANK_SINGLE 1
|
||||
#define ENDPOINT_BANK_DOUBLE 2
|
||||
#define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum) , eptype, epsize, epbank)
|
||||
/* new API >= 120730 */
|
||||
#define ENDPOINT_BANK_SINGLE 1
|
||||
#define ENDPOINT_BANK_DOUBLE 2
|
||||
#define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum), eptype, epsize, epbank)
|
||||
// #endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "lufa.h"
|
||||
#include "outputselect.h"
|
||||
#ifdef MODULE_ADAFRUIT_BLE
|
||||
#include "adafruit_ble.h"
|
||||
# include "adafruit_ble.h"
|
||||
#endif
|
||||
|
||||
uint8_t desired_output = OUTPUT_DEFAULT;
|
||||
|
@ -33,9 +33,7 @@ void set_output(uint8_t output) {
|
|||
*
|
||||
* FIXME: Needs doc
|
||||
*/
|
||||
__attribute__((weak))
|
||||
void set_output_user(uint8_t output) {
|
||||
}
|
||||
__attribute__((weak)) void set_output_user(uint8_t output) {}
|
||||
|
||||
/** \brief Auto Detect Output
|
||||
*
|
||||
|
@ -53,7 +51,7 @@ uint8_t auto_detect_output(void) {
|
|||
#endif
|
||||
|
||||
#ifdef BLUETOOTH_ENABLE
|
||||
return OUTPUT_BLUETOOTH; // should check if BT is connected here
|
||||
return OUTPUT_BLUETOOTH; // should check if BT is connected here
|
||||
#endif
|
||||
|
||||
return OUTPUT_NONE;
|
||||
|
@ -69,4 +67,3 @@ uint8_t where_to_send(void) {
|
|||
}
|
||||
return desired_output;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,14 @@ enum outputs {
|
|||
* backward compatibility for BLUETOOTH_ENABLE, send to BT and USB by default
|
||||
*/
|
||||
#ifndef OUTPUT_DEFAULT
|
||||
#ifdef BLUETOOTH_ENABLE
|
||||
#define OUTPUT_DEFAULT OUTPUT_USB_AND_BT
|
||||
#else
|
||||
#define OUTPUT_DEFAULT OUTPUT_AUTO
|
||||
#endif
|
||||
# ifdef BLUETOOTH_ENABLE
|
||||
# define OUTPUT_DEFAULT OUTPUT_USB_AND_BT
|
||||
# else
|
||||
# define OUTPUT_DEFAULT OUTPUT_AUTO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void set_output(uint8_t output);
|
||||
void set_output_user(uint8_t output);
|
||||
void set_output(uint8_t output);
|
||||
void set_output_user(uint8_t output);
|
||||
uint8_t auto_detect_output(void);
|
||||
uint8_t where_to_send(void);
|
Loading…
Add table
Add a link
Reference in a new issue