Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1022 B

  1. /*
  2. * compatibility.c
  3. *
  4. * Created: 19/1/2016 15:31:35
  5. * Author: akatran
  6. */
  7. #include <avr/io.h>
  8. #include <stdint.h>
  9. #include <util/delay.h>
  10. volatile uint32_t _millis;
  11. void __msleep(int milisec)
  12. {
  13. while(milisec-- >0)
  14. {
  15. _delay_ms(1);
  16. }
  17. }
  18. void __usleep(int usec)
  19. {
  20. while(usec-- >0)
  21. {
  22. _delay_us(1);
  23. }
  24. }
  25. void __start_timer()
  26. {
  27. // Timer details : Clock is 32MHz, Timer resolution is 8bit, Prescaler is 256, Period is 124, Real Time is 0.001s
  28. /* Set the timer to run at the fastest rate. */
  29. TCE0.CTRLA = TC_CLKSEL_DIV256_gc;
  30. /* Configure the timer for normal counting. */
  31. TCE0.CTRLB = TC_WGMODE_NORMAL_gc;
  32. /* At 2 MHz, one tick is 0.5 us. Set period to 8 us. */
  33. TCE0.PER = 124;
  34. //TCC0.PER = 2;
  35. /* Configure timer to generate an interrupt on overflow. */
  36. TCE0.INTCTRLA = TC_OVFINTLVL_HI_gc;
  37. /* Enable this interrupt level. */
  38. PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
  39. _millis=0;
  40. }
  41. long __millis()
  42. {
  43. return _millis;
  44. }
  45. void update_milisec()
  46. {
  47. _millis++;
  48. }