all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.
This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.
The rules are as follows.
Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _
In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.
py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-06-29 17:14:58 -04:00
|
|
|
#ifndef MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|
|
|
|
#define MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|
2016-04-12 08:53:04 -04:00
|
|
|
|
|
|
|
#include "py/obj.h"
|
|
|
|
|
2015-02-13 17:21:44 -05:00
|
|
|
extern const mp_obj_type_t pyb_pin_type;
|
2019-07-19 22:41:20 -04:00
|
|
|
extern const mp_obj_type_t machine_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-12-07 22:41:58 -05:00
|
|
|
extern const mp_obj_type_t machine_hspi_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];
|
|
|
|
|
2020-02-25 16:53:46 -05:00
|
|
|
#define GPIO_MODE_INPUT (0)
|
|
|
|
#define GPIO_MODE_OUTPUT (1)
|
|
|
|
#define GPIO_MODE_OPEN_DRAIN (2) // synthesised
|
|
|
|
#define GPIO_PULL_NONE (0)
|
|
|
|
#define GPIO_PULL_UP (1)
|
|
|
|
// Removed in SDK 1.1.0
|
|
|
|
// #define GPIO_PULL_DOWN (2)
|
|
|
|
|
|
|
|
extern uint8_t pin_mode[16 + 1];
|
|
|
|
|
2016-04-14 06:15:43 -04:00
|
|
|
void pin_init0(void);
|
|
|
|
|
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;
|
|
|
|
|
2020-09-13 22:15:03 -04:00
|
|
|
void pyb_rtc_set_us_since_epoch(uint64_t nowus);
|
|
|
|
uint64_t pyb_rtc_get_us_since_epoch();
|
2016-11-05 18:30:19 -04:00
|
|
|
void rtc_prepare_deepsleep(uint64_t sleep_us);
|
|
|
|
|
all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.
This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.
The rules are as follows.
Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _
In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.
py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-06-29 17:14:58 -04:00
|
|
|
#endif // MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|