add touch1200 for uploading

This commit is contained in:
hathach committed 2018-08-24 18:47:29 +07:00
1 parent 4cbcf9b351
commit adc6182e81
4 files changed
+34 -8

No files matched your search

+5 -8
View File
@@ -85,15 +85,12 @@ bool tud_mounted(void);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK
//--------------------------------------------------------------------+
/** \brief Callback function that will be invoked device is mounted (configured) by USB host
* \note This callback should be used by Application to \b set-up application data
*/
void tud_mount_cb(void);
/** \brief Callback function that will be invoked when device is unmounted (bus reset/unplugged)
* \note This callback should be used by Application to \b tear-down application data
*/
void tud_umount_cb(void);
/** Callback invoked when device is mounted (configured) */
ATTR_WEAK void tud_mount_cb(void);
/** Callback invoked when device is unmounted (bus reset/unplugged) */
ATTR_WEAK void tud_umount_cb(void);
//void tud_device_suspended_cb(void);
+20
View File
@@ -110,4 +110,24 @@ void usb_init(void)
tusb_init();
}
// Invoked when cdc when line state changed e.g connected/disconnected
// Use to reset to DFU when disconnect with 1200 bps
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
{
(void) itf; // interface ID, not used
// disconnected event
if ( !dtr && !rts )
{
cdc_line_coding_t coding;
tud_cdc_get_line_coding(&coding);
if ( coding.bit_rate == 1200 ) enterSerialDfu();
}
}
#endif
@@ -23,6 +23,8 @@
#include "wiring_digital.h"
#include "nrf.h"
extern "C" void usb_init(void);
const uint32_t g_ADigitalPinMap[] =
{
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ,
@@ -39,5 +41,8 @@ void initVariant()
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
// USB init TODO may have trouble with ISR when SD is enabled
usb_init();
}
+4
View File
@@ -23,6 +23,8 @@
#include "wiring_digital.h"
#include "nrf.h"
extern "C" void usb_init(void);
const uint32_t g_ADigitalPinMap[] =
{
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ,
@@ -31,6 +33,7 @@ const uint32_t g_ADigitalPinMap[] =
24 , 25 , 26 , 27 , 28 , 29 , 30 , 31
};
void initVariant()
{
// LED1 & LED2
@@ -41,5 +44,6 @@ void initVariant()
ledOff(PIN_LED2);
// USB init TODO may have trouble with ISR when SD is enabled
usb_init();
}