IchigoLatte PY ver 0.5.0 / GD32VF103 --- [reference] (IchigoLatte) - A OS. * ScrLock You can change NTSC mode when your TV monitor can't display well. You can also turn on the video when the video is off. * Ctrl+Alt+Del You can reboot the OS. (lash) - A latte shell. * .(no) Editable file io. no: 0~15 * uart UART serial io. * @(no) EEPROM file io. no: 0~63 (when 1Mbit) * _ Run the file '.' as Python or binary automatically. * ex. >cat . > uart >cat uart > .0 >cat @0 > .1 >cat .15 > @63 + '_' will be ran by pushing the button at the system booting. + it will switchs mode console<->uart mutually when btn is pushed or ctrl+d is received. (can't use 'vi' in uart mode.) (echo) - A argument printer. * ex. >echo Hello World. (skl) - A keyboard layout setter. (us/jp) * ex. >skl jp (video) - A video mode setter. (0-8) * ex. >video 3 (cat) - A input printer. * 'ESC' exit. * ex. >cat . >cat uart >cat -c 186 uart > . (ls) - A eeprom viewer. * ex. >ls (vi) - A text editor. * 'ESC' save and exit. * Ctrl+D exit.(NOT saved.) * Ctrl+X, Ctrl+C, Ctrl+V cut, copy and paste current line. * Shift+(arrow) select charactors. you can cut, copy and paste with Ctrl+X, Ctrl+C and Ctrl+V. * ex. >vi . >vi @0 (ny) - A simple Python engine. * ex. Interactive mode >ny * ex. Execution mode >ny . * spec length of variable name: 7 keywords that supported: if, else, while, break, def, return operators: ==, !=, <=, >=, >>, <<, =, +, -, *, /, %, not, <, >, &, |, ^, ~ (!) 'and' and 'or' are not supported. use '*' and '+' instead. - [global object 'latte' members] * True * False * print(v) print v to screen. * led(v) v==0 : led off v==1 : led on * btn() return 0/1 status about onborard button. * gpin(v) return 0/1 status about in-port no. v. * out(v) change out-port status. bit field of v is each port no. 7th bit is LED. * cls() clear screen. * lc(x, y) locate cursor to x and y. * msleep(v, [m]) sleep in v(msec). m is sleep mode. m==0 : normal sleep m==1 : deep sleep (precision:1,000 msec, max:65,535,000 msec) * inkey() return keyboard code that last pressed. * rnd(v) return random number less than v. v shuld be a positive number. * chr(v) return char as string of v. * sin8(v) return sin value by integer(x256). v is degree(s).(NOT radian) * tick() return msec that from system booted. * ana(p) return analog value of the port. p==0 : btn p==1-4 : in1-4 * scr(x, y) return char value of the screen at x and y. * pwm(p, d) output pwm signal on port p(1-6) with duration d(usec). * pwmt(t) set pwm cycle to t(usec).[DEFAULT:20,000] * scroll(v, [r]) scroll screen to v. v==0 : up v==1 : right v==2 : down v==3 : left r is rotation mode. r==0 : no rotate[DEFAULT] r==1 : rotate * video(v) switch ntsc signal. v==0 : off v==1 : on v==2 : on(invert mode) v==3 : on x2 v==4 : on x2(invert mode) v==5 : on x4 v==6 : on x4(invert mode) v==7 : on x8 v==8 : on x8(invert mode) (!) before video on, turn off spi by 'spim'. * input() return a number that user inputted. * bps(v) set uart bps to v.[DEFAULT:115,200] * uart(v, ...) write v to uart. if first v is number, a byte binary will be sent to uart. if first v is string, number value will be converted to string. * uart() if call with no args this will return a byte that uart received. if no data received this will return -1. * i2cw(a, ...) write to i2c device that is addressed a. params "..." will be sent to device. * i2cr(a, ...) read from i2c device that is addressed a. the values will be set to params "..." when function returned. * exit(v) exit code. * env(n) set a environment variable to n. the environment variable can be used from other programs. * env() get the environment variable. * mem(v) if v is number, a byte will return on the address v. if v is string, following address will return. v=="f" : fonts data address. (RO, 8byte * 256charactors) v=="." : file address. (RO, 2kb) v=="s" : screen ram address. (RW, 32*24 bytes) v==" " : free ram address. (RW, can use until top of raw stack) ex. | fm = mem("f"); // get address of fonts data. | log( mem(fm+(8*0x41)+0) ); // line 0 of font 'A'(0x41). * mem(a, v, ...) write v to memory of address a. return a address of the end of written. ex. | sm = mem("s"); // get address of screen mem. | mem(sm, 0x41); // put 'A' on (0,0) of screen. * mem() call risc-v code located in free ram. following args will be passed. a0 : (reserved) a1 : int32_t* (pointer to env) the a0 value will return. ex. | free = mem(" "); // get address of free mem. | mem(free, 0x70, 0x47); // write return only code. | mem(); // call the code. * ver() get IchigoLatte version number. later version is bigger than previous version number. * beep(h, d) sounds beep for h(hz) in duration d(msec). * dac(p, v) set analog value of the port. p is the port number. (!) The port will be changed to out mode. Reboot to get it back. p==2 : in2 p==3 : in3 v is analog value of the port. (0-4095) * spim(m) m==-1 : spi off m==0 : spi on (CPOL:0, CPHA:0) m==1 : spi on (CPOL:0, CPHA:1) m==2 : spi on (CPOL:1, CPHA:0) m==3 : spi on (CPOL:1, CPHA:1) (!) before spi on, turn off video by 'video'. * spi(v, ...) write v to spi. (!) before this, turn on spi by 'spim'. --- NaturalStyle Co. Ltd. http://na-s.jp/