lorawan,lora: fix C++ compilation/linking errors

The usual suspects: missing extern and assignments from void *.

Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
This commit is contained in:
Rihards Skuja 2020-10-13 16:56:05 +03:00 committed by Carles Cufí
parent c22e34397e
commit 576b3583ee
2 changed files with 16 additions and 4 deletions

View file

@ -103,7 +103,8 @@ struct lora_driver_api {
static inline int lora_config(const struct device *dev,
struct lora_modem_config *config)
{
const struct lora_driver_api *api = dev->api;
const struct lora_driver_api *api =
(const struct lora_driver_api *)dev->api;
return api->config(dev, config);
}
@ -121,7 +122,8 @@ static inline int lora_config(const struct device *dev,
static inline int lora_send(const struct device *dev,
uint8_t *data, uint32_t data_len)
{
const struct lora_driver_api *api = dev->api;
const struct lora_driver_api *api =
(const struct lora_driver_api *)dev->api;
return api->send(dev, data, data_len);
}
@ -146,7 +148,8 @@ static inline int lora_recv(const struct device *dev, uint8_t *data,
uint8_t size,
k_timeout_t timeout, int16_t *rssi, int8_t *snr)
{
const struct lora_driver_api *api = dev->api;
const struct lora_driver_api *api =
(const struct lora_driver_api *)dev->api;
return api->recv(dev, data, size, timeout, rssi, snr);
}
@ -166,7 +169,8 @@ static inline int lora_recv(const struct device *dev, uint8_t *data,
static inline int lora_test_cw(const struct device *dev, uint32_t frequency,
int8_t tx_power, uint16_t duration)
{
const struct lora_driver_api *api = dev->api;
const struct lora_driver_api *api =
(const struct lora_driver_api *)dev->api;
if (!api->test_cw) {
return -ENOTSUP;

View file

@ -14,6 +14,10 @@
#include <device.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LoRaWAN class types.
*/
@ -183,4 +187,8 @@ void lorawan_enable_adr(bool enable);
*/
int lorawan_set_datarate(enum lorawan_datarate dr);
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_LORAWAN_LORAWAN_H_ */