summaryrefslogtreecommitdiff
path: root/ports/esp8266/modmachine.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-09-06 13:40:51 +1000
committerDamien George <damien.p.george@gmail.com>2017-09-06 13:40:51 +1000
commit01dd7804b87d60b2deab16712eccb3b97351a9b7 (patch)
tree1aa21f38a872b8e62a3d4e4f74f68033c6f827e4 /ports/esp8266/modmachine.h
parenta9862b30068fc9df1022f08019fb35aaa5085f64 (diff)
ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.
Diffstat (limited to 'ports/esp8266/modmachine.h')
-rw-r--r--ports/esp8266/modmachine.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/ports/esp8266/modmachine.h b/ports/esp8266/modmachine.h
new file mode 100644
index 000000000..eae351f68
--- /dev/null
+++ b/ports/esp8266/modmachine.h
@@ -0,0 +1,41 @@
+#ifndef MICROPY_INCLUDED_ESP8266_MODMACHINE_H
+#define MICROPY_INCLUDED_ESP8266_MODMACHINE_H
+
+#include "py/obj.h"
+
+extern const mp_obj_type_t pyb_pin_type;
+extern const mp_obj_type_t pyb_pwm_type;
+extern const mp_obj_type_t pyb_adc_type;
+extern const mp_obj_type_t pyb_rtc_type;
+extern const mp_obj_type_t pyb_uart_type;
+extern const mp_obj_type_t pyb_i2c_type;
+extern const mp_obj_type_t machine_hspi_type;
+
+MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
+
+typedef struct _pyb_pin_obj_t {
+ mp_obj_base_t base;
+ uint16_t phys_port;
+ uint16_t func;
+ uint32_t periph;
+} pyb_pin_obj_t;
+
+const pyb_pin_obj_t pyb_pin_obj[16 + 1];
+
+void pin_init0(void);
+void pin_intr_handler_iram(void *arg);
+void pin_intr_handler(uint32_t);
+
+uint mp_obj_get_pin(mp_obj_t pin_in);
+pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in);
+int pin_get(uint pin);
+void pin_set(uint pin, int value);
+
+extern uint32_t pyb_rtc_alarm0_wake;
+extern uint64_t pyb_rtc_alarm0_expiry;
+
+void pyb_rtc_set_us_since_2000(uint64_t nowus);
+uint64_t pyb_rtc_get_us_since_2000();
+void rtc_prepare_deepsleep(uint64_t sleep_us);
+
+#endif // MICROPY_INCLUDED_ESP8266_MODMACHINE_H