2016-04-12 08:53:04 -04:00
|
|
|
#ifndef __MICROPY_INCLUDED_ESP8266_MODPYB_H__
|
|
|
|
#define __MICROPY_INCLUDED_ESP8266_MODPYB_H__
|
|
|
|
|
|
|
|
#include "py/obj.h"
|
|
|
|
|
2015-02-13 17:21:44 -05:00
|
|
|
extern const mp_obj_type_t pyb_pin_type;
|
2016-03-02 08:37:27 -05:00
|
|
|
extern const mp_obj_type_t pyb_pwm_type;
|
2015-05-18 12:35:56 -04:00
|
|
|
extern const mp_obj_type_t pyb_adc_type;
|
2015-06-22 18:03:17 -04:00
|
|
|
extern const mp_obj_type_t pyb_rtc_type;
|
2016-04-06 12:45:52 -04:00
|
|
|
extern const mp_obj_type_t pyb_uart_type;
|
2016-02-11 07:43:41 -05:00
|
|
|
extern const mp_obj_type_t pyb_i2c_type;
|
2016-03-01 17:53:23 -05:00
|
|
|
extern const mp_obj_type_t pyb_spi_type;
|
2016-06-07 15:40:56 -04:00
|
|
|
extern const mp_obj_type_t pyb_hspi_type;
|
2016-08-19 12:55:07 -04:00
|
|
|
extern const mp_obj_type_t machine_spi_type;
|
2015-12-28 19:19:23 -05:00
|
|
|
|
2016-10-17 20:06:20 -04:00
|
|
|
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
|
2016-04-28 07:23:55 -04:00
|
|
|
|
2016-02-11 06:41:58 -05:00
|
|
|
typedef struct _pyb_pin_obj_t {
|
|
|
|
mp_obj_base_t base;
|
|
|
|
uint16_t phys_port;
|
|
|
|
uint16_t func;
|
2016-04-13 17:38:44 -04:00
|
|
|
uint32_t periph;
|
2016-02-11 06:41:58 -05:00
|
|
|
} pyb_pin_obj_t;
|
|
|
|
|
2016-04-22 05:04:12 -04:00
|
|
|
const pyb_pin_obj_t pyb_pin_obj[16 + 1];
|
|
|
|
|
2016-04-14 06:15:43 -04:00
|
|
|
void pin_init0(void);
|
|
|
|
void pin_intr_handler_iram(void *arg);
|
|
|
|
void pin_intr_handler(uint32_t);
|
|
|
|
|
2015-12-28 19:19:23 -05:00
|
|
|
uint mp_obj_get_pin(mp_obj_t pin_in);
|
2016-02-11 06:41:58 -05:00
|
|
|
pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in);
|
2015-12-28 19:19:23 -05:00
|
|
|
int pin_get(uint pin);
|
|
|
|
void pin_set(uint pin, int value);
|
2016-04-12 08:53:04 -04:00
|
|
|
|
2016-11-05 18:30:19 -04:00
|
|
|
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);
|
|
|
|
|
2016-04-12 08:53:04 -04:00
|
|
|
#endif // __MICROPY_INCLUDED_ESP8266_MODPYB_H__
|