mirror of
https://github.com/eddyem/mmpp.git
synced 2026-03-20 08:40:59 +03:00
Make PCB for fabric made
This commit is contained in:
@@ -77,20 +77,28 @@ Getters returning more than one field ends with `DATAEND` meaning that's all dat
|
||||
All variables here are fields of `user_conf` struct.
|
||||
|
||||
|
||||
* **R** - get *raw ADC* values, e.g.
|
||||
* **R** - get *raw ADC* values:
|
||||
* 0 - Steppers current
|
||||
* 1 - Input voltage 12V
|
||||
* 2 - EndSwitch2 of motor1
|
||||
* 3 - EndSwitch1 of motor1
|
||||
* 4 - inner temperature
|
||||
* 5 - vref
|
||||
|
||||
E.g.:
|
||||
|
||||
```
|
||||
ADC[0]=1991
|
||||
ADC[1]=124
|
||||
ADC[2]=1351
|
||||
ADC[3]=1909
|
||||
ADC[4]=0
|
||||
ADC[5]=0
|
||||
ADC[6]=1707
|
||||
ADC[7]=1531
|
||||
ADC[0]=4095
|
||||
ADC[1]=2340
|
||||
ADC[2]=4095
|
||||
ADC[3]=4087
|
||||
ADC[4]=1665
|
||||
ADC[5]=1532
|
||||
DATAEND
|
||||
```
|
||||
|
||||
|
||||
|
||||
* **S** - get *motors' status*, e.g.
|
||||
|
||||
```
|
||||
@@ -99,7 +107,8 @@ MOTOR0=STOP
|
||||
POS0=-1
|
||||
ESW00=ERR
|
||||
ESW01=BTN
|
||||
MOTOR1=STOPPOS1=-1
|
||||
MOTOR1=STOP
|
||||
POS1=-1
|
||||
ESW10=HALL
|
||||
ESW11=HALL
|
||||
|
||||
@@ -130,6 +139,7 @@ Change of any setter takes place in MCU RAM immediately. To store them permanent
|
||||
* **E num** - set *numerator*
|
||||
* **I num** - set *device ID*
|
||||
* **M#num** - set maxsteps (*num* is 1..65535) for motor `#`
|
||||
* **P num** - properties of internal pullup (0 - disabled, other or without `num` - enabled)
|
||||
* **R#num** - set reverse for motor # (*num* == 0 turns reverse off, *num* == 1 turns it on)
|
||||
* **S#num** - set *speed* (`motspd`) to *num* for motor #
|
||||
* **T num** - set *end-switches threshold* (in ADU, near 0 for Hall switch, 2048 for user button
|
||||
|
||||
@@ -45,6 +45,7 @@ user_conf the_conf = {
|
||||
,.motspd = {10, 10} // max speed: 300 steps per second
|
||||
,.maxsteps = {50000, 50000} // max steps from point to point
|
||||
,.reverse = {0,0} // set DIR to this value when moving to '+'
|
||||
,.intpullup = 1 // by default internal pullup @ Tx pin enabled
|
||||
};
|
||||
|
||||
static int erase_flash();
|
||||
|
||||
@@ -40,6 +40,7 @@ typedef struct{
|
||||
uint16_t motspd[2]; // max motor speed ([3000 / motspd] steps per second)
|
||||
uint16_t maxsteps[2]; // maximum amount of steps for each motor (0 - infinity)
|
||||
uint8_t reverse[2]; // == 1 if positive direction when DIR is low
|
||||
uint8_t intpullup; // internal pullup @ Tx
|
||||
} user_conf;
|
||||
|
||||
extern user_conf the_conf;
|
||||
|
||||
@@ -38,7 +38,7 @@ void sys_tick_handler(void){
|
||||
* PA6 (Tim3Ch1) M2STEP
|
||||
* PA5 - M2EN
|
||||
* PA7 - M2DIR
|
||||
* PB1 - 12V on/off
|
||||
* PB1 - 12V current sensor on/off - set it to 1 to turn off MAX471
|
||||
* PF0 - M1EN
|
||||
* PF1 - M1DIR
|
||||
*/
|
||||
|
||||
@@ -267,7 +267,9 @@ static char *get_conf(){
|
||||
put_uint((uint32_t) *curdesc->ptr);
|
||||
SENDBUF();
|
||||
}while((++curdesc)->fieldname);
|
||||
write2trbuf("USARTSPD=");
|
||||
write2trbuf("INTPULLUP=");
|
||||
put2trbuf(the_conf.intpullup ? '1' : '0');
|
||||
write2trbuf("\nUSARTSPD=");
|
||||
put_uint(the_conf.usartspd);
|
||||
SENDBUF();
|
||||
write2trbuf("REVERSE0=");
|
||||
@@ -338,6 +340,11 @@ static char *set_something(char *str){
|
||||
case 'M': // set maxsteps
|
||||
setmotvals('M', str);
|
||||
break;
|
||||
case 'P': // set pullup
|
||||
omitwsp(str);
|
||||
if(*str == '0') the_conf.intpullup = 0;
|
||||
else the_conf.intpullup = 1;
|
||||
break;
|
||||
case 'R': // set reverse
|
||||
setmotvals('R', str);
|
||||
break;
|
||||
|
||||
@@ -72,9 +72,8 @@ void USART1_config(){
|
||||
| (1 << (1 * 4)) | (1 << (2 * 4)); /* (2) */
|
||||
// Tx (PA9) in OD mode
|
||||
GPIOA->OTYPER |= 1 << 9;
|
||||
#ifdef EBUG
|
||||
GPIOA->PUPDR = (GPIOA->PUPDR & ~GPIO_PUPDR_PUPDR9) | GPIO_PUPDR_PUPDR9_0; // set pullup for Tx
|
||||
#endif
|
||||
if(the_conf.intpullup)
|
||||
GPIOA->PUPDR = (GPIOA->PUPDR & ~GPIO_PUPDR_PUPDR9) | GPIO_PUPDR_PUPDR9_0; // set pullup for Tx
|
||||
/* Enable the peripheral clock USART1 */
|
||||
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
|
||||
/* Configure USART1 */
|
||||
|
||||
Reference in New Issue
Block a user