blob: 414aaa85b0a14f26ce65b415e2963d9b5f1334d9 [file] [log] [blame]
Damien George1a65ff12016-04-12 13:53:04 +01001#ifndef __MICROPY_INCLUDED_ESP8266_MODPYB_H__
2#define __MICROPY_INCLUDED_ESP8266_MODPYB_H__
3
4#include "py/obj.h"
5
Damien George87c62502015-02-13 22:21:44 +00006extern const mp_obj_type_t pyb_pin_type;
Damien George632d8ef2016-03-02 13:37:27 +00007extern const mp_obj_type_t pyb_pwm_type;
Josef Gajdusek25a8a422015-05-18 18:35:56 +02008extern const mp_obj_type_t pyb_adc_type;
Damien Georgede8b5852015-06-22 23:03:17 +01009extern const mp_obj_type_t pyb_rtc_type;
Damien George1a0a3232016-04-06 19:45:52 +030010extern const mp_obj_type_t pyb_uart_type;
Damien Georgedd32f022016-02-11 12:43:41 +000011extern const mp_obj_type_t pyb_i2c_type;
Damien Georgead166852016-12-08 14:41:58 +110012extern const mp_obj_type_t machine_hspi_type;
Damien George342d9032015-12-29 00:19:23 +000013
Damien George4ebdb1f2016-10-18 11:06:20 +110014MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
Damien Georgea6aa35a2016-04-28 12:23:55 +010015
Damien George7059c8c2016-02-11 11:41:58 +000016typedef struct _pyb_pin_obj_t {
17 mp_obj_base_t base;
Damien George7059c8c2016-02-11 11:41:58 +000018 uint16_t phys_port;
Damien George7059c8c2016-02-11 11:41:58 +000019 uint16_t func;
Damien Georgea9a732a2016-04-13 22:38:44 +010020 uint32_t periph;
Damien George7059c8c2016-02-11 11:41:58 +000021} pyb_pin_obj_t;
22
Damien Georgea2d5d842016-04-22 10:04:12 +010023const pyb_pin_obj_t pyb_pin_obj[16 + 1];
24
Damien George674bf1b2016-04-14 11:15:43 +010025void pin_init0(void);
26void pin_intr_handler_iram(void *arg);
27void pin_intr_handler(uint32_t);
28
Damien George342d9032015-12-29 00:19:23 +000029uint mp_obj_get_pin(mp_obj_t pin_in);
Damien George7059c8c2016-02-11 11:41:58 +000030pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in);
Damien George342d9032015-12-29 00:19:23 +000031int pin_get(uint pin);
32void pin_set(uint pin, int value);
Damien George1a65ff12016-04-12 13:53:04 +010033
Paul Sokolovsky8bc3fc22016-11-06 01:30:19 +030034extern uint32_t pyb_rtc_alarm0_wake;
35extern uint64_t pyb_rtc_alarm0_expiry;
36
37void pyb_rtc_set_us_since_2000(uint64_t nowus);
38uint64_t pyb_rtc_get_us_since_2000();
39void rtc_prepare_deepsleep(uint64_t sleep_us);
40
Damien George1a65ff12016-04-12 13:53:04 +010041#endif // __MICROPY_INCLUDED_ESP8266_MODPYB_H__