blob: c23a119e8dc0c1e07d665b487afa50d045556002 [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 George82b95f62016-03-01 22:53:23 +000012extern const mp_obj_type_t pyb_spi_type;
Radomir Dopieralski8e7dfea2016-06-07 21:40:56 +020013extern const mp_obj_type_t pyb_hspi_type;
Radomir Dopieralskid076fae2016-08-19 18:55:07 +020014extern const mp_obj_type_t machine_spi_type;
Damien George342d9032015-12-29 00:19:23 +000015
Damien George4ebdb1f2016-10-18 11:06:20 +110016MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
Damien Georgea6aa35a2016-04-28 12:23:55 +010017
Damien George7059c8c2016-02-11 11:41:58 +000018typedef struct _pyb_pin_obj_t {
19 mp_obj_base_t base;
Damien George7059c8c2016-02-11 11:41:58 +000020 uint16_t phys_port;
Damien George7059c8c2016-02-11 11:41:58 +000021 uint16_t func;
Damien Georgea9a732a2016-04-13 22:38:44 +010022 uint32_t periph;
Damien George7059c8c2016-02-11 11:41:58 +000023} pyb_pin_obj_t;
24
Damien Georgea2d5d842016-04-22 10:04:12 +010025const pyb_pin_obj_t pyb_pin_obj[16 + 1];
26
Damien George674bf1b2016-04-14 11:15:43 +010027void pin_init0(void);
28void pin_intr_handler_iram(void *arg);
29void pin_intr_handler(uint32_t);
30
Damien George342d9032015-12-29 00:19:23 +000031uint mp_obj_get_pin(mp_obj_t pin_in);
Damien George7059c8c2016-02-11 11:41:58 +000032pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in);
Damien George342d9032015-12-29 00:19:23 +000033int pin_get(uint pin);
34void pin_set(uint pin, int value);
Damien George1a65ff12016-04-12 13:53:04 +010035
36#endif // __MICROPY_INCLUDED_ESP8266_MODPYB_H__