@@ -18,10 +18,12 @@ typedef enum {
} tube_pos_t;
typedef enum {
+ sym_None = 0,
sym_Pressure = 0x1,
sym_Plus = 0x2,
sym_Minus = 0x4,
- sym_Percent = 0x8
+ sym_Percent = 0x8,
+ sym_Off = 0xf << 16
} in15_pin_t;
typedef struct {
@@ -88,10 +88,10 @@ void Board_Init(void)
/* Start RGB & Tube Power PWM */
TIM1_Init();
TIM3_Init();
- /* Blink timer */
+ /* Tube Blink timer */
TIM14_Init();
-
- //TIM16_Init();
+ /* IN15 Fade In/Out timer */
+ TIM16_Init();
//TIM17_Init();
//USART1_UART_Init();
@@ -24,6 +24,7 @@ const uint8_t cie[MAX_BRIGHT_LVL + 1] = {
0, 2, 4, 8, 13, 20, 29, 40, 54, 72, 92, 116, 145, 177, 214, 255
};
volatile static uint8_t dispWDT = 0;
+volatile in15_pin_t SymbolIN15 = sym_None;
static in15_pin_t symToFade = 0;
static uint8_t LightingBright;
static light_mode_t LightingMode;
@@ -140,32 +141,37 @@ void new_Second(void) {
* On/off symbols on IN-15 tube.
*/
void in15Off(void) {
- IN15_OFF;
- TUBE_C_OFF;
+ //IN15_OFF;
+ //TUBE_C_OFF;
+ SymbolIN15 = sym_Off;
}
void in15Minus(void) {
- IN15_Minus;
- TUBE_C_ON;
+ //IN15_Minus;
+ //TUBE_C_ON;
+ SymbolIN15 = sym_Minus;
void in15Plus(void) {
- IN15_Plus;
+ //IN15_Plus;
+ SymbolIN15 = sym_Plus;
void in15Percent(void) {
- IN15_Percent;
+ //IN15_Percent;
+ SymbolIN15 = sym_Percent;
void in15P(void) {
- IN15_P;
+ //IN15_P;
+ SymbolIN15 = sym_Pressure;
/** 'Faded' funcions */
@@ -378,8 +384,9 @@ static void HSV2LED(const uint8_t hue, const uint8_t val) {
void showTime(void) {
uint8_t hue;
- MinusFadeIn();
- RTOS_SetTask(MinusFadeOut, 500, 0);
+ //MinusFadeIn();
+ in15Minus();
+ RTOS_SetTask(in15Off, 500, 0); // MinusFadeOut
switch (LightingMode) {
case light_Rainbow:
@@ -28,6 +28,7 @@
/* Private function prototypes -----------------------------------------------*/
/* Private user code ---------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
+extern volatile in15_pin_t SymbolIN15;
/******************************************************************************/
/* Cortex-M0+ Processor Interruption and Exception Handlers */
@@ -203,11 +204,42 @@ void TIM14_IRQHandler(void)
/**
* @brief This function handles TIM16 global interrupt.
+#define STOP_FADE_TIME 20
void TIM16_IRQHandler(void)
{
+ static in15_pin_t sym_old = sym_Off;
+ static uint8_t ph = 0;
+ static uint8_t on = 0;
+ static uint8_t cnt = 0;
+
if ((TIM16->SR & TIM_SR_UIF) != 0) {
- /* Update interrupt flag */
+ /* Clear interrupt flag */
TIM16->SR |= TIM_SR_UIF;
+ if (SymbolIN15 != sym_None) {
+ if (cnt > 0) {
+ cnt --;
+ } else {
+ if (ph == 0) {
+ ph = 1;
+ GPIOA->BSRR = SymbolIN15;
+ if (on < STOP_FADE_TIME) {
+ on += 2;
+ cnt = on;
+ ph = 0; on = 0; cnt = 0;
+ sym_old = SymbolIN15;
+ SymbolIN15 = sym_None;
+ }
+ ph = 0;
+ GPIOA->BSRR = sym_old;
+ cnt = STOP_FADE_TIME - on;
+ } /* cnt == 0 */
+ } /* SymbolIN15 not empty */