diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-11-06 01:30:19 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-11-06 01:30:19 +0300 |
commit | 8bc3fc20feca9ebe9e9972aeb6b68a81d792c5df (patch) | |
tree | 5b20cca6c25356f0d812637ef2a0bdebd34c32c6 /esp8266/modmachine.h | |
parent | 3ccdbf792cb04fb5561dae52839b51a854f75808 (diff) | |
download | micropython-8bc3fc20feca9ebe9e9972aeb6b68a81d792c5df.tar.gz micropython-8bc3fc20feca9ebe9e9972aeb6b68a81d792c5df.zip |
esp8266: Rename "machine" module implementation to use contemporary naming.
Previously they used historical "pyb" affix causing confusion and
inconsistency (there's no "pyb" module in modern ports; but people
took esp8266 port as an example, and "pyb" naming kept proliferating,
while other people complained that source structure is not clear).
Diffstat (limited to 'esp8266/modmachine.h')
-rw-r--r-- | esp8266/modmachine.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/esp8266/modmachine.h b/esp8266/modmachine.h new file mode 100644 index 0000000000..df7953ecb6 --- /dev/null +++ b/esp8266/modmachine.h @@ -0,0 +1,43 @@ +#ifndef __MICROPY_INCLUDED_ESP8266_MODPYB_H__ +#define __MICROPY_INCLUDED_ESP8266_MODPYB_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 pyb_spi_type; +extern const mp_obj_type_t pyb_hspi_type; +extern const mp_obj_type_t machine_spi_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_MODPYB_H__ |