Merge pull request #10 from the-real-orca/mingw
[simavr] / simavr / sim / avr_twi.h
index 21c3687..70911a2 100644 (file)
        along with simavr.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef AVR_TWI_H_
-#define AVR_TWI_H_
+#ifndef __AVR_TWI_H__
+#define __AVR_TWI_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include "sim_avr.h"
 
@@ -94,21 +98,17 @@ avr_twi_init(
                avr_twi_t * port);
 
 /*
- * Create a message value for twi incuding the 'msg' bitfield,
+ * Create a message value for twi including the 'msg' bitfield,
  * 'addr' and data. This value is what is sent as the IRQ value
  */
-static inline uint32_t
+uint32_t
 avr_twi_irq_msg(
                uint8_t msg,
                uint8_t addr,
-               uint8_t data)
-{
-       avr_twi_msg_irq_t _msg = {
-                       .u.twi.msg = msg,
-                       .u.twi.addr = addr,
-                       .u.twi.data = data,
-       };
-       return _msg.u.v;
-}
-
-#endif /* AVR_TWI_H_ */
+               uint8_t data);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /*__AVR_TWI_H__*/