Single firmware image that supports both central and peripheral

  I need to develop a pair of BLE-capable devices that talk to each other.  The communication between them will be very simple - the central needs to tell the peripheral the state of a single switch.  I would like to use the same firmware image for both devices, with a GPIO line tied one way or the other on each device to indicate if this device should act as the sending central or the receiving peripheral.  

  What is the best starting point in terms of example code for something like this?

Related