diff --git a/flight/PiOS/Boards/STM32F4xx_Revolution.h b/flight/PiOS/Boards/STM32F4xx_Revolution.h index 585bfd2ad..370abd2e3 100644 --- a/flight/PiOS/Boards/STM32F4xx_Revolution.h +++ b/flight/PiOS/Boards/STM32F4xx_Revolution.h @@ -28,12 +28,10 @@ #ifndef STM3210E_INS_H_ +#define STM3210E_INS_H_ #include -#define DEBUG_LEVEL 2 -#define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_aux_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_aux_id, __VA_ARGS__); }} - //------------------------ // Timers and Channels Used //------------------------ @@ -135,26 +133,6 @@ extern uint32_t pios_com_vcp_id; #define PIOS_COM_BRIDGE (pios_com_bridge_id) #define PIOS_COM_VCP (pios_com_vcp_id) #define PIOS_COM_DEBUG PIOS_COM_AUX -#if defined(PIOS_INCLUDE_RFM22B) -#define PIOS_COM_RFM22B_RF_RX_BUF_LEN 512 -#define PIOS_COM_RFM22B_RF_TX_BUF_LEN 512 -extern uint32_t pios_com_rfm22b_id; -#define PIOS_COM_RADIO (pios_com_rfm22b_id) -extern uint32_t pios_spi_rfm22b_id; -#define PIOS_RFM22_SPI_PORT (pios_spi_rfm22b_id) -#endif /* PIOS_INCLUDE_RFM22B */ - -//------------------------- -// Packet Handler -//------------------------- -#if defined(PIOS_INCLUDE_PACKET_HANDLER) -extern uint32_t pios_packet_handler; -#define PIOS_PACKET_HANDLER (pios_packet_handler) -#define PIOS_PH_MAX_PACKET 255 -#define PIOS_PH_WIN_SIZE 3 -#define PIOS_PH_MAX_CONNECTIONS 1 -#define RS_ECC_NPARITY 4 -#endif /* PIOS_INCLUDE_PACKET_HANDLER */ //------------------------ // TELEMETRY @@ -285,16 +263,6 @@ extern uint32_t pios_packet_handler; #define PIOS_USB_ENABLED 1 /* Should remove all references to this */ #define PIOS_USB_HID_MAX_DEVS 1 - -//------------------------- -// RFM22 -//------------------------- -#if defined(PIOS_INCLUDE_RFM22B) -extern uint32_t pios_rfm22b_id; -#define RFM22_EXT_INT_USE - -#endif /* PIOS_INCLUDE_RFM22B */ - #endif /* STM3210E_INS_H_ */ /** * @} diff --git a/flight/Revolution/Makefile b/flight/Revolution/Makefile index 73462f033..88d154ba5 100644 --- a/flight/Revolution/Makefile +++ b/flight/Revolution/Makefile @@ -57,7 +57,6 @@ MODULES += AltitudeHold VtolPathFollower FixedWingPathFollower PathPlanner MODULES += CameraStab MODULES += OveroSync MODULES += Telemetry -MODULES += Radio PYMODULES = #FlightPlan @@ -73,7 +72,6 @@ PIOSINC = $(PIOS)/inc OPMODULEDIR = ../Modules FLIGHTLIB = ../Libraries FLIGHTLIBINC = ../Libraries/inc -RSCODEINC = $(FLIGHTLIB)/rscode PIOSSTM32F4XX = $(PIOS)/STM32F4xx PIOSCOMMON = $(PIOS)/Common PIOSBOARDS = $(PIOS)/Boards @@ -143,11 +141,6 @@ SRC += $(FLIGHTLIB)/fifo_buffer.c SRC += $(FLIGHTLIB)/WorldMagModel.c SRC += $(FLIGHTLIB)/insgps13state.c SRC += $(FLIGHTLIB)/taskmonitor.c -SRC += $(FLIGHTLIB)/packet_handler.c -## The Reed-Solomon FEC library -SRC += $(FLIGHTLIB)/rscode/rs.c -SRC += $(FLIGHTLIB)/rscode/berlekamp.c -SRC += $(FLIGHTLIB)/rscode/galois.c ## PIOS Hardware (STM32F4xx) include $(PIOS)/STM32F4xx/library.mk @@ -169,7 +162,6 @@ SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c SRC += $(PIOSCOMMON)/pios_usb_util.c -SRC += $(PIOSCOMMON)/pios_rfm22b.c include ./UAVObjects.inc SRC += $(UAVOBJSRC) @@ -211,7 +203,6 @@ EXTRAINCDIRS += $(OPUAVOBJ) EXTRAINCDIRS += $(OPUAVOBJINC) EXTRAINCDIRS += $(UAVOBJSYNTHDIR) EXTRAINCDIRS += $(FLIGHTLIBINC) -EXTRAINCDIRS += $(RSCODEINC) EXTRAINCDIRS += $(PIOSSTM32F4XX) EXTRAINCDIRS += $(PIOSCOMMON) EXTRAINCDIRS += $(PIOSBOARDS) diff --git a/flight/Revolution/System/inc/pios_config.h b/flight/Revolution/System/inc/pios_config.h index 2886b6c09..4bb7be2a7 100644 --- a/flight/Revolution/System/inc/pios_config.h +++ b/flight/Revolution/System/inc/pios_config.h @@ -73,8 +73,6 @@ #define PIOS_INCLUDE_COM_AUX #define PIOS_INCLUDE_COM_AUXSBUS #define PIOS_INCLUDE_COM_FLEXI -#define PIOS_INCLUDE_RFM22B -#define PIOS_INCLUDE_PACKET_HANDLER #define PIOS_INCLUDE_GPS #define PIOS_INCLUDE_GPS_NMEA_PARSER diff --git a/flight/Revolution/UAVObjects.inc b/flight/Revolution/UAVObjects.inc index 6e1a513d8..5b99daef4 100644 --- a/flight/Revolution/UAVObjects.inc +++ b/flight/Revolution/UAVObjects.inc @@ -91,8 +91,6 @@ UAVOBJSRCFILENAMES += altitudeholdsettings UAVOBJSRCFILENAMES += altitudeholddesired UAVOBJSRCFILENAMES += waypoint UAVOBJSRCFILENAMES += waypointactive -UAVOBJSRCFILENAMES += pipxsettings -UAVOBJSRCFILENAMES += pipxstatus UAVOBJSRC = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),$(UAVOBJSYNTHDIR)/$(UAVOBJSRCFILE).c ) UAVOBJDEFINE = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),-DUAVOBJ_INIT_$(UAVOBJSRCFILE) ) diff --git a/flight/board_hw_defs/revolution/board_hw_defs.c b/flight/board_hw_defs/revolution/board_hw_defs.c index a793b90f6..2bc703cd8 100644 --- a/flight/board_hw_defs/revolution/board_hw_defs.c +++ b/flight/board_hw_defs/revolution/board_hw_defs.c @@ -447,181 +447,6 @@ void PIOS_SPI_flash_irq_handler(void) } #endif /* PIOS_FLASH_ON_ACCEL */ -#if defined(PIOS_INCLUDE_RFM22B) -#include -/* SPI3 Interface - * - Used for RFM22B radio - */ -void PIOS_SPI_rfm22b_irq_handler(void); -void DMA1_Stream0_IRQHandler(void) __attribute__((alias("PIOS_SPI_rfm22b_irq_handler"))); -void DMA1_Stream5_IRQHandler(void) __attribute__((alias("PIOS_SPI_rfm22b_irq_handler"))); -static const struct pios_spi_cfg pios_spi_rfm22b_cfg = { - .regs = SPI3, - .remap = GPIO_AF_SPI3, - .init = { - //.SPI_Mode = SPI_Mode_Slave, - .SPI_Mode = SPI_Mode_Master, - .SPI_Direction = SPI_Direction_2Lines_FullDuplex, - .SPI_DataSize = SPI_DataSize_8b, - //.SPI_NSS = SPI_NSS_Hard, - .SPI_NSS = SPI_NSS_Soft, - .SPI_FirstBit = SPI_FirstBit_MSB, - //.SPI_CRCPolynomial = 7, - .SPI_CRCPolynomial = 0, - //.SPI_CPOL = SPI_CPOL_High, - .SPI_CPOL = SPI_CPOL_Low, - //.SPI_CPHA = SPI_CPHA_2Edge, - .SPI_CPHA = SPI_CPHA_1Edge, - //.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2, - .SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256, - }, - .use_crc = false, - .dma = { - .irq = { - // Note this is the stream ID that triggers interrupts (in this case TX) - .flags = (DMA_IT_TCIF7), - //.flags = (DMA1_FLAG_TC2 | DMA1_FLAG_TE2 | DMA1_FLAG_HT2 | DMA1_FLAG_GL2), - .init = { - .NVIC_IRQChannel = DMA1_Stream7_IRQn, - .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, - .NVIC_IRQChannelSubPriority = 0, - .NVIC_IRQChannelCmd = ENABLE, - }, - }, - .rx = { - .channel = DMA1_Stream0, - .init = { - .DMA_Channel = DMA_Channel_0, - .DMA_PeripheralBaseAddr = (uint32_t) & (SPI3->DR), - .DMA_DIR = DMA_DIR_PeripheralToMemory, - .DMA_PeripheralInc = DMA_PeripheralInc_Disable, - .DMA_MemoryInc = DMA_MemoryInc_Enable, - .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte, - .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, - //.DMA_Mode = DMA_Mode_Circular, - .DMA_Mode = DMA_Mode_Normal, - .DMA_Priority = DMA_Priority_Medium, - //TODO: Enable FIFO - .DMA_FIFOMode = DMA_FIFOMode_Disable, - .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, - .DMA_MemoryBurst = DMA_MemoryBurst_Single, - .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, - }, - }, - .tx = { - .channel = DMA1_Stream7, - .init = { - .DMA_Channel = DMA_Channel_0, - .DMA_PeripheralBaseAddr = (uint32_t) & (SPI3->DR), - .DMA_DIR = DMA_DIR_MemoryToPeripheral, - .DMA_PeripheralInc = DMA_PeripheralInc_Disable, - .DMA_MemoryInc = DMA_MemoryInc_Enable, - .DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte, - .DMA_MemoryDataSize = DMA_MemoryDataSize_Byte, - //.DMA_Mode = DMA_Mode_Circular, - .DMA_Mode = DMA_Mode_Normal, - .DMA_Priority = DMA_Priority_Medium, - .DMA_FIFOMode = DMA_FIFOMode_Disable, - .DMA_FIFOThreshold = DMA_FIFOThreshold_Full, - .DMA_MemoryBurst = DMA_MemoryBurst_Single, - .DMA_PeripheralBurst = DMA_PeripheralBurst_Single, - }, - }, - }, - .sclk = { - .gpio = GPIOC, - .init = { - .GPIO_Pin = GPIO_Pin_10, - .GPIO_Speed = GPIO_Speed_100MHz, - .GPIO_Mode = GPIO_Mode_AF, - .GPIO_OType = GPIO_OType_PP, - .GPIO_PuPd = GPIO_PuPd_NOPULL - }, - }, - .miso = { - .gpio = GPIOC, - .init = { - .GPIO_Pin = GPIO_Pin_11, - .GPIO_Speed = GPIO_Speed_50MHz, - .GPIO_Mode = GPIO_Mode_AF, - .GPIO_OType = GPIO_OType_PP, - .GPIO_PuPd = GPIO_PuPd_NOPULL - }, - }, - .mosi = { - .gpio = GPIOC, - .init = { - .GPIO_Pin = GPIO_Pin_12, - .GPIO_Speed = GPIO_Speed_50MHz, - .GPIO_Mode = GPIO_Mode_AF, - .GPIO_OType = GPIO_OType_PP, - .GPIO_PuPd = GPIO_PuPd_NOPULL - }, - }, - .slave_count = 1, - .ssel = { { - .gpio = GPIOA, - .init = { - .GPIO_Pin = GPIO_Pin_15, - .GPIO_Speed = GPIO_Speed_50MHz, - .GPIO_Mode = GPIO_Mode_OUT, - .GPIO_OType = GPIO_OType_PP, - .GPIO_PuPd = GPIO_PuPd_UP - }, - } }, -}; - -uint32_t pios_spi_rfm22b_id; -void PIOS_SPI_rfm22b_irq_handler(void) -{ - /* Call into the generic code to handle the IRQ for this specific device */ - PIOS_SPI_IRQ_Handler(pios_spi_rfm22b_id); -} - -static const struct pios_exti_cfg pios_exti_rfm22b_cfg __exti_config = { - .vector = PIOS_RFM22_EXT_Int, - .line = EXTI_Line0, - .pin = { - .gpio = GPIOD, - .init = { - .GPIO_Pin = GPIO_Pin_0, - .GPIO_Speed = GPIO_Speed_100MHz, - .GPIO_Mode = GPIO_Mode_IN, - .GPIO_OType = GPIO_OType_OD, - .GPIO_PuPd = GPIO_PuPd_NOPULL, - }, - }, - .irq = { - .init = { - .NVIC_IRQChannel = EXTI0_IRQn, - .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW, - .NVIC_IRQChannelSubPriority = 0, - .NVIC_IRQChannelCmd = ENABLE, - }, - }, - .exti = { - .init = { - .EXTI_Line = EXTI_Line0, // matches above GPIO pin - .EXTI_Mode = EXTI_Mode_Interrupt, - .EXTI_Trigger = EXTI_Trigger_Falling, - .EXTI_LineCmd = ENABLE, - }, - }, -}; - -struct pios_rfm22b_cfg pios_rfm22b_cfg = { - .spi_cfg = &pios_spi_rfm22b_cfg, - .exti_cfg = &pios_exti_rfm22b_cfg, - .frequencyHz = 434000000, - .minFrequencyHz = 434000000 - 2000000, - .maxFrequencyHz = 434000000 + 2000000, - .RFXtalCap = 0x7f, - .maxRFBandwidth = 128000, - .maxTxPower = RFM22_tx_pwr_txpow_7, // +20dBm .. 100mW -}; - -#endif /* PIOS_INCLUDE_RFM22B */ - #endif /* PIOS_INCLUDE_SPI */ #if defined(PIOS_OVERO_SPI)