| Wheelchair Control MCU firmware

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Groups Pages
WheelchairControlMain.c File Reference
Wheelchair control MCU software.
`#include "WheelchairControlMain.h"`

Go to the source code of this file.

t_ConfigStruct | ConfigStructRAM
t_ConfigStruct EEMEM | ConfigStructEEPROM
t_ISRsSharedStruct | ISRsSharedStruct
int16_t | main (void)
void | InitializeMCU (void)
void | CalculateOdometry (void)
void | RunRegulators (void)
void | EEPROM_LoadVariables (void)
void | EEPROM_WriteVariable (uint8_t *address, uint8_t data)
void | EEPROM_WriteWord (uint16_t *address, uint16_t data)
| ISR (USART_RXC_vect)
| ISR (TIMER0_OVF_vect)
| ISR (TIMER2_OVF_vect)
| ISR (INT0_vect)
| ISR (INT1_vect)
| ISR (INT2_vect)

## Detailed Description

This is main program file.

Definition in file WheelchairControlMain.c.

## Function Documentation

void CalculateOdometry | ( | void |  | ) |

Odometry is calculated here.

Definition at line 109 of file WheelchairControlMain.c.

void EEPROM_LoadVariables | ( | void |  | ) |

Loads variables stored in EEPROM to RAM.

Definition at line 367 of file WheelchairControlMain.c.

void EEPROM_WriteVariable | ( | uint8_t * | address,
|  | uint8_t | data
| ) |  |

Writes byte to EEPROM.

Parameters

  address | Address in EEPROM to write to.
  data | 1 byte of data to be written.

Definition at line 409 of file WheelchairControlMain.c.

void EEPROM_WriteWord | ( | uint16_t * | address,
|  | uint16_t | data
| ) |  |

Writes word to EEPROM.

Parameters

  address | Address in EEPROM to write to.
  data | 2 bytes of data to be written.

Definition at line 416 of file WheelchairControlMain.c.

void InitializeMCU | ( | void |  | ) |

Initializes interrupts and peripherals.

Definition at line 62 of file WheelchairControlMain.c.

ISR | ( | USART_RXC_vect |  | ) |

UART Rx complete interrupt service routine.

Definition at line 432 of file WheelchairControlMain.c.

ISR | ( | TIMER0_OVF_vect |  | ) |

TIMER0 interrupt service routine (period = 1 ms). Rx index reset.

Definition at line 995 of file WheelchairControlMain.c.

ISR | ( | TIMER2_OVF_vect |  | ) |

TIMER2 interrupt service routine (period = 2 ms). Measures the range every 50 ms, processes acquired data, PSD motors' regulators are run here.

Definition at line 1008 of file WheelchairControlMain.c.

ISR | ( | INT0_vect |  | ) |

External interrupt 0 (left wheel encoder signal) service routine.

Definition at line 1278 of file WheelchairControlMain.c.

ISR | ( | INT1_vect |  | ) |

External interrupt 1 (right wheel encoder signal) service routine.

Definition at line 1320 of file WheelchairControlMain.c.

ISR | ( | INT2_vect |  | ) |

External interrupt 2 (emergency stop button) service routine.

Warning
  This ISR runs in infinite loop until MCU reset to prevent PC app from controlling the wheelchair in case of emergency!

Definition at line 1364 of file WheelchairControlMain.c.

int16_t main | ( | void |  | ) |

Main - program entry point. Superloop (odometry and regulators) is run here.

Definition at line 40 of file WheelchairControlMain.c.

void RunRegulators | ( | void |  | ) |

Position regulators are run here (wall following and position regulator).

Definition at line 144 of file WheelchairControlMain.c.

## Variable Documentation

t_ConfigStruct EEMEM ConfigStructEEPROM

Configuration variables (stored in eeprom).

Definition at line 29 of file WheelchairControlMain.c.

t_ConfigStruct ConfigStructRAM

Configuration variables.

Definition at line 28 of file WheelchairControlMain.c.

t_ISRsSharedStruct ISRsSharedStruct

Structure inter-ISRs shared variables.

Definition at line 30 of file WheelchairControlMain.c.