⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radio_pl.lst

📁 nRF24L01和nRF24LU1开发包。在C51和S12上实现。
💻 LST
字号:
C51 COMPILER V8.08   RADIO_PL                                                              01/02/2009 11:50:58 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE RADIO_PL
OBJECT MODULE PLACED IN .\obj\radio_pl.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE pl\radio_pl.c LARGE OMF2 OPTIMIZE(9,SPEED) BROWSE INCDIR(l01_bfb;..\..\..\a
                    -rch\hal\include) DEFINE(nRF24L01__) DEBUG PRINT(.\lst\radio_pl.lst) OBJECT(.\obj\radio_pl.obj)

line level    source

   1          /* Copyright (c) 2007 Nordic Semiconductor. All Rights Reserved.
   2           *
   3           * The information contained herein is property of Nordic Semiconductor ASA.
   4           * Terms and conditions of usage are described in detail in NORDIC
   5           * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 
   6           *
   7           * Licensees are granted free, non-transferable use of the information. NO
   8           * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
   9           * the file.
  10           *
  11           * $LastChangedRevision: 2185 $
  12           */ 
  13          
  14          /** @ingroup PL 
  15           * @file
  16           * Initialise the radio in Enhanced ShockBurst mode with Bidirectional data. 
  17           * This is done by opening @b pipe0 with auto ACK and with auto retransmits. 
  18           * It also opens for the use of ACK payload (@b hal_nrf_enable_ack_pl()) and 
  19           * dynamic payload width (@b hal_nrf_enable_dynamic_pl() for general enabeling 
  20           * and @b hal_nrf_setup_dyn_pl() to enable on specific pipes).
  21           *
  22           * @author Per Kristian Schanke
  23           */
  24          
  25          #include "hal_nrf.h"
  26          #include "radio_pl.h"
  27          #include "system.h"
  28          #include "radio.h"
  29          
  30          void radio_pl_init (const uint8_t *address, hal_nrf_operation_mode_t operational_mode)
  31          {
  32   1        hal_nrf_close_pipe(HAL_NRF_ALL);               // First close all radio pipes
  33   1                                                       // Pipe 0 and 1 open by default
  34   1        hal_nrf_open_pipe(HAL_NRF_PIPE0, true);        // Then open pipe0, w/autoack 
  35   1      
  36   1        hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);       // Operates in 16bits CRC mode
  37   1        hal_nrf_set_auto_retr(RF_RETRANSMITS, RF_RETRANS_DELAY);
  38   1                                                       // Enables auto retransmit.
  39   1                                                       // 3 retrans with 250ms delay
  40   1      
  41   1        hal_nrf_set_address_width(HAL_NRF_AW_5BYTES);  // 5 bytes address width
  42   1        hal_nrf_set_address(HAL_NRF_TX, address);      // Set device's addresses
  43   1        hal_nrf_set_address(HAL_NRF_PIPE0, address);   // Sets recieving address on 
  44   1                                                       // pipe0
  45   1      
  46   1      /*****************************************************************************
  47   1       * Changed from esb/radio_esb.c                                              *
  48   1       * Enables:                                                                  *
  49   1       *  - ACK payload                                                            *
  50   1       *  - Dynamic payload width                                                  *
  51   1       *  - Dynamic ACK                                                            *
  52   1       *****************************************************************************/
  53   1        hal_nrf_enable_ack_pl();                       // Try to enable ack payload
  54   1      
C51 COMPILER V8.08   RADIO_PL                                                              01/02/2009 11:50:58 PAGE 2   

  55   1        // When the features are locked, the FEATURE and DYNPD are read out 0x00
  56   1        // even after we have tried to enable ack payload. This mean that we need to
  57   1        // activate the features.
  58   1        if(hal_nrf_read_reg(FEATURE) == 0x00 && (hal_nrf_read_reg(DYNPD) == 0x00))
  59   1        {
  60   2          hal_nrf_lock_unlock ();                      // Activate features
  61   2          hal_nrf_enable_ack_pl();                     // Enables payload in ack
  62   2        }
  63   1      
  64   1        hal_nrf_enable_dynamic_pl();                   // Enables dynamic payload
  65   1        hal_nrf_setup_dyn_pl(ALL_PIPES);               // Sets up dynamic payload on
  66   1                                                       // all data pipes.
  67   1      /*****************************************************************************
  68   1       * End changes from esb/radio_esb.c                                          *
  69   1       *****************************************************************************/
  70   1         
  71   1        if(operational_mode == HAL_NRF_PTX)            // Mode depentant settings
  72   1        {
  73   2          hal_nrf_set_operation_mode(HAL_NRF_PTX);     // Enter TX mode
  74   2        }
  75   1        else
  76   1        {
  77   2          hal_nrf_set_operation_mode(HAL_NRF_PRX);     // Enter RX mode
  78   2          hal_nrf_set_rx_pload_width((uint8_t)HAL_NRF_PIPE0, RF_PAYLOAD_LENGTH);
  79   2                                                       // Pipe0 expect 
  80   2                                                       // PAYLOAD_LENGTH byte payload
  81   2                                                       // PAYLOAD_LENGTH in radio.h
  82   2        }
  83   1      
  84   1        hal_nrf_set_rf_channel(RF_CHANNEL);            // Operating on static channel
  85   1                                                       // Defined in radio.h. 
  86   1                                                       // Frequenzy = 
  87   1                                                       //        2400 + RF_CHANNEL
  88   1        hal_nrf_set_power_mode(HAL_NRF_PWR_UP);        // Power up device
  89   1        
  90   1        start_timer(RF_POWER_UP_DELAY);                // Wait for the radio to 
  91   1        wait_for_timer();                              // power up
  92   1        
  93   1        radio_set_status (RF_IDLE);                    // Radio now ready
  94   1      }    


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    155    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----       4
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -