├── Apps ├── bootDownloader │ ├── README.md │ ├── bootDownloader.bin │ └── bootDownloader.c └── node_test │ ├── app.c │ └── app.h ├── Doc ├── EEPROM说明.txt ├── TIM.txt ├── 电容式触控库.txt └── 选项字说明.txt ├── Driver ├── common.h ├── driver.h ├── inc │ ├── 24l01.h │ ├── CC1101.H │ ├── CC1101_REG.h │ ├── DHT11.h │ ├── adc.h │ ├── clk.h │ ├── delay.h │ ├── flash.h │ ├── font.h │ ├── i2c_driver.h │ ├── spi.h │ ├── timer.h │ ├── uart.h │ └── uc1602_driver.h └── src │ ├── 24L01.c │ ├── CC1101.c │ ├── DHT11.c │ ├── adc.c │ ├── clk.c │ ├── delay.c │ ├── flash.c │ ├── font.c │ ├── i2c_driver.c │ ├── spi.c │ ├── timer.c │ ├── uart.c │ └── uc1602_driver.c ├── HAL ├── wpan.c └── wpan.h ├── LICENSE └── README.md /Apps/bootDownloader/README.md: -------------------------------------------------------------------------------- 1 | 简介 2 | ==== 3 | bootDownloader是一个通过swim接口向没有hairBoot的芯片中烧写hairBoot的应用程序demo。 4 | 该应用运行在已烧录hairBoot的ST-Node中,它会将当前芯片flash中的hairBoot通过swim接口烧录至新的芯片中。 5 | 6 | 使用方法 7 | ======== 8 | 1. 将该应用源码通过STM8 Launcher编译并下载至ST-Node 9 | 2. 应用中的引脚设定为:PC7,Vcc(可选,可以使用3.3V替代); PC6,SWIM; PC5,RST; PC4,指示LED(可选,接阳极); 以及UART。 10 | 按照对应关系连接至待烧写芯片的Vcc, Gnd, SWIM, RST引脚, uart连接至PC串口(可选,只是为了查看烧写结果) 11 | 3. 给ST-Node上电,然后观察串口输出的提示信息或者led的指示;正常的话应该上电瞬间就提示烧写成功,led常亮。 12 | 4. 烧录完成! 新片已经可以使用STM8 Launcher进行串口下载了~ 13 | -------------------------------------------------------------------------------- /Apps/bootDownloader/bootDownloader.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Apps/bootDownloader/bootDownloader.bin -------------------------------------------------------------------------------- /Apps/bootDownloader/bootDownloader.c: -------------------------------------------------------------------------------- 1 | /*!Copyright(c) 2012-2013 uclink 2 | * 3 | *\file bootDownloader.c 4 | *\brief download hairboot to stm8 via swim 5 | * 6 | *\author Zepan 7 | *\version 1.0.0 8 | *\date 07Dec13 9 | * 10 | *\history \arg 1.0.0, 07Dec13, Zepan, Create file. 11 | * 12 | */ 13 | //头文件 14 | #include "app.h" 15 | 16 | //宏定义 17 | #define PAGE_SIZE 64 18 | #define PAGE_CNT 8 19 | 20 | #define VCC_1 PCset(7) 21 | #define VCC_0 PCclr(7) 22 | #define SWIM_1 PCset(6) 23 | #define SWIM_0 PCclr(6) 24 | #define SWIM_IN PCin(6) 25 | #define SWIM_OUTPUT_H GPIO_Init(GPIOC, GPIO_PIN_6, GPIO_MODE_OUT_PP_HIGH_FAST); 26 | #define SWIM_INPUT_H GPIOC->DDR &= ~(1<<6); 27 | #define RST_1 PCset(5) 28 | #define RST_0 PCclr(5) 29 | #define LED_1 PCset(4) 30 | #define LED_0 PCclr(4) 31 | 32 | #define S_0 do{SWIM_0;\ 33 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 34 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 35 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 36 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 37 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 38 | SWIM_1;\ 39 | __asm("NOP\nNOP\nNOP\n");\ 40 | }while(0) //39+1 + 3+1 41 | #define S_1 do{SWIM_0;\ 42 | __asm("NOP\nNOP\nNOP\n");\ 43 | SWIM_1;\ 44 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 45 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 46 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 47 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 48 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");\ 49 | }while(0) //3+1 + 39+1 50 | #define RETRY_CNT 1 51 | 52 | //函数声明 53 | void EntrySeq(void); 54 | char ProgramBoot(void); 55 | void LED_Indicate(char flag); 56 | 57 | char SWIM_SRST(void); 58 | char SWIM_ROTF(void); 59 | char SWIM_WOTF(void); 60 | char SWIM_WriteByte(char* addr, char data); 61 | char SWIM_WriteBuf(unsigned char n, char* addr, char* buf); 62 | char SWIM_ReadByte(char* addr, char* data); 63 | char SWIM_ReadBuf(unsigned char n, char* addr, char* buf); 64 | 65 | //全局变量 66 | char B; 67 | char B_index; 68 | char pb; 69 | 70 | int main(void) 71 | { 72 | //设置初始参数 73 | Parameter_Init(); 74 | 75 | RST_0; 76 | DelayUs(10000); //首先复位 77 | SWIM_0; 78 | DelayUs(20); //>16us 79 | EntrySeq(); 80 | while(SWIM_IN); 81 | while(!SWIM_IN); //接收 128x HSI;(16us) 82 | SWIM_OUTPUT_H; 83 | DelayUs(1000); //>300ns 84 | if(SWIM_SRST()) //软复位 85 | { 86 | printf("first SWIM_SRST failed!\n"); 87 | LED_Indicate(1); 88 | return 1; 89 | }; 90 | DelayUs(30000); 91 | if(SWIM_WriteByte((char*)0x7f80, 0xa0)) //设置debug mode 92 | { 93 | printf("set SWIM_CSR failed!\n"); 94 | LED_Indicate(1); 95 | return 2; 96 | }; 97 | DelayUs(10000); 98 | RST_1; 99 | DelayUs(10000); //release rst>1ms 100 | //active now 101 | if(ProgramBoot()) 102 | { 103 | printf("set ProgramBoot failed!\n"); 104 | LED_Indicate(1); 105 | return 3; 106 | } 107 | else 108 | { 109 | printf("ProgramBoot ok!\n"); 110 | LED_Indicate(0); 111 | } 112 | SWIM_SRST(); 113 | return 0; 114 | } 115 | 116 | void Parameter_Init(void) 117 | { 118 | Set_HSI(); //使用内部16M晶振 119 | DelayUs_Init();//tim1 120 | GPIO_Init(GPIOC, GPIO_PIN_HNIB, GPIO_MODE_OUT_PP_HIGH_FAST); //PC7~4 121 | LED_0; 122 | Init_UART1(115200); 123 | //enableInterrupts(); //开全局中断 124 | DelayUs(50000); 125 | } 126 | 127 | void EntrySeq(void) 128 | { 129 | char i; 130 | SWIM_OUTPUT_H; 131 | for(i = 0; i < 4; i++) 132 | { 133 | SWIM_1; 134 | DelayUs(500); 135 | SWIM_0; 136 | DelayUs(500); 137 | } 138 | for(i = 0; i < 4; i++) 139 | { 140 | SWIM_1; 141 | DelayUs(250); 142 | SWIM_0; 143 | DelayUs(250); 144 | } 145 | SWIM_INPUT_H; 146 | } 147 | 148 | char ProgramBoot(void) 149 | { 150 | char i; 151 | SWIM_WriteByte((char*)0x7F99, 0x08); //STALL CPU 152 | SWIM_WriteByte((char*)0x5062, 0x56); 153 | DelayUs(1000); 154 | SWIM_WriteByte((char*)0x5062, 0xae); //解锁flash 155 | DelayUs(10000); 156 | for(i = 0; i > 4); 192 | pb ^= (pb >> 2); 193 | pb ^= (pb >> 1); 194 | pb = pb & 0x01; //bit xor 195 | 196 | for(i = RETRY_CNT; i > 0; i--) 197 | { 198 | B = data; 199 | B_index = 0; 200 | SWIM_OUTPUT_H; 201 | __asm( 202 | "CLR A\n" //提前清零 203 | "BRES 0x500a, #0x6\n" //header//1 204 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //39+1=40 205 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 206 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 207 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 208 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 209 | "BSET 0x500a, #0x6\n" 210 | "NOP\nNOP\nNOP\n" //3+1=4 211 | "BRES 0x500a, #0x6\n" //提前置零//1 212 | "NOP\nNOP\nNOP\nNOP\n" //3//额外1个 213 | "CheckFinish:\n" 214 | "CP A, #0x8\n" //共8bit//1 215 | "JRNC Finish\n" //没有借位,即A>=8, 8bit完成//0.5 F 216 | "LD A, B\n" //载入数据//1 217 | "BCP A, #0x80\n" //A and 0x80//1 218 | "JREQ SEND0\n" //=0, send0, 否则 send1//0.5 F 219 | "SEND1:\n" //4低40高 220 | //"BRES 0x500a, #0x6\n" //1//8L36H 221 | //"NOP\n" //1 222 | "BSET 0x500a, #0x6\n" //1//0已经8个 223 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //22+2+12=36=44-8 224 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 225 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //额外3个 226 | "JRA NextBit\n" //为保持时间一致//2 F 227 | "SEND0:\n" //40低4高 228 | //"BRES 0x500a, #0x6\n" //1//32L12H 229 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //7+24+1=32=44-12 230 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 231 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"//额外两个 232 | "BSET 0x500a, #0x6\n" //1 233 | //"NOP\n" //1//额外一个 234 | "NextBit:\n" 235 | "LD A, B\n" //载入数据//1 236 | "SLL A\n" //左移一位//4 237 | "LD B, A\n" //保存数据//1 238 | "LD A, B_index\n" //载入当前位数//1 239 | "INC A\n" //自增//4 240 | "BRES 0x500a, #0x6\n" //提前置零//1//H,2+12;L,3+4 241 | "LD B_index, A\n" //保存数据//1 242 | "JRA CheckFinish\n" //循环//2 F 243 | "Finish:\n" //数据发送完成,发送校验位 244 | "TNZ pb\n" //4 245 | "JREQ SEND_0\n" //=0,send_0,否则send_1//0.5 F //至此0共9个 246 | "SEND_1:\n" //4低16高 247 | //"BRES 0x500a, #0x6\n" //1 248 | //"NOP\n" //1 249 | "BSET 0x500a, #0x6\n" //1//至此0共10个 250 | /*"NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //1 251 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 252 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 253 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //32+2=34=44=10*///以后有时间高 254 | "JRA SEND_END\n" //2 F 255 | "SEND_0:\n" //16低4高 256 | //"BRES 0x500a, #0x6\n" //1 257 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" //1 258 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 259 | "NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n" 260 | "NOP\nNOP\nNOP\nNOP\nNOP\n" //9+30+1=40=44-4//再减一个 261 | "BSET 0x500a, #0x6\n" //1 262 | //"NOP\nNOP\nNOP\nNOP\n" //1//以后有时间高 263 | "SEND_END:\n" //至此结束 264 | ); 265 | SWIM_INPUT_H; //1//wait for ack 266 | while(SWIM_IN); //等待下降沿 267 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 268 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 269 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");//延时超过半周期 270 | if(SWIM_IN)break; //ack, return 271 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 272 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 273 | } 274 | SWIM_OUTPUT_H; 275 | return (i <= 0); 276 | } 277 | 278 | char SWIM_SRST(void) 279 | { 280 | char i; 281 | for(i = RETRY_CNT; i > 0; i--) 282 | { 283 | SWIM_OUTPUT_H; 284 | S_0;S_0;S_0;S_0;S_0; 285 | SWIM_INPUT_H; //1 286 | while(SWIM_IN); //等待下降沿 287 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 288 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 289 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");//延时超过半周期 290 | if(SWIM_IN)break; //ack, return 291 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 292 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 293 | }; 294 | SWIM_OUTPUT_H; 295 | return (i <= 0); 296 | } 297 | 298 | char SWIM_ROTF(void) 299 | { 300 | char i; 301 | for(i = RETRY_CNT; i > 0; i--) 302 | { 303 | SWIM_OUTPUT_H; 304 | S_0;S_0;S_0;S_1;S_1; 305 | SWIM_INPUT_H; 306 | while(SWIM_IN); //等待下降沿 307 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 308 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 309 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");//延时超过半周期 310 | if(SWIM_IN)break; //ack, return 311 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 312 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 313 | }; 314 | SWIM_OUTPUT_H; 315 | return (i <= 0); 316 | } 317 | char SWIM_WOTF(void) 318 | { 319 | char i; 320 | for(i = RETRY_CNT; i > 0; i--) 321 | { 322 | SWIM_OUTPUT_H; 323 | S_0;S_0;S_1;S_0;S_1; 324 | SWIM_INPUT_H; 325 | while(SWIM_IN); //等待下降沿 326 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 327 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 328 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n");//延时超过半周期 329 | if(SWIM_IN)break; //ack, return 330 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 331 | __asm("NOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\nNOP\n"); 332 | }; 333 | SWIM_OUTPUT_H; 334 | return (i <= 0); 335 | } 336 | 337 | char SWIM_WriteByte(char* addr, char data) 338 | { 339 | if(SWIM_WOTF()) return 1; 340 | if(S_TxByte(1)) return 2; //N 341 | if(S_TxByte(0)) return 3; //@E 342 | if(S_TxByte((char)((unsigned short)addr>>8))) return 4; //@H 343 | if(S_TxByte((char)((unsigned short)addr&0x0ff))) return 5; //@L 344 | if(S_TxByte(data)) return 6; 345 | return 0; 346 | } 347 | 348 | //n:1~255 349 | char SWIM_WriteBuf(unsigned char n, char* addr, char* buf) 350 | { 351 | u16 i; 352 | 353 | if(SWIM_WOTF()) return 1; 354 | if(S_TxByte(n)) return 2; //N 355 | if(S_TxByte(0)) return 3; //@E 356 | if(S_TxByte((char)((unsigned short)addr>>8))) return 4; //@H 357 | if(S_TxByte((char)((unsigned short)addr&0x0ff))) return 5; //@L 358 | for(i = 0; i < n; i++) 359 | { 360 | if(S_TxByte(buf[i])) break; 361 | } 362 | if(i < n) return 6; 363 | else return 0; 364 | } 365 | 366 | char SWIM_ReadByte(char* addr, char* data) 367 | { 368 | return 0; 369 | } 370 | 371 | char SWIM_ReadBuf(unsigned char n, char* addr, char* buf) 372 | { 373 | return 0; 374 | } -------------------------------------------------------------------------------- /Apps/node_test/app.c: -------------------------------------------------------------------------------- 1 | #include "app.h" 2 | #include "string.h" 3 | /**************** 宏定义 ****************/ 4 | #define UID_ADDR 0x4865 5 | #define UID_LEN 12 6 | /**************** 函数声明 ****************/ 7 | void Cal_ID(u8 *buf); 8 | /**************** 全局变量 ****************/ 9 | const char logo[] = "\ 10 | ___________ _ __ __\n\ 11 | / ___/_ __/ / | / /___ ____/ /__\n\ 12 | \\__ \\ / / / |/ / __ \\/ __ / _ \\\n\ 13 | ___/ // / / /| / /_/ / /_/ / __/\n\ 14 | /____//_/ /_/ |_/\\____/\\__,_/\\___/\n\ 15 | Welcome to use ST Node!\n"; 16 | u8 enterFlag = 0; 17 | /**************** 函数 ****************/ 18 | int main(void) 19 | { 20 | u8 i; 21 | u8 id[UID_LEN]; 22 | Parameter_Init(); //设置初始参数 23 | printf("%s\n", logo); //打印logo 24 | Cal_ID(id); 25 | printf("Your ST Node ID is: "); 26 | for(i = 0; i < UID_LEN; i++) printf("%02X", id[i]); 27 | printf("\nTry input something :)\n"); 28 | while (1) 29 | { 30 | if(enterFlag) 31 | { 32 | printf("Enter @ %u.%03u s\n",(int)((systick*2)/1000), (int)((systick*2)%1000)); 33 | enterFlag = 0; 34 | } 35 | } 36 | } 37 | 38 | //参数初始化 39 | //输入参数:无 40 | //输出参数:无 41 | void Parameter_Init(void) 42 | { 43 | 44 | Set_HSI(); //16M 内部振荡器 45 | Init_UART1(115200); // 初始化串口 46 | T4Tick_Init(); //初始化系统定时器 47 | enableInterrupts(); //开全局中断 48 | } 49 | 50 | //计算节点ID 51 | //输入参数:存储ID的缓存指针 52 | //输出参数:无 53 | void Cal_ID(u8 *buf) 54 | { 55 | u8 i, j; 56 | memcpy(buf, (char *)UID_ADDR, UID_LEN); 57 | for(i =0; i <16; i++) 58 | { 59 | for(j = 0; j < UID_LEN; j++) 60 | { 61 | buf[j] ^= buf[(buf[j+1])%UID_LEN]; 62 | } 63 | } 64 | } 65 | 66 | /**************** 中断句柄 ****************/ 67 | INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) 68 | { 69 | systick++; 70 | TIM4->SR1 = (uint8_t)(~TIM4_IT_UPDATE); 71 | } 72 | 73 | INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18) 74 | { 75 | u8 ch; 76 | if(UART1->SR & (u8)UART1_FLAG_RXNE) 77 | { 78 | ch = UART1->DR; 79 | UART1_SendByte(ch); 80 | if(ch == '\n') 81 | { 82 | enterFlag = 1; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Apps/node_test/app.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :app.h 3 | * 描述 :应用层头文件 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-28 7 | **********************************************************************************/ 8 | #ifndef __APP_H 9 | #define __APP_H 10 | 11 | #include "stm8s.h" 12 | //#include "stm8_tsl_api.h" 13 | #include "driver.h" 14 | 15 | //float格式:31:符号位,23~30,阶码(减127即为2的指数),0~22,底数,为小数部分,前面默认为1,即底数在1~2之间 16 | //stm8为大端存储格式 17 | 18 | //宏定义 19 | #ifdef APP_GLOBAL 20 | #define APP_EXTERN 21 | #else 22 | #define APP_EXTERN extern 23 | #endif 24 | 25 | 26 | //变量声明 27 | APP_EXTERN u8 arg_flag; //参数锁定标志 28 | 29 | 30 | //函数声明 31 | void Parameter_Init(void); 32 | 33 | 34 | #endif 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Doc/EEPROM说明.txt: -------------------------------------------------------------------------------- 1 | EEPROM说明 2 | STM8S的EEPROM以32bit字长为基础组织起来, 3 | 对于小容量(8K及以下)器件,有640字节EEPROM,每页64字节,共10页,其中包括1页的选项字。 4 | 对于小容量(16~32K)器件,有1K字节EEPROM,每页512字节,共2页,其中包括1页的选项字。 5 | 对于小容量(64~128K)器件,有1~2K字节EEPROM,每页512字节,共4页,其中包括1页的选项字。 6 | 7 | 器件复位后,通过对FLASH_DUKR寄存器连续写入MASS密匙来解除DATA区域的写保护 8 | 两个密匙是:0x56,0xAE(程序存储器中顺序写入,EEPROM则反一下) 9 | 写保护解除后,FLASH_IAPSR的DUL位被置一。 10 | 11 | 使用EEPROM相关库函数时,需先取消stm8s.h中对RAM_EXECUTION的注释(宏定义为1) 12 | 13 | 写: 14 | ee_p=(u8 *)0x4000; //指向EEPROM第一个单元 15 | *ee_p=data; 16 | while((FLASH->IAPSR & 0x04) == 0); // 等待写操作成功 17 | 读: 18 | data=*ee_p 19 | 20 | -------------------------------------------------------------------------------- /Doc/TIM.txt: -------------------------------------------------------------------------------- 1 | STM8定时器笔记: 2 | 重复计数器为0时才自动更新 3 | 1、分频: 4 | TIM1 可以在(1~65536)之间任意分频: 5 | Fck_cnt=Fck_psc/(PSCR[15:0]+1) 6 | 先写高字节,后写低字节,更新事件后生效。 7 | 8 | TIM2/TIM3/TIM5 可以在(1~32768)之间以2的幂分频: 9 | Fck_cnt=Fck_psc/(2^(PSCR[3:0])) 10 | 更新事件后生效。 11 | 12 | 2、预装载: 13 | ARR/OCiR预装载允许时(ARPE=1 OCiPE=1),写入的寄存器值不会直接进入影子寄存器,需要发生一次更新事件后,才生效。 14 | ARR/OCiR预装载禁止时(ARPE=0 OCiPE=0),写入的寄存器值直接进入影子寄存器,立即生效,因此可能造成第一次的波形不正常。 15 | 16 | 3、更新: 17 | 置位TIMx_EGR的UG位可以软件生成一个更新事件。 18 | 向上计数方式时,CNT从ARR跳变到0时产生更新事件。 19 | 向下计数方式时,CNT从0跳变到ARR时产生更新事件。 20 | 向上/向下计数方式时(中央对齐模式),OCRi寄存器的值是比较值(OCiREF的有效时间)的一半,ARR寄存器的值是 实际周期值(不用-1)的一半,CNT从ARR-1增加到ARR时产生上溢事件,CNT从1减少到0时产生下溢事件。 21 | 安全使用中央对齐模式的计数器的方法是在启动计数器之前先用软件(置位TIM1_EGR寄存器的UG位)产生一个更新事件,并且不在计数器计数时修改计数器的值。 22 | 23 | 4、PWM模式: 24 | PWM边沿对齐PWM1模式,向上计数时,CCRx正确取值范围为(0~ARR): 25 | CCRx=0 时,产生全无效电平(产生占空比为0%的PWM波形)。 26 | CCRx<=ARR 时,产生CCRx个有效电平(产生占空比为 CCRx/(ARR+1)*100% 的PWM波形)。 27 | CCRx>ARR 时,产生全有效电平。 28 | 29 | PWM边沿对齐PWM1模式,向下计数时,CCRx正确取值范围为(0~ARR): 30 | CCRx=0 时,不能产生占空比 0% 的PWM波形(产生占空比为1/(ARR+1)*100%的PWM波形)。 31 | CCRx<=ARR 时,产生CCRx+1个有效电平(产生占空比为 (CCRx+1)/(ARR+1)*100% 的PWM波形)。 32 | CCRx>ARR 时,产生全有效电平。 33 | 34 | 5、单脉冲模式 35 | 这种模式允许计数器响应一个激励,并在一个程序可控的延时之后产生一个脉宽可控的脉冲。 36 | 仅当比较值与计数器的初始值不同时,才能产生一个脉冲。启动之前(当定时器正在等待触发),必须如下配置: 37 | 向上计数方式:计数器CNT < CCRi ≤ ARR, 38 | 向下计数方式:计数器CNT > CCRi。 39 | 40 | 6、捕获脉冲: 41 | 自动复位计数器方式下的PWM输入信号测量(参见RM0016 英文版P167/中文版P132): 42 | 在该模式下,可以方便地测试输入信号的周期(频率/转速)和占空比。 43 | TIMx_CCR1的 寄存器值+1 就是周期计数值,TIMx_CCR2的 寄存器值+1 就是高电平计数值。 44 | 占空比=(TIMx_CCR2+1)/(TIMx_CCR1+1)*100% 45 | 46 | ★★★需要注意的是,使用这种方法时,TIMx的溢出周期时间必须大于待测信号的最大周期。 47 | 例如:16M HSI内部振荡,16分频(TIM1_PSCR=16-1),TIM1 定时时基为 1us,则 TIM1 可测最大信号周期为 65536 us(最大可捕获值65535+1)。信号周期如果超过这个时间,捕获值就不是周期和占空比了。 48 | 49 | 7、其它捕获方式: 50 | 可以用不复位计数器的方式对输入信号进行捕获。数据处理上稍麻烦一点。 -------------------------------------------------------------------------------- /Doc/电容式触控库.txt: -------------------------------------------------------------------------------- 1 | 使用方法: 2 | 1、stm8_tsl_conf_RC_TOADAPT.h或stm8_tsl_conf_CT_TOADAPT.h改名为stm8_tsl_conf.h 3 | 2、主函数包含 stm8_tsl_api.h 4 | 3、添加所有库文件,但下列只添加其一: 5 | stm8_tsl_rc_acquisition.c,stm8l10x_tsl_ct_acquisition.c, 6 | stm8l15x_tsl_ct_acquisition.c,stm8l15x_tsl_ct_hw_acquisition.c 7 | 4、TSL_Init(); //触控库初始化 8 | Init_keys(); //按键初始化 9 | sSCKeyInfo[i].Setting.b.IMPLEMENTED = 1; 10 | sSCKeyInfo[i].Setting.b.ENABLED = 1; 11 | sSCKeyInfo[i].DxSGroup = 0x01; 12 | 5、在主循环中调用TSL_Action(); //周期性调用获取按键状态 13 | 14 | 主状态机状态:TSLState,以下状态顺序执行 15 | TSL_IDLE_STATE //完成了检测,可以读取稳定的状态 16 | TSL_SCKEY_P1_ACQ_STATE //端口1正获取 17 | TSL_SCKEY_P1_PROC_STATE //端口1正处理 18 | TSL_SCKEY_P2_ACQ_STATE 19 | TSL_SCKEY_P2_PROC_STATE 20 | TSL_SCKEY_P3_ACQ_STATE 21 | TSL_SCKEY_P3_PROC_STATE 22 | TSL_MCKEY1_ACQ_STATE 23 | TSL_MCKEY2_ACQ_STATE 24 | TSL_MCKEY_PROC_STATE 25 | TSL_ECS_STATE //环境控制系统正处理 26 | 27 | 除抖滤波器: 28 | DETECTION_INTEGRATOR_DEFAULT : 0,不滤波,检测一次;1,检测2次 29 | END_DETECTION_INTEGRATOR_DEFAULT : 30 | RECALIBRATION_INTEGRATOR_DEFAULT : 最小为1 31 | 32 | 环境控制系统: 33 | DxS:只检查一组中的一个键 34 | IIR滤波器 35 | 36 | 多路按键校正 37 | #define MCKEY1_DELTA_COEFF_A (0x0119) //高字节整数部分,低字节小数部分 38 | 39 | 按键状态: 40 | 单键: 41 | sSCKeyInfo[] 42 | typedef struct 43 | { 44 | KeyState_T State; /**< 按键状态结构体*/ 45 | KeyFlag_T Setting; /**< 按键设置结构体 */ 46 | u8 Counter; /**< 积分用计数器 */ 47 | u8 DxSGroup; /**< 按键组号 */ 48 | Channel_Info_T Channel; /**< 通道结构体 */ 49 | s8 DetectThreshold; /**< 检测门限值 */ 50 | s8 EndDetectThreshold; /**< 结束检测门限次数 */ 51 | s8 RecalibrationThreshold; /**< 校准门限 */ 52 | } 53 | Single_Channel_Complete_Info_T; 54 | 55 | //KeyFlag_T共用体宏定义,含位域。 56 | typedef union 57 | { 58 | u16 whole; 59 | struct { 60 | unsigned CHANGED: 1 //按键改变 61 | unsigned DETECTED: 1 //按键按下 62 | unsigned DIRECTION: 1 //库函数内部用途 63 | unsigned ENABLED: 1 //按键使能 64 | unsigned ERROR: 1 //按键有错误 65 | unsigned IMPLEMENTED: 1 //按键实施 66 | unsigned LOCKED: 1 //库函数内部用途 67 | unsigned MCKEY_TYPE: 1 //指示多通道按键类型,0为滑环,1为滑条 68 | unsigned NOISE: 1 //指示按键测量过程中有噪声 69 | unsigned POSCHANGED: 1 //指示多通道按键改变 70 | …… //保留 71 | }b; 72 | }KeyFlag_T; 73 | 74 | //KeyState_T共用体宏定义,含位域 75 | typedef union 76 | { 77 | u8 whole; 78 | struct { 79 | unsigned CALIBRATION: 1 //按键正在校准 80 | unsigned DETECTED: 1 //按键检测到 81 | unsigned DISABLED: 1 //按键被失能 82 | unsigned ERROR: 1 //按键有错误 83 | unsigned IDLE: 1 //按键空闲 84 | unsigned POST_STATE: 1 //按键正在检测 85 | unsigned PRE_STATE: 1 //按键在预校准或预检测 86 | unsigned RESERVED: 1 //保留 87 | } b; 88 | } KeyState_T; 89 | 90 | 91 | 92 | 93 | 时基: 94 | TSL_Tick_Base : 0.5us自增一次,0~19计数,TSL_Timer_ISR()完成. 95 | TSL_Tick_10ms : 10ms自增一次,0~9计数 96 | TSL_Tick_100ms : 100ms自增一次,0~9计数。 97 | 98 | SCKEY_DETECTTHRESHOLD_DEFAULT 99 | 默认检测门限值,大于则按下,1~127,越低灵敏度越高,典型10. 100 | SCKEY_ENDDETECTTHRESHOLD_DEFAULT 101 | 结束检测次数,小于则未按下,典型8 102 | SCKEY_RECALIBRATIONTHRESHOLD_DEFAULT 103 | 校准门限值,差值小于该值时校准,典型-10 104 | MCKEY_DETECTTHRESHOLD_DEFAULT 30 105 | MCKEY_ENDDETECTTHRESHOLD_DEFAULT 20 106 | MCKEY_RECALIBRATIONTHRESHOLD_DEFAULT -20 107 | 108 | MCKEY_RESOLUTION_DEFAULT 109 | MCKEY_DIRECTION_CHANGE_ENABLED 110 | MCKEY_DIRECTION_CHANGE_MAX_DISPLACEMENT 111 | MCKEY_DIRECTION_CHANGE_INTEGRATOR_DEFAULT 112 | MCKEY_DIRECTION_CHANGE_THRESHOLD_DEFAULT 113 | 114 | DETECTION_INTEGRATOR_DEFAULT 115 | 检测积分器,0~255,相当于低通滤波,典型2 116 | END_DETECTION_INTEGRATOR_DEFAULT 117 | 结束检测积分器,0~255,相当于低通滤波,典型2 118 | RECALIBRATION_INTEGRATOR_DEFAULT 119 | 校准积分器,典型10 120 | 121 | ECS_TIME_STEP_DEFAULT 122 | IIR采样频率,10ms为单位,1~255,典型20 123 | ECS_TEMPO_DEFAULT 124 | 检测后的延迟,100ms为单位,典型20 125 | ECS_IIR_KFAST_DEFAULT 126 | 快速滤波器的K参数,1~255,典型20,越大反应越快 127 | ECS_IIR_KSLOW_DEFAULT 128 | 慢速滤波器的K参数,1~255,典型10 129 | Yn = (1 - K) . Yn-1 + (K . Xn) 130 | 131 | DTO_DEFAULT 132 | 检测超时时间,单位1S,0~255,典型0(无限) 133 | 134 | NEGDETECT_AUTOCAL 135 | 自动校准,1使能,0失能 136 | 137 | SCKEY_MIN_ACQUISITION 138 | 最小获取值,0~65535,典型50 139 | SCKEY_MAX_ACQUISITION 140 | 最大获取值,0~65535,典型3000 141 | MCKEY_MIN_ACQUISITION 142 | MCKEY_MAX_ACQUISITION 143 | 144 | MCKEY1_DELTA_COEFF_A to MCKEY1_DELTA_COEFF_H 多通道按键校正 145 | MCKEY2_DELTA_COEFF_A to MCKEY2_DELTA_COEFF_H 146 | 147 | IT_SYNC 148 | 中断同步,1使能 149 | 150 | SCKEY_ACQ_NUM 151 | 检测每个按键的次数(每次又有若干次充放电过程),1~255,典型3 152 | SCKEY_ADJUST_LEVEL 153 | 取得的计数值除以2^SCKEY_ADJUST_LEVEL得到最终值用于计算差值,0~255,典型1,与SCKEY_ACQ_NUM有关 154 | MCKEY_ACQ_NUM 155 | MCKEY_ADJUST_LEVEL 156 | MAX_REJECTED_MEASUREMENTS 157 | 最大拒绝次数,SCKEY_ACQ_NUM次检测中最多出现这么多次(充放电)错误是准许的。 158 | MAX_MEAS_COEFF 159 | 最大原始计数值,高字节整数部分,低字节小数部分 160 | MIN_MEAS_COEFF 161 | 最小原始计数值,高字节整数部分,低字节小数部分 162 | 主动屏蔽 163 | 164 | -------------------------------------------------------------------------------- /Doc/选项字说明.txt: -------------------------------------------------------------------------------- 1 | 选项字说明: 2 | OPT0 0x4800 读保护ROP,写0xaa使能读保护 3 | OPT1 0x4801 用户启动代码区域UBC 4 | OPT2 0x4803 可选功能重映射AFR 5 | OPT3 0x4805 杂选项 6 | OPT4 0x4807 时钟选项 7 | OPT5 0x4809 外部时钟启动时间 8 | UniqueID 0x4865~0x4870 96位 9 | 10 | //以下为103F系列(20pin) 11 | AFR7 12 | 0: AFR7 重映射选项字不激活,默认功能,下同。 13 | 1: PC3 = TIM1_CH1N, PC4 = TIM1_CH2N. 14 | AFR6 15 | 保留 16 | AFR5 17 | 保留 18 | AFR4 19 | 1: PB4 = ADC_ETR; PB5 = TIM1_BKIN. 20 | AFR3 21 | 1: PC3 = TLI. 22 | AFR2 23 | 1: PC4 = AIN2, PD2 = AIN3. 24 | AFR1 25 | 1: PA3 = SPI_NSS, PD2 = TIM2_CH3. 26 | AFR0 27 | 1: PC5 = TIM2_CH1, PC6 = TIM1_CH1, PC7 = TIM1_CH2. 28 | 29 | //以下为105系列 30 | AFR7 31 | 0: AFR7 重映射选项字不激活,默认功能,下同。 32 | 1: Port D4 = BEEP. 33 | AFR6 34 | 1: Port B5 = I2C_SDA; 35 | port B4 = I2C_SCL. 36 | AFR5 37 | 1: Port B3 = TIM1_ETR; 38 | port B2 = TIM1_NCC3; 39 | port B1 = TIM1_CH2N; 40 | port B0 = TIM1_CH1N. 41 | AFR4 42 | 1: Port D7 = TIM1_CH4. 43 | AFR3 44 | 1: Port D0 = TIM1_BKIN. 45 | AFR2 46 | 1: Port D0 = CLK_CCO. 47 | 备注: AFR2优先级高于AFR3,如果同时激活,以AFR2为准 48 | AFR1 49 | 1: Port A3 = TIM3_CH1; 50 | port D2 = TIM2_CH3. 51 | AFR0 52 | 1: Port D3 = ADC_ETR. -------------------------------------------------------------------------------- /Driver/common.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * �ļ��� ��common.h 3 | * ���� �����ú���ͷ�ļ� 4 | * ���汾 ��V2.0.0 5 | * ���� �������޲� QQ:715805855 6 | *�޸�ʱ�� ��2012-7-26 7 | **********************************************************************************/ 8 | 9 | #ifndef __COMMON_H 10 | #define __COMMON_H 11 | 12 | #include "stm8s.h" 13 | #include 14 | 15 | //����������ʼ�������� 16 | //EXTI 17 | /* 18 | GPIO_Init(GPIOD, GPIO_PIN_4, GPIO_MODE_IN_PU_IT); 19 | EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOD, EXTI_SENSITIVITY_FALL_ONLY); 20 | */ 21 | //ITC,�����ж����ȼ�,ITC_SetSoftwarePriority 22 | /* 23 | ITC->ISPR6 &= (0x03<<((ITC_IRQ_UART2_RX%4)*2)); 24 | ITC->ISPR6 |= (ITC_PRIORITYLEVEL_2<<((ITC_IRQ_UART2_RX%4)*2)); 25 | 26 | ITC->ISPR5 &= (0x03<<((ITC_IRQ_UART1_RX%4)*2)); 27 | ITC->ISPR5 |= (ITC_PRIORITYLEVEL_2<<((ITC_IRQ_UART2_RX%4)*2)); 28 | */ 29 | 30 | //�궨�� 31 | //����ֵ 32 | #define ABS(x) ((x)>=0?(x):(-x)) 33 | //������������ֵ 34 | #define MAX(a,b,c) ((a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c))) 35 | #define MAX_INDEX(a,b,c) ((a)>(b)?((a)>(c)?0:2):((b)>(c)?1:2)) 36 | 37 | //ȡ�õ�ַ����Ӧ���������͵����� 38 | #define MEM_U8(x) (*((u8 *)(x))) 39 | #define MEM_U16(x) (*((u16 *)(x))) 40 | #define MEM_U32(x) (*((u32 *)(x))) 41 | #define MEM_FLOAT(x) (*((float *)(x))) 42 | 43 | #define SYSCLK HSI_VALUE //ϵͳƵ�� 44 | 45 | //ע�⣺�Ż��ٶ��ú궨�壬�Ż��ռ��ÿ⺯�� 46 | //GPIO���� 47 | #define PIN0 GPIO_PIN_0 48 | #define PIN1 GPIO_PIN_1 49 | #define PIN2 GPIO_PIN_2 50 | #define PIN3 GPIO_PIN_3 51 | #define PIN4 GPIO_PIN_4 52 | #define PIN5 GPIO_PIN_5 53 | #define PIN6 GPIO_PIN_6 54 | #define PIN7 GPIO_PIN_7 55 | 56 | #define PA_out (GPIOA->ODR) 57 | #define PA_in (GPIOA->IDR) 58 | #define PAset(n) (GPIOA->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 64 | #define PB_in (GPIOB->IDR) 65 | #define PBset(n) (GPIOB->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 71 | #define PC_in (GPIOC->IDR) 72 | #define PCset(n) (GPIOC->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 78 | #define PD_in (GPIOD->IDR) 79 | #define PDset(n) (GPIOD->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 85 | #define PE_in (GPIOE->IDR) 86 | #define PEset(n) (GPIOE->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 92 | #define PF_in (GPIOF->IDR) 93 | #define PFset(n) (GPIOF->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 100 | #define PG_in (GPIOG->IDR) 101 | #define PGset(n) (GPIOG->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 109 | #define PH_in (GPIOH->IDR) 110 | #define PHset(n) (GPIOH->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<ODR) 118 | #define PI_in (GPIOI->IDR) 119 | #define PIset(n) (GPIOI->ODR|=(1<ODR&=~(1<ODR^=(1<IDR&(1<>15) 44 | 45 | //变量声明 46 | DELAY_EXTERN volatile u32 systick; 47 | DELAY_EXTERN u16 d_time; 48 | 49 | //函数声明 50 | void T4Tick_Init(void); 51 | void Soft_DelayMs(u16 t); 52 | void Soft_DelayUs(u16 t); 53 | void DelayMs_Init(void); 54 | void DelayUs_Init(void); 55 | void DelayMs(u16 t); 56 | void DelayUs(u16 t); 57 | 58 | 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Driver/inc/flash.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :flash.h 3 | * 描述 :flash操作相关函数头文件 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-27 7 | **********************************************************************************/ 8 | //注意使用flash相关功能应去掉stm8s.h中下面的注释 9 | // To enable execution from RAM 10 | //#if !defined (RAM_EXECUTION) 11 | //#define RAM_EXECUTION (1) 12 | //#endif /* RAM_EXECUTION */ 13 | 14 | #ifndef __FLASH_H 15 | #define __FLASH_H 16 | 17 | #include "common.h" 18 | 19 | //宏定义 20 | #define OPT2_ADDR 0x4803 21 | 22 | //函数声明 23 | void Cfg_OPT2(u8 bit_n,u8 opt); 24 | 25 | #endif -------------------------------------------------------------------------------- /Driver/inc/font.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/inc/font.h -------------------------------------------------------------------------------- /Driver/inc/i2c_driver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/inc/i2c_driver.h -------------------------------------------------------------------------------- /Driver/inc/spi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/inc/spi.h -------------------------------------------------------------------------------- /Driver/inc/timer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :timer.h 3 | * 描述 :定时器相关函数的头文件 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-27 7 | **********************************************************************************/ 8 | #ifndef __TIMER_H 9 | #define __TIMER_H 10 | 11 | #include "common.h" 12 | 13 | //输入捕获初始化样例 14 | /* 15 | //通道1,上升沿, 16 | //TIM1_ICSELECTION_INDIRECTTI表示相邻通道, 17 | // 如CH1<->CH2,CH3<->CH4,DIRECTTI则为本通道,见P130 18 | //TIM1_ICPSC_DIV1表示捕捉预分频,捕捉到几次才触发一次 19 | //最后一个参数为输入滤波器参数,0时无滤波器,详见P154 20 | TIM1_ICInit(TIM1_CHANNEL_1, TIM1_ICPOLARITY_RISING, \ 21 | TIM1_ICSELECTION_INDIRECTTI, TIM1_ICPSC_DIV1, 0x00); 22 | TIM1_ITConfig( TIM1_IT_CC1 , ENABLE); //输入捕获1中断使能 23 | TIM1_ClearFlag(TIM1_FLAG_CC1); //清中断标志 24 | TIM1_Cmd(ENABLE); //运行定时器 25 | */ 26 | 27 | //结构体 28 | typedef struct { 29 | float f; //PWM的频率 30 | float duty; //PWM的占空比 31 | u8 ch; //使用的通道 32 | // GPIO_TypeDef * GPIOx; //该通道所在GPIO口 33 | // GPIO_Pin_TypeDef Pinx; //该通道所用引脚,如GPIO_PIN_0 34 | }PWM_Typedef; 35 | 36 | //函数声明 37 | void T1_PWM_Init(PWM_Typedef *PWMx); 38 | void T1_PWM_Duty(PWM_Typedef *PWMx); 39 | void T2_PWM_Init(PWM_Typedef *PWMx); 40 | void T2_PWM_Duty(PWM_Typedef *PWMx); 41 | 42 | #if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) ||defined(STM8S105) ||\ 43 | defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) 44 | void T3_PWM_Init(PWM_Typedef *PWMx); 45 | void T3_PWM_Duty(PWM_Typedef *PWMx); 46 | #endif 47 | 48 | #endif -------------------------------------------------------------------------------- /Driver/inc/uart.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :uart.h 3 | * 描述 :串口应用头文件 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-26 7 | *注: USART1:RX-PA4,TX-PA5 8 | USART2:RX-PD6,TX-PD5 9 | ****************************************************************************************/ 10 | #ifndef __UART_H 11 | #define __UART_H 12 | #include "common.h" 13 | #include 14 | #include 15 | 16 | #ifdef UART_GLOBAL 17 | #define UART_EXTERN 18 | #else 19 | #define UART_EXTERN extern 20 | #endif 21 | 22 | #define countof(a) (sizeof(a) / sizeof(*(a))) 23 | #define RxBufferSize 64 24 | 25 | //串口中断接收数据相关 26 | //使用方法如下: 27 | /* 28 | if(UART_REC) 29 | { 30 | UART2_SendData(RxBuffer,UART_NUM); 31 | UART2_SendByte('\r\n'); 32 | UART_RX_NUM=0; 33 | } 34 | */ 35 | UART_EXTERN u8 RxBuffer[RxBufferSize]; 36 | //低6位表示接收到的字节数 37 | //bit7表示接收到0x0d,bit8表示接收到0x0a,一行接收完成 38 | UART_EXTERN u8 UART_RX_NUM; 39 | #define UART_REC (UART_RX_NUM&0x80) //串口中断接收完成标志 40 | #define UART_NUM (UART_RX_NUM&0x3f) //串口缓冲区的字节数 41 | 42 | 43 | //字符串整形 44 | static char *itoa(int value, char *string, int radix); 45 | 46 | //如果是UART1 47 | #if defined(STM8S208) ||defined(STM8S207) || defined(STM8S007) ||defined(STM8S103) ||\ 48 | defined(STM8S003) || defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax) 49 | 50 | //先等待非空再发送 51 | #define UART1_SendByte(x) \ 52 | {while (!(UART1->SR & (u8)UART1_FLAG_TXE));UART1->DR = (x);} 53 | 54 | void Init_UART1(u32 baud); 55 | // int fputc(int ch, FILE *f); 56 | // int fgetc(FILE *f); 57 | void UART1_SendString(u8* Data); 58 | void UART1_SendData(u8* Data,u8 len); 59 | u8 UART1_ReceiveByte(void); 60 | void UART1_printf( uint8_t *Data,...); 61 | #endif 62 | 63 | //串口2 64 | #if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) 65 | //先等待非空再发送 66 | #define UART2_SendByte(x) \ 67 | {while (!(UART2->SR & (u8)UART2_FLAG_TXE));UART2->DR = (x);} 68 | 69 | void Init_UART2(u32 baud); 70 | // int fputc(int ch, FILE *f); 71 | // int fgetc(FILE *f); 72 | void UART2_SendString(u8* Data); 73 | void UART2_SendData(u8* Data,u8 len); 74 | u8 UART2_ReceiveByte(void); 75 | void UART2_printf( uint8_t *Data,...); 76 | #endif 77 | 78 | 79 | #endif -------------------------------------------------------------------------------- /Driver/inc/uc1602_driver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/inc/uc1602_driver.h -------------------------------------------------------------------------------- /Driver/src/24L01.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/24L01.c -------------------------------------------------------------------------------- /Driver/src/CC1101.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/CC1101.c -------------------------------------------------------------------------------- /Driver/src/DHT11.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/DHT11.c -------------------------------------------------------------------------------- /Driver/src/adc.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :adc.c 3 | * 描述 :adc相关函数 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-9-10 7 | **********************************************************************************/ 8 | #define ADC_GLOBAL 9 | #include "adc.h" 10 | 11 | //ADC1单次转换 12 | //输入参数:转换通道(0~15) 13 | //输出参数:无 14 | //备注:默认时钟8分频,数据右对齐 15 | void ADC1_Init_Single(u8 ch) 16 | { 17 | //设置数据右对齐 18 | ADC1->CR2 |= (uint8_t)(ADC1_ALIGN_RIGHT); 19 | //设置为单次转换模式 20 | ADC1->CR1 &= (uint8_t)(~ADC1_CR1_CONT); 21 | //选择要转换的通道 22 | ADC1->CSR &= (uint8_t)(~ADC1_CSR_CH); 23 | ADC1->CSR |= (uint8_t)(ch); 24 | //设置时钟预分频,默认8分频 25 | ADC1->CR1 &= (uint8_t)(~ADC1_CR1_SPSEL); 26 | ADC1->CR1 |= (uint8_t)(ADC1_PRESSEL_FCPU_D8); 27 | //失能外部触发 28 | ADC1->CR2 &= (uint8_t)(~ADC1_CR2_EXTTRIG); 29 | //失能斯密特触发器,降低功耗 30 | if(ch<8)ADC1->TDRL |=(u8)(0x01)<TDRH |=(u8)(0x01)<<(ch-8); 32 | //使能ADC1 33 | ADC1->CR1 |= ADC1_CR1_ADON; 34 | } 35 | 36 | //ADC1取得单次转换的结果 37 | //输入参数:存储转换结果的地址 38 | //输出参数:无 39 | //备注:默认右对齐 40 | void ADC1_Get_Single(u16 *data) 41 | { 42 | u8 tmp; 43 | //启动一次转换 44 | ADC1->CR1 |= ADC1_CR1_ADON; 45 | //等待转换结束 46 | while(!(ADC1->CSR&ADC1_FLAG_EOC)); 47 | //清标志 48 | ADC1->CSR&=~ADC1_FLAG_EOC; 49 | tmp = ADC1->DRL; 50 | *data =(ADC1->DRH); 51 | *data =(*data<<8)|tmp; 52 | } 53 | 54 | //ADC1单次扫描模式转换 55 | //输入参数:转换截止通道(0~n扫描) 56 | //输出参数:无 57 | //备注:默认时钟8分频,数据右对齐 58 | void ADC1_Init_Scan(u8 ch) 59 | { 60 | //设置数据右对齐 61 | ADC1->CR2 |= (uint8_t)(ADC1_ALIGN_RIGHT); 62 | //设置为单次转换模式 63 | ADC1->CR1 &= (uint8_t)(~ADC1_CR1_CONT); 64 | //选择要转换的截止通道 65 | ADC1->CSR &= (uint8_t)(~ADC1_CSR_CH); 66 | ADC1->CSR |= (uint8_t)(ch); 67 | //设置扫描模式 68 | ADC1->CR2 |= ADC1_CR2_SCAN; 69 | //设置时钟预分频,默认8分频 70 | ADC1->CR1 &= (uint8_t)(~ADC1_CR1_SPSEL); 71 | ADC1->CR1 |= (uint8_t)(ADC1_PRESSEL_FCPU_D8); 72 | //失能外部触发 73 | ADC1->CR2 &= (uint8_t)(~ADC1_CR2_EXTTRIG); 74 | //失能斯密特触发器,降低功耗 75 | if(ch<8)ADC1->TDRL |=(u8)(0x01)<TDRH |=(u8)(0x01)<<(ch-8); 77 | //使能ADC1 78 | ADC1->CR1 |= ADC1_CR1_ADON; 79 | } 80 | 81 | //ADC1获取单次扫描模式结果 82 | //输入参数:存储结果的数组地址,通道总数 83 | //输出参数:无 84 | //备注:默认时钟8分频,数据右对齐 85 | void ADC1_Get_Scan(u16* data,u8 n) 86 | { 87 | u8 i,tmp; 88 | //启动一次转换 89 | ADC1->CR1 |= ADC1_CR1_ADON; 90 | //等待转换结束 91 | while(!(ADC1->CSR&ADC1_FLAG_EOC)); 92 | //清标志 93 | ADC1->CSR&=~ADC1_FLAG_EOC; 94 | //存储值 95 | for(i=0;i<=n;i++) 96 | { 97 | tmp = *(&(ADC1->DB0RL)+i*2); //右对齐先读低位 98 | data[i] = *(&(ADC1->DB0RH)+i*2); 99 | data[i]= (data[i]<<8)|tmp; 100 | } 101 | } -------------------------------------------------------------------------------- /Driver/src/clk.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :clk.c 3 | * 描述 :时钟相关函数 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-28 7 | **********************************************************************************/ 8 | 9 | #include "clk.h" 10 | 11 | 12 | //设置外部时钟为主时钟 13 | //输入参数:无 14 | //输出参数:无 15 | void Set_HSE(void) 16 | { 17 | //CLK_DeInit(); //恢复默认设置 18 | CLK_HSECmd(ENABLE); //外部时钟开 19 | while(SET != CLK_GetFlagStatus(CLK_FLAG_HSERDY)); //等待外部时钟稳定 20 | CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1); //不分频 21 | CLK_ClockSwitchCmd(ENABLE); //时钟切换使能 22 | //切换配置 23 | CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO,CLK_SOURCE_HSE,DISABLE,CLK_CURRENTCLOCKSTATE_ENABLE); 24 | } 25 | 26 | //设置内部时钟16M为主时钟 27 | //输入参数:无 28 | //输出参数:无 29 | void Set_HSI(void) 30 | { 31 | //CLK_DeInit(); //恢复默认设置 32 | CLK_HSICmd(ENABLE); //内部时钟开 33 | while(SET != CLK_GetFlagStatus(CLK_FLAG_HSIRDY)); //等待内部时钟稳定 34 | CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV1); //不分频,16M 35 | CLK_ClockSwitchCmd(ENABLE); //时钟切换使能 36 | //切换配置 37 | CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO,CLK_SOURCE_HSI,DISABLE,CLK_CURRENTCLOCKSTATE_DISABLE); 38 | } -------------------------------------------------------------------------------- /Driver/src/delay.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :delay.c 3 | * 描述 :延时函数 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-26 7 | **********************************************************************************/ 8 | #define DELAY_GLOBAL 9 | #include "delay.h" 10 | 11 | //定时器4产生滴答时钟 12 | //输入参数:无 13 | //输出参数:无 14 | //备注:16M时钟时,输出488Hz,近似为2ms一次(2.048) 15 | void T4Tick_Init(void) 16 | { 17 | TIM4->ARR = 0xff; //自动重装值 18 | TIM4->PSCR = (uint8_t)(TIM4_PRESCALER_128); //128分频 19 | TIM4->EGR = (uint8_t)TIM4_PSCRELOADMODE_IMMEDIATE; //立即更新分频值 20 | TIM4->IER |= (uint8_t)TIM4_IT_UPDATE; //允许更新中断 21 | TIM4->CR1 |= TIM4_CR1_CEN; //运行 22 | systick=0; 23 | 24 | } 25 | 26 | //软件延时毫秒级时间 27 | //输入参数:毫秒数 28 | //输出参数:无 29 | //备注:自适应晶振频率 30 | void Soft_DelayMs(u16 t) 31 | { 32 | u16 i; 33 | for(;t;t--) 34 | { 35 | for(i=TICK_MS;i;i--); 36 | } 37 | } 38 | 39 | //软件延时微秒级时间 40 | //输入参数:微秒数 41 | //输出参数:无 42 | //备注:自适应晶振频率,不能超过20ms(t溢出) 43 | void Soft_DelayUs(u16 t) 44 | { 45 | for(t=t*TICK_US/4;t;t--) 46 | { 47 | } 48 | 49 | } 50 | 51 | //定时器延时毫秒级时间初始化,只能用TIM1 52 | //输入参数:无 53 | //输出参数:无 54 | //备注:自适应晶振频率 55 | void DelayMs_Init(void) 56 | { 57 | TIM1_DeInit(); 58 | //向上计数,自动重装值为最大值 59 | TIM1_TimeBaseInit(DIV_MS,TIM1_COUNTERMODE_UP,0xffff,0); 60 | //缓冲写入ARR 61 | TIM1_ARRPreloadConfig(ENABLE); 62 | // 软件产生更新事件,用于更新PSCR寄存器 63 | TIM1->EGR = 0x01; 64 | 65 | } 66 | 67 | //定时器延时毫秒级时间 68 | //输入参数:延时毫秒数 69 | //输出参数:无 70 | //备注:自适应晶振频率 71 | void DelayMs(u16 t) 72 | { 73 | TIM1_SetCounter(0x0000); //清零 74 | TIM1->CR1 |= TIM1_CR1_CEN; //开 75 | while(TIM1_GetCounter()CR1 &= (uint8_t)(~TIM1_CR1_CEN); //关 77 | } 78 | 79 | #ifdef USE_T1 80 | 81 | //定时器延时微秒级时间初始化 82 | //输入参数:无 83 | //输出参数:无 84 | //备注:自适应晶振频率 85 | void DelayUs_Init(void) 86 | { 87 | TIM1_DeInit(); 88 | //向上计数,自动重装值为最大值 89 | TIM1_TimeBaseInit(DIV_US,TIM1_COUNTERMODE_UP,0xffff,0); 90 | //缓冲写入ARR 91 | TIM1_ARRPreloadConfig(ENABLE); 92 | // 软件产生更新事件,用于更新PSCR寄存器 93 | TIM1->EGR = 0x01; 94 | } 95 | 96 | //定时器延时微秒级时间 97 | //输入参数:延时微秒数 98 | //输出参数:无 99 | //备注:自适应晶振频率 100 | void DelayUs(u16 t) 101 | { 102 | if(t<9)return; 103 | else 104 | { 105 | t-=8; //除去本身调用所花时间 106 | TIM1_SetCounter(0x0000); //清零 107 | TIM1->CR1 |= TIM1_CR1_CEN; //开 108 | while(TIM1_GetCounter()CR1 &= (uint8_t)(~TIM1_CR1_CEN); //关 110 | } 111 | } 112 | 113 | #elif defined(USE_T2) 114 | 115 | //定时器延时微秒级时间初始化 116 | //输入参数:无 117 | //输出参数:无 118 | //备注:自适应晶振频率 119 | void DelayUs_Init(void) 120 | { 121 | TIM2_DeInit(); 122 | //向上计数,自动重装值为最大值 123 | TIM2_TimeBaseInit(DIV_US,0xffff); 124 | //缓冲写入ARR 125 | TIM2_ARRPreloadConfig(ENABLE); 126 | // 软件产生更新事件,用于更新PSCR寄存器 127 | TIM2->EGR = 0x01; 128 | } 129 | 130 | //定时器延时微秒级时间 131 | //输入参数:延时微秒数 132 | //输出参数:无 133 | //备注:自适应晶振频率 134 | void DelayUs(u16 t) 135 | { 136 | if(t<9)return; 137 | else 138 | { 139 | t-=8; //除去本身调用所花时间 140 | TIM2_SetCounter(0x0000); //清零 141 | TIM2->CR1 |= TIM2_CR1_CEN; //开 142 | while(TIM2_GetCounter()CR1 &= (uint8_t)(~TIM2_CR1_CEN); //关 144 | } 145 | } 146 | 147 | #elif defined(USE_T3) 148 | 149 | //定时器延时微秒级时间初始化 150 | //输入参数:无 151 | //输出参数:无 152 | //备注:自适应晶振频率 153 | void DelayUs_Init(void) 154 | { 155 | TIM3_DeInit(); 156 | //向上计数,自动重装值为最大值 157 | TIM3_TimeBaseInit(DIV_US,0xffff); 158 | //缓冲写入ARR 159 | TIM3_ARRPreloadConfig(ENABLE); 160 | // 软件产生更新事件,用于更新PSCR寄存器 161 | TIM3->EGR = 0x01; 162 | } 163 | 164 | //定时器延时微秒级时间 165 | //输入参数:延时微秒数 166 | //输出参数:无 167 | //备注:自适应晶振频率 168 | void DelayUs(u16 t) 169 | { 170 | if(t<9)return; 171 | else 172 | { 173 | t-=8; //除去本身调用所花时间 174 | TIM3_SetCounter(0x0000); //清零 175 | TIM3->CR1 |= TIM3_CR1_CEN; //开 176 | while(TIM3_GetCounter()CR1 &= (uint8_t)(~TIM3_CR1_CEN); //关 178 | } 179 | } 180 | 181 | #endif 182 | 183 | -------------------------------------------------------------------------------- /Driver/src/flash.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :flash.c 3 | * 描述 :flash操作相关函数 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-27 7 | **********************************************************************************/ 8 | 9 | #include "flash.h" 10 | 11 | //设置引脚功能复用选项字OPT2 12 | //输入参数:要设置的位(BIT0~7),置位or清零(1,0) 13 | //输出参数:无 14 | void Cfg_OPT2(u8 bit_n,u8 opt) 15 | { 16 | uint16_t status;/*记录原来的备选功能状态*/ 17 | status=FLASH_ReadOptionByte(OPT2_ADDR); 18 | //此处可检查是否读到FLASH_OPTIONBYTE_ERROR 19 | //读到的高8位是OPT2,低8位是NOPT2 20 | status>>=8; 21 | if(status&bit_n) //原来是置位 22 | { 23 | if(!opt) //需要清零 24 | { 25 | FLASH_ProgramOptionByte(OPT2_ADDR, (uint8_t)(status&(~bit_n))); 26 | } 27 | } 28 | else //原来是清零 29 | { 30 | if(opt) //需要置位 31 | { 32 | FLASH_ProgramOptionByte(OPT2_ADDR, (uint8_t)(status|bit_n)); 33 | } 34 | } 35 | } 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Driver/src/font.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/font.c -------------------------------------------------------------------------------- /Driver/src/i2c_driver.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/i2c_driver.c -------------------------------------------------------------------------------- /Driver/src/spi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/spi.c -------------------------------------------------------------------------------- /Driver/src/timer.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :timer.c 3 | * 描述 :定时器操作相关函数 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-27,28,29 7 | **********************************************************************************/ 8 | 9 | #include "timer.h" 10 | 11 | //定时器1的PWM初始化,不包含引脚重映射,需在之前设置选项字 12 | //输入参数:PWM结构体指针 13 | //输出参数:无 14 | void T1_PWM_Init(PWM_Typedef *PWMx) 15 | { 16 | // //初始化IO口为推挽输出 17 | // GPIO_Init(PWMx->GPIOx,PWMx->Pinx, GPIO_MODE_OUT_PP_LOW_FAST); 18 | u16 ps ; //预分频值 19 | u16 preload,dutytick; 20 | //根据要产生的频率计算分频值,除最高档(4K以上)外其它档保证12位以上的精度 21 | if(PWMx->f>((SYSCLK>>16)+1)) //16M时245HZ以上 22 | ps=1-1; 23 | else if(PWMx->f>((SYSCLK>>20)+1)) //16~245 24 | ps=16-1; 25 | else //0.95~16,低于0.9Hz则输出不正确 26 | ps=256-1; 27 | preload=(u16)(SYSCLK/(PWMx->f)/(ps+1)); 28 | dutytick=(u16)(preload*(PWMx->duty)+0.5); 29 | //时基初始化 30 | TIM1_TimeBaseInit(ps, TIM1_COUNTERMODE_UP, \ 31 | (u16)(preload-0.5), 0x00); 32 | //PWM输出初始化 33 | switch(PWMx->ch) 34 | { 35 | case 1: 36 | TIM1_OC1Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_DISABLE,\ 37 | dutytick,TIM1_OCPOLARITY_HIGH,\ 38 | TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_SET); 39 | //预装载使能 40 | TIM1_OC1PreloadConfig(ENABLE); 41 | break; 42 | case 2: 43 | TIM1_OC2Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_DISABLE,\ 44 | dutytick,TIM1_OCPOLARITY_HIGH,\ 45 | TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_SET); 46 | //预装载使能 47 | TIM1_OC2PreloadConfig(ENABLE); 48 | break; 49 | case 3: 50 | TIM1_OC3Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_DISABLE,\ 51 | dutytick,TIM1_OCPOLARITY_HIGH,\ 52 | TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_SET); 53 | //预装载使能 54 | TIM1_OC3PreloadConfig(ENABLE); 55 | break; 56 | case 4: 57 | TIM1_OC4Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE, \ 58 | dutytick, \ 59 | TIM1_OCPOLARITY_HIGH, TIM1_OCIDLESTATE_SET); 60 | //预装载使能 61 | TIM1_OC4PreloadConfig(ENABLE); 62 | break; 63 | default: 64 | break; 65 | } 66 | //缓冲写入ARR 67 | TIM1_ARRPreloadConfig(ENABLE); 68 | //输出 69 | TIM1_CtrlPWMOutputs(ENABLE); 70 | //立即更新预分频值 71 | TIM1_PrescalerConfig(ps, TIM1_PSCRELOADMODE_IMMEDIATE); 72 | //开定时器 73 | TIM1_Cmd(ENABLE); 74 | 75 | } 76 | 77 | //定时器1的PWM占空比改变 78 | //输入参数:PWM结构体指针 79 | //输出参数:无 80 | void T1_PWM_Duty(PWM_Typedef *PWMx) 81 | { 82 | u16 cmp; 83 | //计算新比较值 84 | cmp=(u16)(((((u16)(TIM1->ARRH))<<8)+(TIM1->ARRL)+1)*(PWMx->duty)+0.5); 85 | //根据不同通道设置占空比 86 | switch(PWMx->ch) 87 | { 88 | case 1: 89 | TIM1->CCR1H = (uint8_t)(cmp >> 8); 90 | TIM1->CCR1L = (uint8_t)(cmp); 91 | break; 92 | case 2: 93 | TIM1->CCR2H = (uint8_t)(cmp >> 8); 94 | TIM1->CCR2L = (uint8_t)(cmp); 95 | break; 96 | case 3: 97 | TIM1->CCR3H = (uint8_t)(cmp >> 8); 98 | TIM1->CCR3L = (uint8_t)(cmp); 99 | break; 100 | default: 101 | break; 102 | } 103 | } 104 | 105 | //定时器2的PWM初始化,不包含引脚重映射,需在之前设置选项字 106 | //输入参数:PWM结构体指针 107 | //输出参数:无 108 | void T2_PWM_Init(PWM_Typedef *PWMx) 109 | { 110 | u8 ps ; //预分频值 111 | u16 preload,dutytick; 112 | //根据要产生的频率计算分频值,除最高档(4K以上)外其它档保证12位以上的精度 113 | if(PWMx->f>((SYSCLK>>16)+1)) //16M时245HZ以上 114 | ps=0; 115 | else if(PWMx->f>((SYSCLK>>20)+1)) //16~245 116 | ps=4; 117 | else //0.95~16,低于0.95Hz则输出不正确 118 | ps=8; 119 | preload=(u16)((SYSCLK>>ps)/(PWMx->f)); 120 | dutytick=(u16)(preload*(PWMx->duty)+0.5); 121 | //初始化时基 122 | TIM2_TimeBaseInit(ps, (u16)(preload-0.5)); 123 | //PWM输出初始化 124 | switch(PWMx->ch) 125 | { 126 | case 1: 127 | TIM2_OC1Init(TIM2_OCMODE_PWM1, TIM2_OUTPUTSTATE_ENABLE,\ 128 | dutytick, TIM2_OCPOLARITY_HIGH); 129 | TIM2_OC1PreloadConfig(ENABLE); 130 | break; 131 | case 2: 132 | TIM2_OC2Init(TIM2_OCMODE_PWM1, TIM2_OUTPUTSTATE_ENABLE,\ 133 | dutytick, TIM2_OCPOLARITY_HIGH); 134 | TIM2_OC2PreloadConfig(ENABLE); 135 | break; 136 | case 3: 137 | TIM2_OC3Init(TIM2_OCMODE_PWM1, TIM2_OUTPUTSTATE_ENABLE,\ 138 | dutytick, TIM2_OCPOLARITY_HIGH); 139 | TIM2_OC3PreloadConfig(ENABLE); 140 | break; 141 | default: 142 | break; 143 | } 144 | TIM2_Cmd(ENABLE); 145 | } 146 | 147 | //定时器2的PWM占空比改变 148 | //输入参数:PWM结构体指针 149 | //输出参数:无 150 | void T2_PWM_Duty(PWM_Typedef *PWMx) 151 | { 152 | u16 cmp; 153 | //计算新比较值 154 | cmp=(u16)(((((u16)(TIM2->ARRH))<<8)+(TIM2->ARRL)+1)*(PWMx->duty)+0.5); 155 | //根据不同通道设置占空比 156 | switch(PWMx->ch) 157 | { 158 | case 1: 159 | TIM2->CCR1H = (uint8_t)(cmp >> 8); 160 | TIM2->CCR1L = (uint8_t)(cmp); 161 | break; 162 | case 2: 163 | TIM2->CCR2H = (uint8_t)(cmp >> 8); 164 | TIM2->CCR2L = (uint8_t)(cmp); 165 | break; 166 | case 3: 167 | TIM2->CCR3H = (uint8_t)(cmp >> 8); 168 | TIM2->CCR3L = (uint8_t)(cmp); 169 | break; 170 | default: 171 | break; 172 | } 173 | } 174 | 175 | 176 | #if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) ||defined(STM8S105) ||\ 177 | defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) 178 | //定时器3的PWM初始化,不包含引脚重映射,需在之前设置选项字 179 | //输入参数:PWM结构体指针 180 | //输出参数:无 181 | void T3_PWM_Init(PWM_Typedef *PWMx) 182 | { 183 | u8 ps ; //预分频值 184 | u16 preload,dutytick; 185 | //根据要产生的频率计算分频值,除最高档(4K以上)外其它档保证12位以上的精度 186 | if(PWMx->f>((SYSCLK>>16)+1)) //16M时245HZ以上 187 | ps=0; 188 | else if(PWMx->f>((SYSCLK>>20)+1)) //16~245 189 | ps=4; 190 | else //0.95~16,低于0.95Hz则输出不正确 191 | ps=8; 192 | preload=(u16)((SYSCLK>>ps)/(PWMx->f)); 193 | dutytick=(u16)(preload*(PWMx->duty)+0.5); 194 | //初始化时基 195 | TIM3_TimeBaseInit(ps, (u16)(preload-0.5)); 196 | //PWM输出初始化 197 | switch(PWMx->ch) 198 | { 199 | case 1: 200 | TIM3_OC1Init(TIM3_OCMODE_PWM1, TIM3_OUTPUTSTATE_ENABLE,\ 201 | dutytick, TIM3_OCPOLARITY_HIGH); 202 | TIM3_OC1PreloadConfig(ENABLE); 203 | break; 204 | case 2: 205 | TIM3_OC2Init(TIM3_OCMODE_PWM1, TIM3_OUTPUTSTATE_ENABLE,\ 206 | dutytick, TIM3_OCPOLARITY_HIGH); 207 | TIM3_OC2PreloadConfig(ENABLE); 208 | break; 209 | default: 210 | break; 211 | } 212 | TIM3_Cmd(ENABLE); 213 | } 214 | 215 | //定时器3的PWM占空比改变 216 | //输入参数:PWM结构体指针 217 | //输出参数:无 218 | void T3_PWM_Duty(PWM_Typedef *PWMx) 219 | { 220 | u16 cmp; 221 | //计算新比较值 222 | cmp=(u16)(((((u16)(TIM3->ARRH))<<8)+(TIM3->ARRL)+1)*(PWMx->duty)+0.5); 223 | //根据不同通道设置占空比 224 | switch(PWMx->ch) 225 | { 226 | case 1: 227 | TIM3->CCR1H = (uint8_t)(cmp >> 8); 228 | TIM3->CCR1L = (uint8_t)(cmp); 229 | break; 230 | case 2: 231 | TIM3->CCR2H = (uint8_t)(cmp >> 8); 232 | TIM3->CCR2L = (uint8_t)(cmp); 233 | break; 234 | default: 235 | break; 236 | } 237 | } 238 | 239 | #endif 240 | -------------------------------------------------------------------------------- /Driver/src/uart.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * 文件名 :uart.c 3 | * 描述 :串口应用相关函数 4 | * 库版本 :V2.0.0 5 | * 作者 :泽畔无材 QQ:715805855 6 | *修改时间 :2012-7-26 7 | *注: USART1:RX-PA4,TX-PA5 8 | USART2:RX-PD6,TX-PD5 9 | ****************************************************************************************/ 10 | #define UART_GLOBAL 11 | #include "uart.h" 12 | 13 | //如果是UART1 14 | #if defined(STM8S208) ||defined(STM8S207) || defined(STM8S007) ||defined(STM8S103) ||\ 15 | defined(STM8S003) || defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax) 16 | 17 | void Init_UART1(u32 baud) 18 | { 19 | //以下是压缩代码 20 | uint32_t BaudRate_Mantissa = 0, BaudRate_Mantissa100 = 0; 21 | UART1->CR1 |= (uint8_t)UART1_WORDLENGTH_8D; 22 | UART1->CR3 |= (uint8_t)UART1_STOPBITS_1; 23 | UART1->CR1 |= (uint8_t)UART1_PARITY_NO; 24 | BaudRate_Mantissa = ((uint32_t)SYSCLK / (baud << 4)); 25 | BaudRate_Mantissa100 = (((uint32_t)SYSCLK * 100) / (baud << 4)); 26 | UART1->BRR2 |= (uint8_t)((uint8_t)(((BaudRate_Mantissa100 - (BaudRate_Mantissa * 100)) << 4) / 100) & (uint8_t)0x0F); 27 | UART1->BRR2 |= (uint8_t)((BaudRate_Mantissa >> 4) & (uint8_t)0xF0); 28 | UART1->BRR1 |= (uint8_t)BaudRate_Mantissa; 29 | UART1->CR2 &= (uint8_t)~(UART1_CR2_TEN | UART1_CR2_REN); 30 | UART1->CR3 |= (uint8_t)((uint8_t)UART1_SYNCMODE_CLOCK_DISABLE & (uint8_t)(UART1_CR3_CPOL | 31 | UART1_CR3_CPHA | UART1_CR3_LBCL)); 32 | UART1->CR2 |= (uint8_t)UART1_CR2_TEN; 33 | UART1->CR2 |= (uint8_t)UART1_CR2_REN; 34 | UART1->CR3 &= (uint8_t)(~UART1_CR3_CKEN); 35 | 36 | UART1->CR2 |= ((uint8_t)1<<5); //接收中断使能 37 | 38 | UART1->CR1 &= (uint8_t)(~UART1_CR1_UARTD); //使能UART 39 | 40 | //这里可以再设置下IO输入输出模式 41 | // UART1_DeInit(); 42 | // UART1_Init(baud, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, \ 43 | // UART1_PARITY_NO , UART1_SYNCMODE_CLOCK_DISABLE , UART1_MODE_TXRX_ENABLE); 44 | // UART1_ITConfig(UART1_IT_RXNE_OR,ENABLE ); 45 | // UART1_Cmd(ENABLE ); 46 | } 47 | 48 | void UART1_SendString(u8* Data) 49 | { 50 | u16 i=0; 51 | for(;Data[i];i++) 52 | UART1_SendByte(Data[i]); 53 | } 54 | 55 | void UART1_SendData(u8* Data,u8 len) 56 | { 57 | u16 i=0; 58 | for(;iSR & (u8)UART1_FLAG_RXNE)); 65 | return ((uint8_t)UART1->DR); 66 | } 67 | 68 | 69 | //重定向c库函数printf到USART1 70 | int putchar(int ch) 71 | { 72 | UART1_SendByte(ch); 73 | return (ch); 74 | } 75 | /* 76 | int fgetc(FILE *f) 77 | { 78 | while(!(UART1->SR & (u8)UART1_FLAG_RXNE)); 79 | return ((uint8_t)UART1->DR); 80 | } 81 | */ 82 | 83 | /************************************************************************ 84 | * 函数名:UART1_printf 85 | * 描述 :格式化输出,类似于C库中的printf,但这里没有用到C库 86 | * 输入 :-USARTx 串口通道,这里只用到了串口1,即USART1 87 | * -Data 要发送到串口的内容的指针 88 | * -... 其他参数 89 | * 输出 :无 90 | * 返回 :无 91 | * 调用 :外部调用 92 | * 典型应用USART1_printf( "\r\n this is a demo \r\n" ); 93 | * USART1_printf( "\r\n %d \r\n", i ); 94 | * USART1_printf( "\r\n %s \r\n", j ); 95 | ***************************************************************************/ 96 | void UART1_printf( uint8_t *Data,...) 97 | { 98 | const char *s; 99 | int d; 100 | char buf[16]; 101 | va_list ap; 102 | va_start(ap, Data); 103 | 104 | while ( *Data != 0) // 判断是否到达字符串结束符 105 | { 106 | if ( *Data == 0x5c ) //'\' 107 | { 108 | switch ( *++Data ) 109 | { 110 | case 'r': //回车符 111 | UART1_SendData8(0x0d); 112 | Data ++; 113 | break; 114 | 115 | case 'n': //换行符 116 | UART1_SendData8(0x0a); 117 | Data ++; 118 | break; 119 | 120 | default: 121 | Data ++; 122 | break; 123 | } 124 | } 125 | else if ( *Data == '%') 126 | { // 127 | switch ( *++Data ) 128 | { 129 | case 's': //字符串 130 | s = va_arg(ap, const char *); 131 | for ( ; *s; s++) 132 | { 133 | UART1_SendData8(*s); 134 | while (UART1_GetFlagStatus(UART1_FLAG_TXE) == RESET); 135 | } 136 | Data++; 137 | break; 138 | 139 | case 'd': //十进制 140 | d = va_arg(ap, int); 141 | itoa(d, buf, 10); 142 | for (s = buf; *s; s++) 143 | { 144 | UART1_SendData8(*s); 145 | while (UART1_GetFlagStatus(UART1_FLAG_TXE) == RESET); 146 | } 147 | Data++; 148 | break; 149 | default: 150 | Data++; 151 | break; 152 | } 153 | } /* end of else if */ 154 | else UART1_SendData8(*Data++); 155 | while (UART1_GetFlagStatus(UART1_FLAG_TXE) == RESET); 156 | } 157 | } 158 | 159 | #endif 160 | 161 | //串口2 162 | #if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) 163 | void Init_UART2(u32 baud) 164 | { 165 | UART2_DeInit(); 166 | UART2_Init(baud, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, \ 167 | UART2_PARITY_NO , UART2_SYNCMODE_CLOCK_DISABLE , UART2_MODE_TXRX_ENABLE); 168 | UART2_ITConfig(UART2_IT_RXNE_OR,ENABLE ); 169 | UART2_Cmd(ENABLE ); 170 | } 171 | 172 | void UART2_SendString(u8* Data) 173 | { 174 | u16 i=0; 175 | for(;Data[i];i++) 176 | UART2_SendByte(Data[i]); 177 | } 178 | 179 | void UART2_SendData(u8* Data,u8 len) 180 | { 181 | u16 i=0; 182 | for(;iSR & (u8)UART2_FLAG_RXNE)); 189 | return ((uint8_t)UART2->DR); 190 | } 191 | 192 | /* 193 | //重定向c库函数printf到USART2 194 | int fputc(int ch, FILE *f) 195 | { 196 | UART2_SendByte(ch); 197 | return (ch); 198 | } 199 | int fgetc(FILE *f) 200 | { 201 | while(!(UART2->SR & (u8)UART2_FLAG_RXNE)); 202 | return ((uint8_t)UART2->DR); 203 | } 204 | */ 205 | 206 | /************************************************************************ 207 | * 函数名:UART2_printf 208 | * 描述 :格式化输出,类似于C库中的printf,但这里没有用到C库 209 | * 输入 :-USARTx 串口通道,这里只用到了串口1,即USART2 210 | * -Data 要发送到串口的内容的指针 211 | * -... 其他参数 212 | * 输出 :无 213 | * 返回 :无 214 | * 调用 :外部调用 215 | * 典型应用USART1_printf( "\r\n this is a demo \r\n" ); 216 | * USART1_printf( "\r\n %d \r\n", i ); 217 | * USART1_printf( "\r\n %s \r\n", j ); 218 | ***************************************************************************/ 219 | void UART2_printf( uint8_t *Data,...) 220 | { 221 | const char *s; 222 | int d; 223 | char buf[16]; 224 | va_list ap; 225 | va_start(ap, Data); 226 | 227 | while ( *Data != 0) // 判断是否到达字符串结束符 228 | { 229 | if ( *Data == 0x5c ) //'\' 230 | { 231 | switch ( *++Data ) 232 | { 233 | case 'r': //回车符 234 | UART2_SendData8(0x0d); 235 | Data ++; 236 | break; 237 | 238 | case 'n': //换行符 239 | UART2_SendData8(0x0a); 240 | Data ++; 241 | break; 242 | 243 | default: 244 | Data ++; 245 | break; 246 | } 247 | } 248 | else if ( *Data == '%') 249 | { // 250 | switch ( *++Data ) 251 | { 252 | case 's': //字符串 253 | s = va_arg(ap, const char *); 254 | for ( ; *s; s++) 255 | { 256 | UART2_SendData8(*s); 257 | while (UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET); 258 | } 259 | Data++; 260 | break; 261 | 262 | case 'd': //十进制 263 | d = va_arg(ap, int); 264 | itoa(d, buf, 10); 265 | for (s = buf; *s; s++) 266 | { 267 | UART2_SendData8(*s); 268 | while (UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET); 269 | } 270 | Data++; 271 | break; 272 | default: 273 | Data++; 274 | break; 275 | } 276 | } /* end of else if */ 277 | else UART2_SendData8(*Data++); 278 | while (UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET); 279 | } 280 | } 281 | 282 | #endif 283 | 284 | 285 | 286 | 287 | /******************************************************** 288 | * 函数名:itoa 289 | * 描述 :将整形数据转换成字符串 290 | * 输入 :-radix =10 表示10进制,其他结果为0 291 | * -value 要转换的整形数 292 | * -buf 转换后的字符串 293 | * -radix = 10 294 | * 输出 :无 295 | * 返回 :无 296 | * 调用 :被UARTx_printf()调用 297 | *******************************************************/ 298 | static char *itoa(int value, char *string, int radix) 299 | { 300 | int i, d; 301 | int flag = 0; 302 | char *ptr = string; 303 | 304 | /* This implementation only works for decimal numbers. */ 305 | if (radix != 10) 306 | { 307 | *ptr = 0; 308 | return string; 309 | } 310 | 311 | if (!value) 312 | { 313 | *ptr++ = 0x30; 314 | *ptr = 0; 315 | return string; 316 | } 317 | 318 | /* if this is a negative value insert the minus sign. */ 319 | if (value < 0) 320 | { 321 | *ptr++ = '-'; 322 | 323 | /* Make the value positive. */ 324 | value *= -1; 325 | } 326 | 327 | for (i = 10000; i > 0; i /= 10) 328 | { 329 | d = value / i; 330 | 331 | if (d || flag) 332 | { 333 | *ptr++ = (char)(d + 0x30); 334 | value -= (d * i); 335 | flag = 1; 336 | } 337 | } 338 | 339 | /* Null terminate the string. */ 340 | *ptr = 0; 341 | 342 | return string; 343 | 344 | } /* NCL_Itoa */ 345 | 346 | 347 | 348 | 349 | /*****END OF FILE*****/ -------------------------------------------------------------------------------- /Driver/src/uc1602_driver.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/Driver/src/uc1602_driver.c -------------------------------------------------------------------------------- /HAL/wpan.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/HAL/wpan.c -------------------------------------------------------------------------------- /HAL/wpan.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zepan/ST-Node/cc971569d15dc09a9946da7a56cab2ec5b8c10f1/HAL/wpan.h -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ST-Node 2 | ======= 3 | 4 | A library and application demos for ST-Node 5 | 6 | Under Building... 7 | --------------------------------------------------------------------------------