Fork for adding SAM L21 Xplained Pro support

Fork of SX1276Lib by Semtech

Files at this revision

API Documentation at this revision

Comitter:
martinichka
Date:
Tue May 16 12:08:24 2017 +0000
Parent:
26:d09a8ef807e2
Commit message:
Added pinning for SAM L21 Xplained Pro

Changed in this revision

sx1276/sx1276-hal.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/sx1276/sx1276-hal.cpp	Mon Apr 24 09:26:23 2017 +0000
+++ b/sx1276/sx1276-hal.cpp	Tue May 16 12:08:24 2017 +0000
@@ -24,6 +24,8 @@
                             AntSwitch( antSwitch ),
                         #if( defined ( TARGET_NUCLEO_L152RE ) )
                             Fake( D8 )
+                        #elif defined( TARGET_SAML21J18A )
+                            Fake( PA09 )
                         #else
                             Fake( A3 )
                         #endif
@@ -56,6 +58,10 @@
                         :   SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ),
                             AntSwitch( P0_23 ), 
                             Fake( A3 )
+                        #elif defined( TARGET_SAML21J18A )
+                        :   SX1276( events, PB22, PB16, PB23, PA17, PA10, PA20, PA21, PB12, PB13, PB14, PB15),
+                            AntSwitch( PA08 ), 
+                            Fake( PA09 )
                         #else
                         :   SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ),
                             AntSwitch( A4 ), 
@@ -127,8 +133,8 @@
 {
     nss = 1;    
     spi.format( 8,0 );   
-    uint32_t frequencyToSet = 8000000;
-    #if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) )
+    uint32_t frequencyToSet = 500000;
+    #if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_SAML21J18A ) )
         spi.frequency( frequencyToSet );
     #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate
         spi.frequency( frequencyToSet * 2 );
@@ -140,7 +146,7 @@
 
 void SX1276MB1xAS::IoIrqInit( DioIrqHandler *irqHandlers )
 {
-#if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) )
+#if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_SAML21J18A ) )
     dio0.mode( PullDown );
     dio1.mode( PullDown );
     dio2.mode( PullDown );