This module contains SAMD21 BSP APIs implementation.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "common/include/nm_common.h"
Data Structures | |
struct | tstrTimer |
struct | tstrWakeTimer |
Macros | |
#define | BSP_MIN(x, y) ((x)>(y)?(y):(x)) |
#define | DEBOUNCE_TIME (40/TICK_RES) |
#define | LONG_PRESS_TIME (1500/TICK_RES) |
#define | SW1_LINE |
#define | SW1_MUX |
#define | SW1_PIN |
Functions | |
static void | _tcc_callback_to_change_duty_cycle (struct tcc_module *const module_inst) |
static void | _tcc_configurable_timer_callback (struct tcc_module *const module_inst) |
static void | btn_isr (void) |
static void | btn_poll (void) |
Static functions. More... | |
static void | configurable_timer_init (uint32_t u32Period) |
void | nm_bsp_app_configurable_timer_init (uint32_t u32Period) |
sint8 | nm_bsp_app_deinit (void) |
sint8 | nm_bsp_app_init (void) |
void | nm_bsp_btn_init (tpfNmBspBtnPress pfBtnCb) |
void | nm_bsp_start_1ms_timer (tpfNmBspTimerCb pfCb) |
void | nm_bsp_start_configurable_timer (tpfNmBspTimerCb pfCb) |
void | nm_bsp_start_timer (tpfNmBspTimerCb pfCb, uint32 u32Period) |
void | nm_bsp_stop_1ms_timer (void) |
void | nm_bsp_stop_configurable_timer (void) |
void | nm_bsp_stop_timer (void) |
Start 20ms timer. More... | |
void | nm_bsp_uart_send (const uint8 *pu8Buf, uint16 u16Sz) |
static void | timer0_init (void) |
Variables | |
struct tcc_module | configurable_tcc |
static tpfNmBspBtnPress | gpfBtns |
static tstrTimer | gstrConfigurableTimer |
static tstrTimer | gstrTimer1ms |
static tstrTimer | gstrTimer20ms |
static uint16 | gu16Btn1Cnt |
static uint16 | gu16Btn2Cnt |
uint32 | gu32Jiffies1ms |
Global variables. More... | |
uint32 | gu32Jiffies20ms |
Extern global variables. More... | |
static uint8 | gu8BtnIfg |
struct tcc_module | tcc_instance |
#define BSP_MIN | ( | x, | |
y | |||
) | ((x)>(y)?(y):(x)) |
Referenced by spi_flash_write().
#define DEBOUNCE_TIME (40/TICK_RES) |
Referenced by btn_poll().
#define LONG_PRESS_TIME (1500/TICK_RES) |
Referenced by btn_poll().
#define SW1_LINE |
#define SW1_MUX |
#define SW1_PIN |
|
static |
References btn_poll(), gu32Jiffies1ms, gu32Jiffies20ms, NM_BSP_TIME_MSEC, tstrTimer::pfCb, tstrWakeTimer::strTimer, TICK_RES, TICK_RES_SLEEP, tstrTimer::u32Period, tstrTimer::u32Timeout, and tstrWakeTimer::u8Enabled.
Referenced by timer0_init().
|
static |
References tstrTimer::pfCb.
Referenced by configurable_timer_init().
|
static |
References BUTTON_0_EIC_LINE, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_disable_callback(), gu8BtnIfg, and SW1.
Referenced by nm_bsp_btn_init().
|
static |
Static functions.
References BUTTON_0_EIC_LINE, BUTTON_0_INACTIVE, BUTTON_0_PIN, DEBOUNCE_TIME, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_enable_callback(), gpfBtns, gu16Btn1Cnt, gu16Btn2Cnt, gu8BtnIfg, LONG_PRESS_TIME, port_pin_get_input_level(), SW1, and SW2.
Referenced by _tcc_callback_to_change_duty_cycle().
|
static |
[setup_change_config]
[setup_register_callback]
References _tcc_configurable_timer_callback(), configurable_tcc, tcc_config::counter, M2M_DBG, tcc_counter_config::period, TCC_CALLBACK_OVERFLOW, tcc_enable(), tcc_get_config_defaults(), tcc_init(), and tcc_register_callback().
Referenced by nm_bsp_app_configurable_timer_init().
void nm_bsp_app_configurable_timer_init | ( | uint32_t | u32Period | ) |
References configurable_timer_init().
sint8 nm_bsp_app_deinit | ( | void | ) |
References M2M_SUCCESS.
sint8 nm_bsp_app_init | ( | void | ) |
References M2M_SUCCESS, NULL, tstrTimer::pfCb, tstrWakeTimer::strTimer, timer0_init(), tstrTimer::u32Period, tstrTimer::u32Timeout, and tstrWakeTimer::u8Enabled.
Referenced by main().
void nm_bsp_btn_init | ( | tpfNmBspBtnPress | pfBtnCb | ) |
References btn_isr(), BUTTON_0_EIC_LINE, BUTTON_0_EIC_MUX, BUTTON_0_EIC_PIN, extint_chan_conf::detection_criteria, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_enable_callback(), extint_chan_get_config_defaults(), extint_chan_set_config(), EXTINT_DETECT_FALLING, EXTINT_PULL_UP, extint_register_callback(), gpfBtns, extint_chan_conf::gpio_pin, extint_chan_conf::gpio_pin_mux, extint_chan_conf::gpio_pin_pull, gu16Btn1Cnt, gu16Btn2Cnt, gu8BtnIfg, port_get_config_defaults(), PORT_PIN_DIR_INPUT, PORT_PIN_PULL_UP, and port_pin_set_config().
Referenced by app_main().
void nm_bsp_start_1ms_timer | ( | tpfNmBspTimerCb | pfCb | ) |
References tstrTimer::pfCb.
void nm_bsp_start_configurable_timer | ( | tpfNmBspTimerCb | pfCb | ) |
References configurable_tcc, tstrTimer::pfCb, TCC_CALLBACK_OVERFLOW, and tcc_enable_callback().
void nm_bsp_start_timer | ( | tpfNmBspTimerCb | pfCb, |
uint32 | u32Period | ||
) |
References NM_BSP_TIME_MSEC, tstrTimer::pfCb, tstrTimer::u32Period, and tstrTimer::u32Timeout.
Referenced by led_flash().
void nm_bsp_stop_1ms_timer | ( | void | ) |
References NULL, and tstrTimer::pfCb.
void nm_bsp_stop_configurable_timer | ( | void | ) |
References configurable_tcc, NULL, tstrTimer::pfCb, TCC_CALLBACK_OVERFLOW, tcc_disable(), and tcc_disable_callback().
nm_bsp_stop_timer | ( | void | ) |
Start 20ms timer.
Stop 20ms timer.
References NULL, and tstrTimer::pfCb.
Referenced by led_clear(), and led_flash().
|
static |
[setup_change_config]
[setup_register_callback]
References _tcc_callback_to_change_duty_cycle(), tcc_counter_config::clock_prescaler, tcc_config::counter, tcc_counter_config::period, tcc_counter_config::reload_action, TCC_CLOCK_PRESCALER_DIV64, tcc_enable(), tcc_enable_callback(), tcc_get_config_defaults(), tcc_init(), tcc_instance, tcc_register_callback(), and TCC_RELOAD_ACTION_GCLK.
Referenced by nm_bsp_app_init().
struct tcc_module configurable_tcc |
Referenced by configurable_timer_init(), nm_bsp_start_configurable_timer(), and nm_bsp_stop_configurable_timer().
|
static |
Referenced by btn_poll(), and nm_bsp_btn_init().
|
static |
|
static |
|
static |
|
static |
Referenced by btn_poll(), and nm_bsp_btn_init().
|
static |
Referenced by btn_poll(), and nm_bsp_btn_init().
uint32 gu32Jiffies1ms |
Global variables.
Referenced by _tcc_callback_to_change_duty_cycle(), platform_cmd_cmpl_wait(), and platform_event_wait().
uint32 gu32Jiffies20ms |
Extern global variables.
Referenced by _tcc_callback_to_change_duty_cycle().
|
static |
Referenced by btn_isr(), btn_poll(), and nm_bsp_btn_init().
struct tcc_module tcc_instance |
Referenced by timer0_init().