Callisto4Bootloader: lib/c4_colours.c Source File

Callisto4Bootloader

c4_colours.c
Go to the documentation of this file.
1
11 /******************************************************************************
12 * Includes
13 ******************************************************************************/
14 #include <c4_colours.h>
15 #include "board.h"
16 #include "pin_mux.h"
17
18 /******************************************************************************
19 * Definitions
20 ******************************************************************************/
21
24
25 #define LEDS_GPIO BOARD_USER_LED_GPIO
26 #define RED_LED_GPIO_PIN BOARD_USER_LED_RED_PIN
27 #define GREEN_LED_GPIO_PIN BOARD_USER_LED_GREEN_PIN
28 #define BLUE_LED_GPIO_PIN BOARD_USER_LED_BLUE_PIN
29
31 /******************************************************************************
32 * Types
33 ******************************************************************************/
34
40 const char * const colourNames[8] = {
41 #define COLOUR(c) #c,
42 COLOUR_LIST
43 #undef COLOUR
44 };
45
46 /******************************************************************************
47 * External Declarations
48 ******************************************************************************/
49
51 extern void BL_SysTick_DelayTicks(uint32_t n);
52
53 /******************************************************************************
54 * Variables
55 ******************************************************************************/
56
57 /******************************************************************************
58 * Function definitions
59 ******************************************************************************/
60
61 void FlashLed(colour_t led, unsigned int on, unsigned int off)
62 {
63
64 GPIO_PinWrite(LEDS_GPIO, RED_LED_GPIO_PIN * (E_RED & led), 1U);
65 GPIO_PinWrite(LEDS_GPIO, GREEN_LED_GPIO_PIN * ((E_GREEN & led)>>1), 1U);
66 GPIO_PinWrite(LEDS_GPIO, BLUE_LED_GPIO_PIN * ((E_BLUE & led)>>2), 1U);
67 BL_SysTick_DelayTicks(on); // Delay on ms
68 GPIO_PinWrite(LEDS_GPIO, RED_LED_GPIO_PIN, 0U);
69 GPIO_PinWrite(LEDS_GPIO, GREEN_LED_GPIO_PIN, 0U);
70 GPIO_PinWrite(LEDS_GPIO, BLUE_LED_GPIO_PIN, 0U);
71 BL_SysTick_DelayTicks(off); // Delay off ms
72 }
COLOUR_LIST
#define COLOUR_LIST
Definition: c4_colours.h:22
RED_LED_GPIO_PIN
#define RED_LED_GPIO_PIN
GPIO pin for RED LED - 9.
Definition: c4_colours.c:24
BL_SysTick_DelayTicks
void BL_SysTick_DelayTicks(uint32_t n)
Expose function from bootloader.c.
Definition: bootloader.c:317
colourNames
const char *const colourNames[8]
text names for colours generated using x-macro.
Definition: c4_colours.c:37
c4_colours.h
Enumeration of LED colour combinations.
LEDS_GPIO
#define LEDS_GPIO
Which GPIO controller to use - GPIO2.
Definition: c4_colours.c:23
pin_mux.h
FlashLed
void FlashLed(colour_t led, unsigned int on, unsigned int off)
Flash the led in the specified colour.
Definition: c4_colours.c:55
BLUE_LED_GPIO_PIN
#define BLUE_LED_GPIO_PIN
GPIO pin for BLUE LED - 11.
Definition: c4_colours.c:26
board.h
colour_t
colour_t
Enumeration of colours available.
Definition: c4_colours.h:33
GREEN_LED_GPIO_PIN
#define GREEN_LED_GPIO_PIN
GPIO pin for GREEN LED - 10.
Definition: c4_colours.c:25