diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-07-20 16:26:54 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-07-20 16:26:54 -0400 |
commit | b4b81f476c991a8d1620e1a9e010fcff847b3c04 (patch) | |
tree | b84acced159d862c078855fcfebe0f3db7607d7b /Sensor Watch Starter Project/hal/src/hal_slcd_sync.c | |
parent | bc1ee49d80252defad1fcf0723cd4af68a374c06 (diff) | |
download | Sensor-Watch-b4b81f476c991a8d1620e1a9e010fcff847b3c04.tar.gz Sensor-Watch-b4b81f476c991a8d1620e1a9e010fcff847b3c04.tar.bz2 Sensor-Watch-b4b81f476c991a8d1620e1a9e010fcff847b3c04.zip |
bring in all the atmel studio stuff
Diffstat (limited to 'Sensor Watch Starter Project/hal/src/hal_slcd_sync.c')
-rw-r--r-- | Sensor Watch Starter Project/hal/src/hal_slcd_sync.c | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/Sensor Watch Starter Project/hal/src/hal_slcd_sync.c b/Sensor Watch Starter Project/hal/src/hal_slcd_sync.c new file mode 100644 index 00000000..573eb0e2 --- /dev/null +++ b/Sensor Watch Starter Project/hal/src/hal_slcd_sync.c @@ -0,0 +1,150 @@ +/** + * \file + * + * \brief SLCD Segment Liquid Crystal Display Controller(Sync) functionality + * declaration. + * + * Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries. + * + * \asf_license_start + * + * \page License + * + * Subject to your compliance with these terms, you may use Microchip + * software and any derivatives exclusively with Microchip products. + * It is your responsibility to comply with third party license terms applicable + * to your use of third party software (including open source software) that + * may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, + * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, + * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE + * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL + * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE + * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE + * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT + * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY + * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + * + * \asf_license_stop + * + */ + +#include <hal_slcd_sync.h> +#include <utils_assert.h> + +/** + * \brief Initialize SLCD Descriptor + */ +int32_t slcd_sync_init(struct slcd_sync_descriptor *const descr, void *const hw) +{ + ASSERT(descr && hw); + return _slcd_sync_init(&descr->dev, hw); +} + +/** + * \brief Deinitialize SLCD Descriptor + */ +int32_t slcd_sync_deinit(struct slcd_sync_descriptor *const descr) +{ + ASSERT(descr); + return _slcd_sync_deinit(&descr->dev); +} + +/** + * \brief Enable SLCD driver + * + */ +int32_t slcd_sync_enable(struct slcd_sync_descriptor *const descr) +{ + ASSERT(descr); + return _slcd_sync_enable(&descr->dev); +} +/** + * \brief Disable SLCD driver + * + */ +int32_t slcd_sync_disable(struct slcd_sync_descriptor *const descr) +{ + ASSERT(descr); + return _slcd_sync_disable(&descr->dev); +} +/** + * \brief Turn on a Segment + */ +int32_t slcd_sync_seg_on(struct slcd_sync_descriptor *const descr, uint32_t seg) +{ + ASSERT(descr); + return _slcd_sync_seg_on(&descr->dev, seg); +} +/** + * \brief Turn off a Segment + */ +int32_t slcd_sync_seg_off(struct slcd_sync_descriptor *const descr, uint32_t seg) +{ + ASSERT(descr); + return _slcd_sync_seg_off(&descr->dev, seg); +} +/** + * \brief Blink a Segment + */ +int32_t slcd_sync_seg_blink(struct slcd_sync_descriptor *const descr, uint32_t seg, const uint32_t period) +{ + ASSERT(descr && period); + return _slcd_sync_seg_blink(&descr->dev, seg, period); +} + +/** + * \brief Displays a character + */ +int32_t slcd_sync_write_char(struct slcd_sync_descriptor *const descr, const uint8_t character, uint32_t index) +{ + ASSERT(descr); + return _slcd_sync_write_char(&descr->dev, character, index); +} + +/** + * \brief Displays character string string + */ +int32_t slcd_sync_write_string(struct slcd_sync_descriptor *const descr, uint8_t *const str, uint32_t len, + uint32_t index) +{ + uint32_t i; + ASSERT(descr && len); + + for (i = 0; i < len; i++) { + if (_slcd_sync_write_char(&descr->dev, *(str + i), index + i) != ERR_NONE) { + return ERR_INVALID_ARG; + } + } + return ERR_NONE; +} +/** + * \brief Start animation play by a segment array + */ +int32_t slcd_sync_start_animation(struct slcd_sync_descriptor *const descr, const uint32_t segs[], uint32_t len, + const uint32_t period) +{ + ASSERT(descr && segs && len && period); + return _slcd_sync_start_animation(&descr->dev, segs, len, period); +} + +/** + * \brief Stop animation play by a segment array + */ +int32_t slcd_sync_stop_animation(struct slcd_sync_descriptor *const descr, const uint32_t segs[], uint32_t len) +{ + ASSERT(descr && segs && len); + return _slcd_sync_stop_animation(&descr->dev, segs, len); +} + +/** + * \brief Set animation Frequency + */ +int32_t slcd_sync_set_animation_period(struct slcd_sync_descriptor *const descr, const uint32_t period) +{ + ASSERT(descr && period); + return _slcd_sync_set_animation_period(&descr->dev, period); +} |