Build errors on Blinky example

Hello all

I suspect this is  a simple coding error that was I not a complete beginner I'd know how to fix.

I'm using the YouTube series to work through here : nRF5 SDK - Tutorial for Beginners Pt 6 - Reading Digital Input from Buttons - YouTube

The same hardware and software as in the video.

On build, I get the following in Segger. 

Could anyone at least point me in the right direction please?

Thanks in advance.

Andrew

NOTE : I am looking to start on the Nordic Dev Academy and have just ordered a Thingy:53.

Building ‘blinky_pca10040’ from solution ‘blinky_pca10040’ in configuration ‘Debug’
Compiling ‘nrf_fprintf_format.c’
Compiling ‘nrf_memobj.c’
Compiling ‘nrf_ringbuf.c’
Compiling ‘nrf_strerror.c’
Compiling ‘nrfx_atomic.c’
Compiling ‘main.c’
Compiling ‘system_nrf52.c’
Compiling ‘Basic Intput Functions.c’
data definition has no type or storage class
type defaults to 'int' in declaration of 'nrf_gpio_cfg_input' [-Wimplicit-int]
conflicting types for 'nrf_gpio_cfg_input'; have 'int(uint32_t, nrf_gpio_pin_pull_t)' {aka 'int(unsigned int, nrf_gpio_pin_pull_t)'}
Basic Intput Functions.c
previous definition of 'nrf_gpio_cfg_input' with type 'void(uint32_t, nrf_gpio_pin_pull_t)' {aka 'void(unsigned int, nrf_gpio_pin_pull_t)'}
return type defaults to 'int' [-Wimplicit-int]
conflicting types for 'nrf_gpio_range_cfg_input'; have 'int(uint32_t, uint32_t, nrf_gpio_pin_pull_t)' {aka 'int(unsigned int, unsigned int, nrf_gpio_pin_pull_t)'}
Basic Intput Functions.c
previous definition of 'nrf_gpio_range_cfg_input' with type 'void(uint32_t, uint32_t, nrf_gpio_pin_pull_t)' {aka 'void(unsigned int, unsigned int, nrf_gpio_pin_pull_t)'}
expected declaration specifiers before 'nrf_gpio_pin_read'
expected declaration specifiers before 'nrf_gpio_port_in_read'
expected '{' at end of input
Build failed

  • main.c

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "nrf_gpio.h"

    #define LED 17
    #define Button 13

    /**
    * @brief Function for application main entry.
    */
    int main(void)
    {

    nrf_gpio_cfg_output(LED); //Configures the led pin as OUTPUT pin

    nrf_gpio_cfg_input(Button, NRF_GPIO_PIN_PULLUP); //Configures the Button pin as input Pin


    nrf_gpio_pin_set(LED);


    // Toggle LEDs.
    while (true)
    {
    if(nrf_gpio_pin_read(Button) == 0)
    {
    nrf_gpio_pin_clear(LED); // Turn on the LED

    while(nrf_gpio_pin_read(Button) == 0); // Stay in this loop until the button is released

    nrf_gpio_pin_set(LED); // Turns off the LED

    }
    }
    }

  • Sorted!

    I think my problem was considering the "Basic Input Functions.c" was a file to be included in my project and inserting it into the project. It seems it's there just to copy text from to save some typing. A "txt" or other extension might have been more appropriate to account for slow people like me.

    I did remove Segger and the SDK and then installed the same versions as used in the tutorial series. I guess I'll leave those as they are while I work through it.

Related