From be752b807515fce8220a199a9e57f4ff09ca1817 Mon Sep 17 00:00:00 2001 From: a*morale Date: Sun, 30 Sep 2012 17:04:36 +0200 Subject: [PATCH] Fixed some declaration to Exti functions to make it compile. --- flight/PiOS/Common/pios_hmc5883.c | 2 +- flight/PiOS/Common/pios_rfm22b.c | 11 ++++++----- flight/PiOS/inc/pios_hmc5883.h | 2 +- flight/PiOS/inc/pios_rfm22b_priv.h | 18 +++++++++--------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/flight/PiOS/Common/pios_hmc5883.c b/flight/PiOS/Common/pios_hmc5883.c index 14d4f96fe..4d43f7bd2 100644 --- a/flight/PiOS/Common/pios_hmc5883.c +++ b/flight/PiOS/Common/pios_hmc5883.c @@ -393,7 +393,7 @@ int32_t PIOS_HMC5883_Test(void) */ bool PIOS_HMC5883_IRQHandler(void) { - pios_hmc5883_data_ready = true + pios_hmc5883_data_ready = true; return false; } diff --git a/flight/PiOS/Common/pios_rfm22b.c b/flight/PiOS/Common/pios_rfm22b.c index 5f95ecb39..2235f64e5 100644 --- a/flight/PiOS/Common/pios_rfm22b.c +++ b/flight/PiOS/Common/pios_rfm22b.c @@ -462,7 +462,7 @@ static const uint8_t reg_23[] = { 0xC5, 0x89, 0x12, 0x25, 0x static const uint8_t reg_24[] = { 0x00, 0x00, 0x00, 0x02, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x07, 0x07}; // rfm22_clk_recovery_timing_loop_gain1 static const uint8_t reg_25[] = { 0x0A, 0x23, 0x85, 0x0E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x74, 0xFF, 0xFF}; // rfm22_clk_recovery_timing_loop_gain0 -static const uint8_t reg_2A[] = { 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0E, 0x12, 0x17, 0x31, 0x50, 0x50, 0x50}; // rfm22_afc_limiter .. AFC_pull_in_range = ±AFCLimiter[7:0] x (hbsel+1) x 625 Hz +static const uint8_t reg_2A[] = { 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0E, 0x12, 0x17, 0x31, 0x50, 0x50, 0x50}; // rfm22_afc_limiter .. AFC_pull_in_range = �AFCLimiter[7:0] x (hbsel+1) x 625 Hz static const uint8_t reg_6E[] = { 0x04, 0x08, 0x10, 0x20, 0x41, 0x4E, 0x83, 0x9D, 0xC4, 0x08, 0x10, 0x20, 0x31, 0x41}; // rfm22_tx_data_rate1 static const uint8_t reg_6F[] = { 0x19, 0x31, 0x62, 0xC5, 0x89, 0xA5, 0x12, 0x49, 0x9C, 0x31, 0x62, 0xC5, 0x27, 0x89}; // rfm22_tx_data_rate0 @@ -495,7 +495,7 @@ static const uint8_t ss_reg_23[] = { 0xC5, 0xD3}; // rfm22_clk_recovery_offset0 static const uint8_t ss_reg_24[] = { 0x00, 0x07}; // rfm22_clk_recovery_timing_loop_gain1 static const uint8_t ss_reg_25[] = { 0x0F, 0xFF}; // rfm22_clk_recovery_timing_loop_gain0 -static const uint8_t ss_reg_2A[] = { 0xFF, 0xFF}; // rfm22_afc_limiter .. AFC_pull_in_range = ±AFCLimiter[7:0] x (hbsel+1) x 625 Hz +static const uint8_t ss_reg_2A[] = { 0xFF, 0xFF}; // rfm22_afc_limiter .. AFC_pull_in_range = �AFCLimiter[7:0] x (hbsel+1) x 625 Hz static const uint8_t ss_reg_70[] = { 0x24, 0x2D}; // rfm22_modulation_mode_control1 static const uint8_t ss_reg_71[] = { 0x2B, 0x23}; // rfm22_modulation_mode_control2 @@ -633,13 +633,14 @@ int32_t PIOS_RFM22B_Init(uint32_t *rfm22b_id, uint32_t spi_id, uint32_t slave_nu /** * The RFM22B external interrupt routine. */ -void PIOS_RFM22_EXT_Int(void) +bool PIOS_RFM22_EXT_Int(void) { if (!PIOS_RFM22B_validate(g_rfm22b_dev)) - return; + return false; // Inject an interrupt event into the state machine. PIOS_RFM22B_InjectEvent(g_rfm22b_dev, RFM22B_EVENT_INT_RECEIVED, true); + return false; } /** @@ -1746,7 +1747,7 @@ static enum pios_rfm22b_event rfm22_init(struct pios_rfm22b_dev *rfm22b_dev) // adc offset rfm22_write(RFM22_adc_sensor_amp_offset, 0); - // temp sensor calibration .. –40C to +64C 0.5C resolution + // temp sensor calibration .. �40C to +64C 0.5C resolution rfm22_write(RFM22_temp_sensor_calib, RFM22_tsc_tsrange0 | RFM22_tsc_entsoffs); // temp sensor offset diff --git a/flight/PiOS/inc/pios_hmc5883.h b/flight/PiOS/inc/pios_hmc5883.h index d9c362e9d..37124e695 100644 --- a/flight/PiOS/inc/pios_hmc5883.h +++ b/flight/PiOS/inc/pios_hmc5883.h @@ -107,7 +107,7 @@ extern bool PIOS_HMC5883_NewDataAvailable(void); extern int32_t PIOS_HMC5883_ReadMag(int16_t out[3]); extern uint8_t PIOS_HMC5883_ReadID(uint8_t out[4]); extern int32_t PIOS_HMC5883_Test(void); -bool void PIOS_HMC5883_IRQHandler(); +extern bool PIOS_HMC5883_IRQHandler(); #endif /* PIOS_HMC5883_H */ /** diff --git a/flight/PiOS/inc/pios_rfm22b_priv.h b/flight/PiOS/inc/pios_rfm22b_priv.h index cea382220..4719e722d 100644 --- a/flight/PiOS/inc/pios_rfm22b_priv.h +++ b/flight/PiOS/inc/pios_rfm22b_priv.h @@ -83,7 +83,7 @@ extern const struct pios_com_driver pios_rfm22b_com_driver; #define RFM22_is1_icrerror BIT0 // CRC Error. When set to 1 the cyclic redundancy check is failed. #define RFM22_is1_ipkvalid BIT1 // Valid Packet Received.When set to 1 a valid packet has been received. #define RFM22_is1_ipksent BIT2 // Packet Sent Interrupt. When set to1 a valid packet has been transmitted. -#define RFM22_is1_iext BIT3 // External Interrupt. When set to 1 an interrupt occurred on one of the GPIO’s if it is programmed so. The status can be checked in register 0Eh. See GPIOx Configuration section for the details. +#define RFM22_is1_iext BIT3 // External Interrupt. When set to 1 an interrupt occurred on one of the GPIO�s if it is programmed so. The status can be checked in register 0Eh. See GPIOx Configuration section for the details. #define RFM22_is1_irxffafull BIT4 // RX FIFO Almost Full.When set to 1 the RX FIFO has met its almost full threshold and needs to be read by the microcontroller. #define RFM22_is1_ixtffaem BIT5 // TX FIFO Almost Empty. When set to 1 the TX FIFO is almost empty and needs to be filled. #define RFM22_is1_itxffafull BIT6 // TX FIFO Almost Full. When set to 1 the TX FIFO has met its almost full threshold and needs to be transmitted. @@ -123,7 +123,7 @@ extern const struct pios_com_driver pios_rfm22b_com_driver; #define RFM22_opfc1_xton 0x01 // READY Mode (Xtal is ON). #define RFM22_opfc1_pllon 0x02 // TUNE Mode (PLL is ON). When pllon = 1 the PLL will remain enabled in Idle State. This will for faster turn-around time at the cost of increased current consumption in Idle State. #define RFM22_opfc1_rxon 0x04 // RX on in Manual Receiver Mode. Automatically cleared if Multiple Packets config. is disabled and a valid packet received. -#define RFM22_opfc1_txon 0x08 // TX on in Manual Transmit Mode. Automatically cleared in FIFO mode once the packet is sent. Transmission can be aborted during packet transmission, however, when no data has been sent yet, transmission can only be aborted after the device is programmed to “unmodulated carrier” ("Register 71h. Modulation Mode Control 2"). +#define RFM22_opfc1_txon 0x08 // TX on in Manual Transmit Mode. Automatically cleared in FIFO mode once the packet is sent. Transmission can be aborted during packet transmission, however, when no data has been sent yet, transmission can only be aborted after the device is programmed to �unmodulated carrier� ("Register 71h. Modulation Mode Control 2"). #define RFM22_opfc1_x32ksel 0x10 // 32,768 kHz Crystal Oscillator Select. 0: RC oscillator 1: 32 kHz crystal #define RFM22_opfc1_enwt 0x20 // Enable Wake-Up-Timer. Enabled when enwt = 1. If the Wake-up-Timer function is enabled it will operate in any mode and notify the microcontroller through the GPIO interrupt when the timer expires. #define RFM22_opfc1_enlbd 0x40 // Enable Low Battery Detect. When this bit is set to 1 the Low Battery Detector circuit and threshold comparison will be enabled. @@ -303,8 +303,8 @@ extern const struct pios_com_driver pios_rfm22b_com_driver; #define RFM22_temp_sensor_calib 0x12 // R/W #define RFM22_tsc_tstrim_mask 0x0F // Temperature Sensor Trim Value. #define RFM22_tsc_entstrim 0x10 // Temperature Sensor Trim Enable. -#define RFM22_tsc_entsoffs 0x20 // Temperature Sensor Offset to Convert from K to ºC. -#define RFM22_tsc_tsrange0 0x00 // Temperature Sensor Range Selection. –64C to +64C 0.5C resolution +#define RFM22_tsc_entsoffs 0x20 // Temperature Sensor Offset to Convert from K to �C. +#define RFM22_tsc_tsrange0 0x00 // Temperature Sensor Range Selection. �64C to +64C 0.5C resolution #define RFM22_tsc_tsrange1 0x40 // -40 to +85C with 1.0C resolution #define RFM22_tsc_tsrange2 0x80 // 0C to 85C with 0.5C resolution #define RFM22_tsc_tsrange3 0xC0 // -40F to 216F with 1.0F resolution @@ -350,7 +350,7 @@ extern const struct pios_com_driver pios_rfm22b_com_driver; #define RFM22_antenna_diversity_register1 0x28 // R #define RFM22_antenna_diversity_register2 0x29 // R -#define RFM22_afc_limiter 0x2A // R/W .. AFC_pull_in_range = ±AFCLimiter[7:0] x (hbsel+1) x 625 Hz +#define RFM22_afc_limiter 0x2A // R/W .. AFC_pull_in_range = �AFCLimiter[7:0] x (hbsel+1) x 625 Hz #define RFM22_afc_correction_read 0x2B // R @@ -365,11 +365,11 @@ extern const struct pios_com_driver pios_rfm22b_com_driver; #define RFM22_dac_crc_iec16 0x02 // #define RFM22_dac_crc_biacheva 0x03 // #define RFM22_dac_encrc 0x04 // CRC Enable. Cyclic Redundancy Check generation is enabled if this bit is set. -#define RFM22_dac_enpactx 0x08 // Enable Packet TX Handling. If FIFO Mode (dtmod = 10) is being used automatic packet handling may be enabled. Setting enpactx = 1 will enable automatic packet handling in the TX path. Register 30–4D allow for various configurations of the packet structure. Setting enpactx = 0 will not do any packet handling in the TX path. It will only transmit what is loaded to the FIFO. +#define RFM22_dac_enpactx 0x08 // Enable Packet TX Handling. If FIFO Mode (dtmod = 10) is being used automatic packet handling may be enabled. Setting enpactx = 1 will enable automatic packet handling in the TX path. Register 30�4D allow for various configurations of the packet structure. Setting enpactx = 0 will not do any packet handling in the TX path. It will only transmit what is loaded to the FIFO. #define RFM22_dac_skip2ph 0x10 // Skip 2nd Phase of Preamble Detection. If set, we skip the second phase of the preamble detection (under certain conditions) if antenna diversity is enabled. #define RFM22_dac_crcdonly 0x20 // CRC Data Only Enable. When this bit is set to 1 the CRC is calculated on and checked against the packet data fields only. #define RFM22_dac_lsbfrst 0x40 // LSB First Enable. The LSB of the data will be transmitted/received first if this bit is set. -#define RFM22_dac_enpacrx 0x80 // Enable Packet RX Handling. If FIFO Mode (dtmod = 10) is being used automatic packet handling may be enabled. Setting enpacrx = 1 will enable automatic packet handling in the RX path. Register 30–4D allow for various configurations of the packet structure. Setting enpacrx = 0 will not do any packet handling in the RX path. It will only receive everything after the sync word and fill up the RX FIFO. +#define RFM22_dac_enpacrx 0x80 // Enable Packet RX Handling. If FIFO Mode (dtmod = 10) is being used automatic packet handling may be enabled. Setting enpacrx = 1 will enable automatic packet handling in the RX path. Register 30�4D allow for various configurations of the packet structure. Setting enpacrx = 0 will not do any packet handling in the RX path. It will only receive everything after the sync word and fill up the RX FIFO. #define RFM22_ezmac_status 0x31 // R #define RFM22_ezmac_status_pksent 0x01 // Packet Sent. A 1 a packet has been sent by the radio. (Same bit as in register 03, but reading it does not reset the IRQ) @@ -378,7 +378,7 @@ extern const struct pios_com_driver pios_rfm22b_com_driver; #define RFM22_ezmac_status_pkvalid 0x08 // Valid Packet Received. When a 1 a valid packet has been received by the receiver. (Same bit as in register 03, but reading it does not reset the IRQ) #define RFM22_ezmac_status_pkrx 0x10 // Packet Receiving. When 1 the radio is currently receiving a valid packet. #define RFM22_ezmac_status_pksrch 0x20 // Packet Searching. When 1 the radio is searching for a valid packet. -#define RFM22_ezmac_status_rxcrc1 0x40 // If high, it indicates the last CRC received is all one’s. May indicated Transmitter underflow in case of CRC error. +#define RFM22_ezmac_status_rxcrc1 0x40 // If high, it indicates the last CRC received is all one�s. May indicated Transmitter underflow in case of CRC error. #define RFM22_header_control1 0x32 // R/W #define RFM22_header_cntl1_bcen_none 0x00 // No broadcast address enable. @@ -580,7 +580,7 @@ typedef bool ( *t_rfm22_RxDataCallback ) (void *data, uint8_t len); // ************************************ -void PIOS_RFM22_EXT_Int(void); +bool PIOS_RFM22_EXT_Int(void); #endif /* PIOS_RFM22B_PRIV_H */