kopia lustrzana https://github.com/DL7AD/pecanpico10
Implement dynamic Si446x chip identification.
- Patch is applied if 4463 detected - Register settings differ if 4463 detected - Added 'radio' command in CLI to list radio data - Patches to ChibiOS (also in trunk) - Update of SPI settings halconf.h to match latest ChibiOS - Move assert for invalid radio in common functionpull/4/head
rodzic
3be19f7de5
commit
f2fe098feb
|
@ -98,7 +98,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL TRUE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -480,7 +480,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL TRUE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -839,7 +839,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL FALSE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -1217,7 +1217,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC TRUE
|
||||
#define STM32_HAS_RCC_CK48MSEL TRUE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -1607,7 +1607,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC TRUE
|
||||
#define STM32_HAS_RCC_CK48MSEL TRUE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -1942,7 +1942,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL FALSE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -2253,7 +2253,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL FALSE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -2534,7 +2534,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL FALSE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
@ -2888,7 +2888,7 @@
|
|||
#define STM32_HAS_RCC_I2SPLLSRC FALSE
|
||||
#define STM32_HAS_RCC_CK48MSEL FALSE
|
||||
#define STM32_RCC_CK48MSEL_USES_I2S FALSE
|
||||
#define STM32_TIMPRE_PRESCALE4 TRUE
|
||||
#define STM32_TIMPRE_PRESCALE4 FALSE
|
||||
|
||||
/* ADC attributes.*/
|
||||
#define STM32_ADC_HANDLER Vector88
|
||||
|
|
|
@ -103,8 +103,6 @@ void spiStart(SPIDriver *spip, const SPIConfig *config) {
|
|||
|
||||
/**
|
||||
* @brief Deactivates the SPI peripheral.
|
||||
* @note Deactivating the peripheral also enforces a release of the slave
|
||||
* select line.
|
||||
*
|
||||
* @param[in] spip pointer to the @p SPIDriver object
|
||||
*
|
||||
|
|
|
@ -1,401 +1,418 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file templates/halconf.h
|
||||
* @brief HAL configuration header.
|
||||
* @details HAL configuration file, this file allows to enable or disable the
|
||||
* various device drivers from your application. You may also use
|
||||
* this file in order to override the device drivers default settings.
|
||||
*
|
||||
* @addtogroup HAL_CONF
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef HALCONF_H
|
||||
#define HALCONF_H
|
||||
|
||||
#include "mcuconf.h"
|
||||
|
||||
/**
|
||||
* @brief Enables the PAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the CAN subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_CAN FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the DAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_DAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the EXT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_EXT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the GPT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_GPT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2C subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2C TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2S subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2S FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ICU subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ICU TRUE
|
||||
/* Driver extension to add user fields. */
|
||||
#define ICU_DRIVER_EXT_FIELDS \
|
||||
void *link; \
|
||||
virtual_timer_t cca_timer; \
|
||||
virtual_timer_t icu_timer; \
|
||||
virtual_timer_t pwm_timer;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MMC_SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MMC_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the PWM subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PWM FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the QSPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_QSPI FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the RTC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_RTC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SDC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SDC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the UART subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_UART FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the WDG subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_WDG TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* ADC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* CAN driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Sleep mode related APIs inclusion switch.
|
||||
*/
|
||||
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
|
||||
#define CAN_USE_SLEEP_MODE TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* I2C driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables the mutual exclusion APIs on the I2C bus.
|
||||
*/
|
||||
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define I2C_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MAC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_ZERO_COPY FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_EVENTS TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MMC_SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
* This option is recommended also if the SPI driver does not
|
||||
* use a DMA channel and heavily loads the CPU.
|
||||
*/
|
||||
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define MMC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SDC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of initialization attempts before rejecting the card.
|
||||
* @note Attempts are performed at 10mS intervals.
|
||||
*/
|
||||
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
|
||||
#define SDC_INIT_RETRY 100
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Include support for MMC cards.
|
||||
* @note MMC support is not yet implemented so this option must be kept
|
||||
* at @p FALSE.
|
||||
*/
|
||||
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
|
||||
#define SDC_MMC_SUPPORT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
*/
|
||||
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define SDC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Default bit rate.
|
||||
* @details Configuration parameter, this is the baud rate selected for the
|
||||
* default configuration.
|
||||
*/
|
||||
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_DEFAULT_BITRATE 38400
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial buffers size.
|
||||
* @details Configuration parameter, you can change the depth of the queue
|
||||
* buffers depending on the requirements of your application.
|
||||
* @note The default is 16 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_BUFFERS_SIZE 16
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL_USB driver related setting. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial over USB buffers size.
|
||||
* @details Configuration parameter, the buffer size must be a multiple of
|
||||
* the USB data endpoint maximum packet size.
|
||||
* @note The default is 256 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_SIZE 256
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial over USB number of buffers.
|
||||
* @note The default is 2 buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_NUMBER 2
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* UART driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define UART_USE_WAIT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define UART_USE_MUTUAL_EXCLUSION FALSE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* USB driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define USB_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set host wakeup duration.
|
||||
*/
|
||||
#if !defined(USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__)
|
||||
#define USB_HOST_WAKEUP_DURATION 15
|
||||
#endif
|
||||
|
||||
#endif /* HALCONF_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file templates/halconf.h
|
||||
* @brief HAL configuration header.
|
||||
* @details HAL configuration file, this file allows to enable or disable the
|
||||
* various device drivers from your application. You may also use
|
||||
* this file in order to override the device drivers default settings.
|
||||
*
|
||||
* @addtogroup HAL_CONF
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef HALCONF_H
|
||||
#define HALCONF_H
|
||||
|
||||
#include "mcuconf.h"
|
||||
|
||||
/**
|
||||
* @brief Enables the PAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the CAN subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_CAN FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the DAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_DAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the EXT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_EXT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the GPT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_GPT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2C subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2C TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2S subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2S FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ICU subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ICU TRUE
|
||||
/* Driver extension to add user fields. */
|
||||
#define ICU_DRIVER_EXT_FIELDS \
|
||||
void *link; \
|
||||
virtual_timer_t cca_timer; \
|
||||
virtual_timer_t icu_timer; \
|
||||
virtual_timer_t pwm_timer;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MMC_SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MMC_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the PWM subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PWM FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the QSPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_QSPI FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the RTC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_RTC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SDC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SDC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the UART subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_UART FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the WDG subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_WDG TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* ADC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* CAN driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Sleep mode related APIs inclusion switch.
|
||||
*/
|
||||
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
|
||||
#define CAN_USE_SLEEP_MODE TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* I2C driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables the mutual exclusion APIs on the I2C bus.
|
||||
*/
|
||||
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define I2C_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MAC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_ZERO_COPY FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_EVENTS TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MMC_SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
* This option is recommended also if the SPI driver does not
|
||||
* use a DMA channel and heavily loads the CPU.
|
||||
*/
|
||||
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define MMC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SDC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of initialization attempts before rejecting the card.
|
||||
* @note Attempts are performed at 10mS intervals.
|
||||
*/
|
||||
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
|
||||
#define SDC_INIT_RETRY 100
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Include support for MMC cards.
|
||||
* @note MMC support is not yet implemented so this option must be kept
|
||||
* at @p FALSE.
|
||||
*/
|
||||
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
|
||||
#define SDC_MMC_SUPPORT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
*/
|
||||
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define SDC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Default bit rate.
|
||||
* @details Configuration parameter, this is the baud rate selected for the
|
||||
* default configuration.
|
||||
*/
|
||||
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_DEFAULT_BITRATE 38400
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial buffers size.
|
||||
* @details Configuration parameter, you can change the depth of the queue
|
||||
* buffers depending on the requirements of your application.
|
||||
* @note The default is 16 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_BUFFERS_SIZE 16
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL_USB driver related setting. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial over USB buffers size.
|
||||
* @details Configuration parameter, the buffer size must be a multiple of
|
||||
* the USB data endpoint maximum packet size.
|
||||
* @note The default is 256 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_SIZE 256
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial over USB number of buffers.
|
||||
* @note The default is 2 buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_NUMBER 2
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables circular transfers APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_CIRCULAR FALSE
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Handling method for SPI CS line.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* UART driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define UART_USE_WAIT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define UART_USE_MUTUAL_EXCLUSION FALSE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* USB driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define USB_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set host wakeup duration.
|
||||
*/
|
||||
#if !defined(USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__)
|
||||
#define USB_HOST_WAKEUP_DURATION 15
|
||||
#endif
|
||||
|
||||
#endif /* HALCONF_H */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct SysProviders {
|
|||
const radio_config_t radio_list[] = {
|
||||
{ /* Radio #1 */
|
||||
.unit = PKT_RADIO_1,
|
||||
.type = SI4464,
|
||||
.type = SI446X,
|
||||
.band = {
|
||||
(radio_band_t * const)&band_2m,
|
||||
NULL
|
||||
|
@ -125,10 +125,17 @@ void pktSetLineModeICU(void) {
|
|||
/**
|
||||
* TODO: Move this into pktconf.h and use general GPIO to setup.
|
||||
*/
|
||||
void pktSetLineModeRadioCTS(void) {
|
||||
void pktSetLineModeRadioGPIO1(void) {
|
||||
palSetLineMode(LINE_RADIO_GPIO1, PAL_MODE_INPUT_PULLDOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Move this into pktconf.h and use general GPIO to setup.
|
||||
*/
|
||||
void pktSetLineModeRadioGPIO0(void) {
|
||||
palSetLineMode(LINE_RADIO_GPIO0, PAL_MODE_INPUT_PULLDOWN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read GPIO that are used for:
|
||||
* a) general use or
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
#define Si446x_CLK STM32_HSECLK /* Oscillator frequency in Hz */
|
||||
#define Si446x_CLK_OFFSET 22 /* Oscillator frequency drift in ppm */
|
||||
#define Si446x_CLK_TCXO_EN true /* Set this true, if a TCXO is used, false for XTAL */
|
||||
#define Si446x_PART_VARIANT 4464
|
||||
|
||||
/*
|
||||
* Radio GPIO definitions.
|
||||
|
@ -275,7 +274,8 @@ extern "C" {
|
|||
void pktConfigSerialPkt(void);
|
||||
void pktConfigureCoreIO(void);
|
||||
void pktSetLineModeICU(void);
|
||||
void pktSetLineModeRadioCTS(void);
|
||||
void pktSetLineModeRadioGPIO1(void);
|
||||
void pktSetLineModeRadioGPIO0(void);
|
||||
void pktSerialStart(void);
|
||||
void dbgWrite(uint8_t level, uint8_t *buf, uint32_t len);
|
||||
int dbgPrintf(uint8_t level, const char *format, ...);
|
||||
|
|
|
@ -1,394 +1,411 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file templates/halconf.h
|
||||
* @brief HAL configuration header.
|
||||
* @details HAL configuration file, this file allows to enable or disable the
|
||||
* various device drivers from your application. You may also use
|
||||
* this file in order to override the device drivers default settings.
|
||||
*
|
||||
* @addtogroup HAL_CONF
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef HALCONF_H
|
||||
#define HALCONF_H
|
||||
|
||||
#include "mcuconf.h"
|
||||
|
||||
/**
|
||||
* @brief Enables the PAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the CAN subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_CAN FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the DAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_DAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the EXT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_EXT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the GPT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_GPT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2C subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2C TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2S subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2S FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ICU subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ICU TRUE
|
||||
/* Driver extension to add user fields. */
|
||||
#define ICU_DRIVER_EXT_FIELDS \
|
||||
void *link; \
|
||||
virtual_timer_t cca_timer; \
|
||||
virtual_timer_t icu_timer; \
|
||||
virtual_timer_t pwm_timer;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MMC_SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MMC_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the PWM subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PWM FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the QSPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_QSPI FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the RTC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_RTC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SDC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SDC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the UART subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_UART FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the WDG subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_WDG TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* ADC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* CAN driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Sleep mode related APIs inclusion switch.
|
||||
*/
|
||||
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
|
||||
#define CAN_USE_SLEEP_MODE TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* I2C driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables the mutual exclusion APIs on the I2C bus.
|
||||
*/
|
||||
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define I2C_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MAC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_ZERO_COPY FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_EVENTS TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MMC_SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
* This option is recommended also if the SPI driver does not
|
||||
* use a DMA channel and heavily loads the CPU.
|
||||
*/
|
||||
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define MMC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SDC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of initialization attempts before rejecting the card.
|
||||
* @note Attempts are performed at 10mS intervals.
|
||||
*/
|
||||
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
|
||||
#define SDC_INIT_RETRY 100
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Include support for MMC cards.
|
||||
* @note MMC support is not yet implemented so this option must be kept
|
||||
* at @p FALSE.
|
||||
*/
|
||||
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
|
||||
#define SDC_MMC_SUPPORT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
*/
|
||||
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define SDC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Default bit rate.
|
||||
* @details Configuration parameter, this is the baud rate selected for the
|
||||
* default configuration.
|
||||
*/
|
||||
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_DEFAULT_BITRATE 38400
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial buffers size.
|
||||
* @details Configuration parameter, you can change the depth of the queue
|
||||
* buffers depending on the requirements of your application.
|
||||
* @note The default is 16 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_BUFFERS_SIZE 16
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL_USB driver related setting. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial over USB buffers size.
|
||||
* @details Configuration parameter, the buffer size must be a multiple of
|
||||
* the USB data endpoint maximum packet size.
|
||||
* @note The default is 256 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_SIZE 256
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial over USB number of buffers.
|
||||
* @note The default is 2 buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_NUMBER 2
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* UART driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define UART_USE_WAIT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define UART_USE_MUTUAL_EXCLUSION FALSE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* USB driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define USB_USE_WAIT FALSE
|
||||
#endif
|
||||
|
||||
#endif /* HALCONF_H */
|
||||
|
||||
/** @} */
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file templates/halconf.h
|
||||
* @brief HAL configuration header.
|
||||
* @details HAL configuration file, this file allows to enable or disable the
|
||||
* various device drivers from your application. You may also use
|
||||
* this file in order to override the device drivers default settings.
|
||||
*
|
||||
* @addtogroup HAL_CONF
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef HALCONF_H
|
||||
#define HALCONF_H
|
||||
|
||||
#include "mcuconf.h"
|
||||
|
||||
/**
|
||||
* @brief Enables the PAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the CAN subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_CAN FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the DAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_DAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the EXT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_EXT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the GPT subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_GPT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2C subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2C TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the I2S subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2S FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the ICU subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ICU TRUE
|
||||
/* Driver extension to add user fields. */
|
||||
#define ICU_DRIVER_EXT_FIELDS \
|
||||
void *link; \
|
||||
virtual_timer_t cca_timer; \
|
||||
virtual_timer_t icu_timer; \
|
||||
virtual_timer_t pwm_timer;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MAC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MAC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the MMC_SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_MMC_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the PWM subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_PWM FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the QSPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_QSPI FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the RTC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_RTC TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SDC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SDC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the UART subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_UART FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the WDG subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_WDG TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* ADC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define ADC_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* CAN driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Sleep mode related APIs inclusion switch.
|
||||
*/
|
||||
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
|
||||
#define CAN_USE_SLEEP_MODE TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* I2C driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables the mutual exclusion APIs on the I2C bus.
|
||||
*/
|
||||
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define I2C_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MAC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_ZERO_COPY FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables an event sources for incoming packets.
|
||||
*/
|
||||
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
|
||||
#define MAC_USE_EVENTS TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* MMC_SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
* This option is recommended also if the SPI driver does not
|
||||
* use a DMA channel and heavily loads the CPU.
|
||||
*/
|
||||
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define MMC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SDC driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of initialization attempts before rejecting the card.
|
||||
* @note Attempts are performed at 10mS intervals.
|
||||
*/
|
||||
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
|
||||
#define SDC_INIT_RETRY 100
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Include support for MMC cards.
|
||||
* @note MMC support is not yet implemented so this option must be kept
|
||||
* at @p FALSE.
|
||||
*/
|
||||
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
|
||||
#define SDC_MMC_SUPPORT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Delays insertions.
|
||||
* @details If enabled this options inserts delays into the MMC waiting
|
||||
* routines releasing some extra CPU time for the threads with
|
||||
* lower priority, this may slow down the driver a bit however.
|
||||
*/
|
||||
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
|
||||
#define SDC_NICE_WAITING TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Default bit rate.
|
||||
* @details Configuration parameter, this is the baud rate selected for the
|
||||
* default configuration.
|
||||
*/
|
||||
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_DEFAULT_BITRATE 38400
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial buffers size.
|
||||
* @details Configuration parameter, you can change the depth of the queue
|
||||
* buffers depending on the requirements of your application.
|
||||
* @note The default is 16 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_BUFFERS_SIZE 16
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SERIAL_USB driver related setting. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Serial over USB buffers size.
|
||||
* @details Configuration parameter, the buffer size must be a multiple of
|
||||
* the USB data endpoint maximum packet size.
|
||||
* @note The default is 256 bytes for both the transmission and receive
|
||||
* buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_SIZE 256
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial over USB number of buffers.
|
||||
* @note The default is 2 buffers.
|
||||
*/
|
||||
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
|
||||
#define SERIAL_USB_BUFFERS_NUMBER 2
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* SPI driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables circular transfers APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_CIRCULAR FALSE
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define SPI_USE_MUTUAL_EXCLUSION TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Handling method for SPI CS line.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* UART driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define UART_USE_WAIT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||
#define UART_USE_MUTUAL_EXCLUSION FALSE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* USB driver related settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Enables synchronous APIs.
|
||||
* @note Disabling this option saves both code and data space.
|
||||
*/
|
||||
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
|
||||
#define USB_USE_WAIT FALSE
|
||||
#endif
|
||||
|
||||
#endif /* HALCONF_H */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct SysProviders {
|
|||
const radio_config_t radio_list[] = {
|
||||
{ /* Radio #1 */
|
||||
.unit = PKT_RADIO_1,
|
||||
.type = SI4464,
|
||||
.type = SI446X,
|
||||
.band = {
|
||||
(radio_band_t * const)&band_2m,
|
||||
NULL
|
||||
|
@ -126,10 +126,17 @@ void pktSetLineModeICU(void) {
|
|||
/**
|
||||
* TODO: Move this into pktconf.h and use general GPIO to setup.
|
||||
*/
|
||||
void pktSetLineModeRadioCTS(void) {
|
||||
void pktSetLineModeRadioGPIO1(void) {
|
||||
palSetLineMode(LINE_RADIO_GPIO1, PAL_MODE_INPUT_PULLDOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Move this into pktconf.h and use general GPIO to setup.
|
||||
*/
|
||||
void pktSetLineModeRadioGPIO0(void) {
|
||||
palSetLineMode(LINE_RADIO_GPIO0, PAL_MODE_INPUT_PULLDOWN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read GPIO that are used for:
|
||||
* a) general use or
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
#define Si446x_CLK STM32_HSECLK /* Oscillator frequency in Hz */
|
||||
#define Si446x_CLK_OFFSET 22 /* Oscillator frequency drift in ppm */
|
||||
#define Si446x_CLK_TCXO_EN true /* Set this true, if a TCXO is used, false for XTAL */
|
||||
#define Si446x_PART_VARIANT 4463
|
||||
|
||||
/*
|
||||
* Radio GPIO definitions.
|
||||
*/
|
||||
|
@ -271,7 +271,8 @@ extern "C" {
|
|||
void pktConfigSerialPkt(void);
|
||||
void pktConfigureCoreIO(void);
|
||||
void pktSetLineModeICU(void);
|
||||
void pktSetLineModeRadioCTS(void);
|
||||
void pktSetLineModeRadioGPIO1(void);
|
||||
void pktSetLineModeRadioGPIO0(void);
|
||||
void pktSerialStart(void);
|
||||
void dbgWrite(uint8_t level, uint8_t *buf, uint32_t len);
|
||||
int dbgPrintf(uint8_t level, const char *format, ...);
|
||||
|
|
|
@ -95,6 +95,9 @@ DEPDIR := ${CURDIR}/.dep/$(PROJECT)
|
|||
CMSISINC = ${CURDIR}/CMSIS/include
|
||||
CMSISLIB = ${CURDIR}/CMSIS/Lib/GCC
|
||||
|
||||
# ChibiOS versions of system calls
|
||||
ALLSRC := $(CHIBIOS)/os/various/syscalls.c
|
||||
|
||||
# Licensing files.
|
||||
include $(CHIBIOS)/os/license/license.mk
|
||||
# Startup files.
|
||||
|
@ -131,7 +134,6 @@ LDSCRIPT= $(CONFDIR)/STM32F413xH.ld
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(TESTSRC) \
|
||||
$(CHIBIOS)/os/various/syscalls.c \
|
||||
main.c \
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -95,6 +95,9 @@ DEPDIR := ${CURDIR}/.dep/$(PROJECT)
|
|||
CMSISINC = ${CURDIR}/CMSIS/include
|
||||
CMSISLIB = ${CURDIR}/CMSIS/Lib/GCC
|
||||
|
||||
# ChibiOS versions of system calls
|
||||
ALLSRC := $(CHIBIOS)/os/various/syscalls.c
|
||||
|
||||
# Licensing files.
|
||||
include $(CHIBIOS)/os/license/license.mk
|
||||
# Startup files.
|
||||
|
@ -131,7 +134,6 @@ LDSCRIPT= $(CONFDIR)/STM32F413xH.ld
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(TESTSRC) \
|
||||
$(CHIBIOS)/os/various/syscalls.c \
|
||||
main.c \
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -16,20 +16,34 @@
|
|||
#include "geofence.h"
|
||||
#include "si446x_patch.h"
|
||||
|
||||
// Si446x variables
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module local variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static int16_t lastTemp = 0x7FFF;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
si446x_part_t part_info;
|
||||
si446x_func_t func_info;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static const uint8_t Radio_Patch_Data_Array[] = {
|
||||
SI446X_PATCH_CMDS,
|
||||
0x00
|
||||
};
|
||||
|
||||
/* =================================================================== SPI communication ==================================================================== */
|
||||
|
||||
static const SPIConfig ls_spicfg = {
|
||||
.ssport = PAL_PORT(LINE_RADIO_CS),
|
||||
.sspad = PAL_PAD(LINE_RADIO_CS),
|
||||
|
@ -38,13 +52,13 @@ static const SPIConfig ls_spicfg = {
|
|||
|
||||
/**
|
||||
* SPI write which uses CTS on GPIO1.
|
||||
* Use this when first taking radio out of shutdown.
|
||||
* The MCU GPIO pin connected to 446x GPIO1 must be already configured.
|
||||
* Used when starting the radio up from shutdown state.
|
||||
* @pre The MCU GPIO pin connected to 446x GPIO1 must be pre-configured.
|
||||
*/
|
||||
static bool Si446x_writeInit(const uint8_t* txData, uint32_t len) {
|
||||
static bool Si446x_writeBoot(const uint8_t* txData, uint32_t len) {
|
||||
/* Write data via SPI with CTS checked via GPIO1. */
|
||||
/* TODO: Add radio unit ID and get specific radio SPI driver. */
|
||||
uint8_t null_spi[len];
|
||||
//uint8_t null_spi[len];
|
||||
|
||||
/* Acquire bus and then start SPI. */
|
||||
spiAcquireBus(PKT_RADIO_SPI);
|
||||
|
@ -65,9 +79,9 @@ static bool Si446x_writeInit(const uint8_t* txData, uint32_t len) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Transfer data. Discard read back. */
|
||||
/* Transfer data. No need to check CTS.*/
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiExchange(PKT_RADIO_SPI, len, txData, null_spi);
|
||||
spiSend(PKT_RADIO_SPI, len, txData);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
|
||||
/* Stop SPI and relinquish bus. */
|
||||
|
@ -106,7 +120,7 @@ static bool Si446x_write(const uint8_t* txData, uint32_t len) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Transfer data. Discard read back. */
|
||||
/* Transfer data. */
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiExchange(PKT_RADIO_SPI, len, txData, null_spi);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
|
@ -118,15 +132,74 @@ static bool Si446x_write(const uint8_t* txData, uint32_t len) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* SPI read which uses CTS on GPIO1.
|
||||
* Use this when first taking radio out of shutdown.
|
||||
* The MCU GPIO pin connected to 446x GPIO1 must be already configured.
|
||||
*/
|
||||
static bool Si446x_readBoot(const uint8_t* txData, uint32_t txlen,
|
||||
uint8_t* rxData, uint32_t rxlen) {
|
||||
|
||||
/* TODO: Add radio unit ID and get SPI configuration accordingly. */
|
||||
|
||||
/* Acquire bus. */
|
||||
spiAcquireBus(PKT_RADIO_SPI);
|
||||
|
||||
/* Poll for CTS on GPIO1 from radio. */
|
||||
uint8_t timeout = 100;
|
||||
while(palReadLine(LINE_RADIO_GPIO1) != PAL_HIGH && timeout--) {
|
||||
chThdSleep(TIME_MS2I(1));
|
||||
}
|
||||
|
||||
if(!timeout) {
|
||||
/* Relinquish bus. */
|
||||
spiReleaseBus(PKT_RADIO_SPI);
|
||||
TRACE_ERROR("SI > CTS not received");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now write command and any data.
|
||||
*/
|
||||
spiStart(PKT_RADIO_SPI, &ls_spicfg);
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiSend(PKT_RADIO_SPI, txlen, txData);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
|
||||
/* Poll for CTS from command. */
|
||||
timeout = 100;
|
||||
while(palReadLine(LINE_RADIO_GPIO1) != PAL_HIGH && timeout--) {
|
||||
chThdSleep(TIME_MS2I(1));
|
||||
}
|
||||
|
||||
if(!timeout) {
|
||||
/* Stop SPI and relinquish bus. */
|
||||
spiStop(PKT_RADIO_SPI);
|
||||
spiReleaseBus(PKT_RADIO_SPI);
|
||||
TRACE_ERROR("SI > CTS not received");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Read the response. */
|
||||
uint8_t rx_ready[] = {Si446x_READ_CMD_BUFF, 0x00};
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiExchange(PKT_RADIO_SPI, rxlen, rx_ready, rxData);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
|
||||
/* Stop SPI and relinquish bus. */
|
||||
spiStop(PKT_RADIO_SPI);
|
||||
spiReleaseBus(PKT_RADIO_SPI);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from Si446x.
|
||||
*/
|
||||
static bool Si446x_read(const uint8_t* txData, uint32_t txlen,
|
||||
uint8_t* rxData, uint32_t rxlen) {
|
||||
// Transmit data by SPI
|
||||
|
||||
/* TODO: Add radio unit ID and get SPI configuration accordingly. */
|
||||
/* Command readback to be discarded here. */
|
||||
uint8_t null_spi[txlen];
|
||||
|
||||
/* Acquire bus and then start SPI. */
|
||||
spiAcquireBus(PKT_RADIO_SPI);
|
||||
|
@ -140,27 +213,28 @@ static bool Si446x_read(const uint8_t* txData, uint32_t txlen,
|
|||
uint8_t timeout = 100;
|
||||
uint8_t rx_ready[] = {Si446x_READ_CMD_BUFF, 0x00};
|
||||
do {
|
||||
if(timeout != 100)
|
||||
chThdSleep(TIME_MS2I(1));
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiExchange(PKT_RADIO_SPI, 1, rx_ready, &rx_ready[1]);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
if(timeout != 100)
|
||||
chThdSleep(TIME_MS2I(1));
|
||||
|
||||
} while(rx_ready[1] != Si446x_COMMAND_CTS && timeout--);
|
||||
|
||||
if(!timeout) {
|
||||
TRACE_ERROR("SI > CTS not received");
|
||||
/* Stop SPI (de-asserts select as well) and relinquish bus. */
|
||||
/* Stop SPI and relinquish bus. */
|
||||
spiStop(PKT_RADIO_SPI);
|
||||
spiReleaseBus(PKT_RADIO_SPI);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now write command and data. Discard the read back.
|
||||
* Now write command and data.
|
||||
*/
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiExchange(PKT_RADIO_SPI, txlen, txData, null_spi);
|
||||
|
||||
spiSend(PKT_RADIO_SPI, txlen, txData);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
/*
|
||||
* Poll waiting for CTS again using the READ_CMD_BUFF command.
|
||||
* Once CTS is received the response data is ready in the rx data buffer.
|
||||
|
@ -168,14 +242,14 @@ static bool Si446x_read(const uint8_t* txData, uint32_t txlen,
|
|||
*/
|
||||
timeout = 100;
|
||||
do {
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
if(timeout != 100)
|
||||
chThdSleep(TIME_MS2I(1));
|
||||
spiSelect(PKT_RADIO_SPI);
|
||||
spiExchange(PKT_RADIO_SPI, rxlen, rx_ready, rxData);
|
||||
spiUnselect(PKT_RADIO_SPI);
|
||||
} while(rxData[1] != Si446x_COMMAND_CTS && timeout--);
|
||||
|
||||
/* Stop SPI (de-asserts select as well) and relinquish bus. */
|
||||
/* Stop SPI and relinquish bus. */
|
||||
spiStop(PKT_RADIO_SPI);
|
||||
spiReleaseBus(PKT_RADIO_SPI);
|
||||
|
||||
|
@ -219,15 +293,18 @@ static void Si446x_setProperty32(uint16_t reg, uint8_t val1,
|
|||
*/
|
||||
static bool Si446x_init(const radio_unit_t radio) {
|
||||
|
||||
TRACE_INFO("SI > Wake up and initialize radio %d", radio);
|
||||
TRACE_INFO("SI > Start up and initialize radio %d", radio);
|
||||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
/* Wake up radio. */
|
||||
if(!Si446x_radioWakeup(radio)) {
|
||||
TRACE_ERROR("SI > Wake up of radio %d failed", radio);
|
||||
/*
|
||||
* Set MCU GPIO for radio GPIO1 (CTS).
|
||||
* Execute radio startup sequence.
|
||||
*/
|
||||
if(!Si446x_radioStartup(radio)) {
|
||||
TRACE_ERROR("SI > Start up of radio %d failed", radio);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -239,48 +316,70 @@ static bool Si446x_init(const radio_unit_t radio) {
|
|||
|
||||
/*
|
||||
* Start the chip API with the POWER_UP command.
|
||||
* The first POWER_UP is done without patch bit set.
|
||||
* We need to get PART_INFO to determine if this is a 4464 or 4463.
|
||||
* For a 4463 a patch will be loaded.
|
||||
* This is done with a new reset, load and POWER_UP sequence.
|
||||
*
|
||||
* For now though just use a #define to select 4463 config.
|
||||
* A second POWER_UP will take place if a patch needs to be applied.
|
||||
* The PART_INFO command is used to determine if this is a 4464 or 4463.
|
||||
*/
|
||||
#if Si446x_PART_VARIANT == 4463
|
||||
uint16_t i = 0;
|
||||
while(Radio_Patch_Data_Array[i] != 0) {
|
||||
Si446x_writeInit(&Radio_Patch_Data_Array[i + 1], Radio_Patch_Data_Array[i]);
|
||||
i += Radio_Patch_Data_Array[i] + 1;
|
||||
}
|
||||
const uint8_t init_command[] = {Si446x_POWER_UP, 0x81,
|
||||
(Si446x_CLK_TCXO_EN & 0x1),
|
||||
x3, x2, x1, x0};
|
||||
/*
|
||||
* Use of writeInit() enables SPI write without using OS delays.
|
||||
* CTS is available on GPIO1 after wake up for checking command ready.
|
||||
*
|
||||
* The SDO pin is configured to SDO data by POWER_UP.
|
||||
*/
|
||||
Si446x_writeInit(init_command, sizeof(init_command));
|
||||
#else
|
||||
(void)Radio_Patch_Data_Array;
|
||||
|
||||
const uint8_t init_command[] = {Si446x_POWER_UP, 0x01,
|
||||
(Si446x_CLK_TCXO_EN & 0x1),
|
||||
x3, x2, x1, x0};
|
||||
/*
|
||||
* Use of writeInit() enables SPI write without using OS delays.
|
||||
* CTS is available on GPIO1 after wake up for checking command ready.
|
||||
* Use of writeBoot() enables SPI write without using OS delays.
|
||||
* The Si446x GPIO1 is set to CTS at start up.
|
||||
*
|
||||
* The SDO pin is configured to SDO data by POWER_UP.
|
||||
* The Si446x SDO pin is configured to SDO data by the POWER_UP command.
|
||||
*/
|
||||
Si446x_writeInit(init_command, sizeof(init_command));
|
||||
//chThdSleep(TIME_MS2I(25));
|
||||
#endif
|
||||
Si446x_writeBoot(init_command, sizeof(init_command));
|
||||
|
||||
/* TODO: We should clear interrupts here with a GET_INT_STATUS. */
|
||||
/*
|
||||
* Next get the PART_INFO.
|
||||
* Store details for reference.
|
||||
* If the part requires a patch then reset and delay (TBD).
|
||||
* Output the patch and re-execute the POWER_UP command.
|
||||
*/
|
||||
|
||||
/* Set transceiver GPIOs to enable reading of PART_INFO. */
|
||||
uint8_t gpio_pin_cfg_command[] = {
|
||||
const uint8_t get_part[] = {Si446x_GET_PART_INFO};
|
||||
Si446x_readBoot(get_part, sizeof(get_part), (uint8_t *)&part_info,
|
||||
sizeof(part_info));
|
||||
|
||||
/* Save the part number and ROM revision. */
|
||||
handler->radio_part = (part_info.info[3] << 8) + part_info.info[4];
|
||||
handler->radio_rom_rev = part_info.info[9];
|
||||
|
||||
/*
|
||||
* Check this radio requires a patch installed.
|
||||
* TODO: Probably should be in a table...
|
||||
*/
|
||||
if(is_Si4463_patch_required(handler->radio_part, handler->radio_rom_rev)) {
|
||||
/* Power cycle radio and apply patch. */
|
||||
Si446x_radioShutdown(radio);
|
||||
chThdSleep(TIME_MS2I(10));
|
||||
Si446x_radioStartup(radio);
|
||||
uint16_t i = 0;
|
||||
while(Radio_Patch_Data_Array[i] != 0) {
|
||||
Si446x_writeBoot(&Radio_Patch_Data_Array[i + 1], Radio_Patch_Data_Array[i]);
|
||||
i += Radio_Patch_Data_Array[i] + 1;
|
||||
}
|
||||
const uint8_t init_command[] = {Si446x_POWER_UP, 0x81,
|
||||
(Si446x_CLK_TCXO_EN & 0x1),
|
||||
x3, x2, x1, x0};
|
||||
Si446x_writeBoot(init_command, sizeof(init_command));
|
||||
}
|
||||
|
||||
/* Get and save the patch ID from FUNC_INFO for reference. */
|
||||
|
||||
const uint8_t get_func[] = {Si446x_GET_FUNC_INFO};
|
||||
Si446x_readBoot(get_func, sizeof(get_func), (uint8_t *)&func_info,
|
||||
sizeof(func_info));
|
||||
|
||||
handler->radio_patch = (func_info.info[5] << 8) + func_info.info[6];
|
||||
|
||||
/*
|
||||
* Set transceiver GPIOs.
|
||||
* GPIO0, 1 and NIRQ can now be reconfigured as required by TX or RX modes.
|
||||
* In that case each needs to setup GPIOs as required.
|
||||
*/
|
||||
uint8_t gpio_pin_cfg_command2[] = {
|
||||
Si446x_GPIO_PIN_CFG, // Command type = GPIO settings
|
||||
0x00, // GPIO0 GPIO_MODE = DONOTHING
|
||||
0x15, // GPIO1 GPIO_MODE = RAW_RX_DATA
|
||||
|
@ -291,37 +390,31 @@ static bool Si446x_init(const radio_unit_t radio) {
|
|||
0x00 // GEN_CONFIG
|
||||
};
|
||||
|
||||
Si446x_writeInit(gpio_pin_cfg_command, sizeof(gpio_pin_cfg_command));
|
||||
Si446x_write(gpio_pin_cfg_command2, sizeof(gpio_pin_cfg_command2));
|
||||
|
||||
/* Now SPI CTS is configured and can be relied upon for CTS. */
|
||||
//chThdSleep(TIME_MS2I(25));
|
||||
/* TODO:
|
||||
* - Next get the PART_INFO and FUNC_INFO.
|
||||
* - Store these for reference.
|
||||
* - If the part requires a patch then reset and delay (TBD).
|
||||
* - Output the patch and re-execute the POWER_UP and GPIO commands.
|
||||
* - Then continue.
|
||||
*/
|
||||
/* TODO: We should clear interrupts here with a GET_INT_STATUS. */
|
||||
|
||||
si446x_info_t part_info;
|
||||
Si446x_getPartInfo(radio, &part_info);
|
||||
|
||||
|
||||
/* If Si446x is using its own xtal set the trim capacitor value. */
|
||||
#if !Si446x_CLK_TCXO_EN
|
||||
Si446x_setProperty8(Si446x_GLOBAL_XO_TUNE, 0x00);
|
||||
Si446x_setProperty8(Si446x_GLOBAL_XO_TUNE, 0x40);
|
||||
#endif
|
||||
|
||||
/* Fast response registers - not used at this time. */
|
||||
Si446x_setProperty8(Si446x_FRR_CTL_A_MODE, 0x00);
|
||||
Si446x_setProperty8(Si446x_FRR_CTL_B_MODE, 0x00);
|
||||
Si446x_setProperty8(Si446x_FRR_CTL_C_MODE, 0x00);
|
||||
Si446x_setProperty8(Si446x_FRR_CTL_D_MODE, 0x00);
|
||||
|
||||
Si446x_setProperty8(Si446x_INT_CTL_ENABLE, 0x00);
|
||||
|
||||
/* Set combined FIFO mode = 0x70. */
|
||||
//Si446x_setProperty8(Si446x_GLOBAL_CONFIG, 0x60);
|
||||
Si446x_setProperty8(Si446x_GLOBAL_CONFIG, 0x70);
|
||||
|
||||
/* Clear FIFO. */
|
||||
const uint8_t reset_fifo[] = {0x15, 0x01};
|
||||
Si446x_write(reset_fifo, 2);
|
||||
/* Clear TX & RX FIFO. */
|
||||
const uint8_t reset_fifo[] = {Si446x_FIFO_INFO, 0x03};
|
||||
Si446x_write(reset_fifo, sizeof(reset_fifo));
|
||||
/* No need to unset bits... see si docs. */
|
||||
|
||||
|
||||
|
@ -362,65 +455,74 @@ static bool Si446x_init(const radio_unit_t radio) {
|
|||
Si446x_setProperty8(Si446x_MODEM_BCR_GEAR, 0x00);
|
||||
Si446x_setProperty8(Si446x_MODEM_BCR_MISC1, 0xC2);
|
||||
Si446x_setProperty8(Si446x_MODEM_AFC_GEAR, 0x54);
|
||||
#if Si446x_PART_VARIANT == 4463
|
||||
Si446x_setProperty8(Si446x_MODEM_AFC_WAIT, 0x23);
|
||||
#else
|
||||
Si446x_setProperty8(Si446x_MODEM_AFC_WAIT, 0x36);
|
||||
#endif
|
||||
|
||||
if(is_part_Si4463(handler->radio_part))
|
||||
Si446x_setProperty8(Si446x_MODEM_AFC_WAIT, 0x23);
|
||||
else
|
||||
Si446x_setProperty8(Si446x_MODEM_AFC_WAIT, 0x36);
|
||||
|
||||
Si446x_setProperty16(Si446x_MODEM_AFC_GAIN, 0x80, 0xAB);
|
||||
Si446x_setProperty16(Si446x_MODEM_AFC_LIMITER, 0x02, 0x50);
|
||||
Si446x_setProperty8(Si446x_MODEM_AFC_MISC, 0x80);
|
||||
#if Si446x_PART_VARIANT == 4463
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_CONTROL, 0xE0);
|
||||
#else
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_CONTROL, 0xE2);
|
||||
#endif
|
||||
|
||||
if(is_part_Si4463(handler->radio_part))
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_CONTROL, 0xE0);
|
||||
else
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_CONTROL, 0xE2);
|
||||
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_WINDOW_SIZE, 0x11);
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_RFPD_DECAY, 0x63);
|
||||
Si446x_setProperty8(Si446x_MODEM_AGC_IFPD_DECAY, 0x63);
|
||||
#if Si446x_PART_VARIANT == 4463
|
||||
Si446x_setProperty8(Si446x_MODEM_FSK4_GAIN1, 0x80);
|
||||
#else
|
||||
Si446x_setProperty8(Si446x_MODEM_FSK4_GAIN1, 0x00);
|
||||
#endif
|
||||
|
||||
if(is_part_Si4463(handler->radio_part))
|
||||
Si446x_setProperty8(Si446x_MODEM_FSK4_GAIN1, 0x80);
|
||||
else
|
||||
Si446x_setProperty8(Si446x_MODEM_FSK4_GAIN1, 0x00);
|
||||
|
||||
Si446x_setProperty8(Si446x_MODEM_FSK4_GAIN0, 0x02);
|
||||
Si446x_setProperty16(Si446x_MODEM_FSK4_TH, 0x35, 0x55);
|
||||
Si446x_setProperty8(Si446x_MODEM_FSK4_MAP, 0x00);
|
||||
Si446x_setProperty8(Si446x_MODEM_OOK_PDTC, 0x2A);
|
||||
Si446x_setProperty8(Si446x_MODEM_OOK_CNT1, 0x85);
|
||||
Si446x_setProperty8(Si446x_MODEM_OOK_MISC, 0x23);
|
||||
#if Si446x_PART_VARIANT == 4463
|
||||
Si446x_setProperty8(Si446x_MODEM_RAW_SEARCH2, 0xBC);
|
||||
#else
|
||||
Si446x_setProperty8(Si446x_MODEM_RAW_SEARCH, 0xD6);
|
||||
#endif
|
||||
|
||||
if(is_part_Si4463(handler->radio_part))
|
||||
Si446x_setProperty8(Si446x_MODEM_RAW_SEARCH2, 0xBC);
|
||||
else
|
||||
Si446x_setProperty8(Si446x_MODEM_RAW_SEARCH, 0xD6);
|
||||
|
||||
Si446x_setProperty8(Si446x_MODEM_RAW_CONTROL, 0x8F);
|
||||
Si446x_setProperty16(Si446x_MODEM_RAW_EYE, 0x00, 0x3B);
|
||||
Si446x_setProperty8(Si446x_MODEM_ANT_DIV_MODE, 0x01);
|
||||
Si446x_setProperty8(Si446x_MODEM_ANT_DIV_CONTROL, 0x80);
|
||||
Si446x_setProperty8(Si446x_MODEM_RSSI_COMP, 0x40);
|
||||
#if Si446x_PART_VARIANT == 4463
|
||||
Si446x_setProperty8(Si446x_MODEM_SPIKE_DET, 0x03);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_CTRL1, 0xA0);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_CTRL2, 0x04);
|
||||
Si446x_setProperty8(Si446x_MODEM_ONE_SHOT_AFC, 0x07);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_QUAL, 0x06);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_RSSI, 0x78);
|
||||
Si446x_setProperty8(Si446x_MODEM_DECIMATION_CFG2, 0x0C);
|
||||
Si446x_setProperty8(Si446x_MODEM_RSSI_MUTE, 0x00);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_MISC, 0x20);
|
||||
Si446x_setProperty8(Si446x_PREAMBLE_CONFIG, 0x21);
|
||||
#endif
|
||||
|
||||
if(is_part_Si4463(handler->radio_part)) {
|
||||
Si446x_setProperty8(Si446x_MODEM_SPIKE_DET, 0x03);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_CTRL1, 0xA0);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_CTRL2, 0x04);
|
||||
Si446x_setProperty8(Si446x_MODEM_ONE_SHOT_AFC, 0x07);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_QUAL, 0x06);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_RSSI, 0x78);
|
||||
Si446x_setProperty8(Si446x_MODEM_DECIMATION_CFG2, 0x0C);
|
||||
Si446x_setProperty8(Si446x_MODEM_RSSI_MUTE, 0x00);
|
||||
Si446x_setProperty8(Si446x_MODEM_DSA_MISC, 0x20);
|
||||
Si446x_setProperty8(Si446x_PREAMBLE_CONFIG, 0x21);
|
||||
}
|
||||
|
||||
handler->radio_init = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialize radio only if if it has been shutdown.
|
||||
*/
|
||||
bool Si446x_conditional_init(const radio_unit_t radio) {
|
||||
// Initialize radio
|
||||
|
||||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
if(!handler->radio_init)
|
||||
return Si446x_init(radio);
|
||||
|
@ -519,7 +621,9 @@ static void Si446x_setPowerLevel(const radio_pwr_t level)
|
|||
|
||||
|
||||
|
||||
/* =========================================================== Radio specific modulation settings =========================================================== */
|
||||
/*
|
||||
* Radio modulation settings
|
||||
*/
|
||||
|
||||
static void Si446x_setModemAFSK_TX(const radio_unit_t radio) {
|
||||
/* TODO: Hardware mapping. */
|
||||
|
@ -629,7 +733,9 @@ static void Si446x_setModem2FSK_TX(const uint32_t speed)
|
|||
}
|
||||
|
||||
|
||||
/* ====================================================================== Radio Settings ====================================================================== */
|
||||
/*
|
||||
* Radio Settings
|
||||
*/
|
||||
|
||||
static uint8_t __attribute__((unused)) Si446x_getChannel(const radio_unit_t radio) {
|
||||
/* TODO: add hardware mapping. */
|
||||
|
@ -640,7 +746,9 @@ static uint8_t __attribute__((unused)) Si446x_getChannel(const radio_unit_t radi
|
|||
return rxData[3];
|
||||
}
|
||||
|
||||
/* ======================================================================= Radio FIFO ======================================================================= */
|
||||
/*
|
||||
* Radio FIFO
|
||||
*/
|
||||
|
||||
static void Si446x_writeFIFO(uint8_t *msg, uint8_t size) {
|
||||
/* TODO: add hardware mapping. */
|
||||
|
@ -659,7 +767,9 @@ static uint8_t Si446x_getTXfreeFIFO(const radio_unit_t radio) {
|
|||
return rxData[3];
|
||||
}
|
||||
|
||||
/* ====================================================================== Radio States ====================================================================== */
|
||||
/*
|
||||
* Radio States
|
||||
*/
|
||||
|
||||
radio_signal_t Si446x_getCurrentRSSI(const radio_unit_t radio) {
|
||||
/* TODO: add hardware mapping. */
|
||||
|
@ -671,15 +781,6 @@ radio_signal_t Si446x_getCurrentRSSI(const radio_unit_t radio) {
|
|||
return rxData[4];
|
||||
}
|
||||
|
||||
void Si446x_getPartInfo(const radio_unit_t radio, si446x_info_t *info) {
|
||||
/* TODO: add hardware mapping. */
|
||||
(void)radio;
|
||||
/* Get information for this chip. */
|
||||
const uint8_t status_info[] = {Si446x_GET_PART_INFO};
|
||||
Si446x_read(status_info, sizeof(status_info), (uint8_t *)info,
|
||||
sizeof(si446x_info_t));
|
||||
}
|
||||
|
||||
static uint8_t Si446x_getState(const radio_unit_t radio) {
|
||||
/* TODO: add hardware mapping. */
|
||||
(void)radio;
|
||||
|
@ -725,45 +826,46 @@ static void Si446x_setStandbyState(const radio_unit_t radio) {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
void Si446x_enterStandby(const radio_unit_t radio) {
|
||||
void Si446x_radioStandby(const radio_unit_t radio) {
|
||||
Si446x_setStandbyState(radio);
|
||||
}
|
||||
|
||||
/**
|
||||
* The GPIO LINE_RADIO_SDN is set high in board initialization.
|
||||
* Thus the radio is in shutdown following board initialization.
|
||||
* Si446x GPIO1 is configured to output CTS (option 8) during POR.
|
||||
* We use the MCU GPIO connected to radio GPIO1 to check CTS here.
|
||||
*
|
||||
* Radio init is performed in the radio manager thread init stage.
|
||||
* The radio GPIOs can be reconfigured after radio init is complete.
|
||||
*/
|
||||
bool Si446x_radioWakeup(const radio_unit_t radio) {
|
||||
/* The LINE_RADIO_SDN is set high in GPIO board initialization.
|
||||
* Hence the radio is started in shutdown by board initialization.
|
||||
* When the radio is shutdown by software the LINE_RADIO_SDN is also set high.
|
||||
* Si446x GPIO1 is configured to output CTS (option 8) during POR.
|
||||
* We use the MCU GPIO connected to radio GPIO1 to check CTS here.
|
||||
*
|
||||
* Radio init is performed in the radio manager thread init stage.
|
||||
* The use of GPIO1 of the radio can be changed after init is complete.
|
||||
*/
|
||||
TRACE_INFO("SI > Enable radio %i", radio);
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
bool Si446x_radioStartup(const radio_unit_t radio) {
|
||||
|
||||
TRACE_INFO("SI > Enable radio %i", radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
/* Assert SDN low to perform POR wakeup. */
|
||||
palClearLine(LINE_RADIO_SDN);
|
||||
/* Set MCU GPIO input for CTS of radio on GPIO1. */
|
||||
pktSetLineModeRadioCTS();
|
||||
/* Wait for transceiver to wake up (maximum wakeup time is 6mS). */
|
||||
/* Set MCU GPIO input for CTS and POR of radio from GPIO1 and GPIO0. */
|
||||
pktSetLineModeRadioGPIO1();
|
||||
pktSetLineModeRadioGPIO0();
|
||||
/* Wait for transceiver to wake up (maximum wakeup time is 6mS).
|
||||
* During start up the POR state is on GPIO0.
|
||||
* This goes from zero to one when POR completes.
|
||||
* We could test this but for now just use a delay.
|
||||
*/
|
||||
chThdSleep(TIME_MS2I(10));
|
||||
/* Return state of CTS after delay. */
|
||||
return pktReadGPIOline(LINE_RADIO_GPIO1) == PAL_HIGH;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* The radio is shutdown by setting LINE_RADIO_SDN high.
|
||||
*/
|
||||
void Si446x_radioShutdown(const radio_unit_t radio) {
|
||||
TRACE_INFO("SI > Disable radio %i", radio);
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
palSetLine(LINE_RADIO_SDN);
|
||||
handler->radio_init = false;
|
||||
|
@ -1534,7 +1636,7 @@ int16_t Si446x_getLastTemperature(const radio_unit_t radio) {
|
|||
if(lastTemp == 0x7FFF) { // Temperature was never measured => measure it now
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
if(handler->radio_init) {
|
||||
pktAcquireRadio(radio, TIME_INFINITE);
|
||||
|
|
|
@ -226,6 +226,10 @@
|
|||
#define Si446x_CCLK ((Si446x_CLK) + (Si446x_CLK_OFFSET) \
|
||||
* (Si446x_CLK) / 1000000)
|
||||
|
||||
#define is_part_Si4463(part) (part == 0x4463)
|
||||
|
||||
#define is_Si4463_patch_required(part, rom) (is_part_Si4463(part) && rom == 0x6)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
@ -240,16 +244,15 @@ typedef struct {
|
|||
|
||||
/* Si446x part info. */
|
||||
typedef struct {
|
||||
uint8_t cmd;
|
||||
uint8_t cts;
|
||||
uint8_t chiprev;
|
||||
uint16_t part;
|
||||
uint8_t pbuild;
|
||||
uint16_t id;
|
||||
uint8_t customer;
|
||||
uint8_t romid;
|
||||
} si446x_info_t;
|
||||
uint8_t info[10];
|
||||
} si446x_part_t;
|
||||
|
||||
/* Si446x func info. */
|
||||
typedef struct {
|
||||
uint8_t info[10];
|
||||
} si446x_func_t;
|
||||
|
||||
/* External. */
|
||||
typedef struct radioTask radio_task_object_t;
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -262,9 +265,9 @@ extern void pktReleasePacketBuffer(packet_t pp);
|
|||
extern "C" {
|
||||
#endif
|
||||
int16_t Si446x_getLastTemperature(const radio_unit_t radio);
|
||||
bool Si446x_radioWakeup(const radio_unit_t radio);
|
||||
bool Si446x_radioStartup(const radio_unit_t radio);
|
||||
void Si446x_radioShutdown(const radio_unit_t radio);
|
||||
void Si446x_enterStandby(const radio_unit_t radio);
|
||||
void Si446x_radioStandby(const radio_unit_t radio);
|
||||
void Si446x_sendAFSK(packet_t pp);
|
||||
bool Si446x_blocSendAFSK(radio_task_object_t *rto);
|
||||
void Si446x_send2FSK(packet_t pp);
|
||||
|
@ -292,7 +295,6 @@ extern "C" {
|
|||
radio_freq_t freq,
|
||||
channel_hz_t step);
|
||||
radio_signal_t Si446x_getCurrentRSSI(const radio_unit_t radio);
|
||||
void Si446x_getPartInfo(const radio_unit_t radio, si446x_info_t *info);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,7 @@ const ShellCommand commands[] = {
|
|||
{"sats", usb_cmd_get_gps_sat_info},
|
||||
{"error_list", usb_cmd_get_error_list},
|
||||
{"time", usb_cmd_time},
|
||||
{"radio", usb_cmd_radio},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -332,6 +333,7 @@ void usb_cmd_time(BaseSequentialStream *chp, int argc, char *argv[]) {
|
|||
chprintf(chp, "RTC time %04d-%02d-%02d %02d:%02d:%02d\r\n",
|
||||
time.year, time.month, time.day,
|
||||
time.hour, time.minute, time.day);
|
||||
chprintf(chp, "\r\nTo set time: time [YYYY-MM-DD HH:MM:SS]\r\n");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
@ -362,3 +364,32 @@ void usb_cmd_time(BaseSequentialStream *chp, int argc, char *argv[]) {
|
|||
int tm_isdst; Daylight saving time
|
||||
};*/
|
||||
}
|
||||
|
||||
/**
|
||||
* List type, part ROM rev and patch for radio.
|
||||
*/
|
||||
void usb_cmd_radio(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||
(void)argv;
|
||||
|
||||
if(argc > 1) {
|
||||
shellUsage(chp, "radio [number]");
|
||||
return;
|
||||
}
|
||||
radio_unit_t radio;
|
||||
if(argc == 0)
|
||||
radio = PKT_RADIO_1;
|
||||
else
|
||||
radio = atoi(argv[0]);
|
||||
|
||||
int8_t num = pktGetNumRadios();
|
||||
if(radio == 0 || radio > num) {
|
||||
chprintf(chp, "Invalid radio number %d\r\n", radio);
|
||||
return;
|
||||
}
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chprintf(chp, "Radio %d info: part number %04x, rom revision %02x, "
|
||||
"patch ID %04x\r\n",
|
||||
radio, handler->radio_part,
|
||||
handler->radio_rom_rev, handler->radio_patch);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ void usb_cmd_ccm_heap(BaseSequentialStream *chp, int argc, char *argv[]);
|
|||
void usb_cmd_get_gps_sat_info(BaseSequentialStream *chp, int argc, char *argv[]);
|
||||
void usb_cmd_get_error_list(BaseSequentialStream *chp, int argc, char *argv[]);
|
||||
void usb_cmd_time(BaseSequentialStream *chp, int argc, char *argv[]);
|
||||
void usb_cmd_radio(BaseSequentialStream *chp, int argc, char *argv[]);
|
||||
|
||||
extern const ShellCommand commands[];
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ thread_t *pktRadioManagerCreate(const radio_unit_t radio) {
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
/* Create the radio manager name. */
|
||||
chsnprintf(handler->rtask_name, sizeof(handler->rtask_name),
|
||||
|
@ -427,7 +427,7 @@ msg_t pktGetRadioTaskObjectI(const radio_unit_t radio,
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
dyn_objects_fifo_t *task_fifo = handler->the_radio_fifo;
|
||||
chDbgAssert(task_fifo != NULL, "no radio task fifo");
|
||||
|
@ -460,7 +460,7 @@ void pktSubmitRadioTaskI(const radio_unit_t radio,
|
|||
const radio_task_cb_t cb) {
|
||||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
dyn_objects_fifo_t *task_fifo = handler->the_radio_fifo;
|
||||
chDbgAssert(task_fifo != NULL, "no radio task fifo");
|
||||
|
@ -502,7 +502,7 @@ msg_t pktGetRadioTaskObject(const radio_unit_t radio,
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
dyn_objects_fifo_t *task_fifo =
|
||||
chFactoryFindObjectsFIFO(handler->rtask_name);
|
||||
|
@ -538,7 +538,7 @@ void pktSubmitRadioTask(const radio_unit_t radio,
|
|||
const radio_task_cb_t cb) {
|
||||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
dyn_objects_fifo_t *task_fifo = handler->the_radio_fifo;
|
||||
chDbgAssert(task_fifo != NULL, "no radio task fifo");
|
||||
|
@ -638,11 +638,11 @@ int pktDisplayFrequencyCode(const radio_freq_t code, char *buf, size_t size) {
|
|||
break;
|
||||
|
||||
case FREQ_CMDC_RECEIVE:
|
||||
str = "CNC Receivefrequency";
|
||||
str = "CNC Receive frequency";
|
||||
break;
|
||||
|
||||
case FREQ_APRS_DEFAULT:
|
||||
str = "APRS Defaultfrequency";
|
||||
str = "APRS Default frequency";
|
||||
break;
|
||||
|
||||
case FREQ_CODES_END:
|
||||
|
@ -707,7 +707,7 @@ radio_freq_t pktGetReceiveOperatingFrequency(const radio_unit_t radio) {
|
|||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* TODO: Rework to use max radio and start and PKT_RADIO_1 in loop.
|
||||
*/
|
||||
radio_freq_t pktCheckAllowedFrequency(const radio_unit_t radio,
|
||||
radio_freq_t freq) {
|
||||
|
@ -821,7 +821,7 @@ void pktLLDradioStandby(const radio_unit_t radio) {
|
|||
* Put radio in standby (low power) mode.
|
||||
* All registers are retained.
|
||||
*/
|
||||
Si446x_enterStandby(radio);
|
||||
Si446x_radioStandby(radio);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -871,7 +871,7 @@ bool pktLLDradioEnableReceive(const radio_unit_t radio,
|
|||
radio_task_object_t *rto) {
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
if(handler == NULL)
|
||||
return false;
|
||||
|
@ -915,7 +915,7 @@ void pktLLDradioDisableReceive(const radio_unit_t radio) {
|
|||
bool pktLLDradioResumeReceive(const radio_unit_t radio) {
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
radio_freq_t freq = handler->radio_rx_config.base_frequency;
|
||||
channel_hz_t step = handler->radio_rx_config.step_hz;
|
||||
|
@ -940,7 +940,7 @@ bool pktLLDradioResumeReceive(const radio_unit_t radio) {
|
|||
*/
|
||||
void pktLLDradioCaptureRSSI(const radio_unit_t radio) {
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
handler->rx_stength = Si446x_getCurrentRSSI(radio);
|
||||
}
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ void pktStartDecoder(const radio_unit_t radio) {
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
if(!pktIsReceivePaused(radio))
|
||||
/* Wrong state. */
|
||||
|
@ -465,8 +465,8 @@ void pktStopDecoder(radio_unit_t radio) {
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
if(handler == NULL)
|
||||
chDbgAssert(false, "invalid radio ID");
|
||||
/* if(handler == NULL)
|
||||
chDbgAssert(false, "invalid radio ID");*/
|
||||
|
||||
if(!pktIsReceiveActive(radio))
|
||||
return;
|
||||
|
@ -808,7 +808,7 @@ void pktCallbackManagerOpen(radio_unit_t radio) {
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
/* Create the callback handler thread name. */
|
||||
chsnprintf(handler->cbend_name, sizeof(handler->cbend_name),
|
||||
|
@ -833,7 +833,7 @@ dyn_objects_fifo_t *pktIncomingBufferPoolCreate(radio_unit_t radio) {
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
/* Create the packet buffer name for this radio. */
|
||||
chsnprintf(handler->pbuff_name, sizeof(handler->pbuff_name),
|
||||
|
@ -1011,7 +1011,7 @@ thread_t *pktCallbackManagerCreate(radio_unit_t radio) {
|
|||
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
/* Create the callback termination thread name. */
|
||||
chsnprintf(handler->cbend_name, sizeof(handler->cbend_name),
|
||||
|
|
|
@ -92,6 +92,21 @@ typedef struct packetHandlerData {
|
|||
*/
|
||||
radio_unit_t radio;
|
||||
|
||||
/**
|
||||
* @brief Radio part number.
|
||||
*/
|
||||
radio_part_t radio_part;
|
||||
|
||||
/**
|
||||
* @brief Radio revision level.
|
||||
*/
|
||||
radio_rev_t radio_rom_rev;
|
||||
|
||||
/**
|
||||
* @brief Radio patch ID.
|
||||
*/
|
||||
radio_patch_t radio_patch;
|
||||
|
||||
/**
|
||||
* @brief Radio initialization flag.
|
||||
*/
|
||||
|
@ -552,6 +567,9 @@ inline packet_svc_t *pktGetServiceObject(radio_unit_t radio) {
|
|||
if(radio == PKT_RADIO_1) {
|
||||
handler = &RPKTD1;
|
||||
}
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
@ -571,7 +589,7 @@ static inline packet_state_t pktGetServiceState(radio_unit_t radio) {
|
|||
*/
|
||||
packet_svc_t *handler = pktGetServiceObject(radio);
|
||||
|
||||
chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
//chDbgAssert(handler != NULL, "invalid radio ID");
|
||||
|
||||
return handler->state;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,18 @@ typedef enum radioUnit {
|
|||
PKT_RADIO_1
|
||||
} radio_unit_t;
|
||||
|
||||
typedef uint16_t radio_part_t;
|
||||
|
||||
typedef uint8_t radio_rev_t;
|
||||
|
||||
typedef uint16_t radio_patch_t;
|
||||
|
||||
/*
|
||||
* Specify radio family.
|
||||
* Specific radio in family is identified dynamically.
|
||||
*/
|
||||
typedef enum radioTypes {
|
||||
SI4464,
|
||||
SI4463
|
||||
SI446X
|
||||
} radio_type_t;
|
||||
|
||||
typedef enum radioMode {
|
||||
|
|
Ładowanie…
Reference in New Issue