@@ -36,34 +36,33 @@ int main(void)
3636{
3737 LOG_INF ("nrfx_gpiote sample on %s" , CONFIG_BOARD );
3838
39- nrfx_err_t err ;
4039 int rv ;
4140 uint8_t in_channel , out_channel ;
4241 nrfx_gppi_handle_t ppi_handle ;
43- const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE (GPIOTE_INST );
42+ static nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE (NRF_GPIOTE_INST_GET ( GPIOTE_INST ) );
4443
4544 /* Connect GPIOTE instance IRQ to irq handler */
46- IRQ_CONNECT (DT_IRQN (GPIOTE_NODE ), DT_IRQ (GPIOTE_NODE , priority ), nrfx_isr ,
47- NRFX_CONCAT ( nrfx_gpiote_ , GPIOTE_INST , _irq_handler ) , 0 );
45+ IRQ_CONNECT (DT_IRQN (GPIOTE_NODE ), DT_IRQ (GPIOTE_NODE , priority ), nrfx_gpiote_irq_handler ,
46+ & gpiote , 0 );
4847
4948 /* Initialize GPIOTE (the interrupt priority passed as the parameter
5049 * here is ignored, see nrfx_glue.h).
5150 */
52- err = nrfx_gpiote_init (& gpiote , 0 );
53- if (err != NRFX_SUCCESS ) {
54- LOG_ERR ("nrfx_gpiote_init error: 0x%08X " , err );
51+ rv = nrfx_gpiote_init (& gpiote , 0 );
52+ if (rv != 0 ) {
53+ LOG_ERR ("nrfx_gpiote_init error: %d " , rv );
5554 return 0 ;
5655 }
5756
58- err = nrfx_gpiote_channel_alloc (& gpiote , & in_channel );
59- if (err != NRFX_SUCCESS ) {
60- LOG_ERR ("Failed to allocate in_channel, error: 0x%08X " , err );
57+ rv = nrfx_gpiote_channel_alloc (& gpiote , & in_channel );
58+ if (rv != 0 ) {
59+ LOG_ERR ("Failed to allocate in_channel, error: %d " , rv );
6160 return 0 ;
6261 }
6362
64- err = nrfx_gpiote_channel_alloc (& gpiote , & out_channel );
65- if (err != NRFX_SUCCESS ) {
66- LOG_ERR ("Failed to allocate out_channel, error: 0x%08X " , err );
63+ rv = nrfx_gpiote_channel_alloc (& gpiote , & out_channel );
64+ if (rv != 0 ) {
65+ LOG_ERR ("Failed to allocate out_channel, error: %d " , rv );
6766 return 0 ;
6867 }
6968
@@ -84,10 +83,10 @@ int main(void)
8483 .p_handler_config = & handler_config
8584 };
8685
87- err = nrfx_gpiote_input_configure (& gpiote , INPUT_PIN , & input_config );
86+ rv = nrfx_gpiote_input_configure (& gpiote , INPUT_PIN , & input_config );
8887
89- if (err != NRFX_SUCCESS ) {
90- LOG_ERR ("nrfx_gpiote_input_configure error: 0x%08X " , err );
88+ if (rv != 0 ) {
89+ LOG_ERR ("nrfx_gpiote_input_configure error: %d " , rv );
9190 return 0 ;
9291 }
9392
@@ -104,11 +103,11 @@ int main(void)
104103 .polarity = NRF_GPIOTE_POLARITY_TOGGLE ,
105104 .init_val = 1 ,
106105 };
107- err = nrfx_gpiote_output_configure (& gpiote , OUTPUT_PIN ,
106+ rv = nrfx_gpiote_output_configure (& gpiote , OUTPUT_PIN ,
108107 & output_config ,
109108 & task_config );
110- if (err != NRFX_SUCCESS ) {
111- LOG_ERR ("nrfx_gpiote_output_configure error: 0x%08X " , err );
109+ if (rv != 0 ) {
110+ LOG_ERR ("nrfx_gpiote_output_configure error: %d " , rv );
112111 return 0 ;
113112 }
114113
@@ -125,7 +124,7 @@ int main(void)
125124 nrfx_gpiote_out_task_address_get (& gpiote , OUTPUT_PIN ),
126125 & ppi_handle );
127126 if (rv < 0 ) {
128- LOG_ERR ("nrfx_gppi_conn_alloc error: 0x%08X " , rv );
127+ LOG_ERR ("nrfx_gppi_conn_alloc error: %d " , rv );
129128 return 0 ;
130129 }
131130
0 commit comments