@@ 41,6 41,21 @@
#define mmregs ((volatile struct mmregs_layout * volatile) (void *) 0x0)
/*
+ * GPIO pin setting helper
+ */
+#define PORTB (offsetof(struct mmregs_layout, portb) - 0x20)
+#define PORTC (offsetof(struct mmregs_layout, portc) - 0x20)
+#define PORTD (offsetof(struct mmregs_layout, portd) - 0x20)
+
+static inline void __set_pin(uint8_t port, uint8_t pin, bool set)
+{
+ if (set)
+ asm volatile("sbi %0, %1" :: "I" (port), "I" (pin));
+ else
+ asm volatile("cbi %0, %1" :: "I" (port), "I" (pin));
+}
+
+/*
* Macros to construct PORT and DDR register values
*/
#define PIN_INPUT_PORT_Z(bit) 0