From b71bc49ce3da5cc6ea83799b0988fb8301455003 Mon Sep 17 00:00:00 2001 From: pip Date: Sun, 6 Mar 2011 21:08:12 +0000 Subject: [PATCH] Updated USB descriptor to use the BCD values stated on the wiki page http://wiki.openpilot.org/display/Doc/Firmware+USB+descriptors git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2993 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/PipXtreme/inc/main.h | 2 +- flight/PipXtreme/inc/pios_usb.h | 3 ++- flight/PipXtreme/ppm.c | 26 +++++++++++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/flight/PipXtreme/inc/main.h b/flight/PipXtreme/inc/main.h index 11278169f..b1efc1fce 100644 --- a/flight/PipXtreme/inc/main.h +++ b/flight/PipXtreme/inc/main.h @@ -33,7 +33,7 @@ // firmware version #define VERSION_MAJOR 0 // 0 to 255 -#define VERSION_MINOR 8 // 0 to 255 +#define VERSION_MINOR 9 // 0 to 255 // macro's for reading internal flash memory #define mem8(addr) (*((volatile uint8_t *)(addr))) diff --git a/flight/PipXtreme/inc/pios_usb.h b/flight/PipXtreme/inc/pios_usb.h index 76bd6da91..9b8954306 100644 --- a/flight/PipXtreme/inc/pios_usb.h +++ b/flight/PipXtreme/inc/pios_usb.h @@ -49,7 +49,8 @@ //#define PIOS_USB_PRODUCT_ID 0x415C // PipXtreme PID #ifndef PIOS_USB_VERSION_ID -#define PIOS_USB_VERSION_ID 0x1201 /* v2.00 */ +//#define PIOS_USB_VERSION_ID 0x1201 /* v2.00 */ +#define PIOS_USB_VERSION_ID 0x0301 // PipXtreme, board revision 1 #endif /* Internal defines which are used by PIOS USB HID (don't touch) */ diff --git a/flight/PipXtreme/ppm.c b/flight/PipXtreme/ppm.c index b90763d98..b07628e4c 100644 --- a/flight/PipXtreme/ppm.c +++ b/flight/PipXtreme/ppm.c @@ -263,6 +263,20 @@ void ppm_In_Supervisor(void) } } +uint32_t ppm_In_NewFrame(void) +{ + if (booting || ppm_initialising) + return 0; + + if (ppm_In_Frames >= 4 && ppm_In_Frames != ppm_In_PrevFrames) + { // we have a new PPM frame + ppm_In_PrevFrames = ppm_In_Frames; + return ppm_In_PrevFrames; + } + + return 0; +} + int32_t ppm_In_GetChannelPulseWidth(uint8_t channel) { if (booting || ppm_initialising) @@ -329,10 +343,8 @@ void ppm_process(void) if (saved_settings.mode == MODE_PPM_TX) { - if (ppm_In_Frames > 0 && ppm_In_Frames != ppm_In_PrevFrames) - { // we have a new PPM frame - - ppm_In_PrevFrames = ppm_In_Frames; + if (ppm_In_NewFrame() > 0) + { // we have a new PPM frame to send #ifdef PPM_DEBUG DEBUG_PRINTF("\r\n"); @@ -344,7 +356,7 @@ void ppm_process(void) // int32_t pwm = ppm_In_GetChannelPulseWidth(i); #ifdef PPM_DEBUG - DEBUG_PRINTF("ppm_in: %u %u %4u\r\n", ppm_In_PrevFrames, i, ppm_In_GetChannelPulseWidth(i)); + DEBUG_PRINTF("ppm_in: %u %u %4u\r\n", ppm_In_Frames, i, ppm_In_GetChannelPulseWidth(i)); #endif } } @@ -364,6 +376,10 @@ void ppm_deinit(void) // disable the PPM timer TIM_Cmd(PIOS_PPM_IN_TIM, DISABLE); + // un-remap the PPM IN pin +// GPIO_PinRemapConfig(GPIO_PartialRemap1_TIM2, DISABLE); + GPIO_PinRemapConfig(GPIO_PartialRemap2_TIM2, DISABLE); +// GPIO_PinRemapConfig(GPIO_FullRemap_TIM2, DISABLE); } void ppm_init(uint32_t our_sn)