WizFi250-CSI(C Script Interpreter) para estudiantes o IoT-Inicio rápido-prototyping, bricolaje. (2 / 6 paso)

Paso 2: WizFi250-CSI.h

Todas las funciones, estructura y valores estáticos se definen en "WizFi250-CSI.h".

Por lo tanto, el archivo de secuencia de comandos sólo debe incluir "WizFi250-CSI.h".

Usted no necesita incluir otros archivos de cabecera como stdio.h, string.h socket.h.

Al referirse a este "CSI.h WizFi250", puede escribir su propia aplicación (archivo de comandos de C).

Funciones más generales se basan en la "Biblioteca estándar de C".

 int atoi(char *); int atol(char *); int printf(char *, ...); int scanf(char *, ...); void *memcpy(void *,void *,int); int strlen(char *); .......................................... 

Toma funciones se basan en sockets BSD API.

 int socket(int, int, int); int connect(int, struct sockaddr *, unsigned long); int recv(int, void *, unsigned long, int); int recvfrom(int, void *, unsigned long, int, struct sockaddr *, unsigned long *); int send(int, void *, unsigned long, int); .......................................... 

Mayoría de las funciones de hardware de WizFi250 se basa en el estilo de Arduino.

 void pinMode(int gpio, int type); void pinOut(int gpio, int value); int pinIn(int); int analogRead(int); void delay_ms(unsigned long milliseconds); .......................................... 

Por favor, refiérase a la abajo completo "WizFi250 CSI.h".

 <p>/*<br> * This file is part of the WizFi250-CSI(C Script Interpreter) project * By referring to this header file, you can write a C-Script-file of WizFi250-CSI. * * This is published under the "New BSD License". * <a href="http://www.opensource.org/licenses/bsd-license.php" rel="nofollow"> http://www.opensource.org/licenses/bsd-license.ph...</a> * * Copyright (C) 2015 Steve Kim (ssekim * * The WizFi250-CSI is based on picoc project. * <a href="https://github.com/zsaleeba/picoc" rel="nofollow"> http://www.opensource.org/licenses/bsd-license.ph...</a> * Copyright (c) 2009-2011, Zik Saleeba * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the Zik Saleeba nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *</p><p>/ WizFi250-CSI(C Script Interpreter) Header File for All</p><p>// Based on "ctype.h" of C standard library int isalnum(int); int isalpha(int); int isblank(int); int iscntrl(int); int isdigit(int); int isgraph(int); int islower(int); int isprint(int); int ispunct(int); int isspace(int); int isupper(int); int isxdigit(int); int tolower(int); int toupper(int);</p><p>// Based on "stdbool.h" of C standard library typedef int bool; #define true 1 #define false 0</p><p>// Based on "stdio.h" int puts(char *); char *gets(char *); int getchar(); int printf(char *, ...); int sprintf(char *, char *, ...); int snprintf(char *, int, char *, ...); int scanf(char *, ...); int sscanf(char *, char *, ...); int vprintf(char *, va_list); int vsprintf(char *, char *, va_list); int vsnprintf(char *, int, char *, va_list); int vscanf(char *, va_list); int vsscanf(char *, char *, va_list);</p><p>// Based on "stdlib.h" of C standard library #define NULL 0</p><p>int atoi(char *); int atol(char *); int strtol(char *,char **,int); int strtoul(char *,char **,int); void *malloc(int); void *calloc(int,int); void *realloc(void *,int); void free(void *); int rand(); void srand(int); void abort(); void exit(int); char *getenv(char *); int abs(int); int labs(int);</p><p>// Based on "string.h" of C standard library void *memcpy(void *,void *,int); void *memmove(void *,void *,int); void *memchr(char *,int,int); int memcmp(void *,void *,int); void *memset(void *,int,int); char *strcat(char *,char *); char *strncat(char *,char *,int); char *strchr(char *,int); char *strrchr(char *,int); int strcmp(char *,char *); int strncmp(char *,char *,int); int strcoll(char *,char *); char *strcpy(char *,char *); char *strncpy(char *,char *,int); char *strerror(int); int strlen(char *); int strspn(char *,char *); int strcspn(char *,char *); char *strpbrk(char *,char *); char *strstr(char *,char *); char *strtok(char *,char *); int strxfrm(char *,char *,int);</p><p>// Based on "time.h" of C standard library typedef int time_t; typedef int clock_t;</p><p>struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; };</p><p>char *asctime(struct tm *); char *ctime(int *); struct tm *gmtime(int *); struct tm *localtime(int *); int mktime(struct tm *ptm); int strftime(char *, int, char *, struct tm *);</p><p>// Based on "sockets.h" of lwIP #define AF_UNSPEC_networkLibrary 0 #define AF_INET_networkLibrary 2 #define SOCK_STREAM_networkLibrary 1 #define SOCK_DGRAM_networkLibrary 2 #define SOCK_RAW_networkLibrary 3 #define IPPROTO_IP_networkLibrary 0 #define IPPROTO_TCP_networkLibrary 6 #define IPPROTO_UDP_networkLibrary 17</p><p>#define O_NONBLOCK_networkLibrary 1 #define F_GETFL_networkLibrary 3 #define F_SETFL_networkLibrary 4</p><p>#define EAGAIN_networkLibrary 11</p><p>#define MSG_PEEK_networkLibrary 0x01 #define MSG_DONTWAIT_networkLibrary 0x08</p><p>struct in_addr { unsigned long s_addr; };</p><p>struct sockaddr_in { unsigned char sin_len; unsigned char sin_family; unsigned short sin_port; struct in_addr sin_addr; char sin_zero[8]; } sockaddr_in;</p><p>typedef struct fd_set { unsigned char fd_bits [(8+7)/8]; } fd_set;</p><p>int accept(int, struct sockaddr *, unsigned long *); int bind(int, struct sockaddr *, unsigned long); int shutdown(int, int); int getpeername(int, struct sockaddr *, unsigned long *); int getsockname(int, struct sockaddr *, unsigned long *); int getsockopt(int, int, int, void *, unsigned long *); int setsockopt(int, int, int, void *, unsigned long); int close(int); int connect(int, struct sockaddr *, unsigned long); int listen(int, int); int recv(int, void *, unsigned long, int); int recvfrom(int, void *, unsigned long, int, struct sockaddr *, unsigned long *); int send(int, void *, unsigned long, int); int sendto(int, void *, unsigned long, int, struct sockaddr *, unsigned long); int socket(int, int, int); int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); int fcntl(int, int, int); int inet_addr(char *); unsigned short htons(unsigned short);</p><p>// Regarding WizFi250-WiFi /** * Joins a Wi-Fi network * ssid : A null terminated string containing the SSID name of the network to join * auth_type : Authentication type: * open - Open Security * wep - WEP Security * wpa2_tkip - WPA2 Security using TKIP cipher * wpa2_aes - WPA2 Security using AES cipher * wpa2 - WPA2 Security using AES and/or TKIP ciphers * wpa_aes - WPA Security using AES cipher * wpa_tkip - WPA Security using TKIP ciphers * key : Security key * ip : String of IP address string (if 0, DHCP will be applied.) * netmask : String of netamsk string * gateway : String of gateway address string * 0(Success), the others(Fail) */ int wifi_join(char* ssid, char* auth_type, char* key, char* ip, char* netmask, char* gateway);</p><p>/** * Disassociates from a Wi-Fi network. * None */ int wifi_leave();</p><p>// Regarding WizFi250-Hardware /** * Initialises a GPIO pin * gpio : the gpio pin which should be initialised * GPIO1, GPIO6, GPIO7, GPIO8, GPIO9, GPIO12(LED), GPIO13(LED), GPIO14 * type : A structure containing the required gpio configuration 0 : INPUT_PULL_UP : Input with an internal pull-up resistor - use with devices that actively drive the signal low - e.g. button connected to ground 1 : INPUT_PULL_DOWN : Input with an internal pull-down resistor - use with devices that actively drive the signal high - e.g. button connected to a power rail 2 : INPUT_HIGH_IMPEDANCE : Input - must always be driven, either actively or by an external pullup resistor 3 : OUTPUT_PUSH_PULL : Output actively driven high and actively driven low - must not be connected to other active outputs - e.g. LED output 4 : OUTPUT_OPEN_DRAIN_NO_PULL : Output actively driven low but is high-impedance when set high - can be connected to other open-drain/open-collector outputs. Needs an external pull-up resistor 5 : OUTPUT_OPEN_DRAIN_PULL_UP : Output actively driven low and is pulled high with an internal resistor when set high - can be connected to other open-drain/open-collector outputs. * None */ void pinMode(int gpio, int type);</p><p>/** * Sets an output GPIO pin low or hign * gpio : the gpio pin which should be set * GPIO1, GPIO6, GPIO7, GPIO8, GPIO9, GPIO12, GPIO13, GPIO14 * value : 0(low) or 1(high) * None */ void pinOut(int gpio, int value);</p><p>/** * Get the state of an input GPIO pin * gpio : the gpio pin which should be read * GPIO1, GPIO6, GPIO7, GPIO8, GPIO9, GPIO12, GPIO13, GPIO14 * 0(low) or 1(high) */ int pinIn(int);</p><p>/** * Transmit data on a UART interface * uart : the UART interface. UART1, UART2. * data : pointer to the start of data * size : number of bytes to transmit * None */ void uart_tx(int uart, unsigned char* data, int size);</p><p>/** * Takes a single sample from an ADC interface * adc : the interface which should be sampled AD1(Currently, WizFi250-CSI support one ADC) * a variable which will receive the sample (0 ~ 4095) */ int analogRead(int adc);</p><p>/** * Receive data on a UART interface * uart : the UART interface. UART1, UART2. * data : pointer to the buffer which will store incoming data * size : number of bytes to receive * number of received bytes */ int uart_rx(int uart, unsigned char* data, int size);</p><p>/** * Sleep for a given period * milliseconds : the time to sleep in milliseconds * None */ void delay_ms(unsigned long milliseconds);</p> 

Artículos Relacionados

Pantalla de cristal líquido para la Junta de inicio rápido

Pantalla de cristal líquido para la Junta de inicio rápido

pantalla de cristal líquido de tres hilos para el inicio rápidoReqd de piezas:Junta de inicio rápido de paralajeMódulo de visualización de LCD de 2 líneas de paralajecable de interfaz de 3 hilos - de:un cable de panel frontal de la computadoratres pe
Control remoto por infrarrojos para la Junta de inicio rápido de paralaje

Control remoto por infrarrojos para la Junta de inicio rápido de paralaje

mando a distancia Infra-rojo un cable interfaz para el inicio rápidoUna de las mejores cosas acerca de dispositivos con software de la hélicees lo poco que se necesita para agregar periféricos!Reqd de piezas:Pequeño sensor IR - adafruit/157alambreZóc
Energía de la batería para el tablero de inicio rápido

Energía de la batería para el tablero de inicio rápido

el paralaje QuickStart tablero normalmente utiliza el cable USB para la energía.Mientras esto es útil para el desarrollo de sus programas, es un poco incómodo transportar uncomputadora completa alrededor sólo para proporcionar energía de la hélice.Mi
Empleos para estudiantes medio tiempo | Cómo trabajar a tiempo parcial puestos de trabajo como estudiante | Descubra cómo hoy!

Empleos para estudiantes medio tiempo | Cómo trabajar a tiempo parcial puestos de trabajo como estudiante | Descubra cómo hoy!

Empleos para estudiantes medio tiempo | Cómo trabajos de medio tiempo como estudiante | Descubra cómo hoy!http://www.totalshortcut.com/CP1?ID=bimem&AD=Ahora el link para que usted para comenzar con el enlace de arriba. Esto es sólo si eres un estudia
Verificar un ID de Apple para estudiantes cuenta

Verificar un ID de Apple para estudiantes cuenta

Has recibido un correo electrónico de Apple diciendo que emociona que el estudiante va a utilizar un iPad como parte del programa de su escuela, ¿qué haces ahora? Este instructivo le guiará a través de los pasos que debes tomar como un padre para fin
Prácticas para estudiantes de tecnología en robótica.

Prácticas para estudiantes de tecnología en robótica.

Prácticas para estudiantes de tecnología en robótica.Resistencia invita a los estudiantes a unirse a nuestro inicio de robótica para un programa de pasantías (EnduranceRobots.com)Abrimos todas las SelfieBot código fuentes y esquemas de las escuelas,
Crear aplicaciones para Windows 10 IoT sin codificación.

Crear aplicaciones para Windows 10 IoT sin codificación.

Este proyecto se muestra cómo crear aplicaciones para Windows 10 IoT sin codificación.Es importante que usted sabe algunos básicos de la programación pero no tienes que aprender a utilizar Visual Studio y compilar para Windows 10 IoT.El objetivo de e
Consejos de protección de robo de identidad para estudiantes universitarios

Consejos de protección de robo de identidad para estudiantes universitarios

En los últimos años, la mayoría de los consumidores han llegado a darse cuenta de que el robo de identidad está en aumento. Sin embargo, pocos consumidores han considerado cuán vulnerable nuevo colegio los estudiantes pueden ser el robo de identidad.
Camping para estudiantes universitarios con un presupuesto

Camping para estudiantes universitarios con un presupuesto

Creado por: Abigail Altman, Joyce Muema, Rian Fleming, Justin Linfield y Kyle EspenshadeEstas instrucciones proporcionará a los estudiantes una alternativa asequible a la vida universitaria normal. Estas instrucciones son una variación de pasos que p
¿El mejor trabajo para estudiantes de secundaria

¿El mejor trabajo para estudiantes de secundaria

quiero un trabajo que mejora sus habilidades de comunicación, alimenta tu ego, fortalece tus conocimientos y ridículamente bien paga? Entonces, tutoría, podría ser para usted! Vamos a repasar los beneficios...--Paga hasta $20 la hora--Trabajos en su
Módulo interactivo para estudiantes disléxicos (Intel IoT)

Módulo interactivo para estudiantes disléxicos (Intel IoT)

un módulo interactivo está diseñado para que estudiantes disléxicos a mejorar sus habilidades auditivas y visuales por el uso de elementos multimedios interactivos. La metodología utiliza sensores infrarrojos reflexivos para reconocer letras como ins
Caso de la IPad para estudiantes universitarios

Caso de la IPad para estudiantes universitarios

Como los estudiantes universitarios pobres, puede ser difícil mantener electrónica segura y en buenas condiciones de trabajo. La electrónica en primer lugar es cara, y los casos utilizados para conseguir rasguñado solamente añadir al precio. Este cas
Guía para hacer caja Cupcakes para estudiantes universitarios

Guía para hacer caja Cupcakes para estudiantes universitarios

El objetivo de esta tarea es crear el lote perfecto de cupcakes mientras minimizando el estrés, costo y tiempo para los estudiantes universitarios con un presupuesto ajustado. No hay habilidades especiales son necesarias, sólo tiene que ser capaz de
Trabajar con varios ordenadores (para estudiantes)

Trabajar con varios ordenadores (para estudiantes)

trabajo con varios ordenadores puede ser muy difícil. Nunca se sabe qué archivos se encuentran en ordenador, se puede ejecutar en problemas con múltiples versión del mismo archivo, y como resultado, usted podría perder sus archivos todos juntos o por