mirror of
https://github.com/hathach/tinyusb.git
synced 2025-05-08 14:45:49 +08:00
fix wanings
This commit is contained in:
parent
65e01fff2e
commit
99673cdbb8
@ -27,7 +27,7 @@
|
||||
#include "tusb.h"
|
||||
#include "bsp/board_api.h"
|
||||
|
||||
size_t get_console_inputs(uint8_t* buf, size_t bufsize) {
|
||||
static size_t get_console_inputs(uint8_t* buf, size_t bufsize) {
|
||||
size_t count = 0;
|
||||
while (count < bufsize) {
|
||||
int ch = board_getchar();
|
||||
|
@ -165,8 +165,7 @@ static void process_kbd_report(hid_keyboard_report_t const *report)
|
||||
// Mouse
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void cursor_movement(int8_t x, int8_t y, int8_t wheel)
|
||||
{
|
||||
static void cursor_movement(int8_t x, int8_t y, int8_t wheel) {
|
||||
#if USE_ANSI_ESCAPE
|
||||
// Move X using ansi escape
|
||||
if ( x < 0)
|
||||
|
@ -31,18 +31,12 @@
|
||||
#include "tusb.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF PROTYPES
|
||||
// MACRO CONSTANT TYPEDEF PROTOTYPES
|
||||
//--------------------------------------------------------------------+
|
||||
void led_blinking_task(void);
|
||||
extern void cdc_app_task(void);
|
||||
extern void hid_app_task(void);
|
||||
|
||||
#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
|
||||
// API to read/rite MAX3421's register. Implemented by TinyUSB
|
||||
extern uint8_t tuh_max3421_reg_read(uint8_t rhport, uint8_t reg, bool in_isr);
|
||||
extern bool tuh_max3421_reg_write(uint8_t rhport, uint8_t reg, uint8_t data, bool in_isr);
|
||||
#endif
|
||||
|
||||
/*------------- MAIN -------------*/
|
||||
int main(void) {
|
||||
board_init();
|
||||
@ -101,7 +95,9 @@ void led_blinking_task(void) {
|
||||
static bool led_state = false;
|
||||
|
||||
// Blink every interval ms
|
||||
if (board_millis() - start_ms < interval_ms) return; // not enough time
|
||||
if (board_millis() - start_ms < interval_ms) {
|
||||
return;// not enough time
|
||||
}
|
||||
start_ms += interval_ms;
|
||||
|
||||
board_led_write(led_state);
|
||||
|
@ -52,7 +52,7 @@ void cdc_app_init(void) {
|
||||
}
|
||||
|
||||
// helper
|
||||
size_t get_console_inputs(uint8_t *buf, size_t bufsize) {
|
||||
static size_t get_console_inputs(uint8_t *buf, size_t bufsize) {
|
||||
size_t count = 0;
|
||||
while (count < bufsize) {
|
||||
int ch = board_getchar();
|
||||
|
@ -69,12 +69,6 @@ extern void cdc_app_init(void);
|
||||
extern void hid_app_init(void);
|
||||
extern void msc_app_init(void);
|
||||
|
||||
#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
|
||||
// API to read/rite MAX3421's register. Implemented by TinyUSB
|
||||
extern uint8_t tuh_max3421_reg_read(uint8_t rhport, uint8_t reg, bool in_isr);
|
||||
extern bool tuh_max3421_reg_write(uint8_t rhport, uint8_t reg, uint8_t data, bool in_isr);
|
||||
#endif
|
||||
|
||||
/*------------- MAIN -------------*/
|
||||
int main(void) {
|
||||
board_init();
|
||||
|
@ -34,7 +34,7 @@ void msc_app_init(void) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const *cb_data) {
|
||||
static bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const *cb_data) {
|
||||
msc_cbw_t const *cbw = cb_data->cbw;
|
||||
msc_csw_t const *csw = cb_data->csw;
|
||||
|
||||
|
@ -231,14 +231,12 @@ void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance)
|
||||
}
|
||||
|
||||
// check if different than 2
|
||||
bool diff_than_2(uint8_t x, uint8_t y)
|
||||
{
|
||||
static inline bool diff_than_2(uint8_t x, uint8_t y) {
|
||||
return (x - y > 2) || (y - x > 2);
|
||||
}
|
||||
|
||||
// check if 2 reports are different enough
|
||||
bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2)
|
||||
{
|
||||
static bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2) {
|
||||
bool result;
|
||||
|
||||
// x, y, z, rz must different than 2 to be counted
|
||||
@ -251,7 +249,7 @@ bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2)
|
||||
return result;
|
||||
}
|
||||
|
||||
void process_sony_ds4(uint8_t const* report, uint16_t len)
|
||||
static void process_sony_ds4(uint8_t const* report, uint16_t len)
|
||||
{
|
||||
(void)len;
|
||||
const char* dpad_str[] = { "N", "NE", "E", "SE", "S", "SW", "W", "NW", "none" };
|
||||
@ -310,16 +308,13 @@ void process_sony_ds4(uint8_t const* report, uint16_t len)
|
||||
}
|
||||
|
||||
// Invoked when received report from device via interrupt endpoint
|
||||
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
|
||||
{
|
||||
if ( is_sony_ds4(dev_addr) )
|
||||
{
|
||||
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len) {
|
||||
if (is_sony_ds4(dev_addr)) {
|
||||
process_sony_ds4(report, len);
|
||||
}
|
||||
|
||||
// continue to request to receive report
|
||||
if ( !tuh_hid_receive_report(dev_addr, instance) )
|
||||
{
|
||||
if (!tuh_hid_receive_report(dev_addr, instance)) {
|
||||
printf("Error: cannot request to receive report\r\n");
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,8 @@
|
||||
#define EMBEDDED_CLI_IMPL
|
||||
#include "embedded_cli.h"
|
||||
|
||||
#include "msc_app.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
|
Loading…
x
Reference in New Issue
Block a user