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

OneWire on RedBearLab nRF51822

Hello!

I recently purchased a RedBearLab nRF51822 board where I want to use several DS1820 temperature sensors.

For dealing with the OneWire (1-wire) protocol I found this really promising and helpful library.

The problem is that the mentions library does not support the RedBearLab nRF51822 board. I contacted the creator of the library and he thinks its possible to support the board but where the official RedBearLab support advised my to ask here.

The library requires a special PIN setup depending on the used board and I don't know how to set this up correctly.

To avoid doubling the content I already asked for help in the Arduino forum: Need help porting OneWire to RedBearLab nRF51822 - this includes a more detailed explanation about my "problem".

Hopefully somebody can help me! Thank you very much in advance! :)

Parents
  • here is a starting point, just add a custom #elif with your board like this:

        #elif defined(BOARD_REDBEAR_XXX)
    
    
    #define DIRECT_READ(base, pin)          nrf_gpio_pin_read(pin)
    #define DIRECT_WRITE_LOW(base, pin)     nrf_gpio_pin_clear(pin)
    #define DIRECT_WRITE_HIGH(base, pin)    nrf_gpio_pin_set(pin)
    #define DIRECT_MODE_INPUT(base, pin)    nrf_gpio_cfg_input(pin)
    #define DIRECT_MODE_OUTPUT(base, pin)   nrf_gpio_cfg_output(pin)
    

    nrf_gpio_ functions are documented here: gpio abstraction or open "sdk/components/drivers_nrf/hal/nrf_gpio.h"

    cheers! OL

Reply
  • here is a starting point, just add a custom #elif with your board like this:

        #elif defined(BOARD_REDBEAR_XXX)
    
    
    #define DIRECT_READ(base, pin)          nrf_gpio_pin_read(pin)
    #define DIRECT_WRITE_LOW(base, pin)     nrf_gpio_pin_clear(pin)
    #define DIRECT_WRITE_HIGH(base, pin)    nrf_gpio_pin_set(pin)
    #define DIRECT_MODE_INPUT(base, pin)    nrf_gpio_cfg_input(pin)
    #define DIRECT_MODE_OUTPUT(base, pin)   nrf_gpio_cfg_output(pin)
    

    nrf_gpio_ functions are documented here: gpio abstraction or open "sdk/components/drivers_nrf/hal/nrf_gpio.h"

    cheers! OL

Children
No Data
Related