|
Arduino LMIC 6.0.1
Arduino LoRaWAN(r) MAC in C
|
Radio driver for radios based on SX1272/SX1276 chips. More...
Functions | |
| void | os_radio_v2 (u1_t mode, osjob_t *pJob) |
| Initiate a radio operation. | |
| int | radio_init () |
| Initialize radio at system startup. | |
| void | radio_irq_handler (u1_t dio) |
| legacy radio IRQ handler | |
| void | radio_irq_handler_v2 (u1_t dio, ostime_t now) |
| Radio IRQ handler. | |
| void | radio_monitor_rssi (ostime_t nTicks, oslmic_radio_rssi_t *pRssi) |
| Measure the current broadband RSSI for the current channel. | |
| u1_t | radio_rand1 () |
| Generate an 8-bit uniformly-distributed integer. | |
Radio driver for radios based on SX1272/SX1276 chips.
| void os_radio_v2 | ( | u1_t | mode, |
| osjob_t * | pJob ) |
Initiate a radio operation.
| mode | [in] Selects the operation to be performed. |
| pJob | [inout] Job to be scheduled when operation completes. |
The requested radio operation is initiated. Some operations complete immediately; others require hardware to do work, and don't complete until an interrupt occurs. In that case, pJob is scheduled. Because the interrupt may occur right away, it's important that the caller initialize pJob before calling this routine.
References LMIC_RADIO_EV_NONE, LMIC_RADIO_EV_RXSTART, LMIC_RADIO_EV_TXSTART, RADIO_RST, RADIO_RX, RADIO_RXON, RADIO_RXON_C, RADIO_TX, and RADIO_TX_AT.
| int radio_init | ( | void | ) |
Initialize radio at system startup.
This procedure is called during initialization by the os_init() routine. It does a hardware reset of the radio, checks the version and confirms that we're operating a suitable chip, and gets a random seed from wideband noise rssi. It then puts the radio to sleep.
Preconditions must be observed, or you'll get hangs during initialization.
Generally, all these are satisfied by a call to lmic_hal_init_with_pinmap().
| void radio_irq_handler | ( | u1_t | dio | ) |
legacy radio IRQ handler
| [in] | dio | is the image of the DIO0..n pins observed by the primary ISR. |
The HAL is responsible for detecting transitions on the SX127x DIO pins, and scheduling this routine. This routine must run as part of os_runloop_once(); it must not be called directly from a primary ISR.
This routine is for legacy use only; it is for use by older HALs that cannot capture the interrupt time in the primary ISR.
References radio_irq_handler_v2().
| void radio_irq_handler_v2 | ( | u1_t | dio, |
| ostime_t | now ) |
Radio IRQ handler.
| [in] | dio | is the image of the DIO0..n pins observed by the primary ISR. |
| [in] | now | is the HALs best estimate of the time of teh interrupt. |
The HAL is responsible for detecting transitions on the SX127x DIO pins, and scheduling this routine. This routine must run as part of os_runloop_once(); it must not be called directly from a primary ISR.
The radio registers are interrogated, and the interrupt is processed. The radio is then put back to sleep, and the background is scheduled.
References LMIC_RADIO_EV_NONE, LMIC_RADIO_EV_RXDONE, LMIC_RADIO_EV_RXTIMEOUT, LMIC_RADIO_EV_RXUNKNOWN, LMIC_RADIO_EV_TXDONE, and LMIC_RADIO_EV_TXUNKNOWN.
Referenced by radio_irq_handler().
| void radio_monitor_rssi | ( | ostime_t | nTicks, |
| oslmic_radio_rssi_t * | pRssi ) |
Measure the current broadband RSSI for the current channel.
This funtion monitors RSSI for specified number of ostime_t ticks, and return statistics. It first puts the radio into RX continuous mode, waits long enough for the oscillators to start and the PLL to lock, and then measures for the specified period of time. The radio is then returned to idle.
| nTicks | How long to monitor |
| pRssi | pointer to structure to fill in with RSSI data. |
| u1_t radio_rand1 | ( | void | ) |
Generate an 8-bit uniformly-distributed integer.
If there are any bytes remaining in the random buffer, the next byte is returned. Otherwise, sixteen new random bytes are generated, and the first is returned.
References os_wlsbf4().