Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Max32630_One_Wire_Interface
Diff: OneWire_Masters/GPIO/owgpio.h
- Revision:
- 10:0df2cc66fc47
- Parent:
- 9:641516a3f0dc
- Child:
- 11:2833f27ba319
--- a/OneWire_Masters/GPIO/owgpio.h Mon Feb 29 02:35:12 2016 +0000
+++ b/OneWire_Masters/GPIO/owgpio.h Sat Mar 05 01:51:00 2016 +0000
@@ -47,6 +47,9 @@
#define OWGPIO_H
+#if(TARGET_MAX32600)
+
+
#include "mbed.h"
#include "OneWireInterface.h"
#include "OneWireMastersShared.h"
@@ -56,40 +59,78 @@
{
public:
- //1-wire timming constants for bit-bang.
- //Tested on MAX32600MBED board, you will have to adjust if using a different board
- //values in comments are real timming values
+ //1-wire timming constants for bit-bang.
+ //Bit-Bang Master only supported on MAX32600MBED board
+ //All times are in terms of micro seconds
- //Reset Pulse
- static const uint16_t TRSTL_STD = (2250); //560us, from falling edge
+ static const uint16_t TRSTL_STD = 560;
+ static const uint16_t TRSTL_OVD = 56;
//Master sample time for PD
- static const uint16_t TMSP_STD = (250); //68us, from rising edge of reset pulse
+ static const uint16_t TMSP_STD = 68;
+ static const uint16_t TMSP_OVD = 8;
//Write 0
- static const uint16_t TW0L_STD = (240); //64us, from falling edge
+ static const uint16_t TW0L_STD = 64;
+ static const uint16_t TW0L_OVD = 8;
//Write 1, Read low time
- static const uint16_t TW1L_STD = (20); //8us, from falling edge
+ static const uint16_t TW1L_STD = 8;
+ static const uint16_t TW1L_OVD = 1;
//Master sample time for bit
- static const uint16_t TMSR_STD = (3); //12us, from falling edge
+ static const uint16_t TMSR_STD = 12;
+ static const uint16_t TMSR_OVD = 1;
- //make sure to use TSLOT for recoveries, 70us is greater than min value
- static const uint16_t TSLOT_STD = (70); //70us, measured from falling to falling.
+ //make sure to use TSLOT for recoveries
+ static const uint16_t TSLOT_STD = 70;
+ static const uint16_t TSLOT_OVD = 10;
/**********************************************************//**
- * @brief
+ * @brief Owgpio constructor
+ *
+ * @details Initializes given pin for open-drain operation
+ *
+ * On Entry:
+ *
+ * @para[in] ow_gpio - GPIO pin to use for One Wire bus
+ *
+ * @param[in] ext_spu - GPIO pin to use for Strong Pull-Up
+ *
+ * On Exit:
+ *
+ * @return
+ **************************************************************/
+ OwGpio(PinName ow_gpio, PinName ext_spu = NC);
+
+
+ /**********************************************************//**
+ * @brief OwGpio destructor
+ *
+ * @details
+ *
+ * On Entry:
+ *
+ * On Exit:
+ *
+ * @return
+ **************************************************************/
+ virtual ~OwGpio();
+
+
+ /**********************************************************//**
+ * @brief initializes 16-bit counter_0 of TMR3 on MAX32600MBED
*
* @details
*
* On Entry:
*
* On Exit:
- * @return
+ *
+ * @return
**************************************************************/
- OwGpio(PinName ow_gpio, PinName ext_spu = NC);
+ static void init_ow_timer(void);
/***** OW API ****************************************************/
@@ -149,12 +190,15 @@
private:
- DigitalInOut _ow_gpio;
+ void init_ow_gpio(PinName ow_gpio);
+
DigitalOut _ext_spu;
-
OW_SPEED _ow_speed;
OW_LEVEL _ow_level;
+ uint32_t _ow_port;
+ uint32_t _ow_pin;
+
// Search state
uint8_t _rom_number[ROMnumberLen];
uint8_t _last_discrepancy;
@@ -163,4 +207,5 @@
uint8_t _crc8;
};
+#endif/* TARGET_MAX32600*/
#endif /*OWGPIO_H*/