Control drones with a proper joystick
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.

config.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * EEPROM configuration storage utility
  3. * Copyright 2016 by Thomas Buck <xythobuz@xythobuz.de>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation, version 2.
  8. */
  9. #ifndef __CONFIG_H__
  10. #define __CONFIG_H__
  11. #include <stdint.h>
  12. #define CPPM_OUTPUT_PIN_DEFAULT 4
  13. #define CHANNEL_MINIMUM_VALUE 1000
  14. #define CHANNEL_DEFAULT_VALUE 1500
  15. #define CHANNEL_MAXIMUM_VALUE 2000
  16. #define CHANNELS_MAX 12
  17. #define DEFAULT_CHANNELS 6
  18. #define DEFAULT_FRAME_LENGTH 20000
  19. #define DEFAULT_PULSE_LENGTH 300
  20. #define DEFAULT_INVERT_STATE 0
  21. enum RxChannels {
  22. CHANNEL_ROLL = 0,
  23. CHANNEL_PITCH = 1,
  24. CHANNEL_THROTTLE = 2,
  25. CHANNEL_YAW = 3,
  26. CHANNEL_AUX1 = 4,
  27. CHANNEL_AUX2 = 5,
  28. CHANNEL_AUX3 = 6
  29. };
  30. // Increase string number when struct changes!
  31. #define CONFIG_VERSION "USBCPPM-02"
  32. #define CONFIG_VERSION_LENGTH (sizeof(CONFIG_VERSION) - 1)
  33. struct ConfigData {
  34. uint16_t channels, frameLength, pulseLength, inverted, cppmPin;
  35. uint16_t minimum[CHANNELS_MAX];
  36. uint16_t maximum[CHANNELS_MAX];
  37. uint16_t invert[CHANNELS_MAX];
  38. int16_t trim[CHANNELS_MAX];
  39. };
  40. #define CONFIG_DATA_LENGTH (sizeof(ConfigData))
  41. void eepromRead();
  42. void eepromWrite();
  43. #endif // __CONFIG_H__