Hi, i am trying to understand the SDK 17 by building my own libraries such as interrupts, ADC, IIC or so on. I was doing well untill i come across with "LOG". When i look at the examples that uses LOG, sdk_config files are different so i cannot merge them. I just want an application that writes "DEBUG" every 1 seconds. I will build the library from it. I have added my code that converted from example named "temperature". I just deleted the code inside and implemented 2 interrupt service.1780.sdk_config.h
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "nrf.h"
#include "nrf_delay.h"
#include "app_error.h"
#include "bsp.h"
#include "nrf_gpiote.h"
#include "nrf_gpio.h"
#include "boards.h"
#include "nrf_drv_gpiote.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#define OUT1 BSP_LED_0
#define OUT2 BSP_LED_1
#define IN1 BSP_BUTTON_0
#define IN2 BSP_BUTTON_1
void fonksiyon1(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action){
nrf_drv_gpiote_out_toggle(OUT1);
NRF_LOG_INFO("Button 1 Pressed");
}
void fonksiyon2(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action){
nrf_drv_gpiote_out_toggle(OUT2);
NRF_LOG_INFO("Button 2 Pressed");
}
static void interrupt_setup()
{
ret_code_t err_code;
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(false);
out_config.init_state = NRF_GPIOTE_INITIAL_VALUE_HIGH;
err_code = nrf_drv_gpiote_out_init(OUT1, &out_config);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_gpiote_out_init(OUT2, &out_config);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(IN1, &config, fonksiyon1);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_gpiote_in_init(IN2, &config, fonksiyon2);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(IN1,true);
nrf_drv_gpiote_in_event_enable(IN2,true);
}
int main(void)
{
interrupt_setup();
bsp_board_init(BSP_INIT_LEDS);
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_DEFAULT_BACKENDS_INIT();
NRF_LOG_INFO("Debug Started");
while (true)
{
for (int i = 0; i < LEDS_NUMBER; i++)
{
bsp_board_led_invert(i);
nrf_delay_ms(500);
NRF_LOG_INFO("Debug Loop");
}
}
}
/** @} */