File tree Expand file tree Collapse file tree 5 files changed +21
-26
lines changed
variants/Generic_nRF52840 Expand file tree Collapse file tree 5 files changed +21
-26
lines changed Original file line number Diff line number Diff line change @@ -342,8 +342,7 @@ Generic_nRF52840.build.board=GENERIC
342342Generic_nRF52840.build.core=nRF5
343343Generic_nRF52840.build.variant=Generic_nRF52840
344344Generic_nRF52840.build.variant_system_lib=
345- #TODO: убрать отладку
346- Generic_nRF52840.build.extra_flags=-DNRF52 -gdwarf-2
345+ Generic_nRF52840.build.extra_flags=-DNRF52
347346Generic_nRF52840.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
348347Generic_nRF52840.build.ldscript=nrf52840.ld
349348
Original file line number Diff line number Diff line change @@ -92,38 +92,17 @@ void loop( void ) ;
9292
9393#define bit (b ) (1UL << (b))
9494
95- //TODO: Проверить
9695#ifdef NRF_P1
9796 #define digitalPinToPort (P ) ( (g_ADigitalPinMap[P] < 32) ? NRF_P0 : NRF_P1 )
9897#else
9998 #define digitalPinToPort (P ) ( NRF_P0 )
10099#endif
101100
102101//#define digitalPinToPort(P) ( &(NRF_GPIO[P]) )
103- //TODO: Проверить
102+
104103#define digitalPinToBitMask (P ) ( 1UL << ( g_ADigitalPinMap[P] < 32 ? g_ADigitalPinMap[P] : (g_ADigitalPinMap[P]-32) ) )
105104//#define digitalPinToBitMask(P) ( 1 << g_ADigitalPinMap[P] )
106105
107- __STATIC_INLINE NRF_GPIO_Type * nrf_gpio_pin_port_decode (uint32_t * p_pin )
108- {
109- //NRFX_ASSERT(*p_pin < NUMBER_OF_PINS);
110- #if (GPIO_COUNT == 2 )
111- //if (*p_pin < P0_PIN_NUM)
112- if (* p_pin < 32 )
113- {
114- return NRF_P0 ;
115- }
116- else
117- {
118- * p_pin = * p_pin & (32 - 1 );
119- return NRF_P1 ;
120- }
121- #else
122- // The oldest definition case
123- return NRF_GPIO ;
124- #endif
125- }
126-
127106//#define analogInPinToBit(P) ( )
128107#define portOutputRegister (port ) ( &(port->OUTSET) )
129108#define portInputRegister (port ) ( &(port->IN) )
Original file line number Diff line number Diff line change 7878
7979/* GPIO */
8080/* GPIO port was renamed to P0. */
81- //TODO: Разобраться
8281#define NRF_GPIO NRF_P0
8382#define NRF_GPIO_BASE NRF_P0_BASE
8483
Original file line number Diff line number Diff line change @@ -24,6 +24,25 @@ extern "C" {
2424
2525extern void init (void );
2626
27+ __STATIC_INLINE NRF_GPIO_Type * nrf_gpio_pin_port_decode (uint32_t * p_pin )
28+ {
29+ #if (GPIO_COUNT == 2 )
30+ //if (*p_pin < P0_PIN_NUM)
31+ if (* p_pin < 32 )
32+ {
33+ return NRF_P0 ;
34+ }
35+ else
36+ {
37+ * p_pin = * p_pin & (32 - 1 );
38+ return NRF_P1 ;
39+ }
40+ #else
41+ // The oldest definition case
42+ return NRF_GPIO ;
43+ #endif
44+ }
45+
2746#ifdef __cplusplus
2847}
2948#endif
Original file line number Diff line number Diff line change @@ -93,7 +93,6 @@ static const uint8_t SCK = PIN_SPI_SCK ;
9393/*
9494 * Wire Interfaces
9595 */
96- //TODO: Определиться позднее
9796#define WIRE_INTERFACES_COUNT 1
9897
9998#define PIN_WIRE_SDA (20u) // P0.20
You can’t perform that action at this time.
0 commit comments