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:
- 28:057bb14d3cee
- Parent:
- 26:a361e3f42ba5
- Child:
- 32:bce180b544ed
--- a/OneWire_Masters/GPIO/owgpio.h Fri Mar 25 11:11:59 2016 -0500
+++ b/OneWire_Masters/GPIO/owgpio.h Tue Mar 29 09:55:25 2016 -0500
@@ -45,35 +45,16 @@
class OwGpio: public OneWireMaster
{
public:
-
- //1-wire timming constants for bit-bang.
- //Bit-Bang Master only supported on MAX32600MBED board
- //All times are in terms of micro seconds
-
- 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 = 68;
- static const uint16_t TMSP_OVD = 8;
+
+ struct OwTiming
+ {
+ uint16_t tRSTL, tMSP, tW0L, tW1L, tMSR, tSLOT; // All times are in terms of micro seconds
+ };
- //Write 0
- 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 = 8;
- static const uint16_t TW1L_OVD = 0; //closest to 1us I can get
-
- //Master sample time for bit
- static const uint16_t TMSR_STD = 12;
- static const uint16_t TMSR_OVD = 0; //closest to 1us I can get
-
- //make sure to use TSLOT for recoveries
- static const uint16_t TSLOT_STD = 70;
- static const uint16_t TSLOT_OVD = 10;
-
-
+ static const OwTiming stdTiming;
+ static const OwTiming odTiming;
+
+
/**********************************************************//**
* @brief Owgpio constructor
*
@@ -92,20 +73,6 @@
OwGpio(PinName ow_gpio, PinName ext_spu = NC);
- /**********************************************************//**
- * @brief OwGpio destructor
- *
- * @details
- *
- * On Entry:
- *
- * On Exit:
- *
- * @return
- **************************************************************/
- virtual ~OwGpio();
-
-
//Part of OneWireMaster that should be implemented for each master
//See OneWireMaster.h for documentation
@@ -131,24 +98,17 @@
private:
- //counts instances of this class being created
- static uint32_t ow_instance_cnt;
-
- static void init_ow_timer(void);
- static void release_ow_timer(void);
-
- void init_ow_gpio(uint32_t ow_port, uint32_t ow_pin);
- void release_ow_gpio();
-
- //specific instance of this class
- uint32_t _ow_instance;
-
+ const unsigned int _ow_port;
+ const unsigned int _ow_pin;
+
DigitalOut _ext_spu;
OW_SPEED _ow_speed;
- OW_LEVEL _ow_level;
+ OW_LEVEL _ow_level;
- uint32_t _ow_port;
- uint32_t _ow_pin;
+ inline void write_ow_gpio_low();
+ inline void write_ow_gpio_high();
+ inline bool read_ow_gpio();
+ inline void set_ow_gpio_mode(unsigned int mode);
};
#endif/* TARGET_MAX32600*/