Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodemcu/nodemcu-firmware
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b4f8acca13c85581f538723568aa8c29d8a5d624
Choose a base ref
..
head repository: nodemcu/nodemcu-firmware
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3dfc0281327e7c632996908c30656dc7936a6e80
Choose a head ref
Showing with 8 additions and 8 deletions.
  1. +8 −8 app/modules/bh1750.c
16 changes: 8 additions & 8 deletions app/modules/bh1750.c
Original file line number Diff line number Diff line change
@@ -26,15 +26,15 @@ typedef enum {
uint16_t platform_bh1750_sensitivity = PLATFORM_BH1750_DEFAULT_SENSITIVITY;
uint8_t platform_bh1750_mode = PLATFORM_BH1750_CONTINUOUS_AUTO;

static void ICACHE_FLASH_ATTR send_command( uint8_t command )
static void send_command( uint8_t command )
{
platform_i2c_send_start(0);
platform_i2c_send_address(0, BH1750_ADDRESS, PLATFORM_I2C_DIRECTION_TRANSMITTER);
platform_i2c_send_byte(0, command);
platform_i2c_send_stop(0);
}

static void ICACHE_FLASH_ATTR set_sensitivity( uint8_t sensitivity )
static void set_sensitivity( uint8_t sensitivity )
{
send_command((uint8_t) (0b01000 << 3) | (sensitivity >> 5));
send_command((uint8_t) (0b011 << 5 ) | (uint8_t) (sensitivity & 0b11111));
@@ -48,7 +48,7 @@ static void ICACHE_FLASH_ATTR set_sensitivity( uint8_t sensitivity )
}
}

static void ICACHE_FLASH_ATTR platform_bh1750_setup( platform_bh1750_mode_t mode, uint8_t sensitivity )
static void platform_bh1750_setup( platform_bh1750_mode_t mode, uint8_t sensitivity )
{
platform_bh1750_mode = mode;

@@ -63,12 +63,12 @@ static void ICACHE_FLASH_ATTR platform_bh1750_setup( platform_bh1750_mode_t mode
}
}

static void ICACHE_FLASH_ATTR platform_bh1750_power_down()
static void platform_bh1750_power_down()
{
send_command(PLATFORM_BH1750_POWER_DOWN);
}

static uint32_t ICACHE_FLASH_ATTR platform_bh1750_read()
static uint32_t platform_bh1750_read()
{
uint32_t value;
platform_i2c_send_start(0);
@@ -92,7 +92,7 @@ static uint32_t ICACHE_FLASH_ATTR platform_bh1750_read()
return lux_value;
}

static int ICACHE_FLASH_ATTR bh1750_setup(lua_State *L)
static int bh1750_setup(lua_State *L)
{
platform_bh1750_mode_t mode = (platform_bh1750_mode_t) luaL_optinteger( L, 1, PLATFORM_BH1750_CONTINUOUS_AUTO );
uint8_t sensitivity = (uint8_t) luaL_optinteger( L, 2, PLATFORM_BH1750_DEFAULT_SENSITIVITY );
@@ -114,13 +114,13 @@ static int ICACHE_FLASH_ATTR bh1750_setup(lua_State *L)
return 0;
}

static ICACHE_FLASH_ATTR int bh1750_power_down(lua_State *L)
static int bh1750_power_down(lua_State *L)
{
platform_bh1750_power_down();
return 0;
}

static ICACHE_FLASH_ATTR int bh1750_read(lua_State *L)
static int bh1750_read(lua_State *L)
{
lua_pushinteger(L, platform_bh1750_read());
return 1;