From ce21cb7e10ec08a94f191451e8d8911fd11ec3a7 Mon Sep 17 00:00:00 2001 From: eddyem Date: Thu, 29 Dec 2016 16:12:14 +0300 Subject: [PATCH] little fix --- 1_wire/main.c | 4 ++-- 1_wire/user_proto.c | 4 ++-- 1_wire/user_proto.h | 2 +- DMA_GPIO/user_proto.c | 2 +- GPIO_TIM/user_proto.c | 2 +- GPS+ultrasonic/main.c | 2 +- GPS+ultrasonic/uart.c | 2 +- GPS+ultrasonic/user_proto.c | 4 ++-- GPS+ultrasonic/user_proto.h | 2 +- GPS/main.c | 2 +- GPS/uart.c | 2 +- GPS/user_proto.c | 4 ++-- GPS/user_proto.h | 2 +- Jeep_generator/Makefile | 2 +- Jeep_generator/README | 2 +- Jeep_generator/jeep_generator.bin | Bin 7232 -> 7912 bytes Jeep_generator/main.c | 2 +- Jeep_generator/timer.c | 17 ++++++++++------- Jeep_generator/timer.h | 4 ++-- Jeep_generator/user_proto.c | 6 +++--- Jeep_generator/user_proto.h | 2 +- Timelapse_keyboard/uart.c | 2 +- Timelapse_keyboard_only_lasers/uart.c | 2 +- USBCDC_template/user_proto.c | 2 +- canon_lens/user_proto.c | 2 +- distance_meters/main.c | 2 +- distance_meters/user_proto.c | 4 ++-- distance_meters/user_proto.h | 2 +- nokia5110/main.c | 2 +- simple_cdc/main.c | 4 ++-- simple_cdc/user_proto.c | 4 ++-- simple_cdc/user_proto.h | 2 +- stepper_motion/client-p2/cmdlnopts.c | 8 ++++---- stepper_motion/client-p2/cmdlnopts.h | 6 +++--- stepper_motion/client-p2/main.c | 2 +- .../client-p2/{parceargs.c => parseargs.c} | 10 +++++----- .../client-p2/{parceargs.h => parseargs.h} | 16 ++++++++-------- stepper_motion/main.c | 4 ++-- stepper_motion/user_proto.c | 4 ++-- stepper_motion/user_proto.h | 2 +- ultrasonic/main.c | 2 +- ultrasonic/user_proto.c | 4 ++-- ultrasonic/user_proto.h | 2 +- 43 files changed, 80 insertions(+), 77 deletions(-) rename stepper_motion/client-p2/{parceargs.c => parseargs.c} (97%) rename stepper_motion/client-p2/{parceargs.h => parseargs.h} (90%) diff --git a/1_wire/main.c b/1_wire/main.c index bb00ffe..e7e2c7a 100644 --- a/1_wire/main.c +++ b/1_wire/main.c @@ -54,9 +54,9 @@ int main(){ while(1){ usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } - //check_and_parce_UART(USART1); // also check data in UART buffers + //check_and_parse_UART(USART1); // also check data in UART buffers check_btns(); if(Timer - Old_timer > 999){ // one-second cycle Old_timer += 1000; diff --git a/1_wire/user_proto.c b/1_wire/user_proto.c index 08a1223..5376f39 100644 --- a/1_wire/user_proto.c +++ b/1_wire/user_proto.c @@ -61,10 +61,10 @@ uint8_t show_int(int32_t v){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0; diff --git a/1_wire/user_proto.h b/1_wire/user_proto.h index c3c6229..24dc159 100644 --- a/1_wire/user_proto.h +++ b/1_wire/user_proto.h @@ -45,7 +45,7 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); void OW_printID(uint8_t N); #endif // __USER_PROTO_H__ diff --git a/DMA_GPIO/user_proto.c b/DMA_GPIO/user_proto.c index 0034c54..09c1870 100644 --- a/DMA_GPIO/user_proto.c +++ b/DMA_GPIO/user_proto.c @@ -25,7 +25,7 @@ #include "dmagpio.h" /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ void parse_incoming_buf(uint8_t *buf, int *len){ diff --git a/GPIO_TIM/user_proto.c b/GPIO_TIM/user_proto.c index 14243ff..cb48c67 100644 --- a/GPIO_TIM/user_proto.c +++ b/GPIO_TIM/user_proto.c @@ -25,7 +25,7 @@ #include "timgpio.h" /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ void parse_incoming_buf(uint8_t *buf, int *len){ diff --git a/GPS+ultrasonic/main.c b/GPS+ultrasonic/main.c index 8a05dda..a45ced8 100644 --- a/GPS+ultrasonic/main.c +++ b/GPS+ultrasonic/main.c @@ -95,7 +95,7 @@ int main(){ poll_ultrasonic(); poll_ADC(); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } if((string = check_UART2())){ // P(string); diff --git a/GPS+ultrasonic/uart.c b/GPS+ultrasonic/uart.c index e15eb97..707e428 100644 --- a/GPS+ultrasonic/uart.c +++ b/GPS+ultrasonic/uart.c @@ -98,7 +98,7 @@ void UART_isr(uint32_t UART){ UART_buff *curbuff; // Check if we were called because of RXNE if(USART_SR(UART) & USART_SR_RXNE){ - // parce incoming byte + // parse incoming byte data = usart_recv(UART); fill_uart_RXbuff(UART, data); } diff --git a/GPS+ultrasonic/user_proto.c b/GPS+ultrasonic/user_proto.c index c1cef08..2b322fa 100644 --- a/GPS+ultrasonic/user_proto.c +++ b/GPS+ultrasonic/user_proto.c @@ -62,10 +62,10 @@ uint8_t show_int(int32_t v){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0, j; diff --git a/GPS+ultrasonic/user_proto.h b/GPS+ultrasonic/user_proto.h index 4b0fc3a..69bf771 100644 --- a/GPS+ultrasonic/user_proto.h +++ b/GPS+ultrasonic/user_proto.h @@ -42,6 +42,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__ diff --git a/GPS/main.c b/GPS/main.c index 028dc69..4d9324a 100644 --- a/GPS/main.c +++ b/GPS/main.c @@ -86,7 +86,7 @@ int main(){ while(1){ usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } if((string = check_UART2())){ P(string); diff --git a/GPS/uart.c b/GPS/uart.c index e1e3b34..0876706 100644 --- a/GPS/uart.c +++ b/GPS/uart.c @@ -98,7 +98,7 @@ void UART_isr(uint32_t UART){ UART_buff *curbuff; // Check if we were called because of RXNE if(USART_SR(UART) & USART_SR_RXNE){ - // parce incoming byte + // parse incoming byte data = usart_recv(UART); fill_uart_RXbuff(UART, data); } diff --git a/GPS/user_proto.c b/GPS/user_proto.c index c9cfa99..334b0cb 100644 --- a/GPS/user_proto.c +++ b/GPS/user_proto.c @@ -58,10 +58,10 @@ uint8_t show_int(int32_t v){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0; diff --git a/GPS/user_proto.h b/GPS/user_proto.h index 4b0fc3a..69bf771 100644 --- a/GPS/user_proto.h +++ b/GPS/user_proto.h @@ -42,6 +42,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__ diff --git a/Jeep_generator/Makefile b/Jeep_generator/Makefile index 8e33d6c..2aab10c 100644 --- a/Jeep_generator/Makefile +++ b/Jeep_generator/Makefile @@ -46,7 +46,7 @@ SCRIPT_DIR = $(OPENCM3_DIR)/scripts ############################################################################### # C flags -CFLAGS += -Os -g +CFLAGS += -O3 -g CFLAGS += -Wall -Wextra -Wshadow -Wimplicit-function-declaration CFLAGS += -Wredundant-decls # -Wmissing-prototypes -Wstrict-prototypes diff --git a/Jeep_generator/README b/Jeep_generator/README index f57938d..f8cf9c2 100644 --- a/Jeep_generator/README +++ b/Jeep_generator/README @@ -1,6 +1,6 @@ Jeep crankshaft signals generator -Speed from 180 to 6000RPM +Speed from 200 to 6000RPM Buttons "+" and "-", LEDS "MIN" and "MAX" written for chinese devboard based on STM32F103RBT6 diff --git a/Jeep_generator/jeep_generator.bin b/Jeep_generator/jeep_generator.bin index 90533a2d9e4d80a7c0f8d83da6cd01e1f0f5f1d2..e65ab1e7a5af9f79e18700458ac4992172fae3e7 100755 GIT binary patch delta 3305 zcmb_feQ+Dq5#M)rvQLVW$a3OHvQbVtr?D%=l>Ozr;(R>E5Kq22-w`v$8||2=c&PJ`5DU78_*JwtBK_PBX$p~n!1 z^hoH)q>&}=h1!@Pf$q=6{2wJi;09w8`klKyEPG{!= zK8-|9=bua}p5}P3Cz3GX(`0sSz@b2+a%y{=(g0V9h8<~?HBBvhHFcO}Q~mJU5{=&t zS(zdY#~h6*&>ANaJws&8I~UOyF4CZ3p3B~tban5>-Lvy_mUs7}{=~dq+wDgEv3cFr zy$bc8&+FC2^Y_i`o05WO<5~Z++Qzz#NiVwY&C*a>wz;VND61tYz^&O^{0}5yBvT7K ze+lrL2nfBnA3%8$04^xl%~Ay@(Wa@6~sETY3hpj*%R($Q8yaym8Fs5T8Oi(T)< zpnr=sM~$7vE|)@_CnkODp~z7y=ym5rWz@Q{o;eMoC^yFhlrsRrM<{xP)ANnE z%VUWP9ySi5RWc0fF>vSNH3Q}D=|q)s^=<50;(l-hL?V8Y3=BZs@f5en8nliCb&V{# zD+A+)SFVs)oh>_%;Z&1&EK}w?mf?NyY3KL2#WtAO4&OTAJ_H8zfb z6DVE;rvWg6V2-llzCj2Z1EzKo4v9?IxY^iY3V^<5*4Qb?)*<6&(C;V+3O8tu!HA4! z9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tEHpgA0xqs#ZyK6JBf7(3u)6FOJ zhDi*x4?Ef>@#CUg9X6;8*#N@>^sF3I_id9{J!n?JN~+AY&Et~(gB6J z@4^GW3uNDe1YfrH;lXQ7WG4l@w!Rx<-F7Px2g=H8s}0TFhkLp@k9G0KB3)fa_(xCj zwO%g=HHJN1|L;KjpsXa?_}!kKuI}UOB0G5Ki5%sikN`zt6#E(fH-I7(P4aYv@&l67 z8ZqD@MWC%Yl6=Bqe2FaU%?HVX#AhOi*t{@v~TL%a8T_^%)BdgAfUZt-II zJzw>1^KPpJ1A|sMvfxUHmzYVEfn^S;Jg8uOmV9gd_e}&Y6^kIY!zxT{V_(6i0 dLBxtT=zLqdI14HCb{?VFAfF}LUg4=V{0~#CFUtS` diff --git a/Jeep_generator/main.c b/Jeep_generator/main.c index 6421f2b..7336d53 100644 --- a/Jeep_generator/main.c +++ b/Jeep_generator/main.c @@ -43,7 +43,7 @@ int main(){ while(1){ usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } check_btns(); if(Timer - Old_timer > 999){ // one-second cycle diff --git a/Jeep_generator/timer.c b/Jeep_generator/timer.c index f0cd5bc..2e73b8e 100644 --- a/Jeep_generator/timer.c +++ b/Jeep_generator/timer.c @@ -23,9 +23,9 @@ #include "user_proto.h" // for print_int // current speed -int32_t current_RPM = 0; +uint16_t current_RPM = 0; void get_RPM(); -uint16_t get_ARR(int32_t RPM); +uint16_t get_ARR(uint32_t RPM); // pulses: 16 1/0, 4 1/1, 16 1/0, 4 0/0, const uint8_t pulses[] = { @@ -58,8 +58,8 @@ void tim2_isr(){ GPIO_BSRR(OUTP_PORT) = OUTP_PIN; else GPIO_BSRR(OUTP_PORT) = OUTP_PIN << 16; - TIM2_SR = 0; } + TIM2_SR = 0; } /** @@ -67,14 +67,17 @@ void tim2_isr(){ * RPM = 1/tim2_arr / 40 * 60 */ void get_RPM(){ - current_RPM = 3000000 / (int32_t)TIM2_ARR; - current_RPM /= 2; + uint32_t R = 3000000 / (uint32_t)TIM2_ARR; + current_RPM = R/2; + //current_RPM = R; + //current_RPM >>= 1; // x/2 != x>>1, WTF? } // calculate TIM2_ARR by RPM -uint16_t get_ARR(int32_t RPM){ - int32_t R = 3000000 / RPM; +uint16_t get_ARR(uint32_t RPM){ + uint32_t R = 3000000 / RPM; R /= 2; + //R >>= 1; return (uint16_t)R; } diff --git a/Jeep_generator/timer.h b/Jeep_generator/timer.h index 13b7d69..855d2d4 100644 --- a/Jeep_generator/timer.h +++ b/Jeep_generator/timer.h @@ -31,13 +31,13 @@ //~ #define TM2_MAX_SPEED (250) // max & min rotation speed #define MAX_RPM (6000) -#define MIN_RPM (180) +#define MIN_RPM (200) void tim2_init(); void increase_speed(); void decrease_speed(); -extern int32_t current_RPM; +extern uint16_t current_RPM; #endif // __TIMER_H__ diff --git a/Jeep_generator/user_proto.c b/Jeep_generator/user_proto.c index ccdbabd..2827ddd 100644 --- a/Jeep_generator/user_proto.c +++ b/Jeep_generator/user_proto.c @@ -34,13 +34,13 @@ void help(){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; int i = 0; - for(; i < len; i++){ + for(; i < len; ++i){ command = buf[i]; if(!command) continue; // omit zero switch (command){ diff --git a/Jeep_generator/user_proto.h b/Jeep_generator/user_proto.h index 9228749..4201c68 100644 --- a/Jeep_generator/user_proto.h +++ b/Jeep_generator/user_proto.h @@ -42,6 +42,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__ diff --git a/Timelapse_keyboard/uart.c b/Timelapse_keyboard/uart.c index ef4fe36..ecaaab4 100644 --- a/Timelapse_keyboard/uart.c +++ b/Timelapse_keyboard/uart.c @@ -97,7 +97,7 @@ void UART_isr(uint32_t UART){ UART_buff *curbuff; // Check if we were called because of RXNE if(USART_SR(UART) & USART_SR_RXNE){ - // parce incoming byte + // parse incoming byte data = usart_recv(UART); fill_uart_RXbuff(UART, data); } diff --git a/Timelapse_keyboard_only_lasers/uart.c b/Timelapse_keyboard_only_lasers/uart.c index ef4fe36..ecaaab4 100644 --- a/Timelapse_keyboard_only_lasers/uart.c +++ b/Timelapse_keyboard_only_lasers/uart.c @@ -97,7 +97,7 @@ void UART_isr(uint32_t UART){ UART_buff *curbuff; // Check if we were called because of RXNE if(USART_SR(UART) & USART_SR_RXNE){ - // parce incoming byte + // parse incoming byte data = usart_recv(UART); fill_uart_RXbuff(UART, data); } diff --git a/USBCDC_template/user_proto.c b/USBCDC_template/user_proto.c index 33cc326..dc874d9 100644 --- a/USBCDC_template/user_proto.c +++ b/USBCDC_template/user_proto.c @@ -29,7 +29,7 @@ void help(){ /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ int parse_incoming_buf(char *buf, int len){ diff --git a/canon_lens/user_proto.c b/canon_lens/user_proto.c index 6cb3e5b..f7a5741 100644 --- a/canon_lens/user_proto.c +++ b/canon_lens/user_proto.c @@ -137,7 +137,7 @@ void showFval(){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * fill uint8_t data buffer with readed data */ void parse_incoming_buf(){ diff --git a/distance_meters/main.c b/distance_meters/main.c index 2fd343a..f4c1d7a 100644 --- a/distance_meters/main.c +++ b/distance_meters/main.c @@ -56,7 +56,7 @@ int main(){ uint32_t L; usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } if(AWD_flag){ P("Int, value = "); diff --git a/distance_meters/user_proto.c b/distance_meters/user_proto.c index 73bd69d..8e7f3f0 100644 --- a/distance_meters/user_proto.c +++ b/distance_meters/user_proto.c @@ -59,10 +59,10 @@ uint8_t show_int(int32_t v){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0; diff --git a/distance_meters/user_proto.h b/distance_meters/user_proto.h index be14383..d9af859 100644 --- a/distance_meters/user_proto.h +++ b/distance_meters/user_proto.h @@ -44,6 +44,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__ diff --git a/nokia5110/main.c b/nokia5110/main.c index d117073..b026cba 100644 --- a/nokia5110/main.c +++ b/nokia5110/main.c @@ -80,7 +80,7 @@ int main(){ } usbdatalen = 0; } - //check_and_parce_UART(USART1); // also check data in UART buffers + //check_and_parse_UART(USART1); // also check data in UART buffers if(Timer - Old_timer > 999){ // one-second cycle Old_timer += 1000; //print_int(Timer / 1000);newline(); diff --git a/simple_cdc/main.c b/simple_cdc/main.c index 20a7e3b..507dd09 100644 --- a/simple_cdc/main.c +++ b/simple_cdc/main.c @@ -51,9 +51,9 @@ int main(){ while(1){ usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } - //check_and_parce_UART(USART1); // also check data in UART buffers + //check_and_parse_UART(USART1); // also check data in UART buffers check_btns(); if(Timer - Old_timer > 999){ // one-second cycle Old_timer += 1000; diff --git a/simple_cdc/user_proto.c b/simple_cdc/user_proto.c index 5b7aa6f..3e0424c 100644 --- a/simple_cdc/user_proto.c +++ b/simple_cdc/user_proto.c @@ -57,10 +57,10 @@ uint8_t show_int(int32_t v){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0; diff --git a/simple_cdc/user_proto.h b/simple_cdc/user_proto.h index 4b0fc3a..69bf771 100644 --- a/simple_cdc/user_proto.h +++ b/simple_cdc/user_proto.h @@ -42,6 +42,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__ diff --git a/stepper_motion/client-p2/cmdlnopts.c b/stepper_motion/client-p2/cmdlnopts.c index 59e441b..328fb3a 100644 --- a/stepper_motion/client-p2/cmdlnopts.c +++ b/stepper_motion/client-p2/cmdlnopts.c @@ -1,5 +1,5 @@ /* - * cmdlnopts.c - the only function that parce cmdln args and returns glob parameters + * cmdlnopts.c - the only function that parse cmdln args and returns glob parameters * * Copyright 2013 Edward V. Emelianoff * @@ -93,13 +93,13 @@ myoption cmdlnopts[] = { /** - * Parce command line options and return dynamically allocated structure + * Parse command line options and return dynamically allocated structure * to global parameters * @param argc - copy of argc from main * @param argv - copy of argv from main * @return allocated structure with global parameters */ -glob_pars *parce_args(int argc, char **argv){ +glob_pars *parse_args(int argc, char **argv){ int i; void *ptr; ptr = memcpy(&G, &Gdefault, sizeof(G)); assert(ptr); @@ -107,7 +107,7 @@ glob_pars *parce_args(int argc, char **argv){ /// "Использование: %s [аргументы]\n\n\tГде аргументы:\n" change_helpstring(_("Usage: %s [args]\n\n\tWhere args are:\n")); // parse arguments - parceargs(&argc, &argv, cmdlnopts); + parseargs(&argc, &argv, cmdlnopts); if(help) showhelp(-1, cmdlnopts); if(argc > 0){ /// "Игнорирую аргумент[ы]:" diff --git a/stepper_motion/client-p2/cmdlnopts.h b/stepper_motion/client-p2/cmdlnopts.h index 5b0f579..33dac79 100644 --- a/stepper_motion/client-p2/cmdlnopts.h +++ b/stepper_motion/client-p2/cmdlnopts.h @@ -1,5 +1,5 @@ /* - * cmdlnopts.h - comand line options for parceargs + * cmdlnopts.h - comand line options for parseargs * * Copyright 2013 Edward V. Emelianoff * @@ -23,7 +23,7 @@ #ifndef __CMDLNOPTS_H__ #define __CMDLNOPTS_H__ -#include "parceargs.h" +#include "parseargs.h" /* * here are some typedef's for global data @@ -35,6 +35,6 @@ typedef struct{ double relmove; // move relative current position }glob_pars; -glob_pars *parce_args(int argc, char **argv); +glob_pars *parse_args(int argc, char **argv); #endif // __CMDLNOPTS_H__ diff --git a/stepper_motion/client-p2/main.c b/stepper_motion/client-p2/main.c index eca83e8..0d1191a 100644 --- a/stepper_motion/client-p2/main.c +++ b/stepper_motion/client-p2/main.c @@ -235,7 +235,7 @@ int main(int argc, char *argv[]){ char buff[BUFLEN+1]; pthread_t motor_thread; size_t L; - Global_parameters = parce_args(argc, argv); + Global_parameters = parse_args(argc, argv); assert(Global_parameters != NULL); if(!get_shm_block(&sdat, ClientSide) || !check_shm_block(&sdat)){ fprintf(stderr, "Can't get SHM block!"); diff --git a/stepper_motion/client-p2/parceargs.c b/stepper_motion/client-p2/parseargs.c similarity index 97% rename from stepper_motion/client-p2/parceargs.c rename to stepper_motion/client-p2/parseargs.c index 4a39a81..75e8cac 100644 --- a/stepper_motion/client-p2/parceargs.c +++ b/stepper_motion/client-p2/parseargs.c @@ -1,5 +1,5 @@ /* - * parceargs.c - parcing command line arguments & print help + * parseargs.c - parsing command line arguments & print help * * Copyright 2013 Edward V. Emelianoff * @@ -27,7 +27,7 @@ #include // INT_MAX & so on #include // gettext #include // isalpha -#include "parceargs.h" +#include "parseargs.h" // macro to print help messages #ifndef PRNT @@ -135,7 +135,7 @@ int get_optind(int opt, myoption *options){ } /** - * Parce command line arguments + * Parse command line arguments * ! If arg is string, then value will be strdup'ed! * * @param argc (io) - address of argc of main(), return value of argc stay after `getopt` @@ -146,7 +146,7 @@ int get_optind(int opt, myoption *options){ * * @exit: in case of error this function show help & make `exit(-1)` */ -void parceargs(int *argc, char ***argv, myoption *options){ +void parseargs(int *argc, char ***argv, myoption *options){ char *short_options, *soptr; struct option *long_options, *loptr; size_t optsize, i; @@ -247,7 +247,7 @@ void parceargs(int *argc, char ***argv, myoption *options){ */ void showhelp(int oindex, myoption *options){ // ATTENTION: string `help` prints through macro PRNT(), by default it is gettext, - // but you can redefine it before `#include "parceargs.h"` + // but you can redefine it before `#include "parseargs.h"` int max_opt_len = 0; // max len of options substring - for right indentation const int bufsz = 255; char buf[bufsz+1]; diff --git a/stepper_motion/client-p2/parceargs.h b/stepper_motion/client-p2/parseargs.h similarity index 90% rename from stepper_motion/client-p2/parceargs.h rename to stepper_motion/client-p2/parseargs.h index d328b3e..0336e7c 100644 --- a/stepper_motion/client-p2/parceargs.h +++ b/stepper_motion/client-p2/parseargs.h @@ -1,5 +1,5 @@ /* - * parceargs.h - headers for parcing command line arguments + * parseargs.h - headers for parcing command line arguments * * Copyright 2013 Edward V. Emelianoff * @@ -19,8 +19,8 @@ * MA 02110-1301, USA. */ #pragma once -#ifndef __PARCEARGS_H__ -#define __PARCEARGS_H__ +#ifndef __PARSEARGS_H__ +#define __PARSEARGS_H__ #include // bool #include @@ -48,7 +48,7 @@ typedef bool(*argfn)(void *arg, int N); * int iarg; * myoption opts[] = { * {"value", 1, NULL, 'v', arg_int, &iarg, "char val"}, ..., end_option}; - * ..(parce args).. + * ..(parse args).. * charg = (char) iarg; */ typedef enum { @@ -58,7 +58,7 @@ typedef enum { arg_double, // double arg_float, // float arg_string, // char * - arg_function // parce_args will run function `bool (*fn)(char *optarg, int N)` + arg_function // parse_args will run function `bool (*fn)(char *optarg, int N)` } argtype; /* @@ -67,7 +67,7 @@ typedef enum { * conversion depends on .type * * ATTENTION: string `help` prints through macro PRNT(), bu default it is gettext, - * but you can redefine it before `#include "parceargs.h"` + * but you can redefine it before `#include "parseargs.h"` * * if arg is string, then value wil be strdup'ed like that: * char *str; @@ -99,8 +99,8 @@ typedef struct{ extern const char *__progname; void showhelp(int oindex, myoption *options); -void parceargs(int *argc, char ***argv, myoption *options); +void parseargs(int *argc, char ***argv, myoption *options); void change_helpstring(char *s); bool myatod(void *num, const char *str, argtype t); -#endif // __PARCEARGS_H__ +#endif // __PARSEARGS_H__ diff --git a/stepper_motion/main.c b/stepper_motion/main.c index 18fe34a..509cadc 100644 --- a/stepper_motion/main.c +++ b/stepper_motion/main.c @@ -53,9 +53,9 @@ int main(){ while(1){ usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } - //check_and_parce_UART(USART1); // also check data in UART buffers + //check_and_parse_UART(USART1); // also check data in UART buffers if(Timer - Old_timer > 999){ // one-second cycle Old_timer += 1000; }else if(Timer < Old_timer){ // Timer overflow diff --git a/stepper_motion/user_proto.c b/stepper_motion/user_proto.c index 67bc4f2..c4c9b52 100644 --- a/stepper_motion/user_proto.c +++ b/stepper_motion/user_proto.c @@ -51,10 +51,10 @@ void help(){ /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0; diff --git a/stepper_motion/user_proto.h b/stepper_motion/user_proto.h index 4b0fc3a..69bf771 100644 --- a/stepper_motion/user_proto.h +++ b/stepper_motion/user_proto.h @@ -42,6 +42,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__ diff --git a/ultrasonic/main.c b/ultrasonic/main.c index 2fd343a..f4c1d7a 100644 --- a/ultrasonic/main.c +++ b/ultrasonic/main.c @@ -56,7 +56,7 @@ int main(){ uint32_t L; usbd_poll(usbd_dev); if(usbdatalen){ // there's something in USB buffer - usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + usbdatalen = parse_incoming_buf(usbdatabuf, usbdatalen); } if(AWD_flag){ P("Int, value = "); diff --git a/ultrasonic/user_proto.c b/ultrasonic/user_proto.c index 73bd69d..8e7f3f0 100644 --- a/ultrasonic/user_proto.c +++ b/ultrasonic/user_proto.c @@ -59,10 +59,10 @@ uint8_t show_int(int32_t v){ } /** - * parce command buffer buf with length len + * parse command buffer buf with length len * return 0 if buffer processed or len if there's not enough data in buffer */ -int parce_incoming_buf(char *buf, int len){ +int parse_incoming_buf(char *buf, int len){ uint8_t command; //uint32_t utmp; int i = 0; diff --git a/ultrasonic/user_proto.h b/ultrasonic/user_proto.h index be14383..d9af859 100644 --- a/ultrasonic/user_proto.h +++ b/ultrasonic/user_proto.h @@ -44,6 +44,6 @@ void prnt(uint8_t *wrd); void print_int(int32_t N); void print_hex(uint8_t *buff, uint8_t l); -int parce_incoming_buf(char *buf, int len); +int parse_incoming_buf(char *buf, int len); #endif // __USER_PROTO_H__