Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nts1_iface.c: add aligned atrtribute to s_rx_event_decode_buf #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

boochow
Copy link

@boochow boochow commented Sep 13, 2020

Issue: The following sketch does not work.
In the message handler rx_value(), val->value causes system crash.
I suspected this is a memory alignment problem, and added __attribute__((aligned)) to s_rx_event_decode_buf in nts1_iface.c. Then it seems to work correctly.

#include <nts-1.h>

NTS1 nts1;

void rx_value(const nts1_rx_value_t *val) {
  Serial.print("req_id = ");
  Serial.println(val->req_id);
  Serial.print("value = ");
  Serial.println(val->value); // this line doesn't work!
}

void setup() {
  Serial.begin(9600);
  Serial.println("Start!");

  nts1.init(); 
  nts1.setValueEventHandler((nts1_value_event_handler) rx_value);
  nts1.reqOscCount();
}
void loop() {
  nts1.idle();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant