This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Code works with nothing in sdk_config.h enabled

I'm a little confused here...I have a basic main function which is turning on/off some GPIO and logging through SEGGER_RTT.

I thought that in order for that to work, you need to enable the logging defines in the sdk_config.h. However, I've disabled everything in the sdk_config.h file and it still outputs data out of RTT. See code below. Can someone help me understand what the point of the sdk_config.h is if it doesn't seem to do anything?

   // Standard include files
    #include <stdbool.h>
    #include <stdint.h>
    
    // Include nRF HAL headers here
    #include "nrf_delay.h"
    #include "nrf_gpio.h"
    #include "nrf_power.h"
    #include "nrf_clock.h"

    // Include nRF libraries here
    #include "SEGGER_RTT.h"
    
        int main(void)
        {
        	// Initialize GPIO
        	SEGGER_RTT_WriteString(0, "Initializing...\n");
        	nrf_gpio_cfg_output(RED_LED_PIN);
        	nrf_gpio_cfg_output(YELLOW_LED_PIN);
        	nrf_gpio_cfg_input(ACCEL_INT1_PIN, NRF_GPIO_PIN_PULLUP);
        	nrf_gpio_cfg_input(ACCEL_INT2_PIN, NRF_GPIO_PIN_PULLUP);
        	nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
        	
        	// Turn LEDs on
        	nrf_gpio_pin_set(RED_LED_PIN);
        	nrf_gpio_pin_set(YELLOW_LED_PIN);
        	
            while (true)
            {
        		test = nrf_gpio_pin_read(ACCEL_INT1_PIN);
        		test2 = nrf_gpio_pin_read(ACCEL_INT2_PIN);
        		test3 = nrf_gpio_pin_read(BUTTON_PIN);
        		
        		SEGGER_RTT_WriteString(0, "Printing input values:\n");
        		SEGGER_RTT_printf(0, "%d\n", test);
        		SEGGER_RTT_printf(0, "%d\n", test2);
        		SEGGER_RTT_printf(0, "%d\n", test3);
        		
        		nrf_delay_ms(1000);
            }
        }
Parents Reply Children
Related