Initial code for ARM UART output module (mainly for CLI)

This commit is contained in:
Jacob Alexander 2014-06-27 00:53:20 -07:00
parent 99d4aaba84
commit 6f563bdc9f
8 changed files with 619 additions and 23 deletions

View file

@ -669,21 +669,12 @@ void usb_tx(uint32_t endpoint, usb_packet_t *packet)
}
void usb_device_reload()
{
asm volatile("bkpt");
}
void _reboot_Teensyduino_(void)
{
// TODO: initialize R0 with a code....
asm volatile("bkpt");
}
void usb_isr(void)
{
uint8_t status, stat, t;
@ -700,7 +691,7 @@ void usb_isr(void)
t = usb_reboot_timer;
if (t) {
usb_reboot_timer = --t;
if (!t) _reboot_Teensyduino_();
if (!t) usb_device_reload();
}
#ifdef CDC_DATA_INTERFACE
t = usb_cdc_transmit_flush_timer;

View file

@ -105,6 +105,10 @@ inline void Output_setup()
// If the Teensy is powered without a PC connected to the USB port,
// this will wait forever.
usb_init();
#include <led.h>
init_errorLED();
errorLED( 1 );
while(1);
while ( !usb_configured() ) /* wait */ ;
// Register USB Output CLI dictionary
@ -119,19 +123,19 @@ inline void Output_setup()
// USB Data Send
inline void Output_send(void)
{
// TODO undo potentially old keys
for ( uint8_t c = USBKeys_Sent; c < USBKeys_MaxSize; c++ )
USBKeys_Array[c] = 0;
// TODO undo potentially old keys
for ( uint8_t c = USBKeys_Sent; c < USBKeys_MaxSize; c++ )
USBKeys_Array[c] = 0;
// Send keypresses
usb_keyboard_send();
// Send keypresses
usb_keyboard_send();
// Clear modifiers and keys
USBKeys_Modifiers = 0;
USBKeys_Sent = 0;
// Clear modifiers and keys
USBKeys_Modifiers = 0;
USBKeys_Sent = 0;
// Signal Scan Module we are finishedA
Scan_finishedWithUSBBuffer( USBKeys_Sent <= USBKeys_MaxSize ? USBKeys_Sent : USBKeys_MaxSize );
// Signal Scan Module we are finishedA
Scan_finishedWithUSBBuffer( USBKeys_Sent <= USBKeys_MaxSize ? USBKeys_Sent : USBKeys_MaxSize );
}