main.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "mbed.h"
  2. #include "main.h"
  3. #include "SWO.h"
  4. #include "pca9685.h"
  5. #include "tusb322.h"
  6. #include "ds3231.h"
  7. #include "ioc.h"
  8. #include "animation.h"
  9. I2C i2c(PA_10, PA_9);
  10. // SWO_Channel swo("swo");
  11. int main() {
  12. // Start I2C at 400kHz for DS3231
  13. i2c.frequency(400000);
  14. // Start with HV PSU disabled
  15. HV_EnableOutput(false);
  16. TUSB322_Init();
  17. PCA9685_Init();
  18. // Enable HV PSU
  19. HV_EnableOutput(true);
  20. // Set PCA9685 input voltage to highest possible
  21. PCA9685_SetVoltage(1.0);
  22. // swo.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock);
  23. // Bump I2C frequency to 1MHz for PCA9685
  24. i2c.frequency(1000000);
  25. // PCA9685_SetDot(100);
  26. // PCA9685_SetDigit(3, 1, 100);
  27. // PCA9685_SetDigit(2, 3, 100);
  28. // PCA9685_SetDigit(1, 5, 100);
  29. // PCA9685_SetDigit(0, 7, 100);
  30. while(1) {
  31. Animate_Cycle_Basic();
  32. // Animate_Cycle_Analog();
  33. // Animate_Cycle_Low_Pwm();
  34. Animate_Cycle_Pwm();
  35. Animate_Cycle_Fade();
  36. Animate_Cycle_Fade_Random();
  37. Animate_Cycle_Fast();
  38. Animate_Cycle_Fast_Random();
  39. }
  40. }