Maxim Integrated / OneWire

Dependents:   MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more

Revision:
57:1635f247ceae
Parent:
53:071ae5d090d1
Child:
59:f35aa61c59dd
--- a/OneWire_Masters/GPIO/owlink.s	Tue Apr 12 10:51:20 2016 -0500
+++ b/OneWire_Masters/GPIO/owlink.s	Wed Apr 13 18:52:34 2016 -0500
@@ -104,13 +104,6 @@
   str R2, [R0]
   bx R14
   
-// static unsigned int read_ow_gpio(unsigned int * portReg, unsigned int pinMask)
-  THUMB_FUNC
-LABEL(read_ow_gpio)
-  ldr R0, [R0]
-  and R0, R0, R1
-  bx R14
-  
 // void ow_bit(uint8_t * sendrecvbit, volatile uint32_t * inPortReg, volatile uint32_t * outPortReg, unsigned int pinMask, const OwTiming * timing)
   THUMB_FUNC
   EXPORT_LABEL(ow_bit)
@@ -173,9 +166,7 @@
   bl write_ow_gpio_high // Release pin
   mov R0, R5 // delay2
   bl ow_usdelay // Delay for sample time
-  mov R0, R8 // inPortReg
-  bl read_ow_gpio // Read pin
-  mov R5, R0 // Store read value for later
+  ldr R5, [R8] // Read *inPortReg
   b recovery_delay
   // else
 LABEL(write_zero)
@@ -196,9 +187,7 @@
   bl write_ow_gpio_low // Pull low
   mov R0, R5 // tMSR
   bl ow_usdelay // Delay for tMSR
-  mov R0, R8 // inPortReg
-  bl read_ow_gpio // Read pin
-  mov R5, R0 // Store read value for later
+  ldr R5, [R8] // Read *inPortReg
   mov R0, R6 // delay2
   bl ow_usdelay // Delay for release
   mov R0, R7 // outPortReg
@@ -209,7 +198,7 @@
   // R2: Scratch
   // R3: sendrecvbit
   // R4: tREC
-  // R5: read value
+  // R5: *inPortReg
   // R6: Scratch
   // R7: outPortReg
   // R8: inPortReg
@@ -219,7 +208,15 @@
   mov R0, R4
   bl ow_usdelay // Delay for tREC
   
+  // Parse received bit
+  // *sendrecvbit = ((*inPortReg & pinMask) == pinMask)
+  and R5, R5, R1
+  cmp R5, R1
+  ite eq
+  moveq R5, #1
+  movne R5, #0
   strb R5, [R3]
+  
   pop {R4-R8, R14}
   bx R14
 #ifdef TOOLCHAIN_GCC_ARM