AnsweredAssumed Answered

1-Wire library for STM32 in C

Question asked by jirgensons.raivo on Dec 29, 2012
Latest reply on Apr 4, 2018 by Stoian Ivanov
Could not find a ready solution for using 1-wire protocol with STM32 in C (working wiwth IAR), so I decided to rework the C++ library that came with arduino.

So, if anyone needs it  - here it is a fully working solution (compiled wit IAR, tested on STM32F103VET6  processor running at 72 Mhz - Delay functions need to be modified for other frequencies). I have not yet add comments to functions in code, but it should not be hard to understand, as it is 1:1 ported from arduino library. 

Sample code:
OWire OneWire;
unsigned char DeviceAddress[8];
int nCount = 0;
OWInit(&OneWire, GPIOB, GPIO_Pin_14);
while(OWSearch(&OneWire, DeviceAddress))
  printf("Device %d: %02X %02X %02X %02X %02X %02X %02X %02X \n\r",
printf("DeviceCount: %d",nCount);


May be someone finds the Delay library useful too.

Working on DallasTemp library now - will post here when finished..

Any comments, suggestions are welcome...