SAM4L-EK Board Monitor Control.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | BM_CTRL 0x03 |
Enable/disable the board monitor. More... | |
#define | BM_GET_FIRMWARE_VERSION 0x11 |
Send Firmware Version Request. More... | |
#define | BM_LED_CLR 0x05 |
Turn-off a LED of the board monitor. More... | |
#define | BM_LED_SET 0x04 |
Turn-on a LED of the board monitor. More... | |
#define | BM_LED_TGL 0x06 |
Toggle a LED of the board monitor. More... | |
#define | BM_MCU_GET_CURRENT 0x0A |
Send Current Consumption Measured Request. More... | |
#define | BM_MCU_GET_FIFO_FREE_SIZE 0x0D |
Send free size (in byte) of the board monitor command fifo request. More... | |
#define | BM_MCU_RET_CURRENT 0x0C |
Return Current Consumption Measured. More... | |
#define | BM_MCU_RET_FIFO_FREE_SIZE 0x0E |
Return the free size (in byte) of the board monitor command fifo. More... | |
#define | BM_MCU_STATUS 0x07 |
Send MCU power saving information to the board monitor. More... | |
#define | BM_MSG_ID_DEFAULT 0 |
Board Monitor Message Default ID Message. More... | |
#define | BM_MSG_LENGTH_DEFAULT 9 |
Board Monitor Message Number of bytes to transfer. More... | |
#define | BM_MSG_START_PATTERN 0x75 |
Board Monitor Message Start pattern. More... | |
#define | BM_MSG_STOP_PATTERN 0xa3 |
Board Monitor Message Stop pattern. More... | |
#define | BM_PICOUART_SEND 0x09 |
Send PicoUart Frame. More... | |
#define | BM_POINTER_CTRL 0x01 |
Enable/disable the board monitor mouse-like pointer. More... | |
#define | BM_POINTER_MOVE 0x02 |
Send new mouse pointer position. More... | |
#define | BM_PRINT_CLEAR 0x10 |
Clear Print Text Area On Board Monitor. More... | |
#define | BM_PRINT_TEXT 0x0F |
Print Text On Board Monitor. More... | |
#define | BM_PRINT_TEXT_DEEP 6 |
#define | BM_PRINT_TEXT_SIZE 21 |
#define | BM_PULLUP_TWI 0x08 |
Enable/disable the pull-up on TWI lines. More... | |
#define | BM_RET_FIRMWARE_VERSION 0x12 |
Return Firmware Version value . More... | |
#define | BM_TGL_BUTTON 0x0B |
Force Toggle of Button Line. More... | |
Functions | |
void | bm_ctrl (bool state) |
Enable/disable the board monitor. More... | |
bool | bm_get_fifo_free_size (uint16_t *free_size) |
Return the free size (in byte) of the board monitor command fifo. More... | |
bool | bm_get_firmware_version (uint8_t *fw_minor_version, uint8_t *fw_major_version) |
Get Firmware Version. More... | |
bool | bm_get_mcu_current (uint32_t *sleep_mode, float *current) |
Return Current Consumption Measured. More... | |
void | bm_init (void) |
Configure the USART. More... | |
void | bm_led_clr (uint32_t led) |
Turn-off a LED of the board monitor. More... | |
void | bm_led_set (uint32_t led) |
Turn-on a LED of the board monitor. More... | |
void | bm_led_tgl (uint32_t led) |
Toggle a LED of the board monitor. More... | |
void | bm_mouse_pointer_ctrl (bool state) |
Enable/disable the board monitor mouse-like pointer. More... | |
void | bm_mouse_pointer_move (uint32_t x, uint32_t y) |
Send new mouse pointer position. More... | |
void | bm_print_clear (void) |
Clear Print Text Area. More... | |
void | bm_print_txt (uint8_t *str, uint8_t str_length) |
Print Text On Board Monitor. More... | |
void | bm_pullup_twi (bool state) |
Enable/disable the pull-up on TWI lines. More... | |
void | bm_send_mcu_status (uint32_t power_scaling, uint32_t sleep_mode, uint32_t cpu_freq, uint32_t cpu_src) |
Send MCU power saving information to the board monitor, in order to get them displayed on the OLED screen. More... | |
void | bm_send_picouart_frame (uint8_t frame, uint32_t timeout_ms) |
Send PicoUart Frame. More... | |
void | bm_tgl_button (uint32_t timeout_ms) |
Force Toggle of Button Line. More... | |
#define BM_CTRL 0x03 |
Enable/disable the board monitor.
Referenced by bm_ctrl().
#define BM_GET_FIRMWARE_VERSION 0x11 |
Send Firmware Version Request.
Referenced by bm_get_firmware_version().
#define BM_LED_CLR 0x05 |
Turn-off a LED of the board monitor.
Referenced by bm_led_clr().
#define BM_LED_SET 0x04 |
Turn-on a LED of the board monitor.
Referenced by bm_led_set().
#define BM_LED_TGL 0x06 |
Toggle a LED of the board monitor.
Referenced by bm_led_tgl().
#define BM_MCU_GET_CURRENT 0x0A |
Send Current Consumption Measured Request.
Referenced by bm_get_mcu_current().
#define BM_MCU_GET_FIFO_FREE_SIZE 0x0D |
Send free size (in byte) of the board monitor command fifo request.
Referenced by bm_get_fifo_free_size().
#define BM_MCU_RET_CURRENT 0x0C |
Return Current Consumption Measured.
Referenced by bm_get_mcu_current().
#define BM_MCU_RET_FIFO_FREE_SIZE 0x0E |
Return the free size (in byte) of the board monitor command fifo.
Referenced by bm_get_fifo_free_size().
#define BM_MCU_STATUS 0x07 |
Send MCU power saving information to the board monitor.
Referenced by bm_send_mcu_status().
#define BM_MSG_ID_DEFAULT 0 |
Board Monitor Message Default ID Message.
#define BM_MSG_LENGTH_DEFAULT 9 |
Board Monitor Message Number of bytes to transfer.
#define BM_MSG_START_PATTERN 0x75 |
Board Monitor Message Start pattern.
Referenced by bm_ctrl(), bm_get_fifo_free_size(), bm_get_firmware_version(), bm_get_mcu_current(), bm_led_clr(), bm_led_set(), bm_led_tgl(), bm_mouse_pointer_ctrl(), bm_mouse_pointer_move(), bm_print_clear(), bm_print_txt(), bm_pullup_twi(), bm_send_mcu_status(), bm_send_picouart_frame(), and bm_tgl_button().
#define BM_MSG_STOP_PATTERN 0xa3 |
Board Monitor Message Stop pattern.
Referenced by bm_ctrl(), bm_get_fifo_free_size(), bm_get_firmware_version(), bm_get_mcu_current(), bm_led_clr(), bm_led_set(), bm_led_tgl(), bm_mouse_pointer_ctrl(), bm_mouse_pointer_move(), bm_print_clear(), bm_print_txt(), bm_pullup_twi(), bm_send_mcu_status(), bm_send_picouart_frame(), and bm_tgl_button().
#define BM_PICOUART_SEND 0x09 |
Send PicoUart Frame.
Referenced by bm_send_picouart_frame().
#define BM_POINTER_CTRL 0x01 |
Enable/disable the board monitor mouse-like pointer.
Referenced by bm_mouse_pointer_ctrl().
#define BM_POINTER_MOVE 0x02 |
Send new mouse pointer position.
Referenced by bm_mouse_pointer_move().
#define BM_PRINT_CLEAR 0x10 |
Clear Print Text Area On Board Monitor.
Referenced by bm_print_clear().
#define BM_PRINT_TEXT 0x0F |
Print Text On Board Monitor.
Referenced by bm_print_txt().
#define BM_PRINT_TEXT_DEEP 6 |
#define BM_PRINT_TEXT_SIZE 21 |
Referenced by bm_print_txt().
#define BM_PULLUP_TWI 0x08 |
Enable/disable the pull-up on TWI lines.
Referenced by bm_pullup_twi().
#define BM_RET_FIRMWARE_VERSION 0x12 |
Return Firmware Version value .
Referenced by bm_get_firmware_version().
#define BM_TGL_BUTTON 0x0B |
Force Toggle of Button Line.
Referenced by bm_tgl_button().
void bm_ctrl | ( | bool | state | ) |
Enable/disable the board monitor.
state | true to enable, false to disable. |
References BM_CTRL, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
bool bm_get_fifo_free_size | ( | uint16_t * | free_size | ) |
Return the free size (in byte) of the board monitor command fifo.
free_size | free size in byte. |
References BM_MCU_GET_FIFO_FREE_SIZE, BM_MCU_RET_FIFO_FREE_SIZE, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, delay_ms, usart_disable_rx(), usart_disable_tx(), usart_enable_rx(), usart_enable_tx(), usart_getchar(), usart_is_tx_empty(), and usart_putchar().
bool bm_get_firmware_version | ( | uint8_t * | fw_minor_version, |
uint8_t * | fw_major_version | ||
) |
Get Firmware Version.
fw_minor_version | Firmware Version (in ascii format). |
fw_major_version | Firmware Version (in ascii format). |
References BM_GET_FIRMWARE_VERSION, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_RET_FIRMWARE_VERSION, BM_USART_USART, delay_ms, usart_disable_rx(), usart_disable_tx(), usart_enable_rx(), usart_enable_tx(), usart_getchar(), usart_is_tx_empty(), and usart_putchar().
bool bm_get_mcu_current | ( | uint32_t * | sleep_mode, |
float * | current | ||
) |
Return Current Consumption Measured.
sleep_mode | Sleep Mode Desired. |
current | Current Value Measured. |
References BM_MCU_GET_CURRENT, BM_MCU_RET_CURRENT, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, usart_disable_rx(), usart_disable_tx(), usart_enable_rx(), usart_enable_tx(), usart_getchar(), usart_is_tx_empty(), and usart_putchar().
void bm_init | ( | void | ) |
Configure the USART.
Configure the board monitor.
References BM_USART_USART, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_bus_hz(), and usart_init_rs232().
Referenced by ui_bm_init().
void bm_led_clr | ( | uint32_t | led | ) |
Turn-off a LED of the board monitor.
led | led number. Range is [0; 3]. |
References BM_LED_CLR, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_led_set | ( | uint32_t | led | ) |
Turn-on a LED of the board monitor.
led | led number. Range is [0; 3]. |
References BM_LED_SET, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_led_tgl | ( | uint32_t | led | ) |
Toggle a LED of the board monitor.
led | led number. Range is [0; 3]. |
References BM_LED_TGL, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_mouse_pointer_ctrl | ( | bool | state | ) |
Enable/disable the board monitor mouse-like pointer.
state | true to enable, false to disable. |
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_POINTER_CTRL, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_mouse_pointer_move | ( | uint32_t | x, |
uint32_t | y | ||
) |
Send new mouse pointer position.
x | x position. Range is [0; 127]. |
y | y position range is [0; 63]. |
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_POINTER_MOVE, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_print_clear | ( | void | ) |
Clear Print Text Area.
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_PRINT_CLEAR, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_print_txt | ( | uint8_t * | str, |
uint8_t | str_length | ||
) |
Print Text On Board Monitor.
str | String pattern. |
str_length | String length pattern. |
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_PRINT_TEXT, BM_PRINT_TEXT_SIZE, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_pullup_twi | ( | bool | state | ) |
Enable/disable the pull-up on TWI lines.
state | true to enable, false to disable. |
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_PULLUP_TWI, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_send_mcu_status | ( | uint32_t | power_scaling, |
uint32_t | sleep_mode, | ||
uint32_t | cpu_freq, | ||
uint32_t | cpu_src | ||
) |
Send MCU power saving information to the board monitor, in order to get them displayed on the OLED screen.
power_scaling | Power scaling. |
sleep_mode | Sleep mode. |
cpu_freq | CPU frequency. |
cpu_src | CPU source clock. |
References BM_MCU_STATUS, BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
Referenced by ui_bm_send_mcu_status().
void bm_send_picouart_frame | ( | uint8_t | frame, |
uint32_t | timeout_ms | ||
) |
Send PicoUart Frame.
Note that the timeout countdown starts after a 500ms delay in order to keep a stable current measurement.
frame | Frame to be sent. |
timeout_ms | Timeout value in ms. |
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_PICOUART_SEND, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().
void bm_tgl_button | ( | uint32_t | timeout_ms | ) |
Force Toggle of Button Line.
timeout_ms | Timeout value in ms. |
References BM_MSG_START_PATTERN, BM_MSG_STOP_PATTERN, BM_TGL_BUTTON, BM_USART_USART, usart_disable_tx(), usart_enable_tx(), usart_is_tx_empty(), and usart_putchar().