kopia lustrzana https://github.com/jgromes/RadioLib
				
				
				
			[SX126x] Added builtin module for CubeCell (#412)
							rodzic
							
								
									7545343f0c
								
							
						
					
					
						commit
						afe524cfc7
					
				| 
						 | 
				
			
			@ -29,6 +29,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
// save transmission states between loops
 | 
			
		||||
int transmissionState = RADIOLIB_ERR_NONE;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -105,17 +108,17 @@ void loop() {
 | 
			
		|||
      if (transmissionState == RADIOLIB_ERR_NONE) {
 | 
			
		||||
        // packet was successfully sent
 | 
			
		||||
        Serial.println(F("transmission finished!"));
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
      } else {
 | 
			
		||||
        Serial.print(F("failed, code "));
 | 
			
		||||
        Serial.println(transmissionState);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // listen for response
 | 
			
		||||
      radio.startReceive();
 | 
			
		||||
      transmitFlag = false;
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
      // the previous operation was reception
 | 
			
		||||
      // print data and send another packet
 | 
			
		||||
| 
						 | 
				
			
			@ -125,21 +128,21 @@ void loop() {
 | 
			
		|||
      if (state == RADIOLIB_ERR_NONE) {
 | 
			
		||||
        // packet was successfully received
 | 
			
		||||
        Serial.println(F("[SX1262] Received packet!"));
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
        // print data of the packet
 | 
			
		||||
        Serial.print(F("[SX1262] Data:\t\t"));
 | 
			
		||||
        Serial.println(str);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
        // print RSSI (Received Signal Strength Indicator)
 | 
			
		||||
        Serial.print(F("[SX1262] RSSI:\t\t"));
 | 
			
		||||
        Serial.print(radio.getRSSI());
 | 
			
		||||
        Serial.println(F(" dBm"));
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
        // print SNR (Signal-to-Noise Ratio)
 | 
			
		||||
        Serial.print(F("[SX1262] SNR:\t\t"));
 | 
			
		||||
        Serial.print(radio.getSNR());
 | 
			
		||||
        Serial.println(F(" dB"));
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // wait a second before transmitting again
 | 
			
		||||
| 
						 | 
				
			
			@ -154,6 +157,6 @@ void loop() {
 | 
			
		|||
    // we're ready to process more packets,
 | 
			
		||||
    // enable interrupt service routine
 | 
			
		||||
    enableInterrupt = true;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,9 @@ SX1268 radio2 = new Module(8, 4, 5, 6);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1261 radio3 = RadioShield.ModuleB;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,9 @@ SX1262 radio = new Module(10, 2, 3, 9);
 | 
			
		|||
// https://github.com/jgromes/RadioShield
 | 
			
		||||
//SX1262 radio = RadioShield.ModuleA;
 | 
			
		||||
 | 
			
		||||
// or using CubeCell
 | 
			
		||||
//SX1262 radio = new Module(RADIOLIB_ONBOARD_MODULE);
 | 
			
		||||
 | 
			
		||||
// save transmission state between loops
 | 
			
		||||
int transmissionState = RADIOLIB_ERR_NONE;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -234,6 +234,8 @@ RADIOLIB_ENCODING_NRZ	LITERAL1
 | 
			
		|||
RADIOLIB_ENCODING_MANCHESTER	LITERAL1
 | 
			
		||||
RADIOLIB_ENCODING_WHITENING	LITERAL1
 | 
			
		||||
 | 
			
		||||
RADIOLIB_BUILTIN_MODULE	LITERAL1
 | 
			
		||||
 | 
			
		||||
RADIOLIB_ERR_NONE	LITERAL1
 | 
			
		||||
RADIOLIB_ERR_UNKNOWN	LITERAL1
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@
 | 
			
		|||
 * RADIOLIB_NONVOLATILE_READ_BYTE - function/macro to read variables saved in program storage (usually Flash).
 | 
			
		||||
 * RADIOLIB_TYPE_ALIAS - construct to create an alias for a type, usually vai the `using` keyword.
 | 
			
		||||
 * RADIOLIB_TONE_UNSUPPORTED - some platforms do not have tone()/noTone(), which is required for AFSK.
 | 
			
		||||
 * RADIOLIB_BUILTIN_MODULE - some platforms have a builtin radio module on fixed pins, this macro is used to specify that pinout.
 | 
			
		||||
 *
 | 
			
		||||
 * In addition, some platforms may require RadioLib to disable specific drivers (such as ESP8266).
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -699,6 +700,10 @@
 | 
			
		|||
    #define RADIOLIB_CB_ARGS_SPI_END_TRANSACTION        (void, SPIendTransaction, void)
 | 
			
		||||
    #define RADIOLIB_CB_ARGS_SPI_END                    (void, SPIend, void)
 | 
			
		||||
 | 
			
		||||
    // provide an easy access to the on-board module
 | 
			
		||||
    #include "board-config.h"
 | 
			
		||||
    #define RADIOLIB_BUILTIN_MODULE                      RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY
 | 
			
		||||
 | 
			
		||||
    // CubeCell doesn't seem to define nullptr, let's do something like that now
 | 
			
		||||
    #define nullptr                                     NULL
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue