led_max7219.c File Reference

library to communicate with a Titan Micro MAX7219 IC attached to a 4-digit 7-segment (code) More...

Go to the source code of this file.

## Macros

#define | LED_MAX7219_LOAD_PORT B
| port for load line
#define | LED_MAX7219_LOAD_PIN 12
| pin for load line
#define | LED_MAX7219_SPI 2
| SPI to send data.

## Functions

static void | led_max7219_write (uint16_t data, uint8_t display)
| write data on SPI bus and handle load signal More...
void | led_max7219_setup (uint8_t displays)
| setup communication with MAX7219 IC More...
void | led_max7219_on (uint8_t display)
| switch display on More...
void | led_max7219_off (uint8_t display)
| switch display off More...
void | led_max7219_test (bool test, uint8_t display)
| switch display in test or normal operation mode More...
void | led_max7219_intensity (uint8_t intensity, uint8_t digits, uint8_t display)
| set display intensity More...
bool | led_max7219_text (char *text, uint8_t display)
| display text More...
void | led_max7219_number (uint32_t number, uint8_t dots, uint8_t display)
| display number More...

## Variables

static const uint8_t | ascii_7segments []
| ASCII characters encoded for the 7 segments digit block. More...
uint8_t | lex_max7219_displays = 0
| number of display in the chain

## Detailed Description

library to communicate with a Titan Micro MAX7219 IC attached to a 4-digit 7-segment (code)

Author
  King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info

Date
  2017

Note
  peripherals used: GPIO GPIO used to control MAX7219 IC load line, timer timer used to communication with TM1637 IC

Warning
  all calls are blocking

bit vs segment: 0bpabcdefg +a+ f b +g+ e c p +d+

Definition in file led_max7219.c.

## Function Documentation

## led_max7219_intensity()

void led_max7219_intensity | ( | uint8_t | intensity,
|  | uint8_t | digits,
|  | uint8_t | display
| ) |  |

set display intensity

Parameters

  [in] | intensity | level to set (0-15)
  [in] | digits | number of digits to display (1-8)
  [in] | display | display number in chain (0xff for all)

Definition at line 228 of file led_max7219.c.

## led_max7219_number()

void led_max7219_number | ( | uint32_t | number,
|  | uint8_t | dots,
|  | uint8_t | display
| ) |  |

display number

Parameters

  [in] | number | number to display (8 digits max)
  [in] | dots | set bit if dot on corresponding digit should be displayed
  [in] | display | display number in chain (0xff for all)

Definition at line 254 of file led_max7219.c.

## led_max7219_off()

void led_max7219_off | ( | uint8_t | display | ) |

switch display off

Parameters

  [in] | display | display number in chain (0xff for all)

Definition at line 214 of file led_max7219.c.

## led_max7219_on()

void led_max7219_on | ( | uint8_t | display | ) |

switch display on

Parameters

  [in] | display | display number in chain (0xff for all)

Definition at line 209 of file led_max7219.c.

## led_max7219_setup()

void led_max7219_setup | ( | uint8_t | displays | ) |

setup communication with MAX7219 IC

Parameters

  [in] | displays | number of displays in the chain

Definition at line 186 of file led_max7219.c.

## led_max7219_test()

void led_max7219_test | ( | bool | test,
|  | uint8_t | display
| ) |  |

switch display in test or normal operation mode

Parameters

  [in] | test | switch in test mode (else normal operation)
  [in] | display | display number in chain (0xff for all)

Definition at line 219 of file led_max7219.c.

## led_max7219_text()

bool led_max7219_text | ( | char * | text,
|  | uint8_t | display
| ) |  |

display text

Parameters

  [in] | text | text to display (8 characters)
  [in] | display | display number in chain (0xff for all)

Note
  use first bit of each character to enable dot

Returns
  false if string has unsupported characters

Definition at line 240 of file led_max7219.c.

## led_max7219_write()

static void led_max7219_write | ( | uint16_t | data,
|  | uint8_t | display
| ) |  |

static

write data on SPI bus and handle load signal

Parameters

  [in] | data | bytes to write
  [in] | display | display number in chain (0xff for all)

Definition at line 166 of file led_max7219.c.

## Variable Documentation

## ascii_7segments

const uint8_t ascii_7segments[]

static

ASCII characters encoded for the 7 segments digit block.

Note
  starts with space

Definition at line 61 of file led_max7219.c.