update 433MHz transmission doc, add static ICACHE_FLASH_ATTR flag

This commit is contained in:
Mike Wen 2015-06-27 14:42:39 -04:00
parent d955c8815b
commit cf72a3203d
3 changed files with 5 additions and 4 deletions

View File

@ -47,7 +47,7 @@
// #define BUILD_WOFS 1 // #define BUILD_WOFS 1
#define BUILD_SPIFFS 1 #define BUILD_SPIFFS 1
// #define LUA_NUMBER_INTEGRAL #define LUA_NUMBER_INTEGRAL
#define LUA_OPTRAM #define LUA_OPTRAM
#ifdef LUA_OPTRAM #ifdef LUA_OPTRAM

View File

@ -169,7 +169,6 @@ _ROM(MODULES_RC, luaopen_rc, rc_map)
ROM_MODULES_GPIO \ ROM_MODULES_GPIO \
ROM_MODULES_PWM \ ROM_MODULES_PWM \
ROM_MODULES_WIFI \ ROM_MODULES_WIFI \
ROM_MODULES_COAP \
ROM_MODULES_MQTT \ ROM_MODULES_MQTT \
ROM_MODULES_U8G \ ROM_MODULES_U8G \
ROM_MODULES_I2C \ ROM_MODULES_I2C \
@ -187,4 +186,6 @@ _ROM(MODULES_RC, luaopen_rc, rc_map)
ROM_MODULES_CRYPTO \ ROM_MODULES_CRYPTO \
ROM_MODULES_RC ROM_MODULES_RC
// ROM_MODULES_COAP \
#endif #endif

View File

@ -9,13 +9,13 @@
#define defProtocol 1 #define defProtocol 1
#define defRepeat 10 #define defRepeat 10
#define defBits 24 #define defBits 24
void transmit(int pin, int pulseLen, int nHighPulses, int nLowPulses) { static void ICACHE_FLASH_ATTR transmit(int pin, int pulseLen, int nHighPulses, int nLowPulses) {
platform_gpio_write(pin, 1); platform_gpio_write(pin, 1);
os_delay_us(pulseLen*nHighPulses); os_delay_us(pulseLen*nHighPulses);
platform_gpio_write(pin, 0); platform_gpio_write(pin, 0);
os_delay_us(pulseLen*nLowPulses); os_delay_us(pulseLen*nLowPulses);
} }
//rc.send(0,267715,24,185,1) --GPIO, code, bits, pulselen, protocol //rc.send(4,267715,24,185,1,10) --GPIO, code, bits, pulselen, protocol, repeat
static int ICACHE_FLASH_ATTR rc_send(lua_State* L) { static int ICACHE_FLASH_ATTR rc_send(lua_State* L) {
const uint8_t pin = luaL_checkinteger(L, 1); const uint8_t pin = luaL_checkinteger(L, 1);
platform_gpio_mode(pin, PLATFORM_GPIO_OUTPUT, PLATFORM_GPIO_FLOAT); platform_gpio_mode(pin, PLATFORM_GPIO_OUTPUT, PLATFORM_GPIO_FLOAT);