Bladeren bron

Support Serial boolean check for Serial Monitor with HID serial emulation

main
PaulStoffregen 4 jaren geleden
bovenliggende
commit
dcac79c82e
7 gewijzigde bestanden met toevoegingen van 24 en 12 verwijderingen
  1. +7
    -4
      teensy3/usb_dev.c
  2. +1
    -0
      teensy3/usb_dev.h
  3. +1
    -0
      teensy3/usb_seremu.c
  4. +2
    -1
      teensy3/usb_seremu.h
  5. +10
    -6
      teensy4/usb.c
  6. +1
    -0
      teensy4/usb_seremu.c
  7. +2
    -1
      teensy4/usb_seremu.h

+ 7
- 4
teensy3/usb_dev.c Bestand weergeven

@@ -652,10 +652,13 @@ static void usb_control(uint32_t stat)
}
#endif
#ifdef SEREMU_INTERFACE
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE)
&& buf[0] == 0xA9 && buf[1] == 0x45 && buf[2] == 0xC2 && buf[3] == 0x6B) {
usb_reboot_timer = 5;
endpoint0_transmit(NULL, 0);
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE)) {
if (buf[0] == 0xA9 && buf[1] == 0x45 && buf[2] == 0xC2 && buf[3] == 0x6B) {
usb_reboot_timer = 5;
endpoint0_transmit(NULL, 0);
} else {
usb_seremu_online = 1;
}
}
#endif
#ifdef AUDIO_INTERFACE

+ 1
- 0
teensy3/usb_dev.h Bestand weergeven

@@ -70,6 +70,7 @@ static inline uint32_t usb_rx_byte_count(uint32_t endpoint)
#ifdef SEREMU_INTERFACE
extern volatile uint8_t usb_seremu_transmit_flush_timer;
extern void usb_seremu_flush_callback(void);
extern volatile uint8_t usb_seremu_online;
#endif

#ifdef KEYBOARD_INTERFACE

+ 1
- 0
teensy3/usb_seremu.c Bestand weergeven

@@ -42,6 +42,7 @@ volatile uint8_t usb_seremu_transmit_flush_timer=0;
static usb_packet_t *rx_packet=NULL;
static usb_packet_t *tx_packet=NULL;
static volatile uint8_t tx_noautoflush=0;
volatile uint8_t usb_seremu_online=0;

#define TRANSMIT_FLUSH_TIMEOUT 5 /* in milliseconds */


+ 2
- 1
teensy3/usb_seremu.h Bestand weergeven

@@ -54,6 +54,7 @@ void usb_seremu_flush_output(void);
void usb_seremu_flush_callback(void);
extern volatile uint8_t usb_seremu_transmit_flush_timer;
extern volatile uint8_t usb_configuration;
extern volatile uint8_t usb_seremu_online;
#ifdef __cplusplus
}
#endif
@@ -86,7 +87,7 @@ public:
uint8_t numbits(void) { return 8; }
uint8_t dtr(void) { return 1; }
uint8_t rts(void) { return 1; }
operator bool() { return usb_configuration; }
operator bool() { return usb_configuration && usb_seremu_online; }
};
extern usb_seremu_class Serial;
extern void serialEvent(void);

+ 10
- 6
teensy4/usb.c Bestand weergeven

@@ -775,12 +775,16 @@ static void endpoint0_complete(void)
}
#endif
#ifdef SEREMU_INTERFACE
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE)
&& endpoint0_buffer[0] == 0xA9 && endpoint0_buffer[1] == 0x45
&& endpoint0_buffer[2] == 0xC2 && endpoint0_buffer[3] == 0x6B) {
printf("seremu reboot request\n");
usb_start_sof_interrupts(NUM_INTERFACE);
usb_reboot_timer = 80; // TODO: 10 if only 12 Mbit/sec
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE)) {
if (endpoint0_buffer[0] == 0xA9 && endpoint0_buffer[1] == 0x45
&& endpoint0_buffer[2] == 0xC2 && endpoint0_buffer[3] == 0x6B) {
printf("seremu reboot request\n");
usb_start_sof_interrupts(NUM_INTERFACE);
usb_reboot_timer = 80; // TODO: 10 if only 12 Mbit/sec
} else {
// any other feature report means Arduino Serial Monitor is open
usb_seremu_online = 1;
}
}
#endif
#ifdef AUDIO_INTERFACE

+ 1
- 0
teensy4/usb_seremu.c Bestand weergeven

@@ -40,6 +40,7 @@

static volatile uint8_t tx_noautoflush=0;
extern volatile uint8_t usb_high_speed;
volatile uint8_t usb_seremu_online=0;

// TODO: should be 2 different timeouts, high speed (480) vs full speed (12)
#define TRANSMIT_FLUSH_TIMEOUT 75 /* in microseconds */

+ 2
- 1
teensy4/usb_seremu.h Bestand weergeven

@@ -51,6 +51,7 @@ int usb_seremu_write(const void *buffer, uint32_t size);
int usb_seremu_write_buffer_free(void);
void usb_seremu_flush_output(void);
extern volatile uint8_t usb_configuration;
extern volatile uint8_t usb_seremu_online;
#ifdef __cplusplus
}
#endif
@@ -83,7 +84,7 @@ public:
uint8_t numbits(void) { return 8; }
uint8_t dtr(void) { return 1; }
uint8_t rts(void) { return 1; }
operator bool() { return usb_configuration; }
operator bool() { return usb_configuration && usb_seremu_online; }
};
extern usb_seremu_class Serial;
extern void serialEvent(void);

Laden…
Annuleren
Opslaan