센서보드 RF IRQ 테스트 중
Fork of stm-spirit1-rf-driver by
Revision 83:54b207156a91, committed 2018-03-21
- Comitter:
- jmhong
- Date:
- Wed Mar 21 05:06:08 2018 +0000
- Parent:
- 82:a18c22d2b83a
- Child:
- 84:45b9ff78a066
- Commit message:
- HJM : EV COG AD3029LZ test;
Changed in this revision
--- a/mbed_lib.json Fri Feb 02 14:13:24 2018 +0100
+++ b/mbed_lib.json Wed Mar 21 05:06:08 2018 +0000
@@ -3,5 +3,5 @@
"config": {
"mac-address": "{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}"
},
- "macros": ["USE_STM32F4XX_NUCLEO", "X_NUCLEO_IDS01A4", "SPIRIT_USE_FULL_ASSERT"]
+ "macros": ["USE_STM32F4XX_NUCLEO", "X_NUCLEO_IDS01A5", "SPIRIT_USE_FULL_ASSERT"]
}
--- a/source/SimpleSpirit1.cpp Fri Feb 02 14:13:24 2018 +0100
+++ b/source/SimpleSpirit1.cpp Wed Mar 21 05:06:08 2018 +0000
@@ -1,8 +1,10 @@
/*** Mbed Includes ***/
#include "SimpleSpirit1.h"
#include "radio_spi.h"
+//#include "main.h"
-#define SPIRIT_GPIO_IRQ (SPIRIT_GPIO_3)
+//#define SPIRIT_GPIO_IRQ (SPIRIT_GPIO_0)
+#define SPIRIT_GPIO_IRQ (SPIRIT_GPIO_2)
static uint16_t last_state;
#define SPIRIT1_STATUS() ((last_state = (uint16_t)refresh_state()) & SPIRIT1_STATE_STATEBITS)
@@ -46,52 +48,76 @@
/** Init Function **/
void SimpleSpirit1::init() {
- /* reset irq disable counter and irq callback & disable irq */
- _nr_of_irq_disables = 0;
+ /*cubebite HJM, reset irq disable counter and irq callback & disable irq */
+ _nr_of_irq_disables = 0; // @@
disable_spirit_irq();
- /* unselect chip */
+ /*cubebite HJM, unselect chip */
chip_unselect();
- /* configure spi */
+ /*cubebite HJM, configure spi */
_spi.format(8, 0); /* 8-bit, mode = 0, [order = SPI_MSB] only available in mbed3 */
- _spi.frequency(10000000); // 10MHz (i.e. max speed allowed for Spirit1)
+
- /* install irq handler */
+// _spi.frequency(13000000); // 13MHz (i.e. max speed allowed for Spirit1)
+// _spi.frequency(6500000); // 6.5MHz (i.e. max speed allowed for Spirit1)
+// _spi.frequency(4333333); // 4.3333...MHz (i.e. max speed allowed for Spirit1)
+// _spi.frequency(2600000); // 4.3333...MHz (i.e. max speed allowed for Spirit1)
+// _spi.frequency(1444444); // 4.3333...MHz (i.e. max speed allowed for Spirit1)
+// _spi.frequency(764705); // 4.3333...MHz (i.e. max speed allowed for Spirit1)
+ _spi.frequency(393939); // 4.3333...MHz (i.e. max speed allowed for Spirit1)
+
+
+
+ /*cubebite HJM, install irq handler */
_irq.mode(PullUp);
_irq.fall(Callback<void()>(this, &SimpleSpirit1::IrqHandler));
- /* init cube vars */
+ printf("test 4 \n");
+ /*cubebite HJM, init cube vars */
spirit_on = OFF;
last_rssi = 0 ; //MGR
last_sqi = 0 ; //MGR
- /* set frequencies */
- radio_set_xtal_freq(XTAL_FREQUENCY);
- mgmt_set_freq_base((uint32_t)BASE_FREQUENCY);
+ printf("test 5 \n");
+ /*cubebite HJM, set frequencies */
+ radio_set_xtal_freq(XTAL_FREQUENCY); //cubebite HJM, 50MHz
+ mgmt_set_freq_base((uint32_t)BASE_FREQUENCY); // @@
- /* restart board */
- enter_shutdown();
- exit_shutdown();
+ printf("test 6 \n");
+ /*cubebite HJM , restart board */
+ enter_shutdown();
+ exit_shutdown();
- /* soft core reset */
+ printf("test 7 \n");
+ /*cubebite HJM, soft core reset */
cmd_strobe(SPIRIT1_STROBE_SRES);
- /* Configures the SPIRIT1 radio part */
- SRadioInit x_radio_init = {
- XTAL_OFFSET_PPM,
- (uint32_t)BASE_FREQUENCY,
- (uint32_t)CHANNEL_SPACE,
- CHANNEL_NUMBER,
- MODULATION_SELECT,
- DATARATE,
- (uint32_t)FREQ_DEVIATION,
- (uint32_t)BANDWIDTH
- };
- radio_init(&x_radio_init);
- radio_set_pa_level_dbm(0,POWER_DBM);
+ printf("test 8 \n");
+ /*cubebite HJM, Configures the SPIRIT1 radio part */
+ //180119 HJM : 433MHz 설정으로 변경 후 테스트.
+ SRadioInit x_radio_init = {
+ XTAL_OFFSET_PPM, // Xtal offset in ppm
+ (uint32_t)BASE_FREQUENCY, // HJM 수정 후 테스트 중 base frequency
+ (uint32_t)CHANNEL_SPACE, // channel space
+ CHANNEL_NUMBER, // channel number, HJM : 뭐지 0 인줄 알았더니 1로 셋팅되어있네/
+ MODULATION_SELECT, // modulation select
+ DATARATE, // HJM 수정 후 테스트 중
+ (uint32_t)FREQ_DEVIATION, // frequency deviation
+ (uint32_t)BANDWIDTH // channel filter bandwidth
+ };
+
+ printf("test 9 \n");
+ uint8_t ui8Return;
+ ui8Return = radio_init(&x_radio_init);
+ printf("test 9, ui8Return : [%d]\n", ui8Return);
+ /*180117 HJM : 송신 신호 세기 */
+ radio_set_pa_level_dbm(0,POWER_DBM); //hjm test
+// radio_set_pa_level_dbm(0,10.0);
+// radio_set_pa_level_dbm(0,CUBEBITE_OUTPUT_POWER_DBM_TEST);
radio_set_pa_level_max_index(0);
+ printf("test 10 \n");
/* Configures the SPIRIT1 packet handler part*/
PktBasicInit x_basic_init = {
PREAMBLE_LENGTH,
@@ -107,6 +133,7 @@
};
pkt_basic_init(&x_basic_init);
+ printf("test 11 \n");
/* Enable the following interrupt sources, routed to GPIO */
irq_de_init(NULL);
irq_clear_status();
@@ -121,21 +148,24 @@
irq_set_status(RX_FIFO_ALMOST_FULL, S_ENABLE);
#endif // !RX_FIFO_THR_WA
+ printf("test 12 \n");
/* Configure Spirit1 */
radio_persistent_rx(S_ENABLE);
qi_set_sqi_threshold(SQI_TH_0);
qi_sqi_check(S_ENABLE);
- qi_set_rssi_threshold_dbm(CCA_THRESHOLD);
+ qi_set_rssi_threshold_dbm(CCA_THRESHOLD); //180205 HJM : RRSI 셋팅 값 수정 테스트
timer_set_rx_timeout_stop_condition(SQI_ABOVE_THRESHOLD);
timer_set_infinite_rx_timeout();
radio_afc_freeze_on_sync(S_ENABLE);
calibration_rco(S_ENABLE);
+ spirit_on = OFF;
CLEAR_TXBUF();
CLEAR_RXBUF();
_spirit_tx_started = false;
_is_receiving = false;
+ printf("test 13 \n");
/* Configure the radio to route the IRQ signal to its GPIO 3 */
SGpioInit x_gpio_init = {
SPIRIT_GPIO_IRQ,
@@ -144,6 +174,7 @@
};
spirit_gpio_init(&x_gpio_init);
+ printf("test 14 \n");
/* Setup CSMA/CA */
CsmaInit x_csma_init = {
S_ENABLE, // enable persistent mode
@@ -155,46 +186,69 @@
};
csma_ca_init(&x_csma_init);
+ printf("test 15 \n");
#ifdef USE_STANDBY_STATE
/* Puts the SPIRIT1 in STANDBY mode (125us -> rx/tx) */
cmd_strobe(SPIRIT1_STROBE_STANDBY);
#endif // USE_STANDBY_STATE
}
+
+
+
+
static volatile int tx_fifo_remaining = 0; // to be used in irq handler
static volatile int tx_buffer_pos = 0; // to be used in irq handler
static const volatile uint8_t *tx_fifo_buffer = NULL; // to be used in irq handler
-int SimpleSpirit1::send(const void *payload, unsigned int payload_len, bool use_csma_ca) {
+int SimpleSpirit1::send(const void *payload, unsigned int payload_len, bool use_csma_ca)
+{
/* Checks if the payload length is supported */
- if(payload_len > MAX_PACKET_LEN) {
+ printf("\r\n[SEND] 1, MAX_PACKET_LEN : [%d]\n", MAX_PACKET_LEN);
+ printf("[SEND] 2, payload_len : [%d]\n", payload_len);
+
+ if(payload_len > MAX_PACKET_LEN)
+ {
+// printf("[SEND] \n");
return RADIO_TX_ERR;
}
-
+
disable_spirit_irq();
BUSYWAIT_UNTIL(SPIRIT1_STATUS() == SPIRIT1_STATE_RX, STATE_TIMEOUT);
#ifndef NDEBUG
- if((last_state & SPIRIT1_STATE_STATEBITS) != SPIRIT1_STATE_RX) {
+ if((last_state & SPIRIT1_STATE_STATEBITS) != SPIRIT1_STATE_RX)
+ {
debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, last_state>>1);
}
#endif
+
+
+
+
/* Reset State to Ready */
+ printf("[SEND] 3, set_ready_state() call, \n");
set_ready_state();
+
- cmd_strobe(SPIRIT1_STROBE_FTX); // flush TX FIFO buffer
+ printf("[SEND] 4, cmd_strobe() call, SPIRIT1_STROBE_FTX \n");
+ cmd_strobe(SPIRIT1_STROBE_FTX); // flush TX FIFO buffer
#ifndef NDEBUG
debug_if(!(linear_fifo_read_num_elements_tx_fifo() == 0), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
#endif
- pkt_basic_set_payload_length(payload_len); // set desired payload len
+ printf("[SEND] 5, pkt_basic_set_payload_length() call, \n");
+ pkt_basic_set_payload_length(payload_len); // set desired payload len
- if(use_csma_ca) {
+ if(use_csma_ca)
+ {
+ printf("[SEND] 6, csma_ca_state() call, \n");
csma_ca_state(S_ENABLE); // enable CSMA/CA
}
/* Init buffer & number of bytes to be send */
+ printf("[SEND] 7, csma_ca_state() call, \n");
tx_fifo_remaining = payload_len;
tx_fifo_buffer = (const uint8_t*)payload;
@@ -203,18 +257,21 @@
tx_fifo_remaining -= to_send;
- /* Fill FIFO Buffer */
- if(to_send > 0) {
- spi_write_linear_fifo(to_send, (uint8_t*)&tx_fifo_buffer[0]);
+ /* Fill FIFO Buffer */
+ if(to_send > 0)
+ {
+ printf("[SEND] 8, if(to_send > 0), if(to_send > 0) \n");
+ spi_write_linear_fifo(to_send, (uint8_t*)&tx_fifo_buffer[0]);
}
tx_buffer_pos = to_send;
_spirit_tx_started = true;
enable_spirit_irq();
+ printf(" 6");
/* Start transmitting */
- cmd_strobe(SPIRIT1_STROBE_TX);
+ cmd_strobe(SPIRIT1_STROBE_TX);
while(tx_fifo_remaining != 0); // wait until not everything is yet send (evtl. by irq handler)
@@ -223,25 +280,35 @@
debug("\r\n%s (%d): state=%x, _spirit_tx_started=%d\r\n", __func__, __LINE__, SPIRIT1_STATUS()>>1, _spirit_tx_started);
#endif
- if(use_csma_ca) {
+ if(use_csma_ca)
+ {
csma_ca_state(S_DISABLE); // disable CSMA/CA
}
- cmd_strobe(SPIRIT1_STROBE_RX); // Return to RX state
+ cmd_strobe(SPIRIT1_STROBE_RX); // Return to RX state
+
- disable_spirit_irq();
- if(_spirit_tx_started) { // in case of state timeout
+ disable_spirit_irq();
+ if(_spirit_tx_started)
+ { // in case of state timeout
_spirit_tx_started = false;
- enable_spirit_irq();
+ enable_spirit_irq();
+ printf("[SEND] 8, if(_spirit_tx_started), in case of state timeout, return RADIO_TX_ERR \n");
+
return RADIO_TX_ERR;
- } else {
- enable_spirit_irq();
+ }
+ else
+ {
+ enable_spirit_irq();
+ printf("[SEND] 8, else, in case of state timeout, return RADIO_TX_OK \n");
+
return RADIO_TX_OK;
}
}
/** Set Ready State **/
-void SimpleSpirit1::set_ready_state(void) {
+void SimpleSpirit1::set_ready_state(void)
+{
uint16_t state;
disable_spirit_irq();
@@ -255,18 +322,27 @@
CLEAR_TXBUF();
state = SPIRIT1_STATUS();
- if(state == SPIRIT1_STATE_STANDBY) {
+ if(state == SPIRIT1_STATE_STANDBY)
+ {
+ printf("[SEND] 3-1, set_ready_state() call, if(state == SPIRIT1_STATE_STANDBY) in \n");
cmd_strobe(SPIRIT1_STROBE_READY);
- } else if(state == SPIRIT1_STATE_RX) {
+ }
+ else if(state == SPIRIT1_STATE_RX)
+ {
+ printf("[SEND] 3-2, set_ready_state() call, if(state == SPIRIT1_STATE_RX) in \n");
cmd_strobe(SPIRIT1_STROBE_SABORT);
- } else if(state != SPIRIT1_STATE_READY) {
+ }
+ else if(state != SPIRIT1_STATE_READY)
+ {
#ifndef NDEBUG
debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, state>>1);
#endif
+ printf("[SEND] 3-3, set_ready_state() call, else if(state != SPIRIT1_STATE_READY) in, something is wrong. \n");
}
BUSYWAIT_UNTIL((SPIRIT1_STATUS() == SPIRIT1_STATE_READY) && ((last_state & XO_ON) == XO_ON), STATE_TIMEOUT);
- if(last_state != (SPIRIT1_STATE_READY | XO_ON)) {
+ if(last_state != (SPIRIT1_STATE_READY | XO_ON))
+ {
error("\r\nSpirit1: failed to become ready (%x) => pls. reset!\r\n", last_state);
enable_spirit_irq();
return;
@@ -277,8 +353,10 @@
enable_spirit_irq();
}
-int SimpleSpirit1::off(void) {
- if(spirit_on == ON) {
+int SimpleSpirit1::off(void)
+{
+ if(spirit_on == ON)
+ {
/* Disables the mcu to get IRQ from the SPIRIT1 */
disable_spirit_irq();
@@ -301,8 +379,10 @@
return 0;
}
-int SimpleSpirit1::on(void) {
- if(spirit_on == OFF) {
+int SimpleSpirit1::on(void)
+{
+ if(spirit_on == OFF)
+ {
set_ready_state();
/* now we go to Rx */
@@ -339,14 +419,16 @@
}
int SimpleSpirit1::read(void *buf, unsigned int bufsize)
-{
+{
disable_spirit_irq();
+ printf("read() 1 ");
/* Checks if the RX buffer is empty */
if(IS_RXBUF_EMPTY()) {
#ifndef NDEBUG
debug("\r\nBuffer is empty\r\n");
#endif
+ printf("[DEBUG] 2-1");
set_ready_state();
cmd_strobe(SPIRIT1_STROBE_RX);
@@ -365,19 +447,22 @@
return 0;
} else {
/* Copies the packet received */
+
memcpy(buf, spirit_rx_buf, spirit_rx_len);
-
- bufsize = spirit_rx_len;
+ bufsize = spirit_rx_len;
+ printf("recv 3-1");
+
CLEAR_RXBUF();
-
+ printf(" 3-2");
+
enable_spirit_irq();
+ printf(" 3-3 read ok\n");
return bufsize;
}
}
-/* betzw - TODO: CCA should be reviewed (completely)! */
int SimpleSpirit1::channel_clear(void)
{
float rssi_value;
@@ -407,232 +492,228 @@
enable_spirit_irq();
/* Puts the SPIRIT1 in its previous state */
- if(spirit_state == OFF) {
+ if(spirit_state==OFF) {
off();
-
#ifndef NDEBUG
#ifdef USE_STANDBY_STATE
if(SPIRIT1_STATUS() != SPIRIT1_STATE_STANDBY) {
- debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, last_state>>1);
- }
-#else // !USE_STANDBY_STATE
- if(SPIRIT1_STATUS() != SPIRIT1_STATE_READY) {
- debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, last_state>>1);
- }
-#endif // !USE_STANDBY_STATE
-#endif // NDEBUG
- } else { // spirit_state != OFF
- disable_spirit_irq();
+#else
+ if(SPIRIT1_STATUS() != SPIRIT1_STATE_READY) {
+#endif
+ debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, last_state>>1);
+ }
+#endif
+ } else {
+ disable_spirit_irq();
+
+ set_ready_state();
- set_ready_state();
+ cmd_strobe(SPIRIT1_STROBE_RX);
+ BUSYWAIT_UNTIL(SPIRIT1_STATUS() == SPIRIT1_STATE_RX, STATE_TIMEOUT);
+ if((last_state & SPIRIT1_STATE_STATEBITS) != SPIRIT1_STATE_RX) {
+ error("\r\nSpirit1: (#2) failed to enter rx (%x) => retry\r\n", last_state>>1);
+ }
- cmd_strobe(SPIRIT1_STROBE_RX);
- BUSYWAIT_UNTIL(SPIRIT1_STATUS() == SPIRIT1_STATE_RX, STATE_TIMEOUT);
- if((last_state & SPIRIT1_STATE_STATEBITS) != SPIRIT1_STATE_RX) {
- error("\r\nSpirit1: (#2) failed to enter rx (%x) => retry\r\n", last_state>>1);
+ enable_spirit_irq();
+
+#ifndef NDEBUG
+ if(SPIRIT1_STATUS() != SPIRIT1_STATE_RX) {
+ debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, last_state>>1);
+ }
+#endif
}
- enable_spirit_irq();
+ /* Checks the RSSI value with the threshold */
+ if(rssi_value<CCA_THRESHOLD) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
-#ifndef NDEBUG
- if(SPIRIT1_STATUS() != SPIRIT1_STATE_RX) {
- debug("\r\nAssert failed in: %s (%d): state=%x\r\n", __func__, __LINE__, last_state>>1);
- }
-#endif
+ int SimpleSpirit1::get_pending_packet(void)
+ {
+ return !IS_RXBUF_EMPTY();
}
- /* If the received signal strength is above a certain level the medium is considered busy! */
- /* Compare RSSI value with threshold */
- if(rssi_value < CCA_THRESHOLD) {
- return 0; // idle
- } else {
- return 1; // busy
- }
-}
+ /** Spirit Irq Callback **/
+ /* betzw - TODO: use threaded interrupt handling when `MBED_CONF_RTOS_PRESENT` is defined (see `atmel-rf-driver`) */
+ void SimpleSpirit1::IrqHandler() {
+ st_lib_spirit_irqs x_irq_status;
-int SimpleSpirit1::get_pending_packet(void)
-{
- return !IS_RXBUF_EMPTY();
-}
+ /* get interrupt source from radio */
+ irq_get_status(&x_irq_status);
-/** Spirit Irq Callback **/
-/* betzw - TODO: use threaded interrupt handling when `MBED_CONF_RTOS_PRESENT` is defined (see `atmel-rf-driver`) */
-void SimpleSpirit1::IrqHandler() {
- st_lib_spirit_irqs x_irq_status;
-
- /* get interrupt source from radio */
- irq_get_status(&x_irq_status);
-
- /* The IRQ_TX_DATA_SENT notifies the packet has been sent. Puts the SPIRIT1 in RX */
- if(x_irq_status.IRQ_TX_DATA_SENT) { /* betzw - NOTE: MUST be handled before `IRQ_RX_DATA_READY` for Nanostack integration!
+ /* The IRQ_TX_DATA_SENT notifies the packet has been sent. Puts the SPIRIT1 in RX */
+ if(x_irq_status.IRQ_TX_DATA_SENT) { /* betzw - NOTE: MUST be handled before `IRQ_RX_DATA_READY` for Nanostack integration!
Logically, Nanostack only expects the "DONE" after "SUCCESS" (if it gets
DONE before SUCCESS, it assumes you're not going to bother to send SUCCESS).
- */
+ */
#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug_if(!((*tmp) & IRQ_TX_DATA_SENT_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
- debug_if(tx_fifo_remaining != 0, "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug_if(!((*tmp) & IRQ_TX_DATA_SENT_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+ debug_if(tx_fifo_remaining != 0, "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+#endif
+
+ if(_spirit_tx_started) {
+ _spirit_tx_started = false;
+
+ /* call user callback */
+ if(_current_irq_callback) {
+ _current_irq_callback(TX_DONE);
+ }
+ }
+
+ /* Disable handling of other TX flags */
+ x_irq_status.IRQ_TX_FIFO_ALMOST_EMPTY = S_RESET;
+ tx_fifo_buffer = NULL;
+ }
+
+#ifndef RX_FIFO_THR_WA
+ /* The IRQ_TX_FIFO_ALMOST_EMPTY notifies an nearly empty TX fifo */
+ if(x_irq_status.IRQ_TX_FIFO_ALMOST_EMPTY) {
+#ifdef DEBUG_IRQ
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug_if(!((*tmp) & IRQ_TX_FIFO_ALMOST_EMPTY_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+ debug_if(!_spirit_tx_started, "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+ debug_if(tx_fifo_buffer == NULL, "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
#endif
- if(_spirit_tx_started) {
- _spirit_tx_started = false;
+ int8_t fifo_available = SPIRIT_MAX_FIFO_LEN/2; // fill-up half fifo
+ int8_t to_send = (tx_fifo_remaining > fifo_available) ? fifo_available : tx_fifo_remaining;
+
+ tx_fifo_remaining -= to_send;
+
+ /* Fill FIFO Buffer */
+ if(to_send > 0) {
+ spi_write_linear_fifo(to_send, (uint8_t*)&tx_fifo_buffer[tx_buffer_pos]);
+ }
+ tx_buffer_pos += to_send;
+ }
+#endif // !RX_FIFO_THR_WA
+
+ /* TX FIFO underflow/overflow error */
+ if(x_irq_status.IRQ_TX_FIFO_ERROR) {
+#ifdef DEBUG_IRQ
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
+ debug_if(!((*tmp) & IRQ_TX_FIFO_ERROR_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+#endif
+ if(_spirit_tx_started) {
+ _spirit_tx_started = false;
+ /* call user callback */
+ if(_current_irq_callback) {
+ _current_irq_callback(TX_ERR);
+ }
+ }
+
+ /* reset data still to be sent */
+ tx_fifo_remaining = 0;
+ }
- /* call user callback */
- if(_current_irq_callback) {
- _current_irq_callback(TX_DONE);
+ /* The IRQ_RX_DATA_READY notifies a new packet arrived */
+ if(x_irq_status.IRQ_RX_DATA_READY) {
+#ifdef DEBUG_IRQ
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug_if(!((*tmp) & IRQ_RX_DATA_READY_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+#endif
+
+ if(!_is_receiving) { // spurious irq?!? (betzw: see comments on macro 'RX_FIFO_THR_WA'!)
+#ifdef HEAVY_DEBUG
+ debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
+#endif
+ } else {
+ _is_receiving = false; // Finished receiving
+ stop_rx_timeout();
+
+ spirit_rx_len = pkt_basic_get_received_pkt_length();
+
+#ifdef DEBUG_IRQ
+ debug_if(!(spirit_rx_len <= MAX_PACKET_LEN), "\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
+#endif
+
+ if(spirit_rx_len <= MAX_PACKET_LEN) {
+ uint8_t to_receive = spirit_rx_len - _spirit_rx_pos;
+ if(to_receive > 0) {
+ spi_read_linear_fifo(to_receive, &spirit_rx_buf[_spirit_rx_pos]);
+ _spirit_rx_pos += to_receive;
+ }
+ }
+
+ cmd_strobe(SPIRIT1_STROBE_FRX);
+
+ last_rssi = qi_get_rssi(); //MGR
+ last_sqi = qi_get_sqi(); //MGR
+
+ /* call user callback */
+ if((_spirit_rx_pos == spirit_rx_len) && _current_irq_callback) {
+ _current_irq_callback(RX_DONE);
+ }
+
+ /* Disable handling of other RX flags */
+ x_irq_status.IRQ_RX_FIFO_ALMOST_FULL = S_RESET;
}
}
- /* Disable handling of other TX flags */
- x_irq_status.IRQ_TX_FIFO_ALMOST_EMPTY = S_RESET;
- tx_fifo_buffer = NULL;
- }
-
#ifndef RX_FIFO_THR_WA
- /* The IRQ_TX_FIFO_ALMOST_EMPTY notifies an nearly empty TX fifo */
- if(x_irq_status.IRQ_TX_FIFO_ALMOST_EMPTY) {
+ /* RX FIFO almost full */
+ if(x_irq_status.IRQ_RX_FIFO_ALMOST_FULL) {
+#ifdef DEBUG_IRQ
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug_if(!((*tmp) & IRQ_RX_FIFO_ALMOST_FULL_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+#endif
+ if(!_is_receiving) { // spurious irq?!?
#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug_if(!((*tmp) & IRQ_TX_FIFO_ALMOST_EMPTY_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
- debug_if(!_spirit_tx_started, "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
- debug_if(tx_fifo_buffer == NULL, "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+ debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
#endif
-
- int8_t fifo_available = SPIRIT_MAX_FIFO_LEN/2; // fill-up half fifo
- int8_t to_send = (tx_fifo_remaining > fifo_available) ? fifo_available : tx_fifo_remaining;
-
- tx_fifo_remaining -= to_send;
-
- /* Fill FIFO Buffer */
- if(to_send > 0) {
- spi_write_linear_fifo(to_send, (uint8_t*)&tx_fifo_buffer[tx_buffer_pos]);
+ } else {
+ uint8_t fifo_available = linear_fifo_read_num_elements_rx_fifo();
+ if((fifo_available + _spirit_rx_pos) <= MAX_PACKET_LEN) {
+ spi_read_linear_fifo(fifo_available, &spirit_rx_buf[_spirit_rx_pos]);
+ _spirit_rx_pos += fifo_available;
+ } else {
+#ifdef DEBUG_IRQ
+ debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
+#endif
+ }
+ }
}
- tx_buffer_pos += to_send;
- }
#endif // !RX_FIFO_THR_WA
- /* TX FIFO underflow/overflow error */
- if(x_irq_status.IRQ_TX_FIFO_ERROR) {
+ /* Reception errors */
+ if((x_irq_status.IRQ_RX_FIFO_ERROR) || (x_irq_status.IRQ_RX_DATA_DISC)) {
#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
- debug_if(!((*tmp) & IRQ_TX_FIFO_ERROR_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
+ debug_if(!((*tmp) & (IRQ_RX_FIFO_ERROR_MASK | IRQ_RX_DATA_DISC_MASK)), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
#endif
- if(_spirit_tx_started) {
- _spirit_tx_started = false;
- /* call user callback */
- if(_current_irq_callback) {
- _current_irq_callback(TX_ERR);
+ rx_timeout_handler();
+ if(_spirit_tx_started) {
+ _spirit_tx_started = false;
+ /* call user callback */
+ if(_current_irq_callback) {
+ _current_irq_callback(TX_ERR);
+ }
}
}
- /* reset data still to be sent */
- tx_fifo_remaining = 0;
- }
-
- /* The IRQ_RX_DATA_READY notifies a new packet arrived */
- if(x_irq_status.IRQ_RX_DATA_READY) {
+ /* The IRQ_VALID_SYNC is used to notify a new packet is coming */
+ if(x_irq_status.IRQ_VALID_SYNC) {
#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug_if(!((*tmp) & IRQ_RX_DATA_READY_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
-#endif
-
- if(!_is_receiving) { // spurious irq?!? (betzw: see comments on macro 'RX_FIFO_THR_WA'!)
-#ifdef HEAVY_DEBUG
- debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
-#endif
- } else {
- _is_receiving = false; // Finished receiving
- stop_rx_timeout();
-
- spirit_rx_len = pkt_basic_get_received_pkt_length();
-
-#ifdef DEBUG_IRQ
- debug_if(!(spirit_rx_len <= MAX_PACKET_LEN), "\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
+ uint32_t *tmp = (uint32_t*)&x_irq_status;
+ debug_if(!((*tmp) & IRQ_VALID_SYNC_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
#endif
-
- if(spirit_rx_len <= MAX_PACKET_LEN) {
- uint8_t to_receive = spirit_rx_len - _spirit_rx_pos;
- if(to_receive > 0) {
- spi_read_linear_fifo(to_receive, &spirit_rx_buf[_spirit_rx_pos]);
- _spirit_rx_pos += to_receive;
- }
- }
-
- cmd_strobe(SPIRIT1_STROBE_FRX);
-
- last_rssi = qi_get_rssi(); //MGR
- last_sqi = qi_get_sqi(); //MGR
-
- /* call user callback */
- if((_spirit_rx_pos == spirit_rx_len) && _current_irq_callback) {
- _current_irq_callback(RX_DONE);
- }
-
- /* Disable handling of other RX flags */
- x_irq_status.IRQ_RX_FIFO_ALMOST_FULL = S_RESET;
- }
- }
-
-#ifndef RX_FIFO_THR_WA
- /* RX FIFO almost full */
- if(x_irq_status.IRQ_RX_FIFO_ALMOST_FULL) {
-#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug_if(!((*tmp) & IRQ_RX_FIFO_ALMOST_FULL_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
-#endif
- if(!_is_receiving) { // spurious irq?!?
-#ifdef DEBUG_IRQ
- debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
-#endif
- } else {
- uint8_t fifo_available = linear_fifo_read_num_elements_rx_fifo();
- if((fifo_available + _spirit_rx_pos) <= MAX_PACKET_LEN) {
- spi_read_linear_fifo(fifo_available, &spirit_rx_buf[_spirit_rx_pos]);
- _spirit_rx_pos += fifo_available;
- } else {
+ /* betzw - NOTE: there is a race condition between Spirit1 receiving packets and
+ * the MCU trying to send a packet, which gets resolved in favor of
+ * sending.
+ */
+ if(_spirit_tx_started) {
#ifdef DEBUG_IRQ
debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
#endif
- }
- }
- }
-#endif // !RX_FIFO_THR_WA
-
- /* Reception errors */
- if((x_irq_status.IRQ_RX_FIFO_ERROR) || (x_irq_status.IRQ_RX_DATA_DISC)) {
-#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
- debug_if(!((*tmp) & (IRQ_RX_FIFO_ERROR_MASK | IRQ_RX_DATA_DISC_MASK)), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
-#endif
- rx_timeout_handler();
- if(_spirit_tx_started) {
- _spirit_tx_started = false;
- /* call user callback */
- if(_current_irq_callback) {
- _current_irq_callback(TX_ERR);
+ } else {
+ _is_receiving = true;
+ start_rx_timeout();
}
}
}
-
- /* The IRQ_VALID_SYNC is used to notify a new packet is coming */
- if(x_irq_status.IRQ_VALID_SYNC) {
-#ifdef DEBUG_IRQ
- uint32_t *tmp = (uint32_t*)&x_irq_status;
- debug_if(!((*tmp) & IRQ_VALID_SYNC_MASK), "\r\nAssert failed in: %s (%d)\r\n", __func__, __LINE__);
-#endif
- /* betzw - NOTE: there is a race condition between Spirit1 receiving packets and
- * the MCU trying to send a packet, which gets resolved in favor of
- * sending.
- */
- if(_spirit_tx_started) {
-#ifdef DEBUG_IRQ
- debug("\r\n%s (%d): irq=%x\r\n", __func__, __LINE__, *tmp);
-#endif
- } else {
- _is_receiving = true;
- start_rx_timeout();
- }
- }
-}
--- a/source/libs/Contiki_STM32_Library/spirit1.h Fri Feb 02 14:13:24 2018 +0100 +++ b/source/libs/Contiki_STM32_Library/spirit1.h Wed Mar 21 05:06:08 2018 +0000 @@ -102,7 +102,7 @@ #define INFINITE_TIMEOUT 0.0 #ifdef USE_SPIRIT1_433MHz -#define BASE_FREQUENCY 433.0e6 +#define BASE_FREQUENCY 433.4e6 #endif #ifdef USE_SPIRIT1_868MHz @@ -151,11 +151,56 @@ #define POWER_DBM 11.6 -#define CHANNEL_SPACE 100e3 + + +/* 송,수신 성공 셋팅 값 */ +//------------915Mhz------------ +#ifdef USE_SPIRIT1_915MHz +#define CHANNEL_SPACE 20e3 //HJM : SPIRIT_Radio.h 참고, 디폴트 셋팅 값 #define FREQ_DEVIATION 127e3 #define BANDWIDTH 540.0e3 #define MODULATION_SELECT GFSK_BT1 #define DATARATE 250000 +#endif //USE_SPIRIT1_915MHz +//------------915Mhz------------ + + +//------------433Mhz------------ +//작동 되는 셋팅 recv +//#ifdef USE_SPIRIT1_433MHz +//#define CHANNEL_SPACE 20e3 //해봄 +//#define FREQ_DEVIATION 127e3 //해봄 +//#define BANDWIDTH 540.0e3 //해봄 +//#define MODULATION_SELECT GFSK_BT1 +//#define DATARATE 250000 +////#define DATARATE 38400 +//#endif //USE_SPIRIT1_433MHz +//------------433Mhz------------ + +//------------433Mhz------------ +//작동 되는 셋팅 +#ifdef USE_SPIRIT1_433MHz +#define CHANNEL_SPACE 20e3 //해봄 +//#define FREQ_DEVIATION 127e3 //recv +#define FREQ_DEVIATION 50e3 //send +#define BANDWIDTH 50e3 +#define MODULATION_SELECT GFSK_BT1 +#define DATARATE 250000 +//#define DATARATE 38400 +#endif //USE_SPIRIT1_433MHz +//------------433Mhz------------ + + +//#define CHANNEL_SPACE 100e3 +//#define FREQ_DEVIATION 127e3 +//#define BANDWIDTH 540.0e3 +////#define MODULATION_SELECT GFSK_BT1 +//#define MODULATION_SELECT FSK +//#define DATARATE 250000 + + + + #define XTAL_OFFSET_PPM 0 #define SYNC_WORD 0x88888888 #define LENGTH_WIDTH 8 // betzw - NOTE: only 255 bytes for payload!!!
--- a/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Management.c Fri Feb 02 14:13:24 2018 +0100
+++ b/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Management.c Wed Mar 21 05:06:08 2018 +0000
@@ -211,12 +211,15 @@
SpiritCalibrationVco(S_ENABLE);
SpiritRefreshStatus();
+ printf("test 9-3 g_xStatus.MC_STATE : [0x%02X] \n", g_xStatus.MC_STATE);
if(g_xStatus.MC_STATE == MC_STATE_STANDBY)
{
cStandby = 1;
SpiritCmdStrobeReady();
+ printf("test 9-3 1 g_xStatus.MC_STATE : [0x%02X] \n", g_xStatus.MC_STATE);
do{
SpiritRefreshStatus();
+ printf("test 9-3 2 g_xStatus.MC_STATE : [0x%02X]\n", g_xStatus.MC_STATE);
if(g_xStatus.MC_STATE == 0x13)
{
return 1;
@@ -225,9 +228,10 @@
}
SpiritCmdStrobeLockTx();
-
+ printf("test 9-4 g_xStatus.MC_STATE : [0x%02X] \n", g_xStatus.MC_STATE);
do{
SpiritRefreshStatus();
+ printf("test 9-4 1 g_xStatus.MC_STATE : [0x%02X] \n", g_xStatus.MC_STATE);
if(g_xStatus.MC_STATE == 0x13)
{
return 1;
@@ -237,7 +241,7 @@
s_cVcoWordTx = SpiritCalibrationGetVcoCalData();
SpiritCmdStrobeReady();
-
+ printf("test 9-5 g_xStatus.MC_STATE : [0x%02X] \n", g_xStatus.MC_STATE);
do{
SpiritRefreshStatus();
}while(g_xStatus.MC_STATE != MC_STATE_READY);
--- a/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Radio.c Fri Feb 02 14:13:24 2018 +0100
+++ b/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Radio.c Wed Mar 21 05:06:08 2018 +0000
@@ -193,12 +193,15 @@
uint8_t drM, drE, FdevM, FdevE, bwM, bwE;
/* Workaround for Vtune */
+ printf("test 9-1\n");
uint8_t value = 0xA0; SpiritSpiWriteRegisters(0x9F, 1, &value);
/* Calculates the offset respect to RF frequency and according to xtal_ppm parameter: (xtal_ppm*FBase)/10^6 */
+ printf("test 9-2\n");
FOffsetTmp = (int32_t)(((float)pxSRadioInitStruct->nXtalOffsetPpm*pxSRadioInitStruct->lFrequencyBase)/PPM_FACTOR);
/* Check the parameters */
+ printf("test 9-3\n");
s_assert_param(IS_FREQUENCY_BAND(pxSRadioInitStruct->lFrequencyBase));
s_assert_param(IS_MODULATION_SELECTED(pxSRadioInitStruct->xModulationSelect));
s_assert_param(IS_DATARATE(pxSRadioInitStruct->lDatarate));
@@ -207,6 +210,7 @@
s_assert_param(IS_F_DEV(pxSRadioInitStruct->lFreqDev,s_lXtalFrequency));
/* Disable the digital, ADC, SMPS reference clock divider if fXO>24MHz or fXO<26MHz */
+ printf("test 9-4\n");
SpiritSpiCommandStrobes(COMMAND_STANDBY);
do{
/* Delay for state transition */
@@ -214,6 +218,7 @@
/* Reads the MC_STATUS register */
SpiritRefreshStatus();
+ printf("test 9-4 g_xStatus.MC_STATE : [0x%02X]\n", g_xStatus.MC_STATE);
}while(g_xStatus.MC_STATE!=MC_STATE_STANDBY);
if(s_lXtalFrequency<DOUBLE_XTAL_THR)
@@ -228,6 +233,7 @@
}
/* Goes in READY state */
+ printf("test 9-5\n");
SpiritSpiCommandStrobes(COMMAND_READY);
do{
/* Delay for state transition */
@@ -235,38 +241,47 @@
/* Reads the MC_STATUS register */
SpiritRefreshStatus();
+ printf("test 9-5 g_xStatus.MC_STATE : [%d]\n", g_xStatus.MC_STATE);
}while(g_xStatus.MC_STATE!=MC_STATE_READY);
/* Calculates the FC_OFFSET parameter and cast as signed int: FOffsetTmp = (Fxtal/2^18)*FC_OFFSET */
+ printf("test 9-6\n");
xtalOffsetFactor = (int16_t)(((float)FOffsetTmp*FBASE_DIVIDER)/s_lXtalFrequency);
anaRadioRegArray[2] = (uint8_t)((((uint16_t)xtalOffsetFactor)>>8)&0x0F);
anaRadioRegArray[3] = (uint8_t)(xtalOffsetFactor);
/* Calculates the channel space factor */
+ printf("test 9-7\n");
anaRadioRegArray[0] =((uint32_t)pxSRadioInitStruct->nChannelSpace<<9)/(s_lXtalFrequency>>6)+1;
SpiritManagementWaTRxFcMem(pxSRadioInitStruct->lFrequencyBase);
/* 2nd order DEM algorithm enabling */
+ printf("test 9-8\n");
uint8_t tmpreg; SpiritSpiReadRegisters(0xA3, 1, &tmpreg);
tmpreg &= ~0x02; SpiritSpiWriteRegisters(0xA3, 1, &tmpreg);
/* Check the channel center frequency is in one of the possible range */
+ printf("test 9-9\n");
s_assert_param(IS_FREQUENCY_BAND((pxSRadioInitStruct->lFrequencyBase + ((xtalOffsetFactor*s_lXtalFrequency)/FBASE_DIVIDER) + pxSRadioInitStruct->nChannelSpace * pxSRadioInitStruct->cChannelNumber)));
/* Calculates the datarate mantissa and exponent */
+ printf("test 9-10\n");
SpiritRadioSearchDatarateME(pxSRadioInitStruct->lDatarate, &drM, &drE);
digRadioRegArray[0] = (uint8_t)(drM);
digRadioRegArray[1] = (uint8_t)(0x00 | pxSRadioInitStruct->xModulationSelect |drE);
/* Read the fdev register to preserve the clock recovery algo bit */
+ printf("test 9-11\n");
SpiritSpiReadRegisters(0x1C, 1, &tmpreg);
/* Calculates the frequency deviation mantissa and exponent */
+ printf("test 9-12\n");
SpiritRadioSearchFreqDevME(pxSRadioInitStruct->lFreqDev, &FdevM, &FdevE);
digRadioRegArray[2] = (uint8_t)((FdevE<<4) | (tmpreg&0x08) | FdevM);
/* Calculates the channel filter mantissa and exponent */
+ printf("test 9-13\n");
SpiritRadioSearchChannelBwME(pxSRadioInitStruct->lBandwidth, &bwM, &bwE);
digRadioRegArray[3] = (uint8_t)((bwM<<4) | bwE);
@@ -316,6 +331,7 @@
/* Sets Xtal configuration */
+ printf("test 9-14\n");
if(s_lXtalFrequency>DOUBLE_XTAL_THR)
{
SpiritRadioSetXtalFlag(XTAL_FLAG((s_lXtalFrequency/2)));
@@ -326,18 +342,23 @@
}
/* Sets the channel number in the corresponding register */
+ printf("test 9-15\n");
SpiritSpiWriteRegisters(CHNUM_BASE, 1, &pxSRadioInitStruct->cChannelNumber);
/* Configures the Analog Radio registers */
+ printf("test 9-16\n");
SpiritSpiWriteRegisters(CHSPACE_BASE, 4, anaRadioRegArray);
/* Configures the Digital Radio registers */
+ printf("test 9-17\n");
g_xStatus = SpiritSpiWriteRegisters(MOD1_BASE, 4, digRadioRegArray);
/* Enable the freeze option of the AFC on the SYNC word */
+ printf("test 9-18\n");
SpiritRadioAFCFreezeOnSync(S_ENABLE);
/* Set the IQC correction optimal value */
+ printf("test 9-19\n");
anaRadioRegArray[0]=0x80;
anaRadioRegArray[1]=0xE3;
g_xStatus = SpiritSpiWriteRegisters(0x99, 2, anaRadioRegArray);
@@ -3034,12 +3055,32 @@
* @param void.
* @retval None.
*/
+
+
SpiritFunctionalState SpiritRadioGetRefDiv(void)
{
uint8_t tempRegValue;
g_xStatus = SpiritSpiReadRegisters(SYNTH_CONFIG1_BASE, 1, &tempRegValue);
+ //값을 읽어 왔을때, Reserved 영역의 니블 값이 1011 임.
+ int iMask = 1;
+
+ printf("\n !!!!!!!!!!!\n");
+ for (int i = 8; i > 0; --i)
+ {
+ //값 찍기
+ printf("%d",(tempRegValue & (iMask << i-1))?1:0);
+ }
+ printf("\n !!!!!!!!!!!\n");
+
+
+
+
+
+
+
+
if(((tempRegValue>>7)&0x1))
{
return S_ENABLE;
--- a/source/radio_spi.cpp Fri Feb 02 14:13:24 2018 +0100
+++ b/source/radio_spi.cpp Wed Mar 21 05:06:08 2018 +0000
@@ -38,7 +38,6 @@
/* Includes ------------------------------------------------------------------*/
#include "radio_spi.h"
-
#include "SimpleSpirit1.h"
@@ -147,7 +146,7 @@
/* Writes the registers according to the number of bytes */
for (int index = 0; index < cNbBytes; index++)
{
- _spi.write(pcBuffer[index]);
+ _spi.write(pcBuffer[index]);
}
/* Puts the SPI chip select high to end the transaction */
--- a/stm-spirit1-rf-driver/SimpleSpirit1.h Fri Feb 02 14:13:24 2018 +0100
+++ b/stm-spirit1-rf-driver/SimpleSpirit1.h Wed Mar 21 05:06:08 2018 +0000
@@ -158,7 +158,8 @@
unsigned int _nr_of_irq_disables;
/** Low Level Instance Methods **/
- void disable_spirit_irq(void) {
+ void disable_spirit_irq(void)
+ {
_irq.disable_irq();
_nr_of_irq_disables++;
#ifndef NDEBUG
