Ver Fonte

Nouvelle update retrouvé au fin fond des enfers

Pi3rrot há 10 anos atrás
pai
commit
a697814976

+ 0 - 0
lib/.holder


+ 2 - 0
lib/Minitel/.gitignore

@@ -0,0 +1,2 @@
+
+.DS_Store

+ 965 - 0
lib/Minitel/Minitel.cpp

@@ -0,0 +1,965 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+ 
+ #include "Arduino.h"
+#include "SoftwareSerial.h"
+#include "Minitel.h"
+
+byte _currentBgColor = BLACK;
+byte _currentTextColor = WHITE;
+byte _currentMode = TEXT_MODE;
+byte _currentVideo = VIDEO_STANDARD;
+byte _currentSize = SIZE_NORMAL;
+boolean _currentUnderline = false;
+boolean _currentBlink = false;
+boolean _currentShowCursor = false;
+
+
+Minitel::Minitel() : SoftwareSerial(6,7) {
+	init();
+}
+
+
+Minitel::Minitel(int rx, int tx) : SoftwareSerial(rx,tx) {
+	init();
+}
+
+void Minitel::init() {
+	Serial.begin(1200);
+	begin(1200);
+	useDefaultColors();
+	refreshSettings();
+}
+
+byte Minitel::getGraphicChar(String s) {
+  byte carac= 32; // caractère pixel
+
+  if (s.length() == 6) {
+    carac += s[0] == '0' ? 0 : 1;
+    carac += s[1] == '0' ? 0 : 2;
+    carac += s[2] == '0' ? 0 : 4;
+    carac += s[3] == '0' ? 0 : 8;
+    carac += s[4] == '0' ? 0 : 16;
+    carac += s[5] == '0' ? 0 : 32;
+    return carac;
+  }
+  return 9;
+
+
+}
+
+void Minitel::serialprint7(byte b) {
+  boolean  i = false;
+  for(int j = 0; j<8;j++) {
+    if (bitRead(b,j)==1) {
+      i =!i; //calcul de la parité
+    }
+  }
+  if (i) {
+    bitWrite(b,7,1); //ecriture de la partié
+  }
+  else {
+    bitWrite(b,7,0); //ecriture de la partié
+  }
+  write(b); //ecriture du byte sur le software serial
+}
+
+
+
+void Minitel::graphic(String s, int x, int y){
+  moveCursorTo(x, y);
+  graphic(s); 
+}
+
+void Minitel::graphic(String s) {
+  serialprint7(getGraphicChar(s)); 
+}
+
+void Minitel::textByte(byte c) {
+  serialprint7(c);
+}
+
+void Minitel::textByte(byte b, int x, int y) {
+  moveCursorTo(x, y);
+  textByte(b);  
+}
+
+
+boolean Minitel::textChar(byte c) {
+  byte charByte = getCharByte(c);
+  if (isValidChar(charByte)) {
+    serialprint7(charByte);
+    return true;
+  }
+  return false;
+}
+
+boolean Minitel::textChar(byte c, int x, int y) {
+  moveCursorTo(x, y);
+  return textChar(c);  
+}
+
+
+void Minitel::text(String s, int x, int y) {
+  text(s, x, y, HORIZONTAL); 
+}
+
+
+void Minitel::text(String s) {
+  text(s, HORIZONTAL);
+}
+
+
+void Minitel::text(String s, int x, int y, int orientation) {
+  moveCursorTo(x, y);
+  text(s, orientation);
+}
+
+void Minitel::text(String s, int orientation) {
+  for (int i=0; i<s.length(); i++) {
+    char c = s.charAt(i);
+    boolean indent = false;
+    if (isAccent(c)) {
+      i+=1; // chars with accents take 2 array indexes
+      c = s.charAt(i);
+      indent = printAccentChar(c);
+    }
+    else {
+      indent = textChar(c);
+    }
+    if (indent && orientation == VERTICAL) {
+      moveCursor(LEFT);
+      moveCursor(DOWN);
+    }
+  }
+}
+
+
+// Characters
+/*
+ String chars0 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // 0 -> 33
+ String chars1= "!\"#$%&'()*+,-./0123456789:;<=>?@"; // 33 -> 64
+ String chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 65 -> 90
+ String chars3 = "abcdefghijklmnopqrstuvwxyz"; // 97 -> 122
+*/
+byte Minitel::getCharByte(char c) {
+  String characters = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]x_xabcdefghijklmnopqrstuvwxyz";
+  return (byte) characters.lastIndexOf(c);
+}
+
+void Minitel::specialChar(byte c, int x, int y) {
+  moveCursorTo(x, y);
+  specialChar(c);
+}
+
+void Minitel::specialChar(byte c) {
+  if (c == SPE_CHAR_BOOK || c == SPE_CHAR_PARAGRAPH
+    || c == SPE_CHAR_ARROW_LEFT || c == SPE_CHAR_ARROW_UP
+    || c == SPE_CHAR_ARROW_RIGHT || c == SPE_CHAR_ARROW_DOWN 
+    || c == SPE_CHAR_CIRCLE || c == SPE_CHAR_MINUS_PLUS
+    || c == SPE_CHAR_1_4 || c == SPE_CHAR_1_2
+    || c == SPE_CHAR_3_4 || c == SPE_CHAR_UPPER_OE
+    || c == SPE_CHAR_LOWER_OE || c == SPE_CHAR_BETA) {
+    serialprint7(25);
+    serialprint7(c);
+  }
+}
+
+
+
+boolean Minitel::isValidChar(byte index) {
+  if (index >= 32 && index < 123) {
+    return true; 
+  }
+  return false;
+}
+
+
+boolean Minitel::isAccent(char c) {
+  String accents = "áàâäéèëêíìîïóòôöúùûü";
+  if (accents.indexOf(c) >=0) {
+    return true; 
+  }
+  return false;
+}
+
+
+boolean Minitel::printAccentChar(char c) {
+  if (isAccent(c)) {
+	String accents = "áàâäéèëêíìîïóòôöúùûü";
+    int index = (accents.indexOf(c)-1)/2;
+
+    int accentTypeIndex = index%4;
+    printAccent(accentTypeIndex);
+
+    int letterIndex = floor(index/4);
+    char letter = getAccentLetter(letterIndex);
+    textChar(letter);
+
+    return true;
+  }
+  return false;
+}
+
+void Minitel::printAccent(int index) {
+  serialprint7(25);
+  switch(index) {
+    case(0) :
+    serialprint7(GRAVE);
+    break; 
+    case(1) :
+    serialprint7(ACCUTE);
+    break; 
+    case(2) :
+    serialprint7(CIRCUMFLEX);
+    break; 
+  default :
+    serialprint7(UMLAUT);
+  }
+}
+
+char Minitel::getAccentLetter(int letterIndex) {
+  switch(letterIndex) {
+    case(0) :
+    return('a');
+    break; 
+    case(1) :
+    return('e');
+    break; 
+    case(2) :
+    return('i');
+    break; 
+    case(3) :
+    return('o');
+    break;
+  default :
+    return('u');
+  }  
+}
+
+void Minitel::repeat(byte n) {
+  serialprint7(18);
+  serialprint7(64+n);
+}
+
+
+void Minitel::bgColor(byte c) {
+  if (c >= 0 && c <=7) {
+    serialprint7(27);
+    serialprint7(c+80);
+    _currentBgColor = c;
+  }
+}
+
+
+void Minitel::textColor(byte c) {
+  if (c >= 0 && c <=7) {
+    serialprint7(27);
+    serialprint7(c+64);
+    _currentTextColor = c;
+  }
+}
+
+
+void Minitel::useDefaultColors() {
+  bgColor(BLACK);
+  textColor(WHITE); 
+}
+
+
+void Minitel::moveCursorTo(byte x, byte y) {
+  serialprint7(31); // Code positionnement de curseur
+  serialprint7(64+y); // coordonnées x (x+64) (x de 1 à 40)
+  serialprint7(64+x); // coordonnées y (y+64) (y de 1 à 24)
+  refreshSettings();
+}
+
+
+void Minitel::moveCursor(byte dir) {
+  if (dir == LEFT || dir == RIGHT || dir == UP || dir == DOWN) {
+    serialprint7(dir);
+  }
+}
+
+
+void Minitel::moveCursorTo(byte location) {
+  if (location == HOME || location == LINE_END || location == TOP_LEFT) {
+    serialprint7(location);
+  }
+  else if (location == CENTER || location == TOP_RIGHT || location == BOTTOM_RIGHT || location == BOTTOM_LEFT) {
+    if (location == CENTER) {
+      moveCursorTo(20, 12);
+    }
+    else if (location == TOP_RIGHT) {
+      moveCursorTo(40, 1);
+    }
+    else if (location == BOTTOM_RIGHT) {
+      moveCursorTo(40, 24);
+    }
+    else if (location == BOTTOM_LEFT) {
+      moveCursorTo(1, 24);
+    }
+    refreshSettings()  ;
+  }
+}
+
+
+void Minitel::moveCursor(byte dir, int n) {
+  if (dir == LEFT || dir == RIGHT || dir == UP || dir == DOWN) {
+    for (int i=0; i<n; i++) {
+      serialprint7(dir);
+    }
+  }
+}
+
+
+void Minitel::refreshSettings() {
+  // Common parameters
+  serialprint7(_currentMode);
+  textColor(_currentTextColor);
+  bgColor(_currentBgColor); // Only in graphic mode ?
+  blink(_currentBlink);
+  cursor(_currentShowCursor);
+  // Graphic mode specific parameters
+  if (_currentMode == GRAPHIC_MODE) {
+    pixelate(_currentUnderline);
+  }
+  // Text mode specific parameters
+  if (_currentMode == TEXT_MODE) {
+    video(_currentVideo);
+    charSize(_currentSize);
+  }
+}
+
+
+void Minitel::cursor() {
+  cursor(true); 
+}
+
+void Minitel::noCursor() {
+  cursor(false); 
+}
+
+void Minitel::cursor(boolean b) {
+  if(b) {
+    serialprint7(CURSOR_SHOW);
+  }
+  else {
+    serialprint7(CURSOR_HIDE);
+  }
+  _currentShowCursor = b;
+}
+
+
+void Minitel::clearScreen() {
+  serialprint7(CLEARSCREEN);
+  refreshSettings();
+}
+
+
+void Minitel::mode(byte mode) {
+  if (mode == GRAPHIC_MODE || mode == TEXT_MODE) {
+    _currentMode = mode;
+    refreshSettings();
+  } 
+}
+
+void Minitel::graphicMode() {
+  mode(GRAPHIC_MODE);
+}
+
+void Minitel::textMode() {
+  mode(TEXT_MODE);
+}
+
+
+void Minitel::blink() {
+  blink(true); 
+}
+
+void Minitel::noBlink() {
+  blink(false); 
+}
+
+
+void Minitel::blink(boolean b) {
+  serialprint7(27);
+  if (b) {
+    serialprint7(BLINK_ON); 
+  }
+  else {
+    serialprint7(BLINK_OFF);
+  }
+  _currentBlink = b;
+}
+
+
+void Minitel::charSize(byte type) {
+  if (type == SIZE_NORMAL || type == SIZE_DOUBLE_HEIGHT || type == SIZE_DOUBLE_WIDTH || type == SIZE_DOUBLE) {
+    serialprint7(27);
+    serialprint7(type);
+    _currentSize = type;
+  }
+}
+
+
+void Minitel::incrustation(boolean b) {
+  serialprint7(27);
+  if (b) {
+    serialprint7(INCRUSTATION_ON);
+  }
+  else {
+    serialprint7(INCRUSTATION_OFF);
+  } 
+}
+
+void Minitel::incrustation() {
+	incrustation(INCRUSTATION_ON);
+}
+
+void Minitel::noIncrustation() {
+    incrustation(INCRUSTATION_OFF);
+}
+
+
+void Minitel::pixelate() {
+  pixelate(true); 
+}
+
+void Minitel::noPixelate() {
+  pixelate(false); 
+}
+
+
+void Minitel::pixelate(boolean b) {
+  serialprint7(27);
+  if (b) {
+    serialprint7(UNDERLINE_ON);
+  }
+  else {
+    serialprint7(UNDERLINE_OFF);
+  } 
+  _currentUnderline = b;
+}
+
+
+void Minitel::lineMask(boolean b) {
+  serialprint7(27);
+  if (b) {
+    serialprint7(LINE_MASK_ON);
+  }
+  else {
+    serialprint7(LINE_MASK_OFF);
+  } 
+}
+
+void Minitel::lineMask() {
+    lineMask(LINE_MASK_ON);
+}
+
+void Minitel::noLineMask() {
+    lineMask(LINE_MASK_OFF);
+}
+
+void Minitel::video(byte v) {
+  if (v == VIDEO_INVERT || v == VIDEO_STANDARD || v == VIDEO_TRANSPARENT) {
+    serialprint7(27);
+    serialprint7(v);
+    _currentVideo = v;
+  } 
+}
+
+void Minitel::standardVideo() {
+  video(VIDEO_STANDARD); 
+}
+
+void Minitel::invertVideo() {
+  video(VIDEO_INVERT); 
+}
+
+void Minitel::transparentVideo() {
+  video(VIDEO_TRANSPARENT); 
+}
+
+
+void Minitel::setMaxSpeed() {
+  /*
+  serialprint7(27);
+   serialprint7(SPEED_4800);
+   */
+}
+
+// Bip
+// Less than 200ms isn't taken into account
+void Minitel::bip(long duration) {
+  long beginTime = millis();
+  while(millis() < beginTime+100) {//duration) {
+    serialprint7(27);
+    serialprint7(BIP);
+    delay(100);
+  }
+}
+
+byte Minitel::getKeyCode() {
+	byte b = 255;
+	b = read();		
+	if (b != 255) {
+		Serial.println(b);
+	}
+	return b;
+}
+
+char Minitel::getKey() {
+  byte b = 255; 
+  b =  read();
+  char c = '^';
+
+  // Menu keys
+  if (b == 147) {
+  	_menuKeyPressed = true;
+  	delay(50);
+  }
+  else if (_menuKeyPressed) {
+	if (b == 198) { // Sommaire
+		c = '1';
+	
+} 
+	
+else if (b == 197) { // Annul
+		c = '2';
+	
+} 
+	
+else if (b == 66) { // Retour
+		c = '3';
+	
+} 
+	
+else if (b == 195) { // Répétition
+		c = '4';
+	
+} 
+	
+else if (b == 68) { // Guide
+		c = '5';
+	
+} 
+	
+else if (b == 71) { // Correction
+		c = '6';
+	
+} 
+	
+else if (b == 72) { // Suite
+		c = '7';
+	
+} 
+	
+else if (b == 65) { // Envoi
+		c = '8';
+	
+} 
+	_menuKeyPressed = false;
+  }
+  else {
+	if (b == 160) { // Space
+		c = ' ';
+	}
+
+	else if (b == 177) { // 1
+		c = '1';
+	
+} 
+	
+else if (b == 178) { // 2
+		c = '2';
+	
+} 
+	
+else if (b == 51) { // 3
+		c = '3';
+	
+} 
+	
+else if (b == 180) { // 4
+		c = '4';
+	
+} 
+	
+else if (b == 53) { // 5
+		c = '5';
+	
+} 
+	
+else if (b == 54) { // 6
+		c = '6';
+	
+} 
+	
+else if (b == 183) { // 7
+		c = '7';
+	
+} 
+	
+else if (b == 184) { // 8
+		c = '8';
+	
+} 
+	
+else if (b == 57) { // 9
+		c = '9';
+	
+} 
+	
+else if (b == 48) { // 0
+		c = '0';
+	
+} 
+	
+else if (b == 170) { // *
+		c = '*';
+	
+} 
+	
+else if (b == 163) { // #
+		c = '#';
+	
+} 
+	
+else if (b == 172) { // ,
+		c = ',';
+	
+} 
+	
+else if (b == 46) { // .
+		c = '.';
+	
+} 
+	
+else if (b == 39) { // '
+		c = '\'';
+	
+} 
+	
+else if (b == 187) { // ;
+		c = ';';
+	
+} 
+	
+else if (b == 45) { // -
+		c = '-';
+	
+} 
+	
+else if (b == 58) { // :
+		c = ':';
+	
+} 
+	
+else if (b == 63) { // ?
+		c = '?';
+	
+} 
+	
+else if (b == 65) { // A
+		c = 'A';
+	
+} 
+	
+else if (b == 66) { //  B
+		c = 'B';
+	
+} 
+	
+else if (b == 195) { // C
+		c = 'C';
+	
+} 
+	
+else if (b == 68) { // D
+		c = 'D';
+	
+} 
+	
+else if (b == 197) { // E
+		c = 'E';
+	
+} 
+	
+else if (b == 198) { // F
+		c = 'F';
+	
+} 
+	
+else if (b == 71) { // G
+		c = 'G';
+	
+} 
+	
+else if (b == 72) { // H
+		c = 'H';
+	
+} 
+	
+else if (b == 201) { // I
+		c = 'I';
+	
+} 
+	
+else if (b == 202) { // J
+		c = 'J';
+	
+} 
+	
+else if (b == 75) { // K
+		c = 'K';
+	
+} 
+	
+else if (b == 204) { // L
+		c = 'L';
+	
+} 
+	
+else if (b == 77) { // M
+		c = 'M';
+	
+} 
+	
+else if (b == 78) { // N
+		c = 'N';
+	
+} 
+	
+else if (b == 207) { // O
+		c = 'O';
+	
+} 
+	
+else if (b == 80) { // P
+		c = 'P';
+	
+} 
+	
+else if (b == 209) { // Q
+		c = 'Q';
+	
+} 
+	
+else if (b == 210) { // R
+		c = 'R';
+	
+} 
+	
+else if (b == 83) { // S
+		c = 'S';
+	
+} 
+	
+else if (b == 212) { // T
+		c = 'T';
+	
+} 
+	
+else if (b == 85) {  //U
+		c = 'U';
+	
+} 
+	
+else if (b == 86) { // V
+		c = 'V';
+	
+} 
+	
+else if (b == 215) { // W
+		c = 'W';
+	
+} 
+	
+else if (b == 216) { // X
+		c = 'X';
+	
+} 
+	
+else if (b == 89) { // Y
+		c = 'Y';
+	
+} 
+	
+else if (b == 90) { // Z
+		c = 'Z';
+	
+}
+	
+else if (b == 33) { // !
+		c = '!';
+	
+}
+	
+else if (b == 34) { // !
+		c = '"';
+	
+}
+	
+else if (b == 163) { // #
+		c = '#';
+	
+}
+	
+else if (b == 36) { // $
+		c = '$';
+	
+}
+	
+else if (b == 165) { // %
+		c = '%';
+	
+}
+	
+else if (b == 166) { // &
+		c = '&';
+	
+}
+	
+else if (b == 39) { // '
+		c = '\'';
+	
+}
+	
+else if (b == 40) { // (
+		c = '(';
+	
+}
+	
+else if (b == 169) { // )
+		c = ')';
+	
+}
+	
+else if (b == 219) { // [
+		c = '[';
+	
+}
+	
+else if (b == 222) { // ↑
+		c = '↑';
+	
+}
+	
+else if (b == 221) { // ]
+		c = '[';
+	
+}
+	
+else if (b == 60) { // < 
+		c = '<';
+	
+}
+	
+else if (b == 190) { // >
+		c = '>';
+	
+}
+	
+else if (b == 192) { // @
+		c = '@';
+	
+}
+	
+else if (b == 43) { // +
+		c = '+';
+	
+}
+	
+else if (b == 189) { // =
+		c = '=';
+	
+}
+	
+else if (b == 170) { // *
+		c = '*';
+	
+}
+	
+else if (b == 175) { // /
+		c = '/';
+	
+}
+	
+else if (b == 123) { // /
+		c = '|';
+	
+}
+	}
+	return c;
+}
+
+boolean Minitel::isMenuKey() {
+	return _menuKeyPressed;
+}
+
+void Minitel::rect(char c, int x, int y, int w, int h) {
+  byte b = getCharByte(c);
+  rect(b, x, y, w, h);
+}
+
+void Minitel::rect(byte c, int x, int y, int w, int h) {
+  moveCursorTo(x, y); 
+  textByte(c);
+  repeat(w);
+  moveCursorTo(x, y+1);
+  for (int i=0; i<h-2; i++) {
+    textByte(c);
+    moveCursor(DOWN);
+    moveCursor(LEFT); 
+  }
+  moveCursorTo(x+w, y+1);
+  for (int i=0; i<h-2; i++) {
+    textByte(c);
+    moveCursor(DOWN);
+    moveCursor(LEFT); 
+  }
+  moveCursorTo(x, y+h-1);
+  textByte(c);
+  repeat(w);  
+}
+
+void Minitel::spiral(int x, int y, int siz, int c) {
+  int curSiz = 1;
+  // Center
+  specialChar(x, y, c);
+  x++;
+  // Spiral    
+  for (int i=0; i< siz; i++) {
+    for (int j=0; j<curSiz; j++) {
+      specialChar(x, y, c);
+      y++;
+    }
+    curSiz++;
+    for (int j=0; j<curSiz; j++) {
+      specialChar(x, y, c);
+      x--;
+    }
+    for (int j=0; j<curSiz; j++) {
+      specialChar(x, y, c);
+      y--;
+    }
+    curSiz++;   
+    for (int j=0; j<curSiz; j++) {
+      specialChar(x, y, c);
+      x++;
+    }    
+  }
+}
+

+ 215 - 0
lib/Minitel/Minitel.h

@@ -0,0 +1,215 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+
+#ifndef Minitel_h
+#define Minitel_h
+
+#include "Arduino.h"
+#include "SoftwareSerial.h"
+
+// Modes
+
+#define GRAPHIC_MODE 14
+#define TEXT_MODE 15
+
+#define HORIZONTAL 0
+#define VERTICAL 1
+
+// Cursor moves
+#define LEFT 8
+#define RIGHT 9
+#define DOWN 10
+#define UP 11
+
+// Cursor positionning
+#define HOME 13
+#define LINE_END 24
+
+#define TOP_LEFT 1
+#define TOP_RIGHT 2
+#define BOTTOM_LEFT 3
+#define BOTTOM_RIGHT 4
+#define CENTER 5
+
+// Cursor visibility
+// Preceeded by 27
+#define CURSOR_SHOW 17
+#define CURSOR_HIDE 20
+
+// Clear screen
+#define CLEARSCREEN 12
+
+// Font type
+// Preceeded by 27
+// DOUBLE-HEIGHT and DOUBLE may not work on certain Minitels
+#define SIZE_NORMAL 76
+#define SIZE_DOUBLE_HEIGHT 77
+#define SIZE_DOUBLE_WIDTH 78
+#define SIZE_DOUBLE 79
+
+
+// Colors (+80 for background, +64 for text)
+// Preceeded by 27
+// 64->71 txt color black, red, green, yellow, blue, magenta, cyan, white
+// 80->87 bg color black, red, green, yellow, blue, magenta, cyan, white
+#define BLACK 0
+#define RED 1
+#define GREEN 2
+#define YELLOW 3
+#define MAGENTA 4
+#define BLUE 5
+#define CYAN 6
+#define WHITE 7
+
+// Blink
+// Preceeded by 27
+#define BLINK_ON 72
+#define BLINK_OFF 73
+
+// Incrustation
+// Preceeded by 27
+#define INCRUSTATION_ON 75
+#define INCRUSTATION_OFF 74
+
+// Underline
+#define UNDERLINE_ON 90
+#define UNDERLINE_OFF 89
+
+// Underline
+#define LINE_MASK_ON 88
+#define LINE_MASK_OFF 95
+
+// Video mode
+#define VIDEO_INVERT 93
+#define VIDEO_STANDARD 92
+#define VIDEO_TRANSPARENT 94
+
+// Speeds
+#define SPEED_75 0
+#define SPEED_300 1
+#define SPEED_4800 100
+#define SPEED_9600 111 // ??? Minitel 2 ???
+
+// Bip
+#define BIP 7
+
+// Accents
+#define ACCUTE 65
+#define GRAVE 66
+#define CIRCUMFLEX 67
+#define UMLAUT 72
+
+#define SUB_ARTICLE_SEPARATOR 31;
+
+// Preceeded by 25
+#define SPE_CHAR_BOOK 35
+#define SPE_CHAR_PARAGRAPH 39
+#define SPE_CHAR_ARROW_LEFT 44
+#define SPE_CHAR_ARROW_UP 45
+#define SPE_CHAR_ARROW_RIGHT 46
+#define SPE_CHAR_ARROW_DOWN 47
+#define SPE_CHAR_CIRCLE 48
+#define SPE_CHAR_MINUS_PLUS 49
+#define SPE_CHAR_1_4 60
+#define SPE_CHAR_1_2 61
+#define SPE_CHAR_3_4 62
+#define SPE_CHAR_UPPER_OE 106
+#define SPE_CHAR_LOWER_OE 122
+#define SPE_CHAR_BETA 123
+
+
+class Minitel : public SoftwareSerial {
+
+private :	
+	byte _currentBgColor;
+	byte _currentTextColor;
+	byte _currentMode;
+	byte _currentVideo;
+	byte _currentSize;
+	boolean _currentUnderline;
+	boolean _currentBlink;
+	boolean _currentShowCursor;
+	boolean _menuKeyPressed;
+	void init();
+	void mode(byte mode);
+	void cursor(boolean b);
+	void blink(boolean b);
+	void pixelate(boolean b);
+	void video(byte v);
+	void incrustation(boolean b);
+	void lineMask(boolean b);
+	boolean isValidChar(byte index);
+	boolean isAccent(char c);
+	boolean printAccentChar(char c);
+	void printAccent(int index);
+	char getAccentLetter(int letterIndex);
+
+
+public :
+
+	Minitel();
+	Minitel(int rx, int tx);
+	void refreshSettings();
+	byte getGraphicChar(String s);
+	void serialprint7(byte b);
+	void graphic(String s, int x, int y);
+	void graphic(String s);
+	void textByte(byte c);
+	void textByte(byte b, int x, int y);
+	boolean textChar(byte c);
+	boolean textChar(byte c, int x, int y);
+	void text(String s, int x, int y);
+	void text(String s);
+	void text(String s, int x, int y, int orientation);
+	void text(String s, int orientation);
+	byte getCharByte(char c);
+	void specialChar(byte c, int x, int y);
+	void specialChar(byte c);
+	void repeat(byte n);
+	void bgColor(byte c);
+	void textColor(byte c);
+	void useDefaultColors();
+	void moveCursorTo(byte x, byte y);
+	void moveCursor(byte dir);
+	void moveCursorTo(byte location);
+	void moveCursor(byte dir, int n);
+	void cursor();
+	void noCursor();
+	void clearScreen();
+	void graphicMode();
+	void textMode();
+	void blink();
+	void noBlink();
+	void charSize(byte type);
+	void incrustation();
+	void noIncrustation();
+	void pixelate();
+	void noPixelate();
+	void lineMask();
+	void noLineMask();
+	void standardVideo();
+	void invertVideo();
+	void transparentVideo();
+	void setMaxSpeed();
+	void bip(long duration);
+	char getKey();
+	byte getKeyCode();
+	boolean isMenuKey();
+	void rect(char c, int x, int y, int w, int h);
+	void rect(byte c, int x, int y, int w, int h);
+	void spiral(int x, int y, int siz, int c);
+
+};
+
+#endif

+ 57 - 0
lib/Minitel/README.md

@@ -0,0 +1,57 @@
+Minitel
+=======
+
+Minitel library for Arduino
+
+Constants :
+
+//text(String s, int orientation)
+HORIZONTAL
+VERTICAL
+
+// moveCursor()
+LEFT
+RIGHT
+DOWN
+UP
+HOME
+LINE_END
+TOP_LEFT
+TOP_RIGHT
+BOTTOM_LEFT
+BOTTOM_RIGHT
+CENTER
+
+// charSize()
+SIZE_NORMAL
+SIZE_DOUBLE_HEIGHT
+SIZE_DOUBLE_WIDTH
+SIZE_DOUBLE
+
+// Colors
+// bgColor()
+// textColor
+BLACK
+RED
+GREEN
+YELLOW
+MAGENTA
+BLUE
+CYAN
+WHITE
+
+// specialChar()
+SPE_CHAR_BOOK
+SPE_CHAR_PARAGRAPH
+SPE_CHAR_ARROW_LEFT
+SPE_CHAR_ARROW_UP
+SPE_CHAR_ARROW_RIGHT
+SPE_CHAR_ARROW_DOWN
+SPE_CHAR_CIRCLE
+SPE_CHAR_MINUS_PLUS
+SPE_CHAR_1_4
+SPE_CHAR_1_2
+SPE_CHAR_3_4
+SPE_CHAR_UPPER_OE
+SPE_CHAR_LOWER_OE
+SPE_CHAR_BETA

+ 66 - 0
lib/Minitel/examples/MinitelAsKeyboard/MinitelAsKeyboard.ino

@@ -0,0 +1,66 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+
+/**
+ * Use Fnct T + E to disable echo
+ *
+ */
+
+#include <SoftwareSerial.h>
+#include <Minitel.h>
+
+Minitel m(6,7);
+boolean input = true;
+char key = '^';
+boolean isMenu = false;
+
+void setup() {
+  m.clearScreen();
+  Serial.begin(1200);
+  m.textMode();
+  m.cursor();
+}
+
+void loop() {
+  // Read key each 2 loops only
+  if (input) {
+    key = m.getKey();
+    if (m.isMenuKey()) {
+     isMenu = true; 
+    }
+  }
+  else {
+   if (key != '^') {
+     if (isMenu) {
+       if (key == '3') { // Return
+        m.moveCursorTo(HOME);
+        m.moveCursor(DOWN,1);
+       }
+       else if (key == '6') { // Correction
+        m.moveCursor(LEFT,1);
+        m.textChar(' ');
+        m.moveCursor(LEFT, 1);
+       }
+       else { // Clear screen
+        m.clearScreen();
+       }
+      isMenu = false; 
+     }
+     else { // Display char
+       m.textChar(key);
+     }
+   } 
+  }
+  input = !input;
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 19 - 0
lib/Minitel/examples/MinitelBoobs/MinitelBoobs.ino


+ 357 - 0
lib/Minitel/examples/MinitelDemo/MinitelDemo.ino

@@ -0,0 +1,357 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+
+
+#include <SoftwareSerial.h>
+#include <Minitel.h>
+
+Minitel m(6,7);
+
+void setup() {
+  
+}
+
+void loop() {
+ 
+  long pause = 2000;
+
+  demoColor();
+  delay(pause);
+
+  demoGraphics(false);
+  delay(pause);
+
+  demoGraphics(true);
+  delay(pause);
+
+  demoBip();
+  delay(pause);
+
+  demoCursor();
+  delay(pause);
+
+  demoText();
+  delay(pause);
+
+  demoCharacters();
+  delay(pause);
+  
+}
+
+/**
+ *
+ * DEMOS
+ *
+ */
+
+// Graphic characters
+
+void demoGraphics(boolean underline) {
+
+  m.clearScreen();
+  m.textMode();
+  m.textColor(WHITE);
+  m.bgColor(RED);
+  m.text(" GRAPHICS DEMO ", 4, 1);
+  m.bgColor(BLACK);
+
+  
+  m.graphicMode();
+  
+  if (underline) {
+    m.pixelate();
+  }
+  m.noCursor();
+
+  // No color 
+  m.useDefaultColors();
+
+  int xPos = 5;
+  int yPos = 5;
+  m.moveCursorTo(xPos, yPos);
+  int x = 32;
+  for (int i=x; i<x+16; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+
+  m.moveCursorTo(xPos, yPos+2);
+  for (int i=x+16; i<x+32; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+
+  m.moveCursorTo(xPos, yPos+4);
+  for (int i=x+32; i<x+48; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+
+  m.moveCursorTo(xPos, yPos+6);
+  for (int i=x+48; i<x+64; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  } 
+
+  // Colored
+  m.bgColor(RED);
+  m.textColor(WHITE);
+
+  m.moveCursorTo(xPos, yPos+10);
+  x = 32;
+  for (int i=x; i<x+16; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+
+  m.moveCursorTo(xPos, yPos+12);
+  for (int i=x+16; i<x+32; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+
+  m.moveCursorTo(xPos, yPos+14);
+  for (int i=x+32; i<x+48; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+
+  m.moveCursorTo(xPos, yPos+16);
+  for (int i=x+48; i<x+64; i++) {
+    m.serialprint7(i);
+    m.serialprint7(9);
+  }
+  
+  m.useDefaultColors();
+  m.noPixelate();
+  
+}
+
+
+void demoCursor() {
+  m.clearScreen();
+  m.textMode();
+  m.textColor(WHITE);
+  m.bgColor(RED);
+  m.text(" CURSOR DEMO ", 4, 1);
+  m.bgColor(BLACK);
+
+  m.cursor();
+
+  int pause = 1000;
+  m.moveCursorTo(TOP_LEFT);
+  delay(pause);
+  m.moveCursor(RIGHT, 39);
+  delay(pause);
+  m.moveCursor(DOWN, 23);
+  delay(pause);
+  m.moveCursor(LEFT, 39);
+  delay(pause);
+  m.moveCursor(UP, 23);
+  delay(pause);
+  m.moveCursor(RIGHT, 19);
+  delay(pause);
+  m.moveCursor(DOWN, 12);
+  delay(pause);
+  m.moveCursorTo(HOME);
+  delay(pause);
+  m.moveCursorTo(TOP_RIGHT);
+  delay(pause);
+  m.moveCursorTo(BOTTOM_LEFT);
+  delay(pause);
+  m.moveCursorTo(BOTTOM_RIGHT);
+  delay(pause);
+  m.moveCursorTo(TOP_LEFT);
+  delay(pause);
+  m.moveCursorTo(CENTER);
+  m.noCursor();
+}
+
+
+void demoCharacters() {
+  m.clearScreen();
+  m.textMode();
+  m.textColor(WHITE);
+  m.bgColor(RED);
+  m.text(" CHARACTERS DEMO ", 4, 1);
+  m.bgColor(BLACK);
+
+
+  int xPos = 3;
+  int yPos = 5;
+  m.cursor();
+
+  // a->z
+  m.moveCursorTo(xPos, yPos);
+  for (int i=97; i<97+26; i++) {
+    m.serialprint7(i);
+  }
+
+  // A->Z
+  m.moveCursorTo(xPos, yPos+1);
+  for (int i=65; i<65+26; i++) {
+    m.serialprint7(i);
+  }
+
+  // 0-9 + punctuation marks, ...
+  m.moveCursorTo(xPos, yPos+2);
+  for (int i=33; i<33+32; i++) {
+    m.serialprint7(i);
+  }
+  for (int i=91; i<97; i++) {
+    m.serialprint7(i);
+  }
+
+  // Colored characters
+  m.moveCursorTo(xPos, yPos+3);
+  m.textColor(RED);
+  for (int i=97; i<97+26; i++) {
+    m.serialprint7(i);
+  }
+  m.textColor(WHITE);
+
+  // Double width 1/2
+  m.moveCursorTo(xPos, yPos+4);
+  m.charSize(SIZE_DOUBLE_WIDTH);
+  for (int i=97; i<97+13; i++) {
+    m.serialprint7(i);
+  }  
+  m.moveCursorTo(xPos, yPos+5);
+  for (int i=97+13; i<97+26; i++) {
+    m.serialprint7(i);
+  }
+  m.charSize(SIZE_NORMAL);
+
+  // Special characters
+  m.moveCursorTo(xPos, yPos+6);
+  byte chars[] = {
+    SPE_CHAR_BOOK, SPE_CHAR_PARAGRAPH, SPE_CHAR_ARROW_LEFT, SPE_CHAR_ARROW_UP, SPE_CHAR_ARROW_RIGHT, SPE_CHAR_ARROW_DOWN, SPE_CHAR_CIRCLE, SPE_CHAR_MINUS_PLUS, SPE_CHAR_1_4, SPE_CHAR_1_2, SPE_CHAR_3_4, SPE_CHAR_UPPER_OE, SPE_CHAR_LOWER_OE, SPE_CHAR_BETA                  };
+  for (int i=0; i<sizeof(chars); i++) {
+    m.specialChar(chars[i]);
+  }
+
+  // Blink
+  m.moveCursorTo(xPos, yPos+7);
+  m.blink();
+  for (int i=97; i<97+26; i++) {
+    m.serialprint7(i);
+  }
+  m.noBlink();
+
+  // Invert video
+  m.moveCursorTo(xPos, yPos+8);
+  m.invertVideo();
+  for (int i=97; i<97+26; i++) {
+    m.serialprint7(i);
+  }
+  m.standardVideo();
+
+
+  // Transparent
+  // No effet on Minitel 1
+  m.moveCursorTo(xPos, yPos+9);
+  m.transparentVideo();
+  for (int i=97; i<97+26; i++) {
+    m.serialprint7(i);
+  }
+  m.standardVideo();
+}
+
+
+void demoBip() {
+  m.clearScreen();
+  m.textMode();
+  m.textColor(WHITE);
+  m.bgColor(RED);
+  m.text(" BIP DEMO ", 4, 1);
+  m.bgColor(BLACK);
+  
+  for (int i=0; i<2; i++) {
+    m.bip(50);
+    delay(700);
+    m.bip(5);
+    delay(500);
+    m.bip(10);
+    delay(2000);
+  }
+}
+
+void demoText() {
+  m.clearScreen();
+  m.textMode();
+  m.textColor(WHITE);
+  m.bgColor(RED);
+  m.text(" TEXT DEMO ", 4, 1);
+  m.bgColor(BLACK);
+
+  m.cursor();
+  m.text("****************************************", 1, 8);
+  m.blink();
+  m.text("CAUTION", 17, 13);
+  m.noBlink();
+  m.text("This is a test", 13, 15);
+  m.text("****************************************", 1, 20);
+  m.noCursor(); 
+}
+
+void demoColor() {
+
+  m.clearScreen();
+  m.textMode();
+  m.textColor(WHITE);
+  m.bgColor(RED);
+  m.text(" COLORS DEMO ", 4, 1);
+
+  m.graphicMode();
+  m.bgColor(RED);
+  m.rect((byte) m.getGraphicChar("011001"), 4, 4, 33, 20);
+
+  for(int i=0; i<18; i++) {
+    m.moveCursorTo(5, 5+i);
+
+    m.textColor(WHITE);
+    byte c = m.getGraphicChar("111111");
+    m.textByte(c);
+    m.repeat(3);
+
+    m.textColor(YELLOW);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+
+    m.textColor(CYAN);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+
+    m.textColor(GREEN);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+
+    m.textColor(BLUE);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+
+    m.textColor(RED);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+
+    m.textColor(MAGENTA);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+
+    m.textColor(BLACK);
+    m.textByte(m.getGraphicChar("111111"));
+    m.repeat(3);
+  }
+}
+

+ 49 - 0
lib/Minitel/examples/MinitelElectroCardio/Minitel_ElectroCardio.ino

@@ -0,0 +1,49 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+ 
+#include <SoftwareSerial.h>
+#include <Minitel.h>
+
+Minitel m;
+int counter = 0;
+byte ccc = 36;
+
+char c[] = {ccc,11,ccc,11,ccc,11,ccc,11,ccc,10,ccc,10,ccc,10,ccc,ccc,10,ccc,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,ccc,11,8,7,10,10,9,ccc,10,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,ccc,10,8,9,ccc,10,ccc,ccc,11,ccc,11,ccc,11,ccc,11,ccc,ccc,ccc,11,ccc,11,ccc,ccc,ccc,10,ccc,10,ccc,ccc,ccc,ccc,ccc,ccc,ccc,ccc,ccc,ccc,ccc,ccc,ccc};
+
+void setup() {
+}
+
+void loop() {
+  m.clearScreen();
+  m.graphicMode();
+
+  m.moveCursorTo(1,18);
+  for (int i=0; i<sizeof(c); i++) {
+   m.textByte(c[i]); 
+  }
+  delay(900);
+  counter ++;
+
+  if (counter == 20) {
+    m.clearScreen();
+    counter = 0;
+    m.moveCursorTo(1,14);
+    for (int i=0; i<40; i++) {
+      m.textByte(ccc);
+    }
+    m.bip(1000);
+    delay(5000);
+  }
+} 
+

+ 180 - 0
lib/Minitel/examples/MinitelGoogleSearch/MinitelGoogleSearch.ino

@@ -0,0 +1,180 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+ 
+#include <SoftwareSerial.h>
+#include <Minitel.h>
+
+Minitel m;
+
+void setup() {
+}
+
+void loop() {
+
+  m.clearScreen();
+  m.graphicMode();
+  m.pixelate();
+  m.graphic("000001", 1, 1);
+  m.graphic("011000");
+  m.graphic("110000");
+  m.graphic("110000");
+  m.graphic("101101");
+  m.graphic("000010");
+  m.graphic("100010", 1, 2);
+  m.graphic("000000");
+  m.graphic("000110");
+  m.graphic("000110");
+  m.graphic("000110");
+  m.graphic("000110");
+  m.graphic("000001", 1, 3);
+  m.graphic("011001");
+  m.graphic("011001");
+  m.graphic("011001");
+  m.graphic("011000");
+  m.graphic("000001");
+
+  m.graphic("100001", 1, 4);
+  m.graphic("100010");
+  m.graphic("100000");
+  m.graphic("100000");
+  m.graphic("000000");
+  m.graphic("000110");
+
+  m.graphic("000000", 1, 5);
+  m.graphic("110100");
+  m.graphic("001100");
+  m.graphic("001100");
+  m.graphic("011000");
+  
+  m.noPixelate();
+
+  m.textMode();
+  m.invertVideo();
+  m.textColor(CYAN);
+  m.bgColor(WHITE);
+  m.text(" RECHERCHE           ", 13, 1);
+  
+  m.graphicMode();
+  m.graphic("111110");
+  m.graphic("110000");
+  m.graphic("111110");
+  m.graphic("110000");
+  m.graphic("111111");
+  
+  m.textMode();
+  m.text(" PAR NOM             ", 13, 2);
+  
+  m.graphicMode(); 
+  m.graphic("101111");
+  m.graphic("000000");
+  m.graphic("101111");
+  m.graphic("000000");
+  m.graphic("111111");
+
+  m.textMode();
+  m.text(" OU PAR RUBRIQUE     ", 13, 3);
+  
+  m.graphicMode(); 
+  m.graphic("111111");
+  m.graphic("000011");
+  m.graphic("111111");
+  m.graphic("000011");
+  m.graphic("111111");
+
+  m.standardVideo();  
+  m.graphicMode(); 
+  m.bgColor(BLACK);
+  m.graphic("110000", 13, 4);
+  m.repeat(25);
+  
+  m.textMode();
+  m.textColor(WHITE);
+
+  m.text("NOM:", 9, 5);
+  dots(13, 5, 25);
+  m.text("ou  ", 9, 6);
+  dots(13, 6, 25);
+
+
+  m.text("RUBRIQUE:",4, 7);
+  dots(13, 7, 25);
+  dots(13, 8, 25);
+  dots(13, 9, 25);
+
+  m.text("LOCALITE:", 4, 10);
+  dots(13, 10, 25);
+  dots(13, 11, 25);
+
+  m.text("vous pouvez préciser", 13, 12);
+
+  m.text("DEPARTEMENT:", 1, 13);
+  dots(13, 13, 25);
+
+  m.text("ADRESSE:", 5, 14);
+  dots(13, 14, 25);
+
+  m.text("PRENOM:", 6, 15);
+  dots(13, 15, 25);
+
+  m.textByte(126, 1, 19);
+  m.repeat(39);
+    
+  m.text("ligne suivante ", 9, 20);
+  m.invertVideo();
+  m.text(" Suite  ", 32, 20);
+  m.standardVideo();
+
+  m.text("ligne précédente ", 9, 21);
+  m.invertVideo();
+  m.text(" Retour ", 32, 21);
+  m.standardVideo();
+  
+  m.text("effacer ", 9, 22);
+  m.invertVideo();
+  m.text(" Correc.", 32, 22);
+  m.standardVideo();
+  
+  m.text("choisir dans une liste ", 9, 23);
+  m.invertVideo();
+  m.text(" Guide  ", 32, 23);
+  m.standardVideo();
+  
+  m.text("obtenir la réponse ", 9, 24);
+  m.invertVideo();
+  m.text(" Envoi  ", 32, 24);
+  m.standardVideo();
+  
+
+  delay(1000);
+  m.text("G", 13, 5);
+  delay(1000);
+  m.text("O");
+  delay(1000);
+  m.text("O");
+  delay(1000);
+  m.text("G");
+  delay(1000);
+  m.text("L");
+  delay(1000);  
+  m.text("E");
+
+  delay(60000);
+
+}
+
+void dots(int x, int y, int w) {
+  m.text(".", x, y);
+  m.repeat(w);
+}
+

Diff do ficheiro suprimidas por serem muito extensas
+ 19 - 0
lib/Minitel/examples/MinitelInternetmaTuer/MinitelInternetmaTuer.ino


+ 231 - 0
lib/Minitel/examples/MinitelNyanCat/MinitelNyanCat.ino

@@ -0,0 +1,231 @@
+/**
+ * Minitel library for Arduino (v0.1) / May 2013
+ * http://github.com/01010101/Minitel
+ *
+ * By Jerome Saint-Clair aka 01010101
+ * http://saint-clair.net
+ * 
+ * For the Graffiti Research Lab France
+ * http://graffitiresearchlab.fr
+ * 
+ * Based on works by the Tetalab (Fabrice, Renaud, PG & Phil)
+ * http://tetalab.org
+ */
+ 
+#include <SoftwareSerial.h>
+#include <Minitel.h>
+
+Minitel m;
+
+void setup() {
+}
+
+void loop() {
+  m.graphicMode();
+  m.clearScreen();
+  m.graphicMode();
+  bg();
+  rainbow(2, 10);  
+  body(12, 9);
+
+  drawStar1(28, 4);
+  drawStar1(20, 21);
+
+  drawStar2(5, 5, false);
+  drawStar2(22, 9, true);
+  drawStar2(35, 20, false);
+  drawStar2(20, 5, true);
+
+  drawStar2(5, 20, true);
+  drawStar3(32, 11);  
+  drawFrame();
+
+  delay(60000);
+
+}
+
+void drawFrame() {
+  m.graphicMode();
+  m.rect((byte) m.getGraphicChar("011001"), 1, 1, 39, 24);
+ 
+}
+
+
+void drawStar1(int x, int y) {
+  m.graphicMode();
+  m.textColor(WHITE);
+  m.blink();
+  m.graphic("111111", x, y);
+  m.noBlink();
+  m.graphic("111111", x, y-1);
+  m.graphic("111111", x, y+1);
+  m.graphic("111111", x-1, y);
+  m.graphic("111111", x+1, y);  
+}
+
+void drawStar2(int x, int y, boolean b) {
+  m.textMode();
+  //m.m.bgColor
+  m.bgColor(RED);
+  if (b) {
+    m.blink();
+  }
+  m.text(" *", x, y);
+  if (b) {
+    m.noBlink();
+  }
+}
+
+void drawStar3(int x, int y) {
+  m.graphicMode();
+  m.bgColor(RED);
+  m.textColor(WHITE);
+
+  m.graphic("001111", x, y-2);  
+  m.graphic("111100", x, y-1);  
+  m.graphic("111100", x, y);
+  m.graphic("111111", x, y+1);  
+  m.graphic("110000", x, y+2);  
+
+
+  m.graphic("101000", x-1, y);  
+  m.graphic("111100", x-2, y);  
+
+  m.graphic("010100", x+1, y);  
+  m.graphic("111100", x+2, y);  
+
+
+}
+
+
+
+void body(int x, int y) {
+  m.graphicMode();
+
+  m.moveCursorTo(x, y);
+  m.bgColor(RED);
+  m.textColor(BLACK);
+
+  m.graphic("000001");
+  m.graphic("000011");
+  m.repeat(7);
+
+  for (int i=1; i<7; i++) {
+    m.moveCursorTo(x, y+i);
+    m.graphic("101010");
+    m.moveCursor(RIGHT, 8);
+    m.graphic("101010");
+  }
+
+
+  m.moveCursorTo(x-1, y+7);
+  m.graphic("011011");  
+
+
+  // Legs
+  m.moveCursorTo(x, y+7);
+  m.graphic("111000");
+  m.graphic("111001");  
+  m.graphic("111010");
+
+  m.graphic("110000");
+  m.graphic("110000");
+  m.graphic("111001");
+  m.graphic("111010");
+
+  m.graphic("110100");
+  m.graphic("110111");
+
+  // Fur
+  m.moveCursorTo(x+2, y+2);
+  m.graphic("010000");
+  m.moveCursorTo(x+4, y+3);
+  m.graphic("010010");
+
+  m.moveCursorTo(x+2, y+4);
+  m.graphic("010010");
+  m.moveCursorTo(x+4, y+5);
+  m.graphic("010010");
+
+  m.moveCursorTo(x+6, y+2);
+  m.graphic("100001");
+
+  // tail
+  m.moveCursorTo(x-3, y+4);
+  m.graphic("111011");
+  m.graphic("110011");
+  m.graphic("110011");
+
+  // Head
+  m.moveCursorTo(x+6, y+3);
+  m.graphic("011010");
+  m.graphic("001001");
+  m.graphic("000011");
+  m.graphic("100110");
+  m.graphic("100101");
+  m.graphic("000000");
+
+  m.moveCursorTo(x+5, y+4);
+  m.graphic("000001");
+  m.graphic("101000");
+  m.graphic("000010");
+  m.graphic("000000");
+  m.graphic("000001");
+  m.graphic("010100");
+  m.graphic("000010");
+
+  m.moveCursorTo(x+5, y+5);
+  m.graphic("010101");
+  m.graphic("010000");
+  m.graphic("100010"); // eyeleft
+  m.graphic("100010");
+  m.graphic("110010");
+  m.graphic("000000");
+  m.graphic("101010");
+
+  m.moveCursorTo(x+6, y+6);
+  m.graphic("101001");
+  m.graphic("110000");
+  m.graphic("110000");
+  m.graphic("100000");
+  m.graphic("010110");
+
+  m.moveCursorTo(x+9, y+7);
+  m.graphic("110000");
+  m.graphic("100000");
+}
+
+void bg() {
+  m.graphicMode();
+  m.textColor(RED);
+  m.moveCursorTo(1, 1);
+  for (int i=1; i<25; i++) {
+    m.graphic("111111");
+    m.repeat(39);
+  }
+
+}
+
+void rainbow(int x, int y) {
+
+  //WHITE, YELLOW, CYAN, GREEN, BLUE, RED, MAGENTA, BLACK
+  m.graphicMode();
+
+  int colors[] = {
+    RED, MAGENTA, YELLOW, WHITE, GREEN, CYAN, BLUE, RED  };
+
+  for (int i=0; i<8; i++) {
+    m.bgColor(colors[i]);
+    m.textColor(colors[i+1]);
+    m.graphic("001111", x, y+i);
+    //    m.repeat(1);
+    m.graphic("111111");
+    m.repeat(2);
+    m.graphic("001111");
+    m.repeat(2);
+    m.graphic("111111");
+    m.repeat(2);
+  }
+}
+
+

+ 71 - 0
lib/MyGSM/MyGSM.cpp

@@ -0,0 +1,71 @@
+#include <Arduino.h>
+#include "MyGSM.h"
+
+bool flagOn = false;
+
+MyGSM::MyGSM(int pin)
+{
+  pinMode(pin, OUTPUT);
+  digitalWrite(pin, LOW);
+  _pin = pin;
+
+
+}
+ 
+void MyGSM::initShield(){
+  if(flagOn == false){
+    digitalWrite(_pin, LOW);
+    delay(10);
+    digitalWrite(_pin, HIGH);
+    delay(500);
+    digitalWrite(_pin, LOW);
+    flagOn = true;
+  }
+  else return;
+}
+
+void MyGSM::enterPin(){
+  
+}
+
+void MyGSM::send_AT_cmd(const char *at_cmd, char *at_rep)
+{
+  Serial1.print(at_cmd);
+  int strCount = 0;
+  if(strlen(at_cmd) != 0) {
+	  Serial.print("\r[*] Sent : ");
+	  Serial.print(at_cmd);
+	  Serial.println();
+  }
+  delay(100);
+  while(Serial1.available()>0) {
+	  char reponse = Serial1.read();
+	  at_rep[strCount] = reponse;
+	  strCount++;
+  }
+  at_rep[strCount]='\0';
+  delay(500);
+  if(strCount != 0){
+    Serial.println("\r\r[*] Received :");
+    Serial.println(at_rep);
+  }
+}
+
+//Return True if string find on buf
+bool MyGSM::sortRecv(char *buf, char *string)
+{
+  if(strstr(buf, string) != NULL) {
+    return true;
+  }
+  else return false;
+}
+
+char MyGSM::cutRecv(char *buf, char *strBegin, char *strEnd)
+{
+ /* char *token, *endtoken;
+  token = strchr(buf, strBegin);
+  token++;
+  endtoken = strchr(token, strEnd);
+  *endtoken = '\0';
+  return *token;*/
+}

+ 71 - 0
lib/MyGSM/MyGSM.cpp~

@@ -0,0 +1,71 @@
+//#include <WProgram.h>
+#include "MyGSM.h"
+
+bool flagOn = false;
+
+MyGSM::MyGSM(int pin)
+{
+  pinMode(pin, OUTPUT);
+  digitalWrite(pin, LOW);
+  _pin = pin;
+
+
+}
+ 
+void MyGSM::initShield(){
+  if(flagOn == false){
+    digitalWrite(_pin, LOW);
+    delay(10);
+    digitalWrite(_pin, HIGH);
+    delay(500);
+    digitalWrite(_pin, LOW);
+    flagOn = true;
+  }
+  else return;
+}
+
+void MyGSM::enterPin(){
+  
+}
+
+void MyGSM::send_AT_cmd(const char *at_cmd, char *at_rep)
+{
+  Serial1.print(at_cmd);
+  int strCount = 0;
+  if(strlen(at_cmd) != 0) {
+	  Serial.print("\r[*] Sent : ");
+	  Serial.print(at_cmd);
+	  Serial.println();
+  }
+  delay(100);
+  while(Serial1.available()>0) {
+	  char reponse = Serial1.read();
+	  at_rep[strCount] = reponse;
+	  strCount++;
+  }
+  at_rep[strCount]='\0';
+  delay(500);
+  if(strCount != 0){
+    Serial.println("\r\r[*] Received :");
+    Serial.println(at_rep);
+  }
+}
+
+//Return True if string find on buf
+bool MyGSM::sortRecv(char *buf, char *string)
+{
+  if(strstr(buf, string) != NULL) {
+    return true;
+  }
+  else return false;
+}
+
+char MyGSM::cutRecv(char *buf, char *strBegin, char *strEnd)
+{
+ /* char *token, *endtoken;
+  token = strchr(buf, strBegin);
+  token++;
+  endtoken = strchr(token, strEnd);
+  *endtoken = '\0';
+  return *token;*/
+}

+ 25 - 0
lib/MyGSM/MyGSM.h

@@ -0,0 +1,25 @@
+#ifndef MyGSM_h
+#define MyGSM_h
+
+#include <Arduino.h>
+
+class MyGSM
+{
+  public:
+    MyGSM(int pin);
+    void initShield();
+    void enterPin();
+    void send_AT_cmd(const char *at_cmd, char *at_rep);
+    bool sortRecv(char *buff, char *string);
+    char cutRecv(char *buf, char *strBegin, char *strEnd);
+    bool flagOn;    
+    
+  private:
+    int _pin;
+
+
+  
+  
+};
+
+#endif

+ 25 - 0
lib/MyGSM/MyGSM.h~

@@ -0,0 +1,25 @@
+#ifndef MyGSM_h
+#define MyGSM_h
+
+//#include <WProgram.h>
+
+class MyGSM
+{
+  public:
+    MyGSM(int pin);
+    void initShield();
+    void enterPin();
+    void send_AT_cmd(const char *at_cmd, char *at_rep);
+    bool sortRecv(char *buff, char *string);
+    char cutRecv(char *buf, char *strBegin, char *strEnd);
+    bool flagOn;    
+    
+  private:
+    int _pin;
+
+
+  
+  
+};
+
+#endif

+ 330 - 0
src/Minitel_SM.ino

@@ -0,0 +1,330 @@
+#include <SoftwareSerial.h>
+#include "Minitel.h"
+#include "MyGSM.h"
+
+Minitel m(52,53);			//Definition pour le Serial du Minitel
+MyGSM MyGSM(8);
+
+void saisieNum(char *num);
+void saisiePin(char *pin);
+void saisieTxt(char *txt);
+void send_sms();
+void enter_pin();
+void call_number();
+
+// CAYE PAS BIEN ET JMEN FOUT !
+char rep[50];
+char Operator[50];
+char mess_ok[50];
+
+void setup()
+{
+	/****Init Shield GPRS Hardware mode*****/
+	Serial.begin(19200);
+	Serial1.begin(19200);
+	Serial.write(27);       // ESC command
+	Serial.print("[2J");    // clear screen command
+	Serial.println();
+	Serial.println("***********************************");
+	Serial.println("Debug ATM");
+	/****Simulation ON/OFF*****/
+	MyGSM.initShield();
+	Serial.print("[*] Shield Power state : ");
+	Serial.print(MyGSM.flagOn);
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(BLACK);
+
+	m.text("         Smartphone Minitel V1         ", 1, 1);
+	/**** check du pin *****/
+	MyGSM.send_AT_cmd("AT+CPIN?\r", rep);
+	if (strstr(rep, "READY") == NULL) {
+		m.text("[ ] Check for pin lock... ", 2, 3);
+		m.text("Enter PIN code : ", 2, 4);
+		enter_pin();
+
+	}
+	m.text("[*] PIN code is good ! ", 2, 3);
+
+	m.text("[ ]", 2, 5); 
+	m.blink();
+	m.text("Waiting for Auth Network .....", 6, 5);
+	
+	MyGSM.send_AT_cmd("AT+COPS?\r", rep);
+	char *token, *endtoken;
+	token = strchr(rep, '\"');
+	token++;
+	endtoken = strchr(token, '\"');
+	*endtoken = '\0';
+	sprintf(mess_ok, "You are connected to %s", token);
+//	strcpy(mess_ok, "You are connected to ");
+//	strcat(mess_ok, token);
+	sprintf(Operator, "Operator : %s", token);
+	m.noBlink();
+	m.text("[*]", 2, 5);
+	m.text(mess_ok, 5, 5);
+	delay(2000);
+	MyGSM.send_AT_cmd("AT+CGREG?\r\r", rep);
+	
+	delay(1000);
+}
+
+void loop()
+{
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(RED);
+	m.text("         Smartphone Minitel V1         ", 1, 1);
+	m.text(Operator, 1, 23);
+	m.bgColor(BLACK);
+	m.text("1 - Send SMS", 4, 5 );
+	m.text("2 - Read SMS", 4, 6 );
+	m.text("3 - Call a number", 4, 8);
+	m.text("5 - Address Book", 4, 10 );
+	
+	while(1) {
+		
+		MyGSM.send_AT_cmd("", rep);
+		if(MyGSM.sortRecv(rep, "NO CARRIER") == true) {
+			return loop();
+		}
+		
+		if(MyGSM.sortRecv(rep, "RING") == true){
+
+			if(MyGSM.sortRecv(rep, "+CLIP:") == true){
+				char *token, *endtoken;
+				token = strchr(rep, ': "');
+				token++;
+				endtoken = strchr(token, '\"');
+				*endtoken = '\0';
+				sprintf(mess_ok, "From : %s", token);
+				m.clearScreen();
+				m.textMode();
+				m.textColor(WHITE);
+				m.bgColor(RED);
+				m.text(" CALL INCOMMING .... ", 4, 1);
+				m.bgColor(BLACK);
+				m.text(mess_ok, 2, 4);
+				m.text("1 - to answer", 2, 5);
+				m.text("2 - to close", 2, 6);
+				if(m.available()>0) {
+					char key = NULL;
+					key = m.getKey();
+					switch(key) {
+						case '1':
+							MyGSM.send_AT_cmd("ATA\r", rep);
+							break;
+						case '2':
+							MyGSM.send_AT_cmd("ATH\r", rep);
+							break;
+					}
+						
+				}
+				
+			}
+			
+		}
+				
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+			switch(key) {
+				case '1':
+					send_sms();
+					break;
+				
+				case '2':
+					break;
+				
+				case '3':
+					call_number();
+					break;
+			}
+		}
+	}
+	
+	delay(1000);
+
+	
+}
+
+void enter_pin()
+{
+	char pin[5];
+	char at_pin[12];
+	saisiePin(pin);
+	sprintf(at_pin, "AT+CPIN=%s\r", pin);
+	Serial.print(pin);
+	MyGSM.send_AT_cmd(at_pin, rep);
+	MyGSM.send_AT_cmd(at_pin, rep);
+	return setup();
+	
+}
+
+void send_sms()
+{
+	
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(RED);
+	m.text(" Send SMS ", 4, 1);
+	m.bgColor(BLACK);
+	m.text("Number : +", 1, 4);
+	m.cursor();
+	m.moveCursorTo(12,4);	
+	
+	
+	char num[20];
+	char txt[160];
+//	char *cmgs = "AT+CMGS=\"+";
+//	char *endcmgs = "\"";
+	char cmdcmgs[100];
+	
+	
+//	strcpy(cmdcmgs, cmgs);
+//	Serial.print(cmdcmgs);
+//	send_AT_cmd("AT+CGATT?\r");
+	saisieNum(num);
+	saisieTxt(txt);
+//	Serial.print(num);
+//	strcat(cmdcmgs, num);
+//	Serial.print(cmdcmgs);
+//	strcat(cmdcmgs, endcmgs);
+	MyGSM.send_AT_cmd("AT+CMGF=1\r", rep);			//Mode texte pour SMS
+	delay(100);
+	sprintf(cmdcmgs, "AT+CMGS=\"+%s\"\r", num);
+	MyGSM.send_AT_cmd(cmdcmgs, rep);
+	MyGSM.send_AT_cmd(txt, rep);
+		
+	delay(1000);	
+	
+	return loop();
+	
+}
+
+
+void saisieNum(char *num) {
+	int strCount = 0;
+	
+	while(1) {
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+			if(key != NULL) {
+				if (m.isMenuKey() == true) { 
+					key = m.getKey();
+					if (key == '8') {
+						/**** AJOUTER LE CHAR FIN DE COM MANDE AT PUIS PASSER SAISIE MESSAGES ****/
+						num[strCount]='\0';
+						return;
+					}
+				}
+				else {
+					m.textChar(key);		//print sur minitel
+//					Serial.print(key);		//print sur le prompt
+					num[strCount] = key;
+					strCount++;
+					strCount%=19;
+
+				}
+			}
+		}
+	}
+}
+
+
+
+void saisieTxt(char *txt) {
+	int strCount = 0;
+	m.text("Message : ", 1, 6);
+	m.moveCursorTo(1,7);
+	/*** COMMANDE ATM ***/
+	while(1) {
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+				if(key != NULL) {
+				if (m.isMenuKey() == true) { 
+					key = m.getKey();
+					if (key == '8') {
+						txt[strCount]='\x1a';
+						txt[strCount+1]='\r';
+						txt[strCount+2]='\0';
+						return;
+					}
+				}
+				else {
+					m.textChar(key);
+					txt[strCount] = key;
+					strCount++;
+					strCount%=159;
+					
+				}
+			}
+		}
+	}	
+}
+
+
+
+void saisiePin(char *pin) {
+	int strCount = 0;
+	
+	while(1) {
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+			if(key != NULL) {
+				if (m.isMenuKey() == true) { 
+					key = m.getKey();
+					if (key == '8') {
+						/**** AJOUTER LE CHAR FIN DE COM MANDE AT PUIS PASSER SAISIE MESSAGES ****/
+						pin[strCount]='\0';
+						return;
+					}
+				}
+				else {
+					m.textChar('*');		//print sur minitel
+//					Serial.print(key);		//print sur le prompt
+					pin[strCount] = key;
+					strCount++;
+					strCount%=19;
+
+				}
+			}
+		}
+	}
+}
+
+void call_number() {
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(RED);
+	m.text(" Calling system ", 4, 1);
+	m.bgColor(BLACK);
+	m.text("Number : +", 1, 4);
+	m.cursor();
+	m.moveCursorTo(12,4);	
+	
+	
+	char num[20];
+	char txt[160];
+	char cmdcmgs[100];
+	saisieNum(num);
+	sprintf(cmdcmgs, "ATD+%s;\r", num);
+	MyGSM.send_AT_cmd(cmdcmgs, rep);
+	MyGSM.send_AT_cmd(txt, rep);
+		
+	delay(1000);	
+	
+	return loop();
+	
+}

+ 330 - 0
src/Minitel_SM.ino~

@@ -0,0 +1,330 @@
+#include <SoftwareSerial.h>
+#include "Minitel.h"
+#include <MyGSM.h>
+
+Minitel m(52,53);			//Definition pour le Serial du Minitel
+MyGSM MyGSM(8);
+
+void saisieNum(char *num);
+void saisiePin(char *pin);
+void saisieTxt(char *txt);
+void send_sms();
+void enter_pin();
+void call_number();
+
+// CAYE PAS BIEN ET JMEN FOUT !
+char rep[50];
+char Operator[50];
+char mess_ok[50];
+
+void setup()
+{
+	/****Init Shield GPRS Hardware mode*****/
+	Serial.begin(19200);
+	Serial1.begin(19200);
+	Serial.write(27);       // ESC command
+	Serial.print("[2J");    // clear screen command
+	Serial.println();
+	Serial.println("***********************************");
+	Serial.println("Debug ATM");
+	/****Simulation ON/OFF*****/
+	MyGSM.initShield();
+	Serial.print("[*] Shield Power state : ");
+	Serial.print(MyGSM.flagOn);
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(BLACK);
+
+	m.text("         Smartphone Minitel V1         ", 1, 1);
+	/**** check du pin *****/
+	MyGSM.send_AT_cmd("AT+CPIN?\r", rep);
+	if (strstr(rep, "READY") == NULL) {
+		m.text("[ ] Check for pin lock... ", 2, 3);
+		m.text("Enter PIN code : ", 2, 4);
+		enter_pin();
+
+	}
+	m.text("[*] PIN code is good ! ", 2, 3);
+
+	m.text("[ ]", 2, 5); 
+	m.blink();
+	m.text("Waiting for Auth Network .....", 6, 5);
+	
+	MyGSM.send_AT_cmd("AT+COPS?\r", rep);
+	char *token, *endtoken;
+	token = strchr(rep, '\"');
+	token++;
+	endtoken = strchr(token, '\"');
+	*endtoken = '\0';
+	sprintf(mess_ok, "You are connected to %s", token);
+//	strcpy(mess_ok, "You are connected to ");
+//	strcat(mess_ok, token);
+	sprintf(Operator, "Operator : %s", token);
+	m.noBlink();
+	m.text("[*]", 2, 5);
+	m.text(mess_ok, 5, 5);
+	delay(2000);
+	MyGSM.send_AT_cmd("AT+CGREG?\r\r", rep);
+	
+	delay(1000);
+}
+
+void loop()
+{
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(RED);
+	m.text("         Smartphone Minitel V1         ", 1, 1);
+	m.text(Operator, 1, 23);
+	m.bgColor(BLACK);
+	m.text("1 - Send SMS", 4, 5 );
+	m.text("2 - Read SMS", 4, 6 );
+	m.text("3 - Call a number", 4, 8);
+	m.text("5 - Address Book", 4, 10 );
+	
+	while(1) {
+		
+		MyGSM.send_AT_cmd("", rep);
+		if(MyGSM.sortRecv(rep, "NO CARRIER") == true) {
+			return loop();
+		}
+		
+		if(MyGSM.sortRecv(rep, "RING") == true){
+
+			if(MyGSM.sortRecv(rep, "+CLIP:") == true){
+				char *token, *endtoken;
+				token = strchr(rep, ': "');
+				token++;
+				endtoken = strchr(token, '\"');
+				*endtoken = '\0';
+				sprintf(mess_ok, "From : %s", token);
+				m.clearScreen();
+				m.textMode();
+				m.textColor(WHITE);
+				m.bgColor(RED);
+				m.text(" CALL INCOMMING .... ", 4, 1);
+				m.bgColor(BLACK);
+				m.text(mess_ok, 2, 4);
+				m.text("1 - to answer", 2, 5);
+				m.text("2 - to close", 2, 6);
+				if(m.available()>0) {
+					char key = NULL;
+					key = m.getKey();
+					switch(key) {
+						case '1':
+							MyGSM.send_AT_cmd("ATA\r", rep);
+							break;
+						case '2':
+							MyGSM.send_AT_cmd("ATH\r", rep);
+							break;
+					}
+						
+				}
+				
+			}
+			
+		}
+				
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+			switch(key) {
+				case '1':
+					send_sms();
+					break;
+				
+				case '2':
+					break;
+				
+				case '3':
+					call_number();
+					break;
+			}
+		}
+	}
+	
+	delay(1000);
+
+	
+}
+
+void enter_pin()
+{
+	char pin[5];
+	char at_pin[12];
+	saisiePin(pin);
+	sprintf(at_pin, "AT+CPIN=%s\r", pin);
+	Serial.print(pin);
+	MyGSM.send_AT_cmd(at_pin, rep);
+	MyGSM.send_AT_cmd(at_pin, rep);
+	return setup();
+	
+}
+
+void send_sms()
+{
+	
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(RED);
+	m.text(" Send SMS ", 4, 1);
+	m.bgColor(BLACK);
+	m.text("Number : +", 1, 4);
+	m.cursor();
+	m.moveCursorTo(12,4);	
+	
+	
+	char num[20];
+	char txt[160];
+//	char *cmgs = "AT+CMGS=\"+";
+//	char *endcmgs = "\"";
+	char cmdcmgs[100];
+	
+	
+//	strcpy(cmdcmgs, cmgs);
+//	Serial.print(cmdcmgs);
+//	send_AT_cmd("AT+CGATT?\r");
+	saisieNum(num);
+	saisieTxt(txt);
+//	Serial.print(num);
+//	strcat(cmdcmgs, num);
+//	Serial.print(cmdcmgs);
+//	strcat(cmdcmgs, endcmgs);
+	MyGSM.send_AT_cmd("AT+CMGF=1\r", rep);			//Mode texte pour SMS
+	delay(100);
+	sprintf(cmdcmgs, "AT+CMGS=\"+%s\"\r", num);
+	MyGSM.send_AT_cmd(cmdcmgs, rep);
+	MyGSM.send_AT_cmd(txt, rep);
+		
+	delay(1000);	
+	
+	return loop();
+	
+}
+
+
+void saisieNum(char *num) {
+	int strCount = 0;
+	
+	while(1) {
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+			if(key != NULL) {
+				if (m.isMenuKey() == true) { 
+					key = m.getKey();
+					if (key == '8') {
+						/**** AJOUTER LE CHAR FIN DE COM MANDE AT PUIS PASSER SAISIE MESSAGES ****/
+						num[strCount]='\0';
+						return;
+					}
+				}
+				else {
+					m.textChar(key);		//print sur minitel
+//					Serial.print(key);		//print sur le prompt
+					num[strCount] = key;
+					strCount++;
+					strCount%=19;
+
+				}
+			}
+		}
+	}
+}
+
+
+
+void saisieTxt(char *txt) {
+	int strCount = 0;
+	m.text("Message : ", 1, 6);
+	m.moveCursorTo(1,7);
+	/*** COMMANDE ATM ***/
+	while(1) {
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+				if(key != NULL) {
+				if (m.isMenuKey() == true) { 
+					key = m.getKey();
+					if (key == '8') {
+						txt[strCount]='\x1a';
+						txt[strCount+1]='\r';
+						txt[strCount+2]='\0';
+						return;
+					}
+				}
+				else {
+					m.textChar(key);
+					txt[strCount] = key;
+					strCount++;
+					strCount%=159;
+					
+				}
+			}
+		}
+	}	
+}
+
+
+
+void saisiePin(char *pin) {
+	int strCount = 0;
+	
+	while(1) {
+		if(m.available()>0) {
+			char key = NULL;
+			// Obligation de lire 2 buffer en cas de touche Menu
+			key = m.getKey();
+			if(key != NULL) {
+				if (m.isMenuKey() == true) { 
+					key = m.getKey();
+					if (key == '8') {
+						/**** AJOUTER LE CHAR FIN DE COM MANDE AT PUIS PASSER SAISIE MESSAGES ****/
+						pin[strCount]='\0';
+						return;
+					}
+				}
+				else {
+					m.textChar('*');		//print sur minitel
+//					Serial.print(key);		//print sur le prompt
+					pin[strCount] = key;
+					strCount++;
+					strCount%=19;
+
+				}
+			}
+		}
+	}
+}
+
+void call_number() {
+	m.clearScreen();
+	m.textMode();
+	m.textColor(WHITE);
+	m.bgColor(RED);
+	m.text(" Calling system ", 4, 1);
+	m.bgColor(BLACK);
+	m.text("Number : +", 1, 4);
+	m.cursor();
+	m.moveCursorTo(12,4);	
+	
+	
+	char num[20];
+	char txt[160];
+	char cmdcmgs[100];
+	saisieNum(num);
+	sprintf(cmdcmgs, "ATD+%s;\r", num);
+	MyGSM.send_AT_cmd(cmdcmgs, rep);
+	MyGSM.send_AT_cmd(txt, rep);
+		
+	delay(1000);	
+	
+	return loop();
+	
+}

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff