kopia lustrzana https://github.com/DL7AD/pecanpico10
Additional documentation, more work on 446x driver.
rodzic
ea29943ff3
commit
45843f208d
|
@ -257,7 +257,7 @@ CPPWARN = -Wall -Wextra -Wundef
|
|||
#
|
||||
|
||||
# List all user C define here, like -D_DEBUG=1
|
||||
UDEFS = -D_GNU_SOURCE -DARM_MATH_CM4 -DSHELL_CMD_TEST_ENABLED=0
|
||||
UDEFS = -D_GNU_SOURCE -DARM_MATH_CM4 -DSHELL_CMD_TEST_ENABLED=1
|
||||
|
||||
# Define ASM defines here
|
||||
UADEFS =
|
||||
|
|
|
@ -1059,16 +1059,6 @@ THD_FUNCTION(si_fifo_feeder_afsk, arg)
|
|||
c += more;
|
||||
chThdSleep(TIME_MS2I(15));
|
||||
}
|
||||
|
||||
/*
|
||||
* Shutdown radio if reception has been interrupted. If reception was interrupted rx_frequency is set.
|
||||
* If reception has not been interrupted rx_frequency is set 0.
|
||||
*/
|
||||
if(!rx_frequency) {
|
||||
Si446x_shutdown();
|
||||
} else {
|
||||
Si4464_restoreRX();
|
||||
}
|
||||
} else {
|
||||
/* Transmit start failed. */
|
||||
#ifdef PKT_IS_TEST_PROJECT
|
||||
|
@ -1077,6 +1067,15 @@ THD_FUNCTION(si_fifo_feeder_afsk, arg)
|
|||
TRACE_ERROR("SI > Transmit failed");
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Shutdown radio if reception has been interrupted. If reception was interrupted rx_frequency is set.
|
||||
* If reception has not been interrupted rx_frequency is set 0.
|
||||
*/
|
||||
if(!rx_frequency) {
|
||||
Si446x_shutdown();
|
||||
} else {
|
||||
Si4464_restoreRX();
|
||||
}
|
||||
// Free packet object memory
|
||||
ax25_delete(pp);
|
||||
chThdExit(MSG_OK);
|
||||
|
|
|
@ -37,10 +37,23 @@
|
|||
#define Si446x_STATE_TX 7
|
||||
#define Si446x_STATE_RX 8
|
||||
|
||||
// Si4464 Registers
|
||||
/*
|
||||
* Commands.
|
||||
*/
|
||||
|
||||
#define Si446x_READ_CMD_BUFF 0x44
|
||||
#define Si446x_START_TX 0x31
|
||||
#define Si446x_START_RX 0x32
|
||||
#define Si446x_RX_HOP 0x36
|
||||
|
||||
/* Defined response values. */
|
||||
|
||||
#define Si446x_COMMAND_CTS 0xFF
|
||||
|
||||
/*
|
||||
* Property group commands.
|
||||
* Format is 0xGGNN (GG = group, NN = number).
|
||||
*/
|
||||
#define Si446x_GLOBAL_XO_TUNE 0x0000
|
||||
#define Si446x_GLOBAL_CLK_CFG 0x0001
|
||||
#define Si446x_GLOBAL_CONFIG 0x0003
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
|
||||
/*
|
||||
* Diagnostic output definitions.
|
||||
* TODO: Deprecate.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -161,11 +162,22 @@ extern "C" {
|
|||
/* Module inline functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Define GPIO port where the NIRQ from the radio is connected.
|
||||
* @notes The NIRQ line is set in the radio to output the CCA condition.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
static inline void pktSetLineModeCCA(void) {
|
||||
palSetLineMode(LINE_CCA, PAL_MODE_INPUT_PULLUP);
|
||||
}
|
||||
|
||||
/* Decoder blinker LED. */
|
||||
/**
|
||||
* @brief For driving an indicator LED for decoder status.
|
||||
* @notes These functions control the LED on a GPIO line if defined.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
static inline void pktSetLineModeDecoderLED(void) {
|
||||
#if defined(LINE_DECODER_LED)
|
||||
palSetLineMode(LINE_DECODER_LED, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
@ -189,7 +201,12 @@ static inline void pktWriteDecoderLED(uint8_t state) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Squelch (CCA) indicator. */
|
||||
/**
|
||||
* @brief For driving an indicator LED for PWM CCA asserted.
|
||||
* @notes These functions control the LED on a GPIO line if defined.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
static inline void pktSetLineModeSquelchLED(void) {
|
||||
#if defined(LINE_SQUELCH_LED)
|
||||
palSetLineMode(LINE_SQUELCH_LED, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
@ -213,7 +230,12 @@ static inline void pktUnsetLineModeSquelchLED(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Overflow in FIFO queue space. */
|
||||
/**
|
||||
* @brief For driving an indicator LED for PWM queue space exhausted.
|
||||
* @notes These functions control the LED on a GPIO line if defined.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
static inline void pktSetLineModeOverflowLED(void) {
|
||||
#if defined(LINE_OVERFLOW_LED)
|
||||
palSetLineMode(LINE_OVERFLOW_LED, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
@ -237,7 +259,12 @@ static inline void pktUnsetLineModeOverflowLED(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/* LED for FIFO out at PWM/ICU side. */
|
||||
/**
|
||||
* @brief For driving an indicator LED for PWM buffers exhausted.
|
||||
* @notes These functions control the LED on a GPIO line if defined.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
static inline void pktSetLineModeNoFIFOLED(void) {
|
||||
#if defined(LINE_NO_FIFO_LED)
|
||||
palSetLineMode(LINE_NO_FIFO_LED, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
@ -261,7 +288,12 @@ static inline void pktUnsetLineModeNoFIFOLED(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/* PWM mirroring to a GPIO for diagnostics. */
|
||||
/**
|
||||
* @brief For diagnostics only.
|
||||
* @notes These functions control the mirroring of radio PWM data to a GPIO.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static inline void pktSetLineModePWMMirror(void) {
|
||||
#if defined(LINE_PWM_MIRROR)
|
||||
palSetLineMode(LINE_PWM_MIRROR, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
@ -285,46 +317,15 @@ static inline void pktWritePWMMirror(uint8_t state) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Radio configuration for SPI connected radio. */
|
||||
/*static inline msg_t pktOpenRadio(packet_svc_t *handler) {
|
||||
#if USE_SPI_ATTACHED_RADIO == TRUE
|
||||
msg_t msg = pktSubmitRadioTask(handler, TIME_S2I(10), NULL);
|
||||
return msg;
|
||||
#else
|
||||
(void)handler;
|
||||
return MSG_OK;
|
||||
#endif
|
||||
}*/
|
||||
|
||||
/*static inline msg_t pktStartRadio(packet_svc_t *handler) {
|
||||
#if USE_SPI_ATTACHED_RADIO == TRUE
|
||||
msg_t msg = pktSubmitRadioTask(handler, TIME_MS2I(100), NULL);
|
||||
return msg;
|
||||
#else
|
||||
(void)handler;
|
||||
return MSG_OK;
|
||||
#endif
|
||||
}*/
|
||||
|
||||
/*static inline void pktStopRadio(packet_svc_t *handler) {
|
||||
#if USE_SPI_ATTACHED_RADIO == TRUE
|
||||
(void)handler;
|
||||
#else
|
||||
(void)handler;
|
||||
#endif
|
||||
}*/
|
||||
|
||||
/*static inline msg_t pktCloseRadio(packet_svc_t *handler) {
|
||||
#if USE_SPI_ATTACHED_RADIO == TRUE
|
||||
(void)handler;
|
||||
//Si446x_shutdown();
|
||||
#else
|
||||
(void)handler;
|
||||
#endif
|
||||
return MSG_OK;
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sends a command request to a radio.
|
||||
* @post The command object posted to the radio manager queue.
|
||||
*
|
||||
* @param[in] handler pointer to a @p packet handler object
|
||||
* @param[in] task pointer to a task object.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
static inline msg_t pktSendRadioCommand(packet_svc_t *handler,
|
||||
radio_task_object_t *task) {
|
||||
#if USE_SPI_ATTACHED_RADIO == TRUE
|
||||
|
|
|
@ -94,6 +94,7 @@ typedef uint8_t ax25char_t;
|
|||
typedef int16_t ax25size_t;
|
||||
|
||||
#ifdef PKT_IS_TEST_PROJECT
|
||||
|
||||
/* TODO: Create a chFactory FIFO to manage these objects. */
|
||||
struct packet_s {
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue