KrisKasprzak
Well-known member
All,
I've been using small UART based transcievers (E50-TTL-100) with great success. I can read / write and even program them. RadioHead library will work with and E32, but I want different functions and capability--hence I'm writing my own.
The Transceiver serial is created with something like
#define ESerial Serial1
initialization is then
ESerial.begin(9600);
I send complete data structures (Data.volts, Data.amps, Data.ID, etc..) and this code works fine
ESerial.write((uint8_t*) &Data, sizeof(Data));
My library creates an object using (which is library code leveraged from RadioHead)
EBYTE Transceiver(&ESerial, 4, 5, 6);
library constructor is
EBYTE::EBYTE(Stream *s, uint8_t PIN_M0, uint8_t PIN_M1, uint8_t PIN_AUX)
OK...enough background. In the library I'm writing I want a function like the following so i can pass a data structure but as I wan't to let others have the lib, how do you pass a structure when you don't know anything about it?
void EBYTE::SendTheData( ? *TheStructure) {
_s->write((uint8_t*)&TheStructure, (uint16_t) sizeof(TheStructure));
}
Thanks in advance.
I've been using small UART based transcievers (E50-TTL-100) with great success. I can read / write and even program them. RadioHead library will work with and E32, but I want different functions and capability--hence I'm writing my own.
The Transceiver serial is created with something like
#define ESerial Serial1
initialization is then
ESerial.begin(9600);
I send complete data structures (Data.volts, Data.amps, Data.ID, etc..) and this code works fine
ESerial.write((uint8_t*) &Data, sizeof(Data));
My library creates an object using (which is library code leveraged from RadioHead)
EBYTE Transceiver(&ESerial, 4, 5, 6);
library constructor is
EBYTE::EBYTE(Stream *s, uint8_t PIN_M0, uint8_t PIN_M1, uint8_t PIN_AUX)
OK...enough background. In the library I'm writing I want a function like the following so i can pass a data structure but as I wan't to let others have the lib, how do you pass a structure when you don't know anything about it?
void EBYTE::SendTheData( ? *TheStructure) {
_s->write((uint8_t*)&TheStructure, (uint16_t) sizeof(TheStructure));
}
Thanks in advance.