Lines Matching +full:rx +full:- +full:data +full:- +full:mode
5 * SPDX-License-Identifier: Apache-2.0
14 /* LoRaMac-node specific includes */
47 if (!device_is_ready(gpio->port)) { in __sx12xx_configure_pin()
48 LOG_ERR("GPIO device not ready %s", gpio->port->name); in __sx12xx_configure_pin()
49 return -ENODEV; in __sx12xx_configure_pin()
54 LOG_ERR("Cannot configure gpio %s %d: %d", gpio->port->name, in __sx12xx_configure_pin()
55 gpio->pin, err); in __sx12xx_configure_pin()
65 * @param data common sx12xx data struct
70 static inline bool modem_acquire(struct sx12xx_data *data) in modem_acquire() argument
72 return atomic_cas(&data->modem_usage, STATE_FREE, STATE_BUSY); in modem_acquire()
81 * @param data common sx12xx data struct
86 static bool modem_release(struct sx12xx_data *data) in modem_release() argument
89 if (!atomic_cas(&data->modem_usage, STATE_BUSY, STATE_CLEANUP)) { in modem_release()
92 /* Put radio back into sleep mode */ in modem_release()
95 data->operation_done = NULL; in modem_release()
96 atomic_clear(&data->modem_usage); in modem_release()
105 /* Receiving in asynchronous mode */ in sx12xx_ev_rx_done()
108 Radio.Rx(0); in sx12xx_ev_rx_done()
137 /* Copy received data to output buffer */ in sx12xx_ev_rx_done()
147 /* Put radio back into sleep mode */ in sx12xx_ev_rx_done()
152 /* Notify caller RX is complete */ in sx12xx_ev_rx_done()
178 /* Receiving in asynchronous mode */ in sx12xx_ev_rx_error()
181 Radio.Rx(0); in sx12xx_ev_rx_error()
190 k_poll_signal_raise(sig, -EIO); in sx12xx_ev_rx_error()
195 int sx12xx_lora_send(const struct device *dev, uint8_t *data, in sx12xx_lora_send() argument
208 return -EINVAL; in sx12xx_lora_send()
211 ret = sx12xx_lora_send_async(dev, data, data_len, &done); in sx12xx_lora_send()
241 int sx12xx_lora_send_async(const struct device *dev, uint8_t *data, in sx12xx_lora_send_async() argument
246 return -EBUSY; in sx12xx_lora_send_async()
254 Radio.Send(data, data_len); in sx12xx_lora_send_async()
259 int sx12xx_lora_recv(const struct device *dev, uint8_t *data, uint8_t size, in sx12xx_lora_recv() argument
271 return -EBUSY; in sx12xx_lora_recv()
277 /* Set data output location */ in sx12xx_lora_recv()
278 dev_data.rx_params.buf = data; in sx12xx_lora_recv()
284 Radio.Rx(0); in sx12xx_lora_recv()
290 * the RX callback is currently running. Wait until in sx12xx_lora_recv()
291 * the RX callback finishes and we get our packet. in sx12xx_lora_recv()
316 return -EINVAL; in sx12xx_lora_recv_async()
323 return -EBUSY; in sx12xx_lora_recv_async()
332 Radio.Rx(0); in sx12xx_lora_recv_async()
342 return -EBUSY; in sx12xx_lora_config()
345 Radio.SetChannel(config->frequency); in sx12xx_lora_config()
347 if (config->tx) { in sx12xx_lora_config()
351 Radio.SetTxConfig(MODEM_LORA, config->tx_power, 0, in sx12xx_lora_config()
352 config->bandwidth, config->datarate, in sx12xx_lora_config()
353 config->coding_rate, config->preamble_len, in sx12xx_lora_config()
354 false, true, 0, 0, config->iq_inverted, 4000); in sx12xx_lora_config()
357 Radio.SetRxConfig(MODEM_LORA, config->bandwidth, in sx12xx_lora_config()
358 config->datarate, config->coding_rate, in sx12xx_lora_config()
359 0, config->preamble_len, 10, false, 0, in sx12xx_lora_config()
360 false, 0, 0, config->iq_inverted, true); in sx12xx_lora_config()
363 Radio.SetPublicNetwork(config->public_network); in sx12xx_lora_config()
375 return -EBUSY; in sx12xx_lora_test_cw()
395 * Automatically place the radio into sleep mode upon boot. in sx12xx_init()
397 * will bring the radio out of sleep mode before it is used. The radio in sx12xx_init()
398 * is automatically placed back into sleep mode upon TX or RX in sx12xx_init()