|
enum | slcd_bias_value_t { SLCD_BIAS_STATIC = 0
, SLCD_BIAS_HALF = 1
, SLCD_BIAS_THIRD = 2
, SLCD_BIAS_FOURTH = 3
} |
|
enum | slcd_duty_value_t {
SLCD_DUTY_1_COMMON = 0
, SLCD_DUTY_2_COMMON = 1
, SLCD_DUTY_3_COMMON = 2
, SLCD_DUTY_4_COMMON = 3
,
SLCD_DUTY_6_COMMON = 4
, SLCD_DUTY_8_COMMON = 5
} |
|
enum | slcd_prescaler_value_t { SLCD_PRESCALER_DIV16 = 0
, SLCD_PRESCALER_DIV32 = 1
, SLCD_PRESCALER_DIV64 = 2
, SLCD_PRESCALER_DIV128 = 3
} |
|
enum | slcd_clocksource_value_t { SLCD_CLOCKSOURCE_ULP = 0
, SLCD_CLOCKSOURCE_XOSC = 1
} |
|
enum | slcd_clockdiv_value_t {
SLCD_CLOCKDIV_1 = 0
, SLCD_CLOCKDIV_2 = 1
, SLCD_CLOCKDIV_3 = 2
, SLCD_CLOCKDIV_4 = 3
,
SLCD_CLOCKDIV_5 = 4
, SLCD_CLOCKDIV_6 = 5
, SLCD_CLOCKDIV_7 = 6
, SLCD_CLOCKDIV_8 = 7
} |
|
enum | slcd_csrshift_value_t { SLCD_CSRSHIFT_LEFT = 0
, SLCD_CSRSHIFT_RIGHT = 1
} |
|
|
void | slcd_init (uint64_t lcd_pins, slcd_bias_value_t bias, slcd_duty_value_t duty, slcd_clocksource_value_t clocksource, slcd_prescaler_value_t prescaler, slcd_clockdiv_value_t clkdiv) |
| Initializes the SLCD peripheral, but does not enable it.
|
|
void | slcd_set_contrast (uint8_t contrast) |
| Sets the contrast level for the display. Valid values are from 0-15.
|
|
void | slcd_enable (void) |
| Enables the SLCD peripheral.
|
|
bool | slcd_is_enabled (void) |
| Checks if the SLCD peripheral is currently enabled.
|
|
void | slcd_clear (void) |
| Clears all display memory.
|
|
void | slcd_set_segment (uint8_t com, uint8_t seg) |
| Sets a segment in the display memory.
|
|
void | slcd_clear_segment (uint8_t com, uint8_t seg) |
| Clears a segment in the display memory.
|
|
void | slcd_configure_frame_counter (uint8_t fc, uint8_t overflow_count, bool prescale) |
| Configures one of the three frame counters.
|
|
void | slcd_set_frame_counter_enabled (uint8_t fc, bool enabled) |
| Enables or disables one of the three frame counters.
|
|
void | slcd_set_frame_counter_interrupt_enabled (uint8_t fc, bool enabled) |
| Enables or disables one of the three frame counter interrupts.
|
|
void | slcd_configure_blink (bool blink_all, uint8_t bss0, uint8_t bss1, uint8_t fc) |
| Configures the blink mode, but does not start blinking.
|
|
void | slcd_set_blink_enabled (bool enabled) |
| Enables or disables blinking according to the configuration set by slcd_configure_blink.
|
|
void | slcd_configure_circular_shift_animation (uint16_t initial_value, uint8_t size, slcd_csrshift_value_t shift_dir, uint8_t fc) |
| Configures the Circular Shift Register animation, but does not start it. This is pretty obscure and you should consult the datasheet for more information.
|
|
void | slcd_set_circular_shift_animation_enabled (bool enabled) |
| Enables or disables circular shift register animation according to the configuration set by slcd_configure_circular_shift_animation.
|
|
void | slcd_disable (void) |
| Disables the SLCD peripheral.
|
|
Functions for configuring and using the SAM L22's Segment LCD peripheral.
void slcd_init |
( |
uint64_t | lcd_pins, |
|
|
slcd_bias_value_t | bias, |
|
|
slcd_duty_value_t | duty, |
|
|
slcd_clocksource_value_t | clocksource, |
|
|
slcd_prescaler_value_t | prescaler, |
|
|
slcd_clockdiv_value_t | clkdiv ) |
Initializes the SLCD peripheral, but does not enable it.
This function sets up the SLCD peripheral with some defaults:
- LCD runs in standby
- Lowest possible contrast level (2.45 volts)
- Uses the low power waveform
- Charge pump refresh at 250Hz (slowest option)
- Reference Refresh at 62.5Hz (slowest option)
- Bias buffer enabled (side note / TODO: does turning this off save power?)
You will need to specify the remaining configuration options. Duty and bias are easy, but prescaler, clock divider and number of COM lines will combine to determine the frame rate of the display according to this formula: 32768/(prescaler * clock_divider * number_of_common_lines)
- Parameters
-
lcd_pins | A 64-bit mask of the pins to use for the SLCD, as numbered in the pin mux table in the data sheet (SLCD/LP[n]). For example, PB08 is SLCD/LP[2] and PA05 is SLCD/LP[5], so the mask for using both of these pins would be (1 << 2) | (1 << 5). The lowest pins are always used as the common lines, so for a 1/2 duty LCD using pins 2, 5, 6, 7, 30 and 35, pins 2 and 5 would be the COM0 and COM1, and the rest would be segment lines SEG0-SEG3. |
bias | The bias configuration for the SLCD. Valid options are:
- SLCD_BIAS_STATIC for a static display (0V, VLCD)
- SLCD_BIAS_HALF for 1/2 bias (0V, 1/2 VLCD, VLCD)
- SLCD_BIAS_THIRD for 1/3 bias (0V, 1/3 VLCD, 2/3 VLCD, VLCD)
- SLCD_BIAS_FOURTH for 1/4 bias (0V, 1/4 VLCD, 1/2 VLCD, 3/4 VLCD, VLCD)
|
duty | The duty cycle for the SLCD, aka the number of common lines. Valid options are:
- SLCD_DUTY_1_COMMON for a static display
- SLCD_DUTY_2_COMMON for two common lines and a 1/2 duty cycle
- SLCD_DUTY_3_COMMON for three common lines and a 1/3 duty cycle
- SLCD_DUTY_4_COMMON for four common lines and a 1/4 duty cycle
- SLCD_DUTY_6_COMMON for six common lines and a 1/6 duty cycle
- SLCD_DUTY_8_COMMON for eight common lines and a 1/8 duty cycle
|
clocksource | The clock source for the SLCD. Valid options are:
- SLCD_CLOCKSOURCE_ULP for the low-accuracy, low-power internal 32kHz oscillator
- SLCD_CLOCKSOURCE_XOSC for an external 32kHz crystal oscillator
|
prescaler | The prescaler factor, which initially divides the 32kHz clock. Valid options are:
- SLCD_CTRLA_PRESC_PRESC16_Val - Divide by 16
- SLCD_CTRLA_PRESC_PRESC32_Val - Divide by 32
- SLCD_CTRLA_PRESC_PRESC64_Val - Divide by 64
- SLCD_CTRLA_PRESC_PRESC128_Val - Divide by 128
|
clock_divider | The clock divider, which divides the prescaled clock. Valid options areL
- SLCD_CLOCKDIV_1 for no division
- SLCD_CLOCKDIV_2 to divide by 2
- SLCD_CLOCKDIV_3 to divide by 3
- SLCD_CLOCKDIV_4 to divide by 4
- SLCD_CLOCKDIV_5 to divide by 5
- SLCD_CLOCKDIV_6 to divide by 6
- SLCD_CLOCKDIV_7 to divide by 7
- SLCD_CLOCKDIV_8 to divide by 8
|