Skip to content

Commit

Permalink
Merge branch 'lorawan-temp' of github.com:Mani-Sadhasivam/zephyr into…
Browse files Browse the repository at this point in the history
… feat_lorawan

Signed-off-by: Kuba Sanak <contact@kuba.fyi>
  • Loading branch information
KubaFYI committed Feb 21, 2020
2 parents 19c37b7 + b617e35 commit da06cb8
Showing 2 changed files with 7 additions and 13 deletions.
9 changes: 2 additions & 7 deletions drivers/lora/sx1276.c
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
#include <zephyr.h>

#include <sx1276/sx1276.h>
#include <timer.h>

#define LOG_LEVEL CONFIG_LORA_LOG_LEVEL
#include <logging/log.h>
@@ -34,6 +33,7 @@ static volatile uint32_t backup_reg[2] = { 0 ,0 };
static volatile uint32_t saved_time;

extern DioIrqHandler *DioIrq[];

struct counter_alarm_cfg alarm_cfg;

struct sx1276_dio {
@@ -127,7 +127,6 @@ void BoardCriticalSectionEnd(uint32_t *mask)
void counter_isr(struct device *counter_dev, u8_t chan_id,
u32_t ticks, void *user_data)
{
printk("ISR\n");
TimerIrqHandler();
}

@@ -147,20 +146,17 @@ uint32_t RtcGetTimerValue(void)

uint32_t RtcGetTimerElapsedTime(void)
{
LOG_INF("elapsed: %d\n", (uint32_t)(counter_read(dev_data.counter)));
return (uint32_t)(counter_read(dev_data.counter) - saved_time);
}

u32_t RtcGetMinimumTimeout(void)
{
/* TODO: Get this value from counter driver */
return 2;
return 1;
}

void RtcSetAlarm(uint32_t timeout)
{
LOG_INF("timeout: %d\n", timeout);

alarm_cfg.flags = 0;
alarm_cfg.ticks = timeout;
alarm_cfg.callback = counter_isr;
@@ -171,7 +167,6 @@ void RtcSetAlarm(uint32_t timeout)

uint32_t RtcSetTimerContext(void)
{
// saved_time = counter_read(dev_data.counter);
counter_get_value(dev_data.counter, &saved_time);

return (uint32_t)saved_time;
11 changes: 5 additions & 6 deletions subsys/lorawan/lorawan.c
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ void McpsConfirm(McpsConfirm_t *mcpsConfirm)
{
if (mcpsConfirm->Status != LORAMAC_EVENT_INFO_STATUS_OK) {
LOG_ERR("McpsRequest failed : %s",
log_strdup(to_status_str[mcpsConfirm->Status]));
log_strdup(to_event_info_status_str[mcpsConfirm->Status]));
} else {
LOG_DBG("McpsRequest success!");
}
@@ -115,7 +115,7 @@ void McpsIndication(McpsIndication_t *mcpsIndication)
{
if (mcpsIndication->Status != LORAMAC_EVENT_INFO_STATUS_OK) {
LOG_ERR("McpsIndication failed : %s",
log_strdup(to_status_str[mcpsIndication->Status]));
log_strdup(to_event_info_status_str[mcpsIndication->Status]));
return;
}

@@ -135,7 +135,7 @@ void MlmeConfirm( MlmeConfirm_t *mlmeConfirm )

if (mlmeConfirm->Status != LORAMAC_EVENT_INFO_STATUS_OK) {
LOG_ERR("McpsIndication failed : %s",
log_strdup(to_status_str[mlmeConfirm->Status]));
log_strdup(to_event_info_status_str[mlmeConfirm->Status]));
return;
}

@@ -324,11 +324,10 @@ void lorawan_spinner(void *unused1, void *unused2, void *unused3)
ARG_UNUSED(unused1);
ARG_UNUSED(unused2);
ARG_UNUSED(unused3);

int i=0,j=0;

while (1) {
LoRaMacProcess();
k_sleep(1);
k_sleep(50);
}

}

0 comments on commit da06cb8

Please sign in to comment.