Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ATS programming on ESP8266

5,181 views

Published on

ATS programming on ESP8266

Published in: Technology
  • Be the first to comment

ATS programming on ESP8266

  1. 1. ATS programming on ESP8266ATS programming on ESP8266ATS programming on ESP8266ATS programming on ESP8266ATS programming on ESP8266 Kiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu Okabe
  2. 2. ESP8266 moduleESP8266 moduleESP8266 moduleESP8266 moduleESP8266 module ☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/ ☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module ☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks ☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ... ☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm
  3. 3. ATS languageATS languageATS languageATS languageATS language ☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/ ☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types ☆ Linear types☆ Linear types☆ Linear types☆ Linear types☆ Linear types ☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC ☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free ☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time
  4. 4. DemoDemoDemoDemoDemo The code is found at following:The code is found at following:The code is found at following:The code is found at following:The code is found at following: https://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-ats
  5. 5. Demo environmentDemo environmentDemo environmentDemo environmentDemo environment
  6. 6. Software architectureSoftware architectureSoftware architectureSoftware architectureSoftware architecture
  7. 7. Example of ATS interfaceExample of ATS interfaceExample of ATS interfaceExample of ATS interfaceExample of ATS interface (*�https://github.com/fpiot/esp8266-ats/blob/ats/SATS/gpio.sats�*) %{# #include�"ets_sys.h" #include�"gpio.h" %} macdef�BIT2�=�$extval(uint,�"BIT2") macdef�GPIO_OUT_ADDRESS��=�$extval(int,�"GPIO_OUT_ADDRESS") macdef�PERIPHS_IO_MUX_GPIO2_U�=�$extval(ptr,�"PERIPHS_IO_MUX_GPIO2_U") macdef�FUNC_GPIO2�=�$extval(uint,�"FUNC_GPIO2") fun�GPIO_REG_READ�(x:�int):�uint�=�"mac#" fun�PIN_FUNC_SELECT�(p:�ptr,�v:�uint):�void�=�"mac#" fun�PIN_PULLUP_EN�(p:�ptr):�void�=�"mac#" fun�gpio_init�():�void�=�"mac#" fun�gpio_output_set�(set_mask:�uint,�clear_mask:�uint, ���������������������enable_mask:�uint,�disable_mask:�uint):�void�=�"mac#" (*�https://github.com/fpiot/esp8266-ats/blob/ats/SATS/gpio.sats�*) %{# #include�"ets_sys.h" #include�"gpio.h" %} macdef�BIT2�=�$extval(uint,�"BIT2") macdef�GPIO_OUT_ADDRESS��=�$extval(int,�"GPIO_OUT_ADDRESS") macdef�PERIPHS_IO_MUX_GPIO2_U�=�$extval(ptr,�"PERIPHS_IO_MUX_GPIO2_U") macdef�FUNC_GPIO2�=�$extval(uint,�"FUNC_GPIO2") fun�GPIO_REG_READ�(x:�int):�uint�=�"mac#" fun�PIN_FUNC_SELECT�(p:�ptr,�v:�uint):�void�=�"mac#" fun�PIN_PULLUP_EN�(p:�ptr):�void�=�"mac#" fun�gpio_init�():�void�=�"mac#" fun�gpio_output_set�(set_mask:�uint,�clear_mask:�uint, ���������������������enable_mask:�uint,�disable_mask:�uint):�void�=�"mac#" (*�https://github.com/fpiot/esp8266-ats/blob/ats/SATS/gpio.sats�*) %{# #include�"ets_sys.h" #include�"gpio.h" %} macdef�BIT2�=�$extval(uint,�"BIT2") macdef�GPIO_OUT_ADDRESS��=�$extval(int,�"GPIO_OUT_ADDRESS") macdef�PERIPHS_IO_MUX_GPIO2_U�=�$extval(ptr,�"PERIPHS_IO_MUX_GPIO2_U") macdef�FUNC_GPIO2�=�$extval(uint,�"FUNC_GPIO2") fun�GPIO_REG_READ�(x:�int):�uint�=�"mac#" fun�PIN_FUNC_SELECT�(p:�ptr,�v:�uint):�void�=�"mac#" fun�PIN_PULLUP_EN�(p:�ptr):�void�=�"mac#" fun�gpio_init�():�void�=�"mac#" fun�gpio_output_set�(set_mask:�uint,�clear_mask:�uint, ���������������������enable_mask:�uint,�disable_mask:�uint):�void�=�"mac#" (*�https://github.com/fpiot/esp8266-ats/blob/ats/SATS/gpio.sats�*) %{# #include�"ets_sys.h" #include�"gpio.h" %} macdef�BIT2�=�$extval(uint,�"BIT2") macdef�GPIO_OUT_ADDRESS��=�$extval(int,�"GPIO_OUT_ADDRESS") macdef�PERIPHS_IO_MUX_GPIO2_U�=�$extval(ptr,�"PERIPHS_IO_MUX_GPIO2_U") macdef�FUNC_GPIO2�=�$extval(uint,�"FUNC_GPIO2") fun�GPIO_REG_READ�(x:�int):�uint�=�"mac#" fun�PIN_FUNC_SELECT�(p:�ptr,�v:�uint):�void�=�"mac#" fun�PIN_PULLUP_EN�(p:�ptr):�void�=�"mac#" fun�gpio_init�():�void�=�"mac#" fun�gpio_output_set�(set_mask:�uint,�clear_mask:�uint, ���������������������enable_mask:�uint,�disable_mask:�uint):�void�=�"mac#" (*�https://github.com/fpiot/esp8266-ats/blob/ats/SATS/gpio.sats�*) %{# #include�"ets_sys.h" #include�"gpio.h" %} macdef�BIT2�=�$extval(uint,�"BIT2") macdef�GPIO_OUT_ADDRESS��=�$extval(int,�"GPIO_OUT_ADDRESS") macdef�PERIPHS_IO_MUX_GPIO2_U�=�$extval(ptr,�"PERIPHS_IO_MUX_GPIO2_U") macdef�FUNC_GPIO2�=�$extval(uint,�"FUNC_GPIO2") fun�GPIO_REG_READ�(x:�int):�uint�=�"mac#" fun�PIN_FUNC_SELECT�(p:�ptr,�v:�uint):�void�=�"mac#" fun�PIN_PULLUP_EN�(p:�ptr):�void�=�"mac#" fun�gpio_init�():�void�=�"mac#" fun�gpio_output_set�(set_mask:�uint,�clear_mask:�uint, ���������������������enable_mask:�uint,�disable_mask:�uint):�void�=�"mac#"
  8. 8. Example of ATS applicationExample of ATS applicationExample of ATS applicationExample of ATS applicationExample of ATS application (*�https://github.com/fpiot/esp8266-ats/blob/ats/blinky_ats/user/ user_main.dats�*) extern�fun�some_timerfunc�(arg:�ptr):�void implement�some_timerfunc�(arg)�=�{ ��val�()�=�println!�"some_timerfunc()�called." ��(*�Do�blinky�stuff�*) ��val�v�=�GPIO_REG_READ(GPIO_OUT_ADDRESS)�land�BIT2 ��val�()�=�if�v�!=�0�then �������������(*�Set�GPIO2�to�LOW�*) �������������gpio_output_set�(0U,�BIT2,�BIT2,�0U) �����������else �������������(*�Set�GPIO2�to�HIGH�*) �������������gpio_output_set�(BIT2,�0U,�BIT2,�0U) } extern�fun�user_init�():�void�=�"mac#" local ��var�some_timer:�os_timer_t in ��implement�user_init�()�=�{ ����val�()�=�uart_div_modify(0,�UART_CLK_FREQ�/�115200) ����val�()�=�println!�"nuser_init()�start." ����val�_��=�wifi_set_opmode_current�NULL_MODE ����(*�Initialize�the�GPIO�subsystem.�*) ����val�()�=�gpio_init�() (*�https://github.com/fpiot/esp8266-ats/blob/ats/blinky_ats/user/ user_main.dats�*) extern�fun�some_timerfunc�(arg:�ptr):�void implement�some_timerfunc�(arg)�=�{ ��val�()�=�println!�"some_timerfunc()�called." ��(*�Do�blinky�stuff�*) ��val�v�=�GPIO_REG_READ(GPIO_OUT_ADDRESS)�land�BIT2 ��val�()�=�if�v�!=�0�then �������������(*�Set�GPIO2�to�LOW�*) �������������gpio_output_set�(0U,�BIT2,�BIT2,�0U) �����������else �������������(*�Set�GPIO2�to�HIGH�*) �������������gpio_output_set�(BIT2,�0U,�BIT2,�0U) } extern�fun�user_init�():�void�=�"mac#" local ��var�some_timer:�os_timer_t in ��implement�user_init�()�=�{ ����val�()�=�uart_div_modify(0,�UART_CLK_FREQ�/�115200) ����val�()�=�println!�"nuser_init()�start." ����val�_��=�wifi_set_opmode_current�NULL_MODE ����(*�Initialize�the�GPIO�subsystem.�*) ����val�()�=�gpio_init�() (*�https://github.com/fpiot/esp8266-ats/blob/ats/blinky_ats/user/ user_main.dats�*) extern�fun�some_timerfunc�(arg:�ptr):�void implement�some_timerfunc�(arg)�=�{ ��val�()�=�println!�"some_timerfunc()�called." ��(*�Do�blinky�stuff�*) ��val�v�=�GPIO_REG_READ(GPIO_OUT_ADDRESS)�land�BIT2 ��val�()�=�if�v�!=�0�then �������������(*�Set�GPIO2�to�LOW�*) �������������gpio_output_set�(0U,�BIT2,�BIT2,�0U) �����������else �������������(*�Set�GPIO2�to�HIGH�*) �������������gpio_output_set�(BIT2,�0U,�BIT2,�0U) } extern�fun�user_init�():�void�=�"mac#" local ��var�some_timer:�os_timer_t in ��implement�user_init�()�=�{ ����val�()�=�uart_div_modify(0,�UART_CLK_FREQ�/�115200) ����val�()�=�println!�"nuser_init()�start." ����val�_��=�wifi_set_opmode_current�NULL_MODE ����(*�Initialize�the�GPIO�subsystem.�*) ����val�()�=�gpio_init�() (*�https://github.com/fpiot/esp8266-ats/blob/ats/blinky_ats/user/ user_main.dats�*) extern�fun�some_timerfunc�(arg:�ptr):�void implement�some_timerfunc�(arg)�=�{ ��val�()�=�println!�"some_timerfunc()�called." ��(*�Do�blinky�stuff�*) ��val�v�=�GPIO_REG_READ(GPIO_OUT_ADDRESS)�land�BIT2 ��val�()�=�if�v�!=�0�then �������������(*�Set�GPIO2�to�LOW�*) �������������gpio_output_set�(0U,�BIT2,�BIT2,�0U) �����������else �������������(*�Set�GPIO2�to�HIGH�*) �������������gpio_output_set�(BIT2,�0U,�BIT2,�0U) } extern�fun�user_init�():�void�=�"mac#" local ��var�some_timer:�os_timer_t in ��implement�user_init�()�=�{ ����val�()�=�uart_div_modify(0,�UART_CLK_FREQ�/�115200) ����val�()�=�println!�"nuser_init()�start." ����val�_��=�wifi_set_opmode_current�NULL_MODE ����(*�Initialize�the�GPIO�subsystem.�*) ����val�()�=�gpio_init�() (*�https://github.com/fpiot/esp8266-ats/blob/ats/blinky_ats/user/ user_main.dats�*) extern fun�some_timerfunc�(arg:�ptr):�void implement�some_timerfunc�(arg)�=�{ val�()�=�println!�"some_timerfunc()�called." (*�Do�blinky�stuff�*) val�v�=�GPIO_REG_READ(GPIO_OUT_ADDRESS)�land�BIT2 val�()�=�if�v�!=�0 then (*�Set�GPIO2�to�LOW�*) �������������gpio_output_set�(0U,�BIT2,�BIT2,�0U) else (*�Set�GPIO2�to�HIGH�*) �������������gpio_output_set�(BIT2,�0U,�BIT2,�0U) } extern fun�user_init�():�void�=�"mac#" local var�some_timer:�os_timer_t in implement�user_init�()�=�{ val�()�=�uart_div_modify(0,�UART_CLK_FREQ�/�115200) val�()�=�println!�"nuser_init()�start." val�_��=�wifi_set_opmode_current�NULL_MODE (*�Initialize�the�GPIO�subsystem.�*) val�()�=�gpio_init�()
  9. 9. Functional IoT Meetup at December 12Functional IoT Meetup at December 12Functional IoT Meetup at December 12Functional IoT Meetup at December 12Functional IoT Meetup at December 12
  10. 10. License of photosLicense of photosLicense of photosLicense of photosLicense of photos *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0

×