Add send_str

This commit is contained in:
CVR 2021-10-13 10:55:53 +13:00
parent 56705b840b
commit 05fe5d53f4
3 changed files with 10 additions and 4 deletions

View File

@ -104,12 +104,17 @@ word Mrf24j::address16_read(void) {
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.
* @param data
*/
void Mrf24j::send16(word dest16, char * data) {
byte len = strlen(data); // get the length of the char* array
void Mrf24j::send(word dest16, char * data, int len) {
int i = 0;
write_long(i++, bytes_MHR); // header length
// +ignoreBytes is because some module seems to ignore 2 bytes after the header?!.

View File

@ -227,7 +227,8 @@ class Mrf24j
*/
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);

View File

@ -47,7 +47,7 @@ int main() {
//mrf.wake();
sprintf(tmp,"Received %i\n\r", i);
mrf.send16(0x4202, tmp);
mrf.send_str(0x4202, tmp);
_delay_ms(2000);
}