Add send_str
This commit is contained in:
parent
56705b840b
commit
05fe5d53f4
|
@ -104,12 +104,17 @@ word Mrf24j::address16_read(void) {
|
||||||
return a16h << 8 | read_short(MRF_SADRL);
|
return a16h << 8 | read_short(MRF_SADRL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Mrf24j::send_str(word dest16, char * data) {
|
||||||
|
byte len = strlen(data); // get the length of the char* array
|
||||||
|
send(dest16, data, len);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple send 16, with acks, not much of anything.. assumes src16 and local pan only.
|
* Simple send 16, with acks, not much of anything.. assumes src16 and local pan only.
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
void Mrf24j::send16(word dest16, char * data) {
|
void Mrf24j::send(word dest16, char * data, int len) {
|
||||||
byte len = strlen(data); // get the length of the char* array
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
write_long(i++, bytes_MHR); // header length
|
write_long(i++, bytes_MHR); // header length
|
||||||
// +ignoreBytes is because some module seems to ignore 2 bytes after the header?!.
|
// +ignoreBytes is because some module seems to ignore 2 bytes after the header?!.
|
||||||
|
|
|
@ -227,7 +227,8 @@ class Mrf24j
|
||||||
*/
|
*/
|
||||||
void set_palna(boolean enabled);
|
void set_palna(boolean enabled);
|
||||||
|
|
||||||
void send16(word dest16, char * data);
|
void send(word dest16, char * data, int len);
|
||||||
|
void send_str(word dest16, char * data);
|
||||||
|
|
||||||
void interrupt_handler(void);
|
void interrupt_handler(void);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ int main() {
|
||||||
//mrf.wake();
|
//mrf.wake();
|
||||||
|
|
||||||
sprintf(tmp,"Received %i\n\r", i);
|
sprintf(tmp,"Received %i\n\r", i);
|
||||||
mrf.send16(0x4202, tmp);
|
mrf.send_str(0x4202, tmp);
|
||||||
|
|
||||||
_delay_ms(2000);
|
_delay_ms(2000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue