WizFi250-CSI(C Script Interpreter) pour le prototypage rapide, DIY, IoT-démarrage ou étudiants. (2 / 6 étapes)

Étape 2: WizFi250-CSI.h

Toutes les fonctions, structure et valeurs statiques sont définis dans « WizFi250-CSI.h ».

Ainsi, votre fichier de script seulement doit inclure "WizFi250-CSI.h".

Vous ne pas besoin d’inclure un autre fichiers d’en-tête stdio.h, string.h ou socket.h.

En se référant à cette « WizFi250-CSI.h », vous pouvez écrire votre propre application (fichier de script de C).

Fonctions plus générales sont basées sur « Bibliothèque standard du C ».

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

Fonctions socket sont basées sur les 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); .......................................... 

Matériel-fonctions la plupart des WizFi250 sont basées sur Arduino style.

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

S’il vous plaît, se référer au dessous complet « 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> 

Articles Liés

Rapide et Simple interrupteurs doux (pour le prototypage rapide)

Rapide et Simple interrupteurs doux (pour le prototypage rapide)

les manières différentes de faire un doux commutateurs.Ce instructable montre une autre option d'un prototype très rapide pour la commutation logicielle, à l'aide d'un aluminium bande au lieu de tissu conducteur et fils pleins au lieu d'un fil conduc
Prototypage rapide - impression 3D pour faire des maîtres

Prototypage rapide - impression 3D pour faire des maîtres

En utilisant une imprimante 3D pour faire votre prototype original, il est alors possible de faire rapidement les doublons de votre conception et rentable en utilisant le moule processus décisionnel. ComposiMold peut être utilisé pour fabriquer les m
Prototypage rapide avec de l’argile polymère

Prototypage rapide avec de l’argile polymère

Argile polymère est un matériau excellent à utiliser pour le prototypage rapide de vos projets. Il est très résistant à la chaleur et se dessécher à moins que cuit au four. J'ai utilisé pour faire des clôtures temporaires, pour aider à la soudure et
Série-à-WiFi à l’aide de WizFi250-CSI

Série-à-WiFi à l’aide de WizFi250-CSI

Il y a quelques semaines, j'ai écrit un message affiché sur WizFi250-CSI comme ci-dessous.Et maintenant, je vais montrer une application de série-à-wifi à l'aide de WizFi250-CSI.Avec WizFi250-CSI, j'ai terminé l'application de la série-à-wifi en 10 m
Technique de prototypage rapide pour la conception des articulations à l’aide de courbes de Bézier.

Technique de prototypage rapide pour la conception des articulations à l’aide de courbes de Bézier.

Technique de prototypage rapide pour la conceptionjoints articulés, entrelacés ou intercaléesà l'aide de courbes de Bézier en modélisationmouvements robotiques complexesR. Siderits MDP. Clifford MSIVJ. HawkinsM. l'équipe swift Exp-PathK. Cannon MSII
Utilisez une vraie planche à pain pour le prototypage de votre circuit

Utilisez une vraie planche à pain pour le prototypage de votre circuit

aujourd'hui amateurs électronique utilisation soi-disant montage expérimental pour le prototypage leurs projets. Ces montage expérimental sans soudure ne nécessite pas de soudure et est réutilisables plusieurs centaines de fois.Bon, vous pourriez pen
Prototypages rapides - où pour faire notre propre PCB ?

Prototypages rapides - où pour faire notre propre PCB ?

Si vous n'avez pas votre propre système de gravure humide, vous aurez besoin d'envoyer des pcb peuvent être effectués par une entrepriseBeaucoup d'entreprises ont une option de « prototypage rapide », où vous obtenez votre planche de retour, dans la
Venturi vide dégazage appareils utilisés dans le prototypage rapide de partie biomédicale

Venturi vide dégazage appareils utilisés dans le prototypage rapide de partie biomédicale

l'équipe de projet :Richard H. Siderits MDChristoper Sereni MSIIIVarun Singh - équipe de pathologie expérimentaleÉliminer les bulles, quand vous faites des blancs à utiliser pour l'usinage de pièces en plastique ou des modèles de moulage de caoutchou
Prototypage rapide la manière démodée (tôle + soudure)

Prototypage rapide la manière démodée (tôle + soudure)

Vous voulez faire des choses cool ? À peu de frais ? Rapide ? Vous avez besoin de quelque sorte à faire réellement le bâtiment. Inutile de venir juste avec des idées hein ? Cette instructable présente un moyen de faire de petits articles plus rapidem
Zéro construire une voiture RC avec CAO et prototypage rapide

Zéro construire une voiture RC avec CAO et prototypage rapide

IntroductionPendant longtemps j'ai voulu construire une voiture RC complètement à partir de zéro, mais jamais tout à fait avait accès à tous les outils nécessaires pour le faire à la main ou été en mesure de justifier le coût d'utilisation des méthod
Chibikart : Prototypage rapide un Subminiature électrique Go-Kart à l’aide de Fabrication numérique et composants Hobby

Chibikart : Prototypage rapide un Subminiature électrique Go-Kart à l’aide de Fabrication numérique et composants Hobby

Chibikart! est un kart électrique 2WD très petit mais puissant et maniable que vous pouvez générer à l'aide de standard industriel et de composants de passe-temps et de pièces de châssis mécanosoudé numériquement. À l'aide de batteries ion-lithium mo
À l’aide de Celtx 101 - Script écrit pour les films

À l’aide de Celtx 101 - Script écrit pour les films

ceci est un tutoriel étape par étape comment utiliser Celtx. Ce tutoriel va vous montrer comment écrire un scénario, dessiner un story-board, créer une liste et écrire correctement un catalogue maître. Pour ce tutoriel vous aurez besoin d'un ordinate
Faire un Script VB pour répondre à toutes vos questions

Faire un Script VB pour répondre à toutes vos questions

prêt pour une idée de scénario stupide je suis venu avec ? C'est ici. C'est une réponse à vous questions, deux lignes de code, et le meilleur de tous c'est faux !Vous aurez besoin-un ordinateur qui exécute Windows 98 ou version ultérieure-un ami (ou
Script Python pour arrêter Windows Applications/arrêt de l’ordinateur

Script Python pour arrêter Windows Applications/arrêt de l’ordinateur

# Programme qui arrêtera les applications courantes de Windows et arrêter l'ordinateur# Pour les vraiment paresseux. :-)Print ("arrêt demandes maintenant")# importer le module système d'exploitation# permet aux utilisateurs d'exécuter des comman