esb gcc program
Fork of esb_gcc by
nrf_esb_constants.h@0:b7e137e41f80, 2015-03-23 (annotated)
- Committer:
- joshuajnoble
- Date:
- Mon Mar 23 02:58:28 2015 +0000
- Revision:
- 0:b7e137e41f80
esb gcc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joshuajnoble | 0:b7e137e41f80 | 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
joshuajnoble | 0:b7e137e41f80 | 2 | * |
joshuajnoble | 0:b7e137e41f80 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
joshuajnoble | 0:b7e137e41f80 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
joshuajnoble | 0:b7e137e41f80 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
joshuajnoble | 0:b7e137e41f80 | 6 | * |
joshuajnoble | 0:b7e137e41f80 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
joshuajnoble | 0:b7e137e41f80 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
joshuajnoble | 0:b7e137e41f80 | 9 | * the file. |
joshuajnoble | 0:b7e137e41f80 | 10 | * |
joshuajnoble | 0:b7e137e41f80 | 11 | * $LastChangedRevision: 32956 $ |
joshuajnoble | 0:b7e137e41f80 | 12 | */ |
joshuajnoble | 0:b7e137e41f80 | 13 | |
joshuajnoble | 0:b7e137e41f80 | 14 | |
joshuajnoble | 0:b7e137e41f80 | 15 | /** |
joshuajnoble | 0:b7e137e41f80 | 16 | * @file |
joshuajnoble | 0:b7e137e41f80 | 17 | * @brief Enhanced ShockBurst constants and default values. |
joshuajnoble | 0:b7e137e41f80 | 18 | * |
joshuajnoble | 0:b7e137e41f80 | 19 | * NOTE! Changing values here has no effect. They are only provided as a reference. |
joshuajnoble | 0:b7e137e41f80 | 20 | */ |
joshuajnoble | 0:b7e137e41f80 | 21 | |
joshuajnoble | 0:b7e137e41f80 | 22 | #ifndef NRF_ESB_CONSTANTS_H__ |
joshuajnoble | 0:b7e137e41f80 | 23 | #define NRF_ESB_CONSTANTS_H__ |
joshuajnoble | 0:b7e137e41f80 | 24 | |
joshuajnoble | 0:b7e137e41f80 | 25 | /** |
joshuajnoble | 0:b7e137e41f80 | 26 | * @addtogroup esb_02_api |
joshuajnoble | 0:b7e137e41f80 | 27 | * @{ |
joshuajnoble | 0:b7e137e41f80 | 28 | */ |
joshuajnoble | 0:b7e137e41f80 | 29 | |
joshuajnoble | 0:b7e137e41f80 | 30 | |
joshuajnoble | 0:b7e137e41f80 | 31 | /*****************************************************************************/ |
joshuajnoble | 0:b7e137e41f80 | 32 | /** @name Hardware resources used by Enhanced ShockBurst */ |
joshuajnoble | 0:b7e137e41f80 | 33 | /*****************************************************************************/ |
joshuajnoble | 0:b7e137e41f80 | 34 | #define NRF_ESB_HIGH_IRQ_PRIORITY 0 ///< Interrupt priority the ESB timer and the radio |
joshuajnoble | 0:b7e137e41f80 | 35 | #define NRF_ESB_LOW_IRQ_PRIORITY 1 ///< Interrupt priority for ESB callback functions. |
joshuajnoble | 0:b7e137e41f80 | 36 | |
joshuajnoble | 0:b7e137e41f80 | 37 | #ifndef USE_SD_HW_RESOURCES |
joshuajnoble | 0:b7e137e41f80 | 38 | #define NRF_ESB_SWI_IRQn SWI0_IRQn ///< Software interrupt # used for callback functions. |
joshuajnoble | 0:b7e137e41f80 | 39 | #define NRF_ESB_SWI_IRQ_HANDLER SWI0_IRQHandler ///< Software interrupt handler used for callback functions. |
joshuajnoble | 0:b7e137e41f80 | 40 | |
joshuajnoble | 0:b7e137e41f80 | 41 | #define NRF_ESB_TIMER NRF_TIMER2 ///< Timer to be used as flywheel timer. |
joshuajnoble | 0:b7e137e41f80 | 42 | #define NRF_ESB_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER2_Msk ///< PERPOWER mask for the timer. |
joshuajnoble | 0:b7e137e41f80 | 43 | #define NRF_ESB_TIMER_IRQn TIMER2_IRQn ///< Interrupt # for the timer. |
joshuajnoble | 0:b7e137e41f80 | 44 | #define NRF_ESB_TIMER_IRQ_HANDLER TIMER2_IRQHandler ///< Interrupt handler for the timer. |
joshuajnoble | 0:b7e137e41f80 | 45 | |
joshuajnoble | 0:b7e137e41f80 | 46 | // In addition, ESB uses the radio peripheral and radio interrupts. |
joshuajnoble | 0:b7e137e41f80 | 47 | |
joshuajnoble | 0:b7e137e41f80 | 48 | /* |
joshuajnoble | 0:b7e137e41f80 | 49 | * PPI configuration |
joshuajnoble | 0:b7e137e41f80 | 50 | */ |
joshuajnoble | 0:b7e137e41f80 | 51 | #define NRF_ESB_PPI_EEP0 (NRF_PPI -> CH0_EEP) ///< ESB PPI event endpoint 0. |
joshuajnoble | 0:b7e137e41f80 | 52 | #define NRF_ESB_PPI_TEP0 (NRF_PPI -> CH0_TEP) ///< ESB PPI task endpoint 0. |
joshuajnoble | 0:b7e137e41f80 | 53 | #define NRF_ESB_PPI_EEP1 (NRF_PPI -> CH1_EEP) ///< ESB PPI event endpoint 1. |
joshuajnoble | 0:b7e137e41f80 | 54 | #define NRF_ESB_PPI_TEP1 (NRF_PPI -> CH1_TEP) ///< ESB PPI task endpoint 1. |
joshuajnoble | 0:b7e137e41f80 | 55 | #define NRF_ESB_PPI_EEP2 (NRF_PPI -> CH2_EEP) ///< ESB PPI event endpoint 2. |
joshuajnoble | 0:b7e137e41f80 | 56 | #define NRF_ESB_PPI_TEP2 (NRF_PPI -> CH2_TEP) ///< ESB PPI task endpoint 2. |
joshuajnoble | 0:b7e137e41f80 | 57 | |
joshuajnoble | 0:b7e137e41f80 | 58 | #define NRF_ESB_PPI_CHEN_MSK_0_AND_1 (0x03) ///< Channel enable/disable mask for PPI endpoint 0 and 1. |
joshuajnoble | 0:b7e137e41f80 | 59 | #define NRF_ESB_PPI_CHEN_MSK_2 (0x04) ///< Channel enable/disable mask for PPI endpoint 2. |
joshuajnoble | 0:b7e137e41f80 | 60 | #else |
joshuajnoble | 0:b7e137e41f80 | 61 | #define NRF_ESB_SWI_IRQn SWI1_IRQn ///< Software interrupt # used for callback functions. |
joshuajnoble | 0:b7e137e41f80 | 62 | #define NRF_ESB_SWI_IRQ_HANDLER SWI1_IRQHandler ///< Software interrupt handler used for callback functions. |
joshuajnoble | 0:b7e137e41f80 | 63 | |
joshuajnoble | 0:b7e137e41f80 | 64 | #define NRF_ESB_TIMER NRF_TIMER0 ///< Timer to be used as flywheel timer. |
joshuajnoble | 0:b7e137e41f80 | 65 | #define NRF_ESB_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER0_Msk ///< PERPOWER mask for the timer. |
joshuajnoble | 0:b7e137e41f80 | 66 | #define NRF_ESB_TIMER_IRQn TIMER0_IRQn ///< Interrupt # for the timer. |
joshuajnoble | 0:b7e137e41f80 | 67 | #define NRF_ESB_TIMER_IRQ_HANDLER TIMER0_IRQHandler ///< Interrupt handler for the timer. |
joshuajnoble | 0:b7e137e41f80 | 68 | |
joshuajnoble | 0:b7e137e41f80 | 69 | // In addition, ESB uses the radio peripheral and radio interrupts. |
joshuajnoble | 0:b7e137e41f80 | 70 | |
joshuajnoble | 0:b7e137e41f80 | 71 | /* |
joshuajnoble | 0:b7e137e41f80 | 72 | * PPI configuration |
joshuajnoble | 0:b7e137e41f80 | 73 | */ |
joshuajnoble | 0:b7e137e41f80 | 74 | #define NRF_ESB_PPI_EEP0 (NRF_PPI -> CH8_EEP) ///< ESB PPI event endpoint 0. |
joshuajnoble | 0:b7e137e41f80 | 75 | #define NRF_ESB_PPI_TEP0 (NRF_PPI -> CH8_TEP) ///< ESB PPI task endpoint 0. |
joshuajnoble | 0:b7e137e41f80 | 76 | #define NRF_ESB_PPI_EEP1 (NRF_PPI -> CH9_EEP) ///< ESB PPI event endpoint 1. |
joshuajnoble | 0:b7e137e41f80 | 77 | #define NRF_ESB_PPI_TEP1 (NRF_PPI -> CH9_TEP) ///< ESB PPI task endpoint 1. |
joshuajnoble | 0:b7e137e41f80 | 78 | #define NRF_ESB_PPI_EEP2 (NRF_PPI -> CH10_EEP) ///< ESB PPI event endpoint 2. |
joshuajnoble | 0:b7e137e41f80 | 79 | #define NRF_ESB_PPI_TEP2 (NRF_PPI -> CH10_TEP) ///< ESB PPI task endpoint 2. |
joshuajnoble | 0:b7e137e41f80 | 80 | |
joshuajnoble | 0:b7e137e41f80 | 81 | #define NRF_ESB_PPI_CHEN_MSK_0_AND_1 (0x300) ///< Channel enable/disable mask for PPI endpoint 0 and 1. |
joshuajnoble | 0:b7e137e41f80 | 82 | #define NRF_ESB_PPI_CHEN_MSK_2 (0x400) ///< Channel enable/disable mask for PPI endpoint 2. |
joshuajnoble | 0:b7e137e41f80 | 83 | |
joshuajnoble | 0:b7e137e41f80 | 84 | #endif |
joshuajnoble | 0:b7e137e41f80 | 85 | |
joshuajnoble | 0:b7e137e41f80 | 86 | #define NRF_ESB_CONST_PIPE_COUNT 8 ///< Number of TX pipes (at least one for each Device-Host pairs). |
joshuajnoble | 0:b7e137e41f80 | 87 | #define NRF_ESB_CONST_FIFO_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX FIFO. |
joshuajnoble | 0:b7e137e41f80 | 88 | #define NRF_ESB_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time. |
joshuajnoble | 0:b7e137e41f80 | 89 | #define NRF_ESB_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes. |
joshuajnoble | 0:b7e137e41f80 | 90 | #define NRF_ESB_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue. |
joshuajnoble | 0:b7e137e41f80 | 91 | /** @} */ |
joshuajnoble | 0:b7e137e41f80 | 92 | |
joshuajnoble | 0:b7e137e41f80 | 93 | |
joshuajnoble | 0:b7e137e41f80 | 94 | /*****************************************************************************/ |
joshuajnoble | 0:b7e137e41f80 | 95 | /** @name Constant pipe and FIFO configuration */ |
joshuajnoble | 0:b7e137e41f80 | 96 | /*****************************************************************************/ |
joshuajnoble | 0:b7e137e41f80 | 97 | #define NRF_ESB_CONST_PIPE_COUNT 8 ///< Number of transmission pipes (at least one for each Device-Host pairs). |
joshuajnoble | 0:b7e137e41f80 | 98 | #define NRF_ESB_CONST_QUEUE_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX queue. |
joshuajnoble | 0:b7e137e41f80 | 99 | #define NRF_ESB_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time. |
joshuajnoble | 0:b7e137e41f80 | 100 | #define NRF_ESB_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes. |
joshuajnoble | 0:b7e137e41f80 | 101 | #define NRF_ESB_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue. |
joshuajnoble | 0:b7e137e41f80 | 102 | |
joshuajnoble | 0:b7e137e41f80 | 103 | /** @} */ |
joshuajnoble | 0:b7e137e41f80 | 104 | |
joshuajnoble | 0:b7e137e41f80 | 105 | /*****************************************************************************/ |
joshuajnoble | 0:b7e137e41f80 | 106 | /** @name Default parameters */ |
joshuajnoble | 0:b7e137e41f80 | 107 | /*****************************************************************************/ |
joshuajnoble | 0:b7e137e41f80 | 108 | |
joshuajnoble | 0:b7e137e41f80 | 109 | /* |
joshuajnoble | 0:b7e137e41f80 | 110 | Corresponds to Legacy nRFgo SDK ESB addresses: |
joshuajnoble | 0:b7e137e41f80 | 111 | Address pipe 0 {0xE7, 0xE7, 0xE7, 0xE7, 0xE7} |
joshuajnoble | 0:b7e137e41f80 | 112 | Address pipe 1 {0xC2, 0xC2, 0xC2, 0xC2, 0xC2} |
joshuajnoble | 0:b7e137e41f80 | 113 | Address pipe 2 {0xC3, 0xC2, 0xC2, 0xC2, 0xC2} |
joshuajnoble | 0:b7e137e41f80 | 114 | Address pipe 3 {0xC4, 0xC2, 0xC2, 0xC2, 0xC2} |
joshuajnoble | 0:b7e137e41f80 | 115 | */ |
joshuajnoble | 0:b7e137e41f80 | 116 | |
joshuajnoble | 0:b7e137e41f80 | 117 | #define NRF_ESB_DEFAULT_BASE_ADDRESS_0 0xE7E7E7E7 ///< Default base address 0. |
joshuajnoble | 0:b7e137e41f80 | 118 | #define NRF_ESB_DEFAULT_BASE_ADDRESS_1 0xC2C2C2C2 ///< Default base address 1. |
joshuajnoble | 0:b7e137e41f80 | 119 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_0 0xE7 ///< Default prefix address pipe 0. |
joshuajnoble | 0:b7e137e41f80 | 120 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_1 0xC2 ///< Default prefix address pipe 1. |
joshuajnoble | 0:b7e137e41f80 | 121 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_2 0xC3 ///< Default prefix address pipe 2. |
joshuajnoble | 0:b7e137e41f80 | 122 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_3 0xC4 ///< Default prefix address pipe 3. |
joshuajnoble | 0:b7e137e41f80 | 123 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_4 0xC5 ///< Default prefix address pipe 4. |
joshuajnoble | 0:b7e137e41f80 | 124 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_5 0xC6 ///< Default prefix address pipe 5. |
joshuajnoble | 0:b7e137e41f80 | 125 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_6 0xC7 ///< Default prefix address pipe 6. |
joshuajnoble | 0:b7e137e41f80 | 126 | #define NRF_ESB_DEFAULT_PREFIX_BYTE_7 0xC8 ///< Default prefix address pipe 7. |
joshuajnoble | 0:b7e137e41f80 | 127 | #define NRF_ESB_DEFAULT_BASE_ADDRESS_LENGTH NRF_ESB_BASE_ADDRESS_LENGTH_4B ///< Default on-air base address length. |
joshuajnoble | 0:b7e137e41f80 | 128 | #define NRF_ESB_DEFAULT_CRC_LENGTH NRF_ESB_CRC_LENGTH_1_BYTE ///< Default CRC length. |
joshuajnoble | 0:b7e137e41f80 | 129 | #define NRF_ESB_DEFAULT_ENABLED_PRX_PIPES 0xFF ///< Default enabled RX pipes. |
joshuajnoble | 0:b7e137e41f80 | 130 | #define NRF_ESB_DEFAULT_MAX_NUMBER_OF_RETRANSMITS 15 ///< Default number of retransmits. |
joshuajnoble | 0:b7e137e41f80 | 131 | #define NRF_ESB_DEFAULT_OUTPUT_POWER NRF_ESB_OUTPUT_POWER_0_DBM ///< Default TX output power. |
joshuajnoble | 0:b7e137e41f80 | 132 | #define NRF_ESB_DEFAULT_DATARATE NRF_ESB_DATARATE_2_MBPS ///< Default datarate. |
joshuajnoble | 0:b7e137e41f80 | 133 | #define NRF_ESB_DEFAULT_RETRANSMIT_DELAY 600 ///< Default retransmit delay. |
joshuajnoble | 0:b7e137e41f80 | 134 | #define NRF_ESB_DEFAULT_CHANNEL (10) |
joshuajnoble | 0:b7e137e41f80 | 135 | #define NRF_ESB_DEFAULT_XOSC_CTL NRF_ESB_XOSC_CTL_AUTO ///< Default setting for controlling the XOSC |
joshuajnoble | 0:b7e137e41f80 | 136 | |
joshuajnoble | 0:b7e137e41f80 | 137 | /** @} */ |
joshuajnoble | 0:b7e137e41f80 | 138 | |
joshuajnoble | 0:b7e137e41f80 | 139 | /** @} */ |
joshuajnoble | 0:b7e137e41f80 | 140 | |
joshuajnoble | 0:b7e137e41f80 | 141 | #endif |