The BitBrain method for learning and inference at the edge