feat(driver): Clean up header files dependency

This commit is contained in:
Wu Jian Gang
2018-05-19 23:49:26 +08:00
parent 78bdcf043e
commit 3c560f678a
8 changed files with 49 additions and 18 deletions

View File

@ -12,8 +12,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "esp_common.h"
#include "freertos/portmacro.h" #include <stdint.h>
#include "esp8266/eagle_soc.h"
#include "esp8266/pin_mux_register.h"
#include "FreeRTOS.h"
#include "gpio.h" #include "gpio.h"

View File

@ -12,8 +12,15 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "esp_common.h" #include <stddef.h>
#include "freertos/portmacro.h" #include <stdbool.h>
#include <stdint.h>
#include "esp8266/ets_sys.h"
#include "esp8266/eagle_soc.h"
#include "esp8266/timer_register.h"
#include "FreeRTOS.h"
#define US_TO_RTC_TIMER_TICKS(t) \ #define US_TO_RTC_TIMER_TICKS(t) \
((t) ? \ ((t) ? \

View File

@ -12,14 +12,17 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "c_types.h" #include <stdint.h>
#include <stdbool.h>
#include "esp8266/ets_sys.h" #include "esp8266/ets_sys.h"
#include "esp_misc.h" #include "esp_misc.h"
#include "gpio.h"
#include "freertos/portmacro.h"
#include "gpio.h"
#include "i2c_master.h" #include "i2c_master.h"
#include "FreeRTOS.h"
static uint8_t m_nLastSDA; static uint8_t m_nLastSDA;
static uint8_t m_nLastSCL; static uint8_t m_nLastSCL;
@ -215,9 +218,9 @@ uint8_t i2c_master_getAck(void)
bool i2c_master_checkAck(void) bool i2c_master_checkAck(void)
{ {
if (i2c_master_getAck()) { if (i2c_master_getAck()) {
return FALSE; return false;
} else { } else {
return TRUE; return true;
} }
} }

View File

@ -17,12 +17,15 @@
* @brief Defines and Macros for the SPI. * @brief Defines and Macros for the SPI.
*/ */
#include "spi_interface.h" #include <stdint.h>
#include "esp8266/eagle_soc.h"
#include "esp8266/ets_sys.h" #include "esp8266/ets_sys.h"
#include "esp8266/pin_mux_register.h" #include "esp8266/pin_mux_register.h"
#include "esp_libc.h"
#include "freertos/portmacro.h" #include "spi_interface.h"
#include "FreeRTOS.h"
//***************************************************************************** //*****************************************************************************
// //
// Make sure all of the definitions in this header have a C binding. // Make sure all of the definitions in this header have a C binding.

View File

@ -12,14 +12,21 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "esp_common.h" #include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "esp8266/pin_mux_register.h"
#include "esp8266/uart_register.h"
#include "esp8266/rom_functions.h"
#include "esp_misc.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/queue.h" #include "freertos/queue.h"
#include "uart.h" #include "uart.h"
#include "esp8266/rom_functions.h"
enum { enum {
UART_EVENT_RX_CHAR, UART_EVENT_RX_CHAR,

View File

@ -19,6 +19,8 @@
extern "C" { extern "C" {
#endif #endif
#include "esp8266/uart_register.h"
#define ETS_UART_INTR_ENABLE() _xt_isr_unmask(1 << ETS_UART_INUM) #define ETS_UART_INTR_ENABLE() _xt_isr_unmask(1 << ETS_UART_INUM)
#define ETS_UART_INTR_DISABLE() _xt_isr_mask(1 << ETS_UART_INUM) #define ETS_UART_INTR_DISABLE() _xt_isr_mask(1 << ETS_UART_INUM)
#define UART_INTR_MASK 0x1ff #define UART_INTR_MASK 0x1ff

View File

@ -25,6 +25,8 @@
#ifndef _EAGLE_SOC_H_ #ifndef _EAGLE_SOC_H_
#define _EAGLE_SOC_H_ #define _EAGLE_SOC_H_
#include <stdint.h>
//Register Bits{{ //Register Bits{{
#define BIT31 0x80000000 #define BIT31 0x80000000
#define BIT30 0x40000000 #define BIT30 0x40000000
@ -64,8 +66,8 @@
#define ETS_UNCACHED_ADDR(addr) (addr) #define ETS_UNCACHED_ADDR(addr) (addr)
#define ETS_CACHED_ADDR(addr) (addr) #define ETS_CACHED_ADDR(addr) (addr)
#define READ_PERI_REG(addr) (*((volatile uint32 *)ETS_UNCACHED_ADDR(addr))) #define READ_PERI_REG(addr) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr)))
#define WRITE_PERI_REG(addr, val) (*((volatile uint32 *)ETS_UNCACHED_ADDR(addr))) = (uint32)(val) #define WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)
#define CLEAR_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg) & (~(mask)))) #define CLEAR_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg) & (~(mask))))
#define SET_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg) | (mask))) #define SET_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg) | (mask)))
#define GET_PERI_REG_BITS(reg, hipos, lowpos) ((READ_PERI_REG(reg) >> (lowpos)) & ((1 << ((hipos) - (lowpos) + 1)) - 1)) #define GET_PERI_REG_BITS(reg, hipos, lowpos) ((READ_PERI_REG(reg) >> (lowpos)) & ((1 << ((hipos) - (lowpos) + 1)) - 1))

View File

@ -25,6 +25,8 @@
#ifndef __ETS_SYS_H__ #ifndef __ETS_SYS_H__
#define __ETS_SYS_H__ #define __ETS_SYS_H__
#include <stdint.h>
/* interrupt related */ /* interrupt related */
#define ETS_SPI_INUM 2 #define ETS_SPI_INUM 2
#define ETS_GPIO_INUM 4 #define ETS_GPIO_INUM 4
@ -35,7 +37,7 @@
#define ETS_FRC_TIMER1_INUM 9 #define ETS_FRC_TIMER1_INUM 9
extern char NMIIrqIsOn; extern char NMIIrqIsOn;
extern uint32 WDEV_INTEREST_EVENT; extern uint32_t WDEV_INTEREST_EVENT;
#define INT_ENA_WDEV 0x3ff20c18 #define INT_ENA_WDEV 0x3ff20c18
#define WDEV_TSF0_REACH_INT (BIT(27)) #define WDEV_TSF0_REACH_INT (BIT(27))