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 22:14:58 +01:00
|
|
|
#ifndef MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|
|
|
|
#define MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|
2016-04-12 13:53:04 +01:00
|
|
|
|
|
|
|
#include "py/obj.h"
|
|
|
|
|
2015-02-13 22:21:44 +00:00
|
|
|
extern const mp_obj_type_t pyb_pin_type;
|
2015-06-22 23:03:17 +01:00
|
|
|
extern const mp_obj_type_t pyb_rtc_type;
|
2016-12-08 03:41:58 +00:00
|
|
|
extern const mp_obj_type_t machine_hspi_type;
|
2015-12-29 00:19:23 +00:00
|
|
|
|
2016-10-18 01:06:20 +01:00
|
|
|
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
|
2016-04-28 12:23:55 +01:00
|
|
|
|
2016-02-11 11:41:58 +00:00
|
|
|
typedef struct _pyb_pin_obj_t {
|
|
|
|
mp_obj_base_t base;
|
|
|
|
uint16_t phys_port;
|
|
|
|
uint16_t func;
|
2016-04-13 22:38:44 +01:00
|
|
|
uint32_t periph;
|
2016-02-11 11:41:58 +00:00
|
|
|
} pyb_pin_obj_t;
|
|
|
|
|
2016-04-22 10:04:12 +01:00
|
|
|
const pyb_pin_obj_t pyb_pin_obj[16 + 1];
|
|
|
|
|
2020-02-25 21:53:46 +00: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 11:15:43 +01:00
|
|
|
void pin_init0(void);
|
|
|
|
|
2015-12-29 00:19:23 +00:00
|
|
|
uint mp_obj_get_pin(mp_obj_t pin_in);
|
2016-02-11 11:41:58 +00:00
|
|
|
pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in);
|
2015-12-29 00:19:23 +00:00
|
|
|
int pin_get(uint pin);
|
|
|
|
void pin_set(uint pin, int value);
|
2016-04-12 13:53:04 +01:00
|
|
|
|
2016-11-05 22:30:19 +00:00
|
|
|
extern uint32_t pyb_rtc_alarm0_wake;
|
|
|
|
extern uint64_t pyb_rtc_alarm0_expiry;
|
|
|
|
|
2020-09-14 03:15:03 +01:00
|
|
|
void pyb_rtc_set_us_since_epoch(uint64_t nowus);
|
|
|
|
uint64_t pyb_rtc_get_us_since_epoch();
|
2016-11-05 22:30:19 +00: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 22:14:58 +01:00
|
|
|
#endif // MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|