├── README.md ├── doc └── doxy │ ├── Doxyfile.doxy │ ├── doxygen_1.css │ ├── footer.tex │ ├── footer_1.html │ ├── header.tex │ ├── header_1.html │ └── tabs_1.css ├── example ├── basic │ ├── ARM │ │ ├── CEC │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_CEC.cfg │ │ │ ├── Click_DALI_2_CEC.mbas │ │ │ ├── Click_DALI_2_CEC.mbpar.example │ │ │ ├── Click_DALI_2_config.mbas │ │ │ ├── Click_DALI_2_timer.mbas │ │ │ └── Click_DALI_2_types.mbas │ │ ├── KINETIS │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_KINETIS.cfg │ │ │ ├── Click_DALI_2_KINETIS.mbas │ │ │ ├── Click_DALI_2_KINETIS.mbpar.example │ │ │ ├── Click_DALI_2_timer.mbas │ │ │ └── Click_DALI_2_types.mbas │ │ ├── MSP │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_MSP.cfg │ │ │ ├── Click_DALI_2_MSP.mbas │ │ │ ├── Click_DALI_2_MSP.mbpar.example │ │ │ ├── Click_DALI_2_timer.mbas │ │ │ └── Click_DALI_2_types.mbas │ │ ├── STM │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_STM.cfg │ │ │ ├── Click_DALI_2_STM.mbas │ │ │ ├── Click_DALI_2_STM.mbpar.example │ │ │ ├── Click_DALI_2_timer.mbas │ │ │ └── Click_DALI_2_types.mbas │ │ └── TIVA │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_TIVA.cfg │ │ │ ├── Click_DALI_2_TIVA.mbas │ │ │ ├── Click_DALI_2_TIVA.mbpar.example │ │ │ ├── Click_DALI_2_timer.mbas │ │ │ └── Click_DALI_2_types.mbas │ ├── AVR │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_AVR.mbas │ │ ├── Click_DALI_2_AVR.mbpav.example │ │ ├── Click_DALI_2_timer.mbas │ │ └── Click_DALI_2_types.mbas │ ├── DSPIC │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_DSPIC.cfg │ │ ├── Click_DALI_2_DSPIC.mbas │ │ ├── Click_DALI_2_DSPIC.mbpds.example │ │ ├── Click_DALI_2_timer.mbas │ │ └── Click_DALI_2_types.mbas │ ├── FT90x │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_FT90x.mbas │ │ ├── Click_DALI_2_FT90x.mbpf9.example │ │ ├── Click_DALI_2_timer.mbas │ │ └── Click_DALI_2_types.mbas │ ├── PIC │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_PIC.cfg │ │ ├── Click_DALI_2_PIC.mbas │ │ ├── Click_DALI_2_PIC.mbppi.example │ │ ├── Click_DALI_2_timer.mbas │ │ └── Click_DALI_2_types.mbas │ └── PIC32 │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_PIC32.cfg │ │ ├── Click_DALI_2_PIC32.mbas │ │ ├── Click_DALI_2_PIC32.mbp32.example │ │ ├── Click_DALI_2_timer.mbas │ │ └── Click_DALI_2_types.mbas ├── c │ ├── ARM │ │ ├── CEC │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_CEC.c │ │ │ ├── Click_DALI_2_CEC.cfg │ │ │ ├── Click_DALI_2_CEC.mcpar │ │ │ ├── Click_DALI_2_CEC.mcpar.example │ │ │ ├── Click_DALI_2_config.h │ │ │ ├── Click_DALI_2_timer.h │ │ │ └── Click_DALI_2_types.h │ │ ├── KINETIS │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_KINETIS.c │ │ │ ├── Click_DALI_2_KINETIS.cfg │ │ │ ├── Click_DALI_2_KINETIS.mcpar │ │ │ ├── Click_DALI_2_KINETIS.mcpar.example │ │ │ ├── Click_DALI_2_config.h │ │ │ ├── Click_DALI_2_timer.h │ │ │ └── Click_DALI_2_types.h │ │ ├── MSP │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_MSP.c │ │ │ ├── Click_DALI_2_MSP.cfg │ │ │ ├── Click_DALI_2_MSP.mcpar │ │ │ ├── Click_DALI_2_MSP.mcpar.example │ │ │ ├── Click_DALI_2_config.h │ │ │ ├── Click_DALI_2_timer.h │ │ │ └── Click_DALI_2_types.h │ │ ├── STM │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2.pld.ini │ │ │ ├── Click_DALI_2_STM.asm │ │ │ ├── Click_DALI_2_STM.bin │ │ │ ├── Click_DALI_2_STM.bmk │ │ │ ├── Click_DALI_2_STM.brk │ │ │ ├── Click_DALI_2_STM.c │ │ │ ├── Click_DALI_2_STM.c.ini │ │ │ ├── Click_DALI_2_STM.cfg │ │ │ ├── Click_DALI_2_STM.cp │ │ │ ├── Click_DALI_2_STM.dbg │ │ │ ├── Click_DALI_2_STM.dct │ │ │ ├── Click_DALI_2_STM.dlt │ │ │ ├── Click_DALI_2_STM.emcl │ │ │ ├── Click_DALI_2_STM.hex │ │ │ ├── Click_DALI_2_STM.log │ │ │ ├── Click_DALI_2_STM.lst │ │ │ ├── Click_DALI_2_STM.lst.ini │ │ │ ├── Click_DALI_2_STM.mcpar │ │ │ ├── Click_DALI_2_STM.mcpar.example │ │ │ ├── Click_DALI_2_STM.mcpar_callertable.txt │ │ │ ├── Click_DALI_2_STM.user.dic │ │ │ ├── Click_DALI_2_STM.wch │ │ │ ├── Click_DALI_2_config.h │ │ │ ├── Click_DALI_2_timer.h │ │ │ ├── Click_DALI_2_timer.h.ini │ │ │ └── Click_DALI_2_types.h │ │ └── TIVA │ │ │ ├── Click_DALI_2.pld │ │ │ ├── Click_DALI_2_TIVA.c │ │ │ ├── Click_DALI_2_TIVA.cfg │ │ │ ├── Click_DALI_2_TIVA.mcpar │ │ │ ├── Click_DALI_2_TIVA.mcpar.example │ │ │ ├── Click_DALI_2_config.h │ │ │ ├── Click_DALI_2_timer.h │ │ │ └── Click_DALI_2_types.h │ ├── AVR │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_AVR.c │ │ ├── Click_DALI_2_AVR.mcpav │ │ ├── Click_DALI_2_AVR.mcpav.example │ │ ├── Click_DALI_2_config.h │ │ ├── Click_DALI_2_timer.h │ │ └── Click_DALI_2_types.h │ ├── DSPIC │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_DSPIC.c │ │ ├── Click_DALI_2_DSPIC.cfg │ │ ├── Click_DALI_2_DSPIC.mcpds │ │ ├── Click_DALI_2_DSPIC.mcpds.example │ │ ├── Click_DALI_2_config.h │ │ ├── Click_DALI_2_timer.h │ │ └── Click_DALI_2_types.h │ ├── FT90x │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_FT90x.c │ │ ├── Click_DALI_2_FT90x.mcpf9 │ │ ├── Click_DALI_2_FT90x.mcpf9.example │ │ ├── Click_DALI_2_config.h │ │ ├── Click_DALI_2_timer.h │ │ └── Click_DALI_2_types.h │ ├── PIC │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_PIC.c │ │ ├── Click_DALI_2_PIC.cfg │ │ ├── Click_DALI_2_PIC.mcppi │ │ ├── Click_DALI_2_PIC.mcppi.example │ │ ├── Click_DALI_2_config.h │ │ ├── Click_DALI_2_timer.h │ │ └── Click_DALI_2_types.h │ └── PIC32 │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_PIC32.c │ │ ├── Click_DALI_2_PIC32.cfg │ │ ├── Click_DALI_2_PIC32.mcp32 │ │ ├── Click_DALI_2_PIC32.mcp32.example │ │ ├── Click_DALI_2_config.h │ │ ├── Click_DALI_2_timer.h │ │ └── Click_DALI_2_types.h └── pascal │ ├── ARM │ ├── CEC │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_CEC.cfg │ │ ├── Click_DALI_2_CEC.mpas │ │ ├── Click_DALI_2_CEC.mppar.example │ │ ├── Click_DALI_2_config.mpas │ │ ├── Click_DALI_2_timer.mpas │ │ └── Click_DALI_2_types.mpas │ ├── KINETIS │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_KINETIS.cfg │ │ ├── Click_DALI_2_KINETIS.mpas │ │ ├── Click_DALI_2_KINETIS.mppar.example │ │ ├── Click_DALI_2_timer.mpas │ │ └── Click_DALI_2_types.mpas │ ├── MSP │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_MSP.cfg │ │ ├── Click_DALI_2_MSP.mpas │ │ ├── Click_DALI_2_MSP.mppar.example │ │ ├── Click_DALI_2_timer.mpas │ │ └── Click_DALI_2_types.mpas │ ├── STM │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_STM.cfg │ │ ├── Click_DALI_2_STM.mpas │ │ ├── Click_DALI_2_STM.mppar.example │ │ ├── Click_DALI_2_timer.mpas │ │ └── Click_DALI_2_types.mpas │ └── TIVA │ │ ├── Click_DALI_2.pld │ │ ├── Click_DALI_2_TIVA.cfg │ │ ├── Click_DALI_2_TIVA.mpas │ │ ├── Click_DALI_2_TIVA.mppar.example │ │ ├── Click_DALI_2_timer.mpas │ │ └── Click_DALI_2_types.mpas │ ├── AVR │ ├── Click_DALI_2.pld │ ├── Click_DALI_2_AVR.mpas │ ├── Click_DALI_2_AVR.mppav.example │ ├── Click_DALI_2_timer.mpas │ └── Click_DALI_2_types.mpas │ ├── DSPIC │ ├── Click_DALI_2.pld │ ├── Click_DALI_2_DSPIC.cfg │ ├── Click_DALI_2_DSPIC.mpas │ ├── Click_DALI_2_DSPIC.mppds.example │ ├── Click_DALI_2_timer.mpas │ └── Click_DALI_2_types.mpas │ ├── FT90x │ ├── Click_DALI_2.pld │ ├── Click_DALI_2_FT90x.mpas │ ├── Click_DALI_2_FT90x.mppf9.example │ ├── Click_DALI_2_timer.mpas │ └── Click_DALI_2_types.mpas │ ├── PIC │ ├── Click_DALI_2.pld │ ├── Click_DALI_2_PIC.cfg │ ├── Click_DALI_2_PIC.mpas │ ├── Click_DALI_2_PIC.mpppi.example │ ├── Click_DALI_2_timer.mpas │ └── Click_DALI_2_types.mpas │ └── PIC32 │ ├── Click_DALI_2.pld │ ├── Click_DALI_2_PIC32.cfg │ ├── Click_DALI_2_PIC32.mpas │ ├── Click_DALI_2_PIC32.mpp32.example │ ├── Click_DALI_2_timer.mpas │ └── Click_DALI_2_types.mpas ├── library ├── __dali2_driver.c ├── __dali2_driver.h └── __dali2_hal.c └── packages ├── basic ├── DALI 2 Click ARM.mpkg ├── DALI 2 Click AVR.mpkg ├── DALI 2 Click FT90x.mpkg ├── DALI 2 Click PIC.mpkg ├── DALI 2 Click PIC32.mpkg └── DALI 2 Click dsPIC.mpkg ├── c ├── DALI 2 Click ARM.mpkg ├── DALI 2 Click AVR.mpkg ├── DALI 2 Click FT90x.mpkg ├── DALI 2 Click PIC.mpkg ├── DALI 2 Click PIC32.mpkg └── DALI 2 Click dsPIC.mpkg └── pascal ├── DALI 2 Click ARM.mpkg ├── DALI 2 Click AVR.mpkg ├── DALI 2 Click FT90x.mpkg ├── DALI 2 Click PIC.mpkg ├── DALI 2 Click PIC32.mpkg └── DALI 2 Click dsPIC.mpkg /README.md: -------------------------------------------------------------------------------- 1 | ![MikroE](http://www.mikroe.com/img/designs/beta/logo_small.png) 2 | 3 | --- 4 | 5 | # DALI_2 Click 6 | 7 | - **CIC Prefix** : DALI2 8 | - **Author** : MikroE Team 9 | - **Verison** : 1.0.0 10 | - **Date** : Feb 2018. 11 | 12 | --- 13 | 14 | ### Software Support 15 | 16 | We provide a library for the DALI_2 Click on our [LibStock](https://libstock.mikroe.com/projects/view/2333/dali-2-click) 17 | page, as well as a demo application (example), developed using MikroElektronika 18 | [compilers](http://shop.mikroe.com/compilers). The demo can run on all the main 19 | MikroElektronika [development boards](http://shop.mikroe.com/development-boards). 20 | 21 | **Library Description** 22 | 23 | Library implements DALI master functionalities. 24 | 25 | Key functions : 26 | 27 | - ``` void dali2_sendCmd(const uint8_t balAddress, const uint8_t cmd, const uint8_t cmdType, const uint8_t folType) ``` - Executes DALI command 28 | - ``` void dali2_masterInit() ``` - Initializes master functionality 29 | - ``` uint8_t dali2_masterStatus() ``` - Returns master status 30 | 31 | **Examples Description** 32 | 33 | The application is composed of three sections : 34 | 35 | - System Initialization - Initializes GPIO pins for TX and RX 36 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 37 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 38 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 39 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 40 | 41 | 42 | ```.c 43 | void applicationTask() 44 | { 45 | uint8_t counter; 46 | 47 | for (counter = 0; counter < 2; counter++) 48 | { 49 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 50 | Delay_ms( 1000 ); 51 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 52 | Delay_ms( 1000 ); 53 | } 54 | 55 | for (counter = 0; counter < 8; counter++) 56 | { 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 58 | Delay_ms( 500 ); 59 | } 60 | 61 | for (counter = 0; counter < 8; counter++) 62 | { 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 64 | Delay_ms( 500 ); 65 | } 66 | 67 | current_state = dali2_masterStatus(); 68 | } 69 | ``` 70 | 71 | **Note** 72 | 73 | This implementation of DALI master requires timer with exact 104 uS interrupt time. The MCU used 74 | for example must be cappable to execute ```void dali2_isr()``` function in time less than 104 uS. 75 | In theory it is usable on faster MCUs but before usage you should check does your MCU is cappable to 76 | acomplish dali2_isr function call for less than 104us. 77 | 78 | 79 | The full application code, and ready to use projects can be found on our 80 | [LibStock](https://libstock.mikroe.com/projects/view/2333/dali-2-click) page. 81 | 82 | --- 83 | --- 84 | -------------------------------------------------------------------------------- /doc/doxy/footer.tex: -------------------------------------------------------------------------------- 1 | % Latex footer for doxygen 1.8.11 2 | %--- End generated contents --- 3 | 4 | % Index 5 | \backmatter 6 | \newpage 7 | \phantomsection 8 | \clearemptydoublepage 9 | \addcontentsline{toc}{chapter}{Index} 10 | \printindex 11 | 12 | \end{document} 13 | -------------------------------------------------------------------------------- /doc/doxy/footer_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /doc/doxy/header.tex: -------------------------------------------------------------------------------- 1 | % Latex header for doxygen 1.8.11 2 | \documentclass[twoside]{book} 3 | 4 | % Packages required by doxygen 5 | \usepackage{fixltx2e} 6 | \usepackage{calc} 7 | \usepackage{doxygen} 8 | \usepackage[export]{adjustbox} % also loads graphicx 9 | \usepackage{graphicx} 10 | \usepackage[utf8]{inputenc} 11 | \usepackage{makeidx} 12 | \usepackage{multicol} 13 | \usepackage{multirow} 14 | \PassOptionsToPackage{warn}{textcomp} 15 | \usepackage{textcomp} 16 | \usepackage[nointegrals]{wasysym} 17 | \usepackage[table]{xcolor} 18 | 19 | % Font selection 20 | \usepackage[T1]{fontenc} 21 | \usepackage[scaled=.90]{helvet} 22 | \usepackage{courier} 23 | \usepackage{amssymb} 24 | \usepackage{sectsty} 25 | \renewcommand{\familydefault}{\sfdefault} 26 | \allsectionsfont{% 27 | \fontseries{bc}\selectfont% 28 | \color{darkgray}% 29 | } 30 | \renewcommand{\DoxyLabelFont}{% 31 | \fontseries{bc}\selectfont% 32 | \color{darkgray}% 33 | } 34 | \newcommand{\+}{\discretionary{\mbox{\scriptsize$\hookleftarrow$}}{}{}} 35 | 36 | % Page & text layout 37 | \usepackage{geometry} 38 | \geometry{% 39 | a4paper,% 40 | top=2.5cm,% 41 | bottom=2.5cm,% 42 | left=2.5cm,% 43 | right=2.5cm% 44 | } 45 | \tolerance=750 46 | \hfuzz=15pt 47 | \hbadness=750 48 | \setlength{\emergencystretch}{15pt} 49 | \setlength{\parindent}{0cm} 50 | \setlength{\parskip}{3ex plus 2ex minus 2ex} 51 | \makeatletter 52 | \renewcommand{\paragraph}{% 53 | \@startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{% 54 | \normalfont\normalsize\bfseries\SS@parafont% 55 | }% 56 | } 57 | \renewcommand{\subparagraph}{% 58 | \@startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{% 59 | \normalfont\normalsize\bfseries\SS@subparafont% 60 | }% 61 | } 62 | \makeatother 63 | 64 | % Headers & footers 65 | \usepackage{fancyhdr} 66 | \pagestyle{fancyplain} 67 | \fancyhead[LE]{\fancyplain{}{\bfseries\thepage}} 68 | \fancyhead[CE]{\fancyplain{}{}} 69 | \fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}} 70 | \fancyhead[LO]{\fancyplain{}{\bfseries\rightmark}} 71 | \fancyhead[CO]{\fancyplain{}{}} 72 | \fancyhead[RO]{\fancyplain{}{\bfseries\thepage}} 73 | \fancyfoot[LE]{\fancyplain{}{}} 74 | \fancyfoot[CE]{\fancyplain{}{}} 75 | \fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize MikroElektronika 2016 }} 76 | \fancyfoot[LO]{\fancyplain{}{\bfseries\scriptsize MikroElektronika 2016 }} 77 | \fancyfoot[CO]{\fancyplain{}{}} 78 | \fancyfoot[RO]{\fancyplain{}{}} 79 | \renewcommand{\footrulewidth}{0.4pt} 80 | \renewcommand{\chaptermark}[1]{% 81 | \markboth{#1}{}% 82 | } 83 | \renewcommand{\sectionmark}[1]{% 84 | \markright{\thesection\ #1}% 85 | } 86 | 87 | % Indices & bibliography 88 | \usepackage{natbib} 89 | \usepackage[titles]{tocloft} 90 | \setcounter{tocdepth}{3} 91 | \setcounter{secnumdepth}{5} 92 | \makeindex 93 | 94 | % Hyperlinks (required, but should be loaded last) 95 | \usepackage{ifpdf} 96 | \ifpdf 97 | \usepackage[pdftex,pagebackref=true]{hyperref} 98 | \else 99 | \usepackage[ps2pdf,pagebackref=true]{hyperref} 100 | \fi 101 | \hypersetup{% 102 | colorlinks=true,% 103 | linkcolor=red,% 104 | citecolor=red,% 105 | unicode% 106 | } 107 | 108 | % Custom commands 109 | \newcommand{\clearemptydoublepage}{% 110 | \newpage{\pagestyle{empty}\cleardoublepage}% 111 | } 112 | 113 | \usepackage{caption} 114 | \captionsetup{labelsep=space,justification=centering,font={bf},singlelinecheck=off,skip=4pt,position=top} 115 | 116 | %===== C O N T E N T S ===== 117 | 118 | \begin{document} 119 | 120 | % Titlepage & ToC 121 | \hypersetup{pageanchor=false, 122 | bookmarksnumbered=true, 123 | pdfencoding=unicode 124 | } 125 | \pagenumbering{roman} 126 | \begin{titlepage} 127 | \begin{figure} 128 | \end{figure} 129 | \vspace*{4cm} 130 | \begin{center}% 131 | {\Huge NFC Tag 2 click }\\ 132 | \vspace*{1cm} 133 | {\large MikroElektronika 2016 }\\ 134 | \vspace{4cm} 135 | \end{center} 136 | \end{titlepage} 137 | \clearemptydoublepage 138 | \tableofcontents 139 | \clearemptydoublepage 140 | \pagenumbering{arabic} 141 | \hypersetup{pageanchor=true} 142 | 143 | %--- Begin generated contents --- 144 | -------------------------------------------------------------------------------- /doc/doxy/header_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | $projectname: $title 10 | $title 11 | 12 | 13 | 14 | $treeview 15 | $search 16 | $mathjax 17 | 18 | $extrastylesheet 19 | 20 | 21 |
22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
33 |
$projectname 34 |  $projectnumber 35 |
36 |
$projectbrief
37 |
42 |
$projectbrief
43 |
$searchbox
54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2_CEC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CEC1702 5 | 6 | 3 7 | 8 | $40080108:$01E0 9 | 10 | 11 | $40080104:$0001 12 | 13 | 14 | $4000A408:$0000 15 | 16 | 17 | 18 | 0 19 | 0 20 | 21 | -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2_CEC.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration CEC : 8 | ' 9 | ' MCU : CEC1702 10 | ' Dev. Board : Clicker 2 for CEC1702 11 | ' ARM Compiler ver : v6.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_CEC 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2_CEC.mbpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=CEC1702 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_CEC.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_CEC_M4 22 | File4=clicker_2_CEC1702 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2_config.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_config 2 | 3 | include Click_DALI_2_types 4 | 5 | end. -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | end sub 18 | 19 | sub procedure Timer_interrupt() 20 | 21 | dali2_isr() 22 | 23 | end sub 24 | 25 | end. -------------------------------------------------------------------------------- /example/basic/ARM/CEC/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/ARM/KINETIS/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/ARM/KINETIS/Click_DALI_2_KINETIS.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MK64FN1M0XXX12 5 | 6 | 22 7 | 8 | $40065000:$0000 9 | 10 | 11 | $40047000:$C0000 12 | 13 | 14 | $40048004:$10000 15 | 16 | 17 | $40048044:$1140000 18 | 19 | 20 | $40064000:$0022 21 | 22 | 23 | $40064001:$0024 24 | 25 | 26 | $40064003:$0000 27 | 28 | 29 | $40064004:$0002 30 | 31 | 32 | $40064005:$0046 33 | 34 | 35 | $40064008:$0000 36 | 37 | 38 | $4006400C:$0000 39 | 40 | 41 | $40048048:$0000 42 | 43 | 44 | $40052000:$0000 45 | 46 | 47 | $020000:$0007 48 | 49 | 50 | $000408:$00FF 51 | 52 | 53 | $000409:$00FF 54 | 55 | 56 | $00040A:$00FF 57 | 58 | 59 | $00040B:$00FF 60 | 61 | 62 | $00040C:$0002 63 | 64 | 65 | $00040D:$00FD 66 | 67 | 68 | $00040E:$00FF 69 | 70 | 71 | $00040F:$00FF 72 | 73 | 74 | 75 | 0 76 | 0 77 | 78 | -------------------------------------------------------------------------------- /example/basic/ARM/KINETIS/Click_DALI_2_KINETIS.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration KINETIS : 8 | ' 9 | ' MCU : MK64 10 | ' Dev. Board : HEXIWEAR 11 | ' ARM Compiler ver : v6.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_KINETIS 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/ARM/KINETIS/Click_DALI_2_KINETIS.mbpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MK64FN1M0XXX12 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_KINETIS.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_MK_M4 22 | File4=docking_station_HEXIWEAR 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/basic/ARM/KINETIS/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | SIM_SCGC6 = SIM_SCGC6 or (1 << PIT) 18 | NVIC_IntEnable(IVT_INT_PIT0) 19 | PIT_MCR = 0x00 20 | PIT_LDVAL0 = 12479 21 | PIT_TCTRL0 = PIT_TCTRL0 or 2 22 | PIT_TCTRL0 = PIT_TCTRL0 or 1 23 | EnableInterrupts() 24 | 25 | end sub 26 | 27 | sub procedure Timer_interrupt() iv IVT_INT_PIT0 28 | 29 | dali2_isr() 30 | PIT_TFLG0.TIF = 1 31 | 32 | end sub 33 | 34 | end. -------------------------------------------------------------------------------- /example/basic/ARM/KINETIS/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/ARM/MSP/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/ARM/MSP/Click_DALI_2_MSP.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MSP432P401R 5 | 6 | 5 7 | 8 | $40010404:$50000 9 | 10 | 11 | $40010408:$0033 12 | 13 | 14 | $4001040C:$10003 15 | 16 | 17 | $4000480C:$0084 18 | 19 | 20 | $40011010:$1000 21 | 22 | 23 | 24 | 0 25 | 26 | -------------------------------------------------------------------------------- /example/basic/ARM/MSP/Click_DALI_2_MSP.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration MSP : 8 | ' 9 | ' MCU : MSP432 10 | ' Dev. Board : Clicker 2 for MSP432 11 | ' ARM Compiler ver : v6.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_MSP 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/ARM/MSP/Click_DALI_2_MSP.mbpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MSP432P401R 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_MSP.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_MSP_M4 22 | File4=clicker_2_MSP432 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/basic/ARM/MSP/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | TIMER32_T32CONTROL1 = (TIMER32_T32CONTROL1 and 0xFFFFFFFE) 18 | TIMER32_T32CONTROL1 = (TIMER32_T32CONTROL1 or 0x02) 19 | TIMER32_T32CONTROL1 = (TIMER32_T32CONTROL1 or 0) 20 | TIMER32_T32CONTROL1 = (TIMER32_T32CONTROL1 or 0x20) 21 | TIMER32_T32CONTROL1 = (TIMER32_T32CONTROL1 or 0x40) 22 | TIMER32_T32LOAD1 = 0x0000BB80 23 | NVIC_IntEnable(IVT_INT_T32_INT1) 24 | ' IVT_INT_T32_INT1TIMER32_T32CONTROL1 = (IVT_INT_T32_INT1TIMER32_T32CONTROL1 or 0x80) 25 | EnableInterrupts() 26 | 27 | end sub 28 | 29 | sub procedure Timer_interrupt() iv IVT_INT_T32_INT1 30 | 31 | dali2_isr() 32 | TIMER32_T32INTCLR1 = 1 33 | 34 | end sub 35 | 36 | end. -------------------------------------------------------------------------------- /example/basic/ARM/MSP/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/ARM/STM/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/ARM/STM/Click_DALI_2_STM.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | STM32F107VC 5 | 6 | 3 7 | 8 | $400FE060:$5010081 9 | 10 | 11 | $40021004:$1D8402 12 | 13 | 14 | $400FE060:$10644 15 | 16 | 17 | 18 | 0 19 | 20 | -------------------------------------------------------------------------------- /example/basic/ARM/STM/Click_DALI_2_STM.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration STM32 : 8 | ' 9 | ' MCU : STM32F107VCT6 10 | ' Dev. Board : EasyMx PRO v7 for STM32 11 | ' ARM Compiler ver : v6.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_STM 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/ARM/STM/Click_DALI_2_STM.mbpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=STM32F107VC 3 | Clock=72000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_STM.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_STM32_M3 22 | File4=easymx_v7_STM32F107VC 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/basic/ARM/STM/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | RCC_APB1ENR.TIM2EN = 1 18 | TIM2_CR1.CEN = 0 19 | TIM2_PSC = 0 20 | TIM2_ARR = 7487 21 | NVIC_IntEnable(IVT_INT_TIM2) 22 | TIM2_DIER.UIE = 1 23 | TIM2_CR1.CEN = 1 24 | 25 | end sub 26 | 27 | sub procedure Timer_interrupt() iv IVT_INT_TIM2 28 | 29 | dali2_isr() 30 | TIM2_SR.UIF = 0 31 | 32 | end sub 33 | 34 | end. -------------------------------------------------------------------------------- /example/basic/ARM/STM/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/ARM/TIVA/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/ARM/TIVA/Click_DALI_2_TIVA.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TM4C129XNCZAD 5 | 6 | 4 7 | 8 | $400FE0B0:$33300004 9 | 10 | 11 | $400FE07C:$0011 12 | 13 | 14 | $400FE160:$800018 15 | 16 | 17 | $400FE164:$0000 18 | 19 | 20 | 21 | 0 22 | 23 | -------------------------------------------------------------------------------- /example/basic/ARM/TIVA/Click_DALI_2_TIVA.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration TIVA : 8 | ' 9 | ' MCU : TM4C129XNCZAD 10 | ' Dev. Board : EasyMx PRO v7 for TIVA ARM 11 | ' ARM Compiler ver : v6.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_TIVA 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/ARM/TIVA/Click_DALI_2_TIVA.mbpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=TM4C129XNCZAD 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_TIVA.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_TIVA_M4 22 | File4=easymx_v7_TM4C129XNCZAD 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/basic/ARM/TIVA/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | SYSCTL_RCGCTIMER_R0_bit = 1 18 | EnableInterrupts() 19 | TIMER_CTL_TAEN_bit = 0 20 | TIMER0_CFG = 4 21 | TIMER0_TAMR = TIMER0_TAMR or 2 22 | TIMER0_TAPR = 0 23 | TIMER0_TAILR = 12480 24 | NVIC_IntEnable(IVT_INT_TIMER0A_16_32_bit) 25 | TIMER_IMR_TATOIM_bit = 1 26 | TIMER_CTL_TAEN_bit = 1 27 | 28 | end sub 29 | 30 | sub procedure Timer_interrupt() iv IVT_INT_TIMER0A_16_32_bit 31 | 32 | dali2_isr() 33 | TIMER_ICR_TATOCINT_bit = 1 34 | 35 | end sub 36 | 37 | end. -------------------------------------------------------------------------------- /example/basic/ARM/TIVA/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/AVR/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/AVR/Click_DALI_2_AVR.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration AVR : 8 | ' 9 | ' MCU : ATMEGA32 10 | ' Dev. Board : EasyAVR v7 11 | ' AVR Compiler ver : v7.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_AVR 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/AVR/Click_DALI_2_AVR.mbpav.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=ATMEGA32 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_AVR.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_AVR_LT 22 | File4=easyavr_v7_ATMEGA32 23 | File5=//SPI 24 | File6=//TWI 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/basic/AVR/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | SREG_I_bit = 1 18 | TCCR1A = 0x80 19 | TCCR1B = 0x09 20 | OCR1AH = 0x03 21 | OCR1AL = 0x3F 22 | OCIE1A_bit = 1 23 | 24 | end sub 25 | 26 | sub procedure Timer_interrupt() org IVT_ADDR_TIMER1_COMPA 27 | 28 | dali2_isr() 29 | 30 | end sub 31 | 32 | end. -------------------------------------------------------------------------------- /example/basic/AVR/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/DSPIC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/DSPIC/Click_DALI_2_DSPIC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P33FJ256GP710A 5 | 6 | 8 7 | 8 | $F80000:$00CF 9 | 10 | 11 | $F80002:$00CF 12 | 13 | 14 | $F80004:$0007 15 | 16 | 17 | $F80006:$00A2 18 | 19 | 20 | $F80008:$0085 21 | 22 | 23 | $F8000A:$007F 24 | 25 | 26 | $F8000C:$00E7 27 | 28 | 29 | $F8000E:$00C1 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/basic/DSPIC/Click_DALI_2_DSPIC.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration dsPIC : 8 | ' 9 | ' MCU : P33FJ256GP710A 10 | ' Dev. Board : EasyPIC Fusion v7 11 | ' dsPIC Compiler ver : v7.0.1.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_DSPIC 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/DSPIC/Click_DALI_2_DSPIC.mbpds.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P33FJ256GP710A 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_DSPIC.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_DSPIC 22 | File4=easypicfusion_v7_P33FJ256GP710A 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/basic/DSPIC/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | T1CON = 0x8000 18 | T1IE_bit = 1 19 | T1IF_bit = 0 20 | IPC0 = IPC0 or 0x1000 21 | PR1 = 416 22 | 23 | end sub 24 | 25 | sub procedure Timer_interrupt() iv IVT_ADDR_T1INTERRUPT 26 | 27 | dali2_isr() 28 | T1IF_bit = 0 29 | 30 | end sub 31 | 32 | end. -------------------------------------------------------------------------------- /example/basic/DSPIC/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/FT90x/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/FT90x/Click_DALI_2_FT90x.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration FT90x : 8 | ' 9 | ' MCU : FT900 10 | ' Dev. Board : EasyFT90x v7 11 | ' FT90x Compiler ver : v2.2.1.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_FT90x 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/FT90x/Click_DALI_2_FT90x.mbpf9.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=FT900 3 | Clock=100000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_FT90x.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_FT90x 22 | File4=easyft90x_v7_FT900 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/basic/FT90x/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | TIMER_CONTROL_0 = 2 18 | TIMER_SELECT = 0 19 | TIMER_PRESC_LS = 0 20 | TIMER_PRESC_MS = 0 21 | TIMER_WRITE_LS = 159 22 | TIMER_WRITE_MS = 40 23 | TIMER_CONTROL_3 = 0 24 | TIMER_CONTROL_4 = TIMER_CONTROL_4 or 17 25 | TIMER_CONTROL_2 = TIMER_CONTROL_2 or 0 26 | TIMER_INT = TIMER_INT or 2 27 | TIMER_CONTROL_1 = TIMER_CONTROL_1 or 1 28 | IRQ_CTRL = (IRQ_CTRL and not uint32_t((1 << GLOBAL_INTERRUPT_MASK))) 29 | 30 | end sub 31 | 32 | sub procedure Timer_interrupt() iv IVT_TIMERS_IRQ 33 | 34 | if (TIMER_INT_A_bit) then 35 | TIMER_INT = ((TIMER_INT and 0xAA) or (1 << 0)) 36 | end if 37 | dali2_isr() 38 | 39 | end sub 40 | 41 | end. -------------------------------------------------------------------------------- /example/basic/FT90x/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/PIC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/PIC/Click_DALI_2_PIC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P18F87K22 5 | 6 | 13 7 | 8 | $300000:$0015 9 | 10 | 11 | $300001:$0013 12 | 13 | 14 | $300002:$007F 15 | 16 | 17 | $300003:$007C 18 | 19 | 20 | $300004:$00F9 21 | 22 | 23 | $300005:$008B 24 | 25 | 26 | $300006:$0091 27 | 28 | 29 | $300008:$00FF 30 | 31 | 32 | $300009:$00C0 33 | 34 | 35 | $30000A:$00FF 36 | 37 | 38 | $30000B:$00E0 39 | 40 | 41 | $30000C:$00FF 42 | 43 | 44 | $30000D:$0040 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /example/basic/PIC/Click_DALI_2_PIC.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration PIC : 8 | ' 9 | ' MCU : P18F87K22 10 | ' Dev. Board : EasyPIC PRO v7 11 | ' PIC Compiler ver : v7.1.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_PIC 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/PIC/Click_DALI_2_PIC.mbppi.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P18F87K22 3 | Clock=64000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_PIC.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_P18 22 | File4=easypicpro_v7_P18F87K22 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/basic/PIC/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | T0CON = 0xC2 18 | TMR0L = 0x30 19 | GIE_bit = 1 20 | TMR0IE_bit = 1 21 | 22 | end sub 23 | 24 | sub procedure Interrupt() 25 | 26 | if ((TMR1IF_bit <> 0)) then 27 | dali2_isr() 28 | TMR1IF_bit = 0 29 | TMR1L = 0x30 30 | end if 31 | 32 | end sub 33 | 34 | end. -------------------------------------------------------------------------------- /example/basic/PIC/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/basic/PIC32/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/basic/PIC32/Click_DALI_2_PIC32.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P32MX795F512L 5 | 6 | 4 7 | 8 | $1FC02FF0:$C7070000 9 | 10 | 11 | $1FC02FF4:$0151 12 | 13 | 14 | $1FC02FF8:$14C503 15 | 16 | 17 | $1FC02FFC:$110FF00F 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /example/basic/PIC32/Click_DALI_2_PIC32.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | 'Example for DALI_2 Click 3 | ' 4 | ' Date : Feb 2018. 5 | ' Author : MikroE Team 6 | ' 7 | 'Test configuration PIC32 : 8 | ' 9 | ' MCU : P32MX795F512L 10 | ' Dev. Board : EasyPIC Fusion v7 11 | ' PIC32 Compiler ver : v4.0.0.0 12 | ' 13 | '--- 14 | ' 15 | 'Description : 16 | ' 17 | 'The application is composed of three sections : 18 | ' 19 | '- System Initialization - Initializes GPIO pins for TX and RX 20 | '- Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | '- Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | 'light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | 'half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | ' 25 | '**Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | ' 27 | ' 28 | program Click_DALI_2_PIC32 29 | 30 | include Click_DALI_2_types 31 | include Click_DALI_2_config 32 | include Click_DALI_2_timer 33 | 34 | dim 35 | current_state as uint8_t 36 | 37 | sub procedure systemInit() 38 | 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT) 40 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT) 41 | 42 | end sub 43 | 44 | sub procedure applicationInit() 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)) 47 | dali2_masterInit() 48 | dali2_configTimer() 49 | 50 | end sub 51 | 52 | sub procedure applicationTask() 53 | dim 54 | counter as uint8_t 55 | 56 | for counter = 0 to 2-1 57 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 58 | Delay_ms(1000) 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 60 | Delay_ms(1000) 61 | next counter 62 | for counter = 0 to 8-1 63 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 64 | Delay_ms(500) 65 | next counter 66 | for counter = 0 to 8-1 67 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND) 68 | Delay_ms(500) 69 | next counter 70 | current_state = dali2_masterStatus() 71 | 72 | end sub 73 | 74 | main : 75 | 76 | systemInit() 77 | applicationInit() 78 | while (1) 79 | applicationTask() 80 | wend 81 | 82 | end. -------------------------------------------------------------------------------- /example/basic/PIC32/Click_DALI_2_PIC32.mbp32.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P32MX795F512L 3 | Clock=80000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_PIC32.mbas 9 | File1=Click_DALI_2_config.mbas 10 | File2=Click_DALI_2_types.mbas 11 | File3=Click_DALI_2_timer.mbas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_P32MX 22 | File4=easypicfusion_v7_P32MX795F512L 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/basic/PIC32/Click_DALI_2_timer.mbas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Use mikroE Timer Calculator to generate proper timer configuration 3 | ' and timer ISR. 4 | ' 5 | ' https://www.mikroe.com/timer-calculator 6 | ' 7 | module Click_DALI_2_timer 8 | 9 | include Click_DALI_2_types 10 | 11 | sub procedure dali2_configTimer() 12 | 13 | implements 14 | 15 | sub procedure dali2_configTimer() 16 | 17 | T1CON = 0x8000 18 | T1IP0_bit = 1 19 | T1IP1_bit = 1 20 | T1IP2_bit = 1 21 | T1IF_bit = 0 22 | T1IE_bit = 1 23 | PR1 = 8320 24 | TMR1 = 0 25 | EnableInterrupts() 26 | 27 | end sub 28 | 29 | sub procedure Timer_interrupt() iv IVT_TIMER_1 ilevel 7 ics ICS_SRS 30 | 31 | dali2_isr() 32 | T1IF_bit = 0 33 | 34 | end sub 35 | 36 | end. -------------------------------------------------------------------------------- /example/basic/PIC32/Click_DALI_2_types.mbas: -------------------------------------------------------------------------------- 1 | module Click_DALI_2_types 2 | 3 | typedef uint8_t as byte 4 | typedef int8_t as short 5 | typedef uint16_t as word 6 | typedef int16_t as integer 7 | typedef uint32_t as longword 8 | typedef int32_t as longint 9 | 10 | typedef T_DALI2_P as ^const uint8_t 11 | 12 | end. -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_CEC.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration CEC : 8 | 9 | MCU : CEC1702 10 | Dev. Board : Clicker 2 for CEC1702 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_CEC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CEC1702 5 | 6 | 3 7 | 8 | $40080108:$01E0 9 | 10 | 11 | $40080104:$0001 12 | 13 | 14 | $4000A408:$0000 15 | 16 | 17 | 18 | 0 19 | 0 20 | 21 | -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_CEC.mcpar: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=CEC1702 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_CEC.c 9 | File1=..\..\..\..\library\__dali2_driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\..\library\ 16 | Path1=..\..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_CEC.mcpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=CEC1702 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_CEC.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_CEC_M4 22 | File4=clicker_2_CEC1702 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | 4 | -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_confgTimer() 14 | { 15 | // Configure Timer 16 | } 17 | 18 | static void Timer_interrupt() 19 | { 20 | dali2_isr(); 21 | // Reset Flag 22 | } -------------------------------------------------------------------------------- /example/c/ARM/CEC/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_KINETIS.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration KINETIS : 8 | 9 | MCU : MK64 10 | Dev. Board : HEXIWEAR 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_KINETIS.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MK64FN1M0XXX12 5 | 6 | 22 7 | 8 | $40065000:$0000 9 | 10 | 11 | $40047000:$C0000 12 | 13 | 14 | $40048004:$10000 15 | 16 | 17 | $40048044:$1140000 18 | 19 | 20 | $40064000:$0022 21 | 22 | 23 | $40064001:$0024 24 | 25 | 26 | $40064003:$0000 27 | 28 | 29 | $40064004:$0002 30 | 31 | 32 | $40064005:$0046 33 | 34 | 35 | $40064008:$0000 36 | 37 | 38 | $4006400C:$0000 39 | 40 | 41 | $40048048:$0000 42 | 43 | 44 | $40052000:$0000 45 | 46 | 47 | $020000:$0007 48 | 49 | 50 | $000408:$00FF 51 | 52 | 53 | $000409:$00FF 54 | 55 | 56 | $00040A:$00FF 57 | 58 | 59 | $00040B:$00FF 60 | 61 | 62 | $00040C:$0002 63 | 64 | 65 | $00040D:$00FD 66 | 67 | 68 | $00040E:$00FF 69 | 70 | 71 | $00040F:$00FF 72 | 73 | 74 | 75 | 0 76 | 0 77 | 78 | -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_KINETIS.mcpar: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MK64FN1M0XXX12 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_KINETIS.c 9 | File1=..\..\..\..\library\__dali2_driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\..\library\ 16 | Path1=..\..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_KINETIS.mcpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MK64FN1M0XXX12 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_KINETIS.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_MK_M4 22 | File4=docking_station_HEXIWEAR 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 2 ] = 5 | { 6 | 1000000, 7 | _SPI_CFG_CLK_PHASE_CAPT_LEADING | 8 | _SPI_CFG_CLK_IDLE_LOW | 9 | _SPI_CFG_MASTER | 10 | _SPI_CFG_MSB_FIRST | 11 | _SPI_CFG_FRAME_SIZE_8BITS | 12 | _SPI_CFG_SELECT_CTAR0 13 | }; 14 | #endif 15 | 16 | #ifdef ENABLE_I2C 17 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 18 | { 19 | 100000 20 | }; 21 | #endif 22 | 23 | #ifdef ENABLE_UART 24 | const uint32_t _DALI2_UART_CFG [ 4 ] = 25 | { 26 | 9600, 27 | _UART_8_BIT_DATA, 28 | _UART_NOPARITY, 29 | _UART_ONE_STOPBIT 30 | }; 31 | #endif 32 | -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_confgTimer() 14 | { 15 | SIM_SCGC6 |= (1 << PIT); 16 | NVIC_IntEnable(IVT_INT_PIT0); 17 | PIT_MCR = 0x00; 18 | PIT_LDVAL0 = 6239; 19 | PIT_TCTRL0 |= 2; 20 | PIT_TCTRL0 |= 1; 21 | } 22 | 23 | void Timer_interrupt() iv IVT_INT_PIT0 24 | { 25 | dali2_isr(); 26 | PIT_TFLG0.TIF = 1; 27 | } -------------------------------------------------------------------------------- /example/c/ARM/KINETIS/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_MSP.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration MSP : 8 | 9 | MCU : MSP432 10 | Dev. Board : Clicker 2 for MSP432 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_MSP.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MSP432P401R 5 | 6 | 5 7 | 8 | $40010404:$50000 9 | 10 | 11 | $40010408:$0033 12 | 13 | 14 | $4001040C:$10003 15 | 16 | 17 | $4000480C:$0084 18 | 19 | 20 | $40011010:$1000 21 | 22 | 23 | 24 | 0 25 | 26 | -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_MSP.mcpar: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MSP432P401R 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_MSP.c 9 | File1=..\..\..\..\library\__dali2_driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\..\library\ 16 | Path1=..\..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_MSP.mcpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MSP432P401R 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_MSP.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_MSP_M4 22 | File4=clicker_2_MSP432 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 7 ] = 5 | { 6 | _SPI_MASTER, 7 | 64, 8 | _SPI_CLOCKSOURCE_SMCLK, 9 | _SPI_MSB_FIRST, 10 | _SPI_PHASE_DATA_CHANGE_FIRST_CAPTURE_NEXT, 11 | _SPI_CLK_IDLE_HIGH, 12 | _SPI_3PIN 13 | }; 14 | #endif 15 | 16 | #ifdef ENABLE_I2C 17 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 18 | { 19 | 100000 20 | }; 21 | #endif 22 | 23 | #ifdef ENABLE_UART 24 | const uint32_t _DALI2_UART_CFG[ 1 ] = 25 | { 26 | 9600 27 | }; 28 | #endif 29 | -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | TIMER32_T32CONTROL1 &= 0xFFFFFFFE; 16 | TIMER32_T32CONTROL1 |= 0x02; 17 | TIMER32_T32CONTROL1 |= 0; 18 | TIMER32_T32CONTROL1 |= 0x20; 19 | TIMER32_T32CONTROL1 |= 0x40; 20 | TIMER32_T32LOAD1 = 0x0000BB80; 21 | NVIC_IntEnable(IVT_INT_T32_INT1); 22 | // IVT_INT_T32_INT1TIMER32_T32CONTROL1 |= 0x80; 23 | EnableInterrupts(); 24 | } 25 | 26 | void Timer_interrupt() iv IVT_INT_T32_INT1 27 | { 28 | dali2_isr(); 29 | TIMER32_T32INTCLR1 = 1; 30 | } -------------------------------------------------------------------------------- /example/c/ARM/MSP/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2.pld.ini: -------------------------------------------------------------------------------- 1 | [Position] 2 | Line=1 3 | Column=1 4 | [FoldedLines] 5 | Count=0 6 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.asm: -------------------------------------------------------------------------------- 1 | Click_DALI_2_STM_dali2_configTimer: 2 | ;click_dali_2_timer.h,15 :: static void dali2_configTimer() 3 | SUB SP, SP, #4 4 | STR LR, [SP, #0] 5 | ;click_dali_2_timer.h,17 :: RCC_APB1ENR.TIM2EN = 1; 6 | MOVS R1, #1 7 | SXTB R1, R1 8 | MOVW R0, #lo_addr(RCC_APB1ENR+0) 9 | MOVT R0, #hi_addr(RCC_APB1ENR+0) 10 | _SX [R0, ByteOffset(RCC_APB1ENR+0)] 11 | ;click_dali_2_timer.h,18 :: TIM2_CR1.CEN = 0; 12 | MOVS R1, #0 13 | SXTB R1, R1 14 | MOVW R0, #lo_addr(TIM2_CR1+0) 15 | MOVT R0, #hi_addr(TIM2_CR1+0) 16 | _SX [R0, ByteOffset(TIM2_CR1+0)] 17 | ;click_dali_2_timer.h,19 :: TIM2_PSC = 0; 18 | MOVS R1, #0 19 | MOVW R0, #lo_addr(TIM2_PSC+0) 20 | MOVT R0, #hi_addr(TIM2_PSC+0) 21 | STR R1, [R0, #0] 22 | ;click_dali_2_timer.h,20 :: TIM2_ARR = 7487; 23 | MOVW R1, #7487 24 | MOVW R0, #lo_addr(TIM2_ARR+0) 25 | MOVT R0, #hi_addr(TIM2_ARR+0) 26 | STR R1, [R0, #0] 27 | ;click_dali_2_timer.h,21 :: NVIC_IntEnable(IVT_INT_TIM2); 28 | MOVW R0, #44 29 | BL _NVIC_IntEnable+0 30 | ;click_dali_2_timer.h,22 :: TIM2_DIER.UIE = 1; 31 | MOVS R1, #1 32 | SXTB R1, R1 33 | MOVW R0, #lo_addr(TIM2_DIER+0) 34 | MOVT R0, #hi_addr(TIM2_DIER+0) 35 | _SX [R0, ByteOffset(TIM2_DIER+0)] 36 | ;click_dali_2_timer.h,23 :: TIM2_CR1.CEN = 1; 37 | MOVW R0, #lo_addr(TIM2_CR1+0) 38 | MOVT R0, #hi_addr(TIM2_CR1+0) 39 | _SX [R0, ByteOffset(TIM2_CR1+0)] 40 | ;click_dali_2_timer.h,24 :: EnableInterrupts(); 41 | BL _EnableInterrupts+0 42 | ;click_dali_2_timer.h,25 :: } 43 | L_end_dali2_configTimer: 44 | LDR LR, [SP, #0] 45 | ADD SP, SP, #4 46 | BX LR 47 | ; end of Click_DALI_2_STM_dali2_configTimer 48 | _Timer_interrupt: 49 | ;click_dali_2_timer.h,27 :: void Timer_interrupt() iv IVT_INT_TIM2 50 | SUB SP, SP, #4 51 | STR LR, [SP, #0] 52 | ;click_dali_2_timer.h,29 :: dali2_isr(); 53 | BL _dali2_isr+0 54 | ;click_dali_2_timer.h,30 :: TIM2_SR.UIF = 0; 55 | MOVS R1, #0 56 | SXTB R1, R1 57 | MOVW R0, #lo_addr(TIM2_SR+0) 58 | MOVT R0, #hi_addr(TIM2_SR+0) 59 | _SX [R0, ByteOffset(TIM2_SR+0)] 60 | ;click_dali_2_timer.h,31 :: } 61 | L_end_Timer_interrupt: 62 | LDR LR, [SP, #0] 63 | ADD SP, SP, #4 64 | BX LR 65 | ; end of _Timer_interrupt 66 | _systemInit: 67 | ;Click_DALI_2_STM.c,35 :: void systemInit() 68 | SUB SP, SP, #4 69 | STR LR, [SP, #0] 70 | ;Click_DALI_2_STM.c,37 :: mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 71 | MOVS R2, #0 72 | MOVS R1, #7 73 | MOVS R0, #0 74 | BL _mikrobus_gpioInit+0 75 | ;Click_DALI_2_STM.c,38 :: mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 76 | MOVS R2, #0 77 | MOVS R1, #1 78 | MOVS R0, #0 79 | BL _mikrobus_gpioInit+0 80 | ;Click_DALI_2_STM.c,39 :: } 81 | L_end_systemInit: 82 | LDR LR, [SP, #0] 83 | ADD SP, SP, #4 84 | BX LR 85 | ; end of _systemInit 86 | _applicationInit: 87 | ;Click_DALI_2_STM.c,41 :: void applicationInit() 88 | SUB SP, SP, #4 89 | STR LR, [SP, #0] 90 | ;Click_DALI_2_STM.c,43 :: dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 91 | MOVW R0, #lo_addr(__MIKROBUS1_GPIO+0) 92 | MOVT R0, #hi_addr(__MIKROBUS1_GPIO+0) 93 | BL _dali2_gpioDriverInit+0 94 | ;Click_DALI_2_STM.c,44 :: dali2_masterInit(); 95 | BL _dali2_masterInit+0 96 | ;Click_DALI_2_STM.c,45 :: dali2_configTimer(); 97 | BL Click_DALI_2_STM_dali2_configTimer+0 98 | ;Click_DALI_2_STM.c,46 :: } 99 | L_end_applicationInit: 100 | LDR LR, [SP, #0] 101 | ADD SP, SP, #4 102 | BX LR 103 | ; end of _applicationInit 104 | _applicationTask: 105 | ;Click_DALI_2_STM.c,48 :: void applicationTask() 106 | SUB SP, SP, #8 107 | STR LR, [SP, #0] 108 | ;Click_DALI_2_STM.c,53 :: for (counter = 0; counter < 2; counter++) 109 | ; counter start address is: 4 (R1) 110 | MOVS R1, #0 111 | ; counter end address is: 4 (R1) 112 | L_applicationTask0: 113 | ; counter start address is: 4 (R1) 114 | CMP R1, #2 115 | IT CS 116 | BCS L_applicationTask1 117 | ;Click_DALI_2_STM.c,55 :: dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 118 | STRB R1, [SP, #4] 119 | MOVS R3, __DALI2_FOLLOWING_COMMAND 120 | MOVS R2, __DALI2_BROADCAST_CMD 121 | MOVS R1, __DALI2_OFF 122 | MOVS R0, __DALI2_ADDRESS01 123 | BL _dali2_sendCmd+0 124 | ;Click_DALI_2_STM.c,56 :: Delay_ms( 1000 ); 125 | MOVW R7, #6911 126 | MOVT R7, #183 127 | NOP 128 | NOP 129 | L_applicationTask3: 130 | SUBS R7, R7, #1 131 | BNE L_applicationTask3 132 | NOP 133 | NOP 134 | NOP 135 | ;Click_DALI_2_STM.c,57 :: dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 136 | MOVS R3, __DALI2_FOLLOWING_COMMAND 137 | MOVS R2, __DALI2_BROADCAST_CMD 138 | MOVS R1, __DALI2_RECALL_MAX_LEVEL 139 | MOVS R0, __DALI2_ADDRESS01 140 | BL _dali2_sendCmd+0 141 | LDRB R1, [SP, #4] 142 | ;Click_DALI_2_STM.c,58 :: Delay_ms( 1000 ); 143 | MOVW R7, #6911 144 | MOVT R7, #183 145 | NOP 146 | NOP 147 | L_applicationTask5: 148 | SUBS R7, R7, #1 149 | BNE L_applicationTask5 150 | NOP 151 | NOP 152 | NOP 153 | ;Click_DALI_2_STM.c,53 :: for (counter = 0; counter < 2; counter++) 154 | ADDS R1, R1, #1 155 | UXTB R1, R1 156 | ;Click_DALI_2_STM.c,59 :: } 157 | ; counter end address is: 4 (R1) 158 | IT AL 159 | BAL L_applicationTask0 160 | L_applicationTask1: 161 | ;Click_DALI_2_STM.c,61 :: for (counter = 0; counter < 8; counter++) 162 | ; counter start address is: 4 (R1) 163 | MOVS R1, #0 164 | ; counter end address is: 4 (R1) 165 | L_applicationTask7: 166 | ; counter start address is: 4 (R1) 167 | CMP R1, #8 168 | IT CS 169 | BCS L_applicationTask8 170 | ;Click_DALI_2_STM.c,63 :: dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 171 | STRB R1, [SP, #4] 172 | MOVS R3, __DALI2_FOLLOWING_COMMAND 173 | MOVS R2, __DALI2_BROADCAST_CMD 174 | MOVS R1, __DALI2_DOWN 175 | MOVS R0, __DALI2_ADDRESS01 176 | BL _dali2_sendCmd+0 177 | LDRB R1, [SP, #4] 178 | ;Click_DALI_2_STM.c,64 :: Delay_ms( 500 ); 179 | MOVW R7, #36223 180 | MOVT R7, #91 181 | NOP 182 | NOP 183 | L_applicationTask10: 184 | SUBS R7, R7, #1 185 | BNE L_applicationTask10 186 | NOP 187 | NOP 188 | NOP 189 | ;Click_DALI_2_STM.c,61 :: for (counter = 0; counter < 8; counter++) 190 | ADDS R1, R1, #1 191 | UXTB R1, R1 192 | ;Click_DALI_2_STM.c,65 :: } 193 | ; counter end address is: 4 (R1) 194 | IT AL 195 | BAL L_applicationTask7 196 | L_applicationTask8: 197 | ;Click_DALI_2_STM.c,67 :: for (counter = 0; counter < 8; counter++) 198 | ; counter start address is: 4 (R1) 199 | MOVS R1, #0 200 | ; counter end address is: 4 (R1) 201 | L_applicationTask12: 202 | ; counter start address is: 4 (R1) 203 | CMP R1, #8 204 | IT CS 205 | BCS L_applicationTask13 206 | ;Click_DALI_2_STM.c,69 :: dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 207 | STRB R1, [SP, #4] 208 | MOVS R3, __DALI2_FOLLOWING_COMMAND 209 | MOVS R2, __DALI2_BROADCAST_CMD 210 | MOVS R1, __DALI2_UP 211 | MOVS R0, __DALI2_ADDRESS01 212 | BL _dali2_sendCmd+0 213 | LDRB R1, [SP, #4] 214 | ;Click_DALI_2_STM.c,70 :: Delay_ms( 500 ); 215 | MOVW R7, #36223 216 | MOVT R7, #91 217 | NOP 218 | NOP 219 | L_applicationTask15: 220 | SUBS R7, R7, #1 221 | BNE L_applicationTask15 222 | NOP 223 | NOP 224 | NOP 225 | ;Click_DALI_2_STM.c,67 :: for (counter = 0; counter < 8; counter++) 226 | ADDS R1, R1, #1 227 | UXTB R1, R1 228 | ;Click_DALI_2_STM.c,71 :: } 229 | ; counter end address is: 4 (R1) 230 | IT AL 231 | BAL L_applicationTask12 232 | L_applicationTask13: 233 | ;Click_DALI_2_STM.c,73 :: current_state = dali2_masterStatus(); 234 | BL _dali2_masterStatus+0 235 | ;Click_DALI_2_STM.c,74 :: } 236 | L_end_applicationTask: 237 | LDR LR, [SP, #0] 238 | ADD SP, SP, #8 239 | BX LR 240 | ; end of _applicationTask 241 | _main: 242 | ;Click_DALI_2_STM.c,76 :: void main() 243 | ;Click_DALI_2_STM.c,78 :: systemInit(); 244 | BL _systemInit+0 245 | ;Click_DALI_2_STM.c,79 :: applicationInit(); 246 | BL _applicationInit+0 247 | ;Click_DALI_2_STM.c,81 :: while (1) 248 | L_main17: 249 | ;Click_DALI_2_STM.c,83 :: applicationTask(); 250 | BL _applicationTask+0 251 | ;Click_DALI_2_STM.c,84 :: } 252 | IT AL 253 | BAL L_main17 254 | ;Click_DALI_2_STM.c,85 :: } 255 | L_end_main: 256 | L__main_end_loop: 257 | B L__main_end_loop 258 | ; end of _main 259 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/example/c/ARM/STM/Click_DALI_2_STM.bin -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.bmk: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.brk: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration STM32 : 8 | 9 | MCU : STM32F107VCT6 10 | Dev. Board : EasyMx PRO v7 for STM32 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.c.ini: -------------------------------------------------------------------------------- 1 | [Position] 2 | Line=16 3 | Column=78 4 | [FoldedLines] 5 | Count=0 6 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | STM32F107VC 5 | 6 | 3 7 | 8 | $400FE060:$5010081 9 | 10 | 11 | $40021004:$1D8402 12 | 13 | 14 | $400FE060:$10644 15 | 16 | 17 | 18 | 0 19 | 0 20 | 0 21 | 22 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.dbg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/example/c/ARM/STM/Click_DALI_2_STM.dbg -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.dlt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/example/c/ARM/STM/Click_DALI_2_STM.dlt -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.emcl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/example/c/ARM/STM/Click_DALI_2_STM.emcl -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.log: -------------------------------------------------------------------------------- 1 | 0 1 mikroCARM.exe -MSF -DBG -pSTM32F107VC -BIN -LHF -C -DL -SSA -O11111114 -fo72 -N"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\example\c\ARM\STM\Click_DALI_2_STM.mcpar" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Defs\" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M3\" -SP"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\example\c\ARM\STM\" -SP"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\library\HAL\" -SP"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\library\" -SP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Packages\mikroBUS Board Definition API\Uses\" -IP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M3\" -IP"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\example\c\ARM\STM\" -IP"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\library\" -IP"E:\git\click-boards\DALI_2_click\SW\mikroSDK_ver\library\HAL\" -IP"C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Packages\mikroBUS Board Definition API\Uses\" "Click_DALI_2_STM.c" "__dali2_driver.c" "__Lib_Math.emcl" "__Lib_MathDouble.emcl" "__Lib_Delays.emcl" "__Lib_System_105_107.emcl" "__Lib_GPIO_32F10x_Defs.emcl" "__Lib_GPIO_32F10x.emcl" "__Lib_Button.emcl" "__Lib_UART_123_45.emcl" "easymx_v7_STM32F107VC.emcl" "Click_DALI_2.pld" 2 | diagnostics: 0 122 Compilation Started stdint.h 3 | hint: 0 1004 interrupt handler (Timer_interrupt at 0x002C) click_dali_2_timer.h 4 | diagnostics: 85 123 Compiled Successfully Click_DALI_2_STM.c 5 | hint: 51 1164 Variable 'current_state' has been eliminated by optimizer Click_DALI_2_STM.c 6 | diagnostics: 0 122 Compilation Started stdint.h 7 | hint: 458 1163 Variable 'pulsePosition' has been declared, but not used __dali2_driver.c 8 | hint: 811 1163 Variable 'i' has been declared, but not used __dali2_driver.c 9 | hint: 893 1163 Variable 'pulsePosition' has been declared, but not used __dali2_driver.c 10 | diagnostics: 973 123 Compiled Successfully __dali2_driver.c 11 | hint: 323 1164 Variable 'tmp' has been eliminated by optimizer __dali2_driver.c 12 | hint: 487 1164 Variable 'pulsePosition' has been eliminated by optimizer __dali2_driver.c 13 | hint: 547 1164 Variable 'loc' has been eliminated by optimizer __dali2_driver.c 14 | hint: 548 1164 Variable 'val' has been eliminated by optimizer __dali2_driver.c 15 | hint: 558 1164 Variable 'loc' has been eliminated by optimizer __dali2_driver.c 16 | hint: 717 1164 Variable 'tmp' has been eliminated by optimizer __dali2_driver.c 17 | diagnostics: 0 127 All files Compiled in 250 ms 18 | hint: 0 1144 Used RX: 16 (100%) Free RX: 0 (0%) Used RX: 16 (100%) Free RX: 0 (0%) 19 | hint: 0 1144 Static RAM (bytes): 209 Dynamic RAM (bytes): 65324 Static RAM (bytes): 209 Dynamic RAM (bytes): 65324 20 | hint: 0 1144 Used ROM (bytes): 5506 (2%) Free ROM (bytes): 256638 (98%) Used ROM (bytes): 5506 (2%) Free ROM (bytes): 256638 (98%) 21 | diagnostics: 0 125 Project Linked Successfully Click_DALI_2_STM.mcpar 22 | diagnostics: 0 128 Linked in 312 ms 23 | diagnostics: 0 129 Project 'Click_DALI_2_STM.mcpar' completed: 718 ms 24 | diagnostics: 0 103 Finished successfully: 05 Feb 2018, 11:26:39 Click_DALI_2_STM.mcpar 25 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.lst.ini: -------------------------------------------------------------------------------- 1 | [Position] 2 | Line=122 3 | Column=1 4 | [FoldedLines] 5 | Count=0 6 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.mcpar: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=STM32F107VC 3 | Clock=72000000 4 | [BUILD_TYPE] 5 | Value=0 6 | 7 | 8 | [MEMORY_MODEL] 9 | Value=0 10 | [ACTIVE_TAB] 11 | Value=Click_DALI_2_timer.h 12 | [USE_EEPROM] 13 | Value=0 14 | [USE_HEAP] 15 | Value=0 16 | [HEAP_SIZE] 17 | Value=2000 18 | [EEPROM_DEFINITION] 19 | Value= 20 | [FILES] 21 | File0=Click_DALI_2_STM.c 22 | File1=..\..\..\..\library\__dali2_driver.c 23 | Count=2 24 | [BINARIES] 25 | Count=0 26 | [IMAGES] 27 | Count=0 28 | ActiveImageIndex=-1 29 | [OPENED_FILES] 30 | File0=Click_DALI_2_STM.c 31 | File1=..\..\..\..\library\__dali2_driver.h 32 | File2=..\..\..\..\library\__dali2_driver.c 33 | File3=Click_DALI_2_STM.lst 34 | File4=.\C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Packages\mikroBUS Board Definition API\Uses\__em_f107vc_log.c 35 | File5=Click_DALI_2_timer.h 36 | Count=6 37 | [EEPROM] 38 | Count=0 39 | [ACTIVE_COMMENTS_FILES] 40 | Count=0 41 | [OTHER_FILES] 42 | Count=0 43 | [SEARCH_PATH] 44 | Path0=..\..\..\..\library\HAL\ 45 | Path1=..\..\..\..\library\ 46 | Path2=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Packages\mikroBUS Board Definition API\Uses\ 47 | Count=3 48 | [HEADER_PATH] 49 | Path0=..\..\..\..\library\ 50 | Path1=..\..\..\..\library\HAL\ 51 | Path2=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Packages\mikroBUS Board Definition API\Uses\ 52 | Count=3 53 | [HEADERS] 54 | File0=..\..\..\..\library\__dali2_driver.h 55 | File1=Click_DALI_2_config.h 56 | File2=Click_DALI_2_types.h 57 | File3=Click_DALI_2_timer.h 58 | Count=4 59 | [PLDS] 60 | File0=Click_DALI_2.pld 61 | Count=1 62 | [Useses] 63 | File0=easymx_v7_STM32_generic 64 | File1=UART 65 | File2=Button 66 | File3=easymx_v7_STM32F107VC 67 | Count=4 68 | [EXPANDED_NODES] 69 | 0=Click_DALI_2_STM.mcpar 70 | 1=Sources 71 | 9=Header Files 72 | Count=3 73 | [PROGRAMMER_OPTIONS] 74 | Value=JTAG 75 | [PROGRAMMER_TYPE] 76 | Value=mE 77 | [DEBUGGER_TYPE] 78 | Value=default 79 | [AT_DEBUG_STARTUP] 80 | LOAD_BIN_TO_RAM=0 81 | START_EXEC_FROM_ADDR=0 82 | START_ADDR=-1 83 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.mcpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=STM32F107VC 3 | Clock=72000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_STM.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_STM32_M3 22 | File4=easymx_v7_STM32F107VC 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.mcpar_callertable.txt: -------------------------------------------------------------------------------- 1 | main 2 | __FillZeros 3 | systemInit 4 | mikrobus_gpioInit 5 | _gpioInit_1 6 | GPIO_Digital_Input 7 | GPIO_Config 8 | GPIO_Clk_Enable 9 | GPIO_Digital_Output 10 | GPIO_Config 11 | _gpioInit_2 12 | GPIO_Digital_Input 13 | GPIO_Digital_Output 14 | applicationInit 15 | dali2_gpioDriverInit 16 | hal_gpioMap 17 | dali2_masterInit 18 | _setAN_1 19 | _setRST_1 20 | _setCS_1 21 | _setSCK_1 22 | _setMISO_1 23 | _setMOSI_1 24 | _setPWM_1 25 | _setINT_1 26 | _setRX_1 27 | _setTX_1 28 | _setSCL_1 29 | _setSDA_1 30 | _setAN_2 31 | _setRST_2 32 | _setCS_2 33 | _setSCK_2 34 | _setMISO_2 35 | _setMOSI_2 36 | _setPWM_2 37 | _setINT_2 38 | _setRX_2 39 | _setTX_2 40 | _setSCL_2 41 | _setSDA_2 42 | dali2_configTimer 43 | NVIC_IntEnable 44 | EnableInterrupts 45 | applicationTask 46 | dali2_sendCmd 47 | _prepareAddress 48 | _prepareData 49 | _writeData 50 | _checkSpecCmd 51 | _setAN_1 52 | _setRST_1 53 | _setCS_1 54 | _setSCK_1 55 | _setMISO_1 56 | _setMOSI_1 57 | _setPWM_1 58 | _setINT_1 59 | _setRX_1 60 | _setTX_1 61 | _setSCL_1 62 | _setSDA_1 63 | _setAN_2 64 | _setRST_2 65 | _setCS_2 66 | _setSCK_2 67 | _setMISO_2 68 | _setMOSI_2 69 | _setPWM_2 70 | _setINT_2 71 | _setRX_2 72 | _setTX_2 73 | _setSCL_2 74 | _setSDA_2 75 | dali2_masterStatus 76 | _setAN_1 77 | _setRST_1 78 | _setCS_1 79 | _setSCK_1 80 | _setMISO_1 81 | _setMOSI_1 82 | _setPWM_1 83 | _setINT_1 84 | _setRX_1 85 | _setTX_1 86 | _setSCL_1 87 | _setSDA_1 88 | _setAN_2 89 | _setRST_2 90 | _setCS_2 91 | _setSCK_2 92 | _setMISO_2 93 | _setMOSI_2 94 | _setPWM_2 95 | _setINT_2 96 | _setRX_2 97 | _setTX_2 98 | _setSCL_2 99 | _setSDA_2 100 | _getAN_1 101 | _getRST_1 102 | _getCS_1 103 | _getSCK_1 104 | _getMISO_1 105 | _getMOSI_1 106 | _getPWM_1 107 | _getINT_1 108 | _getRX_1 109 | _getTX_1 110 | _getSCL_1 111 | _getSDA_1 112 | _getAN_2 113 | _getRST_2 114 | _getCS_2 115 | _getSCK_2 116 | _getMISO_2 117 | _getMOSI_2 118 | _getPWM_2 119 | _getINT_2 120 | _getRX_2 121 | _getTX_2 122 | _getSCL_2 123 | _getSDA_2 124 | Timer_interrupt 125 | dali2_isr 126 | _sendingData 127 | _setAN_1 128 | _setRST_1 129 | _setCS_1 130 | _setSCK_1 131 | _setMISO_1 132 | _setMOSI_1 133 | _setPWM_1 134 | _setINT_1 135 | _setRX_1 136 | _setTX_1 137 | _setSCL_1 138 | _setSDA_1 139 | _setAN_2 140 | _setRST_2 141 | _setCS_2 142 | _setSCK_2 143 | _setMISO_2 144 | _setMOSI_2 145 | _setPWM_2 146 | _setINT_2 147 | _setRX_2 148 | _setTX_2 149 | _setSCL_2 150 | _setSDA_2 151 | _receivingData 152 | _getAN_1 153 | _getRST_1 154 | _getCS_1 155 | _getSCK_1 156 | _getMISO_1 157 | _getMOSI_1 158 | _getPWM_1 159 | _getINT_1 160 | _getRX_1 161 | _getTX_1 162 | _getSCL_1 163 | _getSDA_1 164 | _getAN_2 165 | _getRST_2 166 | _getCS_2 167 | _getSCK_2 168 | _getMISO_2 169 | _getMOSI_2 170 | _getPWM_2 171 | _getINT_2 172 | _getRX_2 173 | _getTX_2 174 | _getSCL_2 175 | _getSDA_2 176 | _getAN_1 177 | _getRST_1 178 | _getCS_1 179 | _getSCK_1 180 | _getMISO_1 181 | _getMOSI_1 182 | _getPWM_1 183 | _getINT_1 184 | _getRX_1 185 | _getTX_1 186 | _getSCL_1 187 | _getSDA_1 188 | _getAN_2 189 | _getRST_2 190 | _getCS_2 191 | _getSCK_2 192 | _getMISO_2 193 | _getMOSI_2 194 | _getPWM_2 195 | _getINT_2 196 | _getRX_2 197 | _getTX_2 198 | _getSCL_2 199 | _getSDA_2 200 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_STM.user.dic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/example/c/ARM/STM/Click_DALI_2_STM.user.dic -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 2 ] = 5 | { 6 | _SPI_FPCLK_DIV256, 7 | _SPI_FIRST_CLK_EDGE_TRANSITION | 8 | _SPI_CLK_IDLE_LOW | 9 | _SPI_MASTER | 10 | _SPI_MSB_FIRST | 11 | _SPI_8_BIT | 12 | _SPI_SSM_ENABLE | 13 | _SPI_SS_DISABLE | 14 | _SPI_SSI_1 15 | }; 16 | #endif 17 | 18 | #ifdef ENABLE_I2C 19 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 20 | { 21 | 100000 22 | }; 23 | #endif 24 | 25 | #ifdef ENABLE_UART 26 | const uint32_t _DALI2_UART_CFG [ 4 ] = 27 | { 28 | 9600, 29 | _UART_8_BIT_DATA, 30 | _UART_NOPARITY, 31 | _UART_ONE_STOPBIT 32 | }; 33 | #endif 34 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #include "__dali2_driver.h" 12 | 13 | #define __DALI_2_TIMER__ 14 | 15 | static void dali2_configTimer() 16 | { 17 | RCC_APB1ENR.TIM2EN = 1; 18 | TIM2_CR1.CEN = 0; 19 | TIM2_PSC = 0; 20 | TIM2_ARR = 7487; 21 | NVIC_IntEnable(IVT_INT_TIM2); 22 | TIM2_DIER.UIE = 1; 23 | TIM2_CR1.CEN = 1; 24 | EnableInterrupts(); 25 | } 26 | 27 | void Timer_interrupt() iv IVT_INT_TIM2 28 | { 29 | dali2_isr(); 30 | TIM2_SR.UIF = 0; 31 | } -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_timer.h.ini: -------------------------------------------------------------------------------- 1 | [Position] 2 | Line=1 3 | Column=1 4 | [FoldedLines] 5 | Count=0 6 | -------------------------------------------------------------------------------- /example/c/ARM/STM/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_TIVA.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration TIVA : 8 | 9 | MCU : TM4C129XNCZAD 10 | Dev. Board : EasyMx PRO v7 for TIVA ARM 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_TIVA.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TM4C129XNCZAD 5 | 6 | 4 7 | 8 | $400FE0B0:$33300004 9 | 10 | 11 | $400FE07C:$0011 12 | 13 | 14 | $400FE160:$800018 15 | 16 | 17 | $400FE164:$0000 18 | 19 | 20 | 21 | 0 22 | 23 | -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_TIVA.mcpar: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=TM4C129XNCZAD 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_TIVA.c 9 | File1=..\..\..\..\library\__dali2_driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\..\library\ 16 | Path1=..\..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_TIVA.mcpar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=TM4C129XNCZAD 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_TIVA.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_TIVA_M4 22 | File4=easymx_v7_TM4C129XNCZAD 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 3 ] = 5 | { 6 | 1000000, 7 | _SPI_MASTER, 8 | _SPI_8_BIT | 9 | _SPI_CLK_IDLE_HIGH | 10 | _SPI_SECOND_CLK_EDGE_TRANSITION 11 | }; 12 | #endif 13 | 14 | #ifdef ENABLE_I2C 15 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 16 | { 17 | _I2C_BITRATE_STANDARD_MODE 18 | }; 19 | #endif 20 | 21 | #ifdef ENABLE_UART 22 | const uint32_t _DALI2_UART_CFG[ 6 ] = 23 | { 24 | 9600, 25 | 0, // CPU FQ Parameter will be replaced during init call 26 | _UART_8_BIT_DATA, 27 | _UART_NOPARITY, 28 | _UART_ONE_STOPBIT, 29 | _UART_HIGH_SPEED 30 | }; 31 | #endif 32 | -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | SYSCTL_RCGCTIMER_R0_bit = 1; 16 | EnableInterrupts(); 17 | TIMER_CTL_TAEN_bit = 0; 18 | TIMER0_CFG = 4; 19 | TIMER0_TAMR |= 2; 20 | TIMER0_TAPR = 0; 21 | TIMER0_TAILR = 12480; 22 | NVIC_IntEnable(IVT_INT_TIMER0A_16_32_bit); 23 | TIMER_IMR_TATOIM_bit = 1; 24 | TIMER_CTL_TAEN_bit = 1; 25 | } 26 | 27 | void Timer_interrupt() iv IVT_INT_TIMER0A_16_32_bit 28 | { 29 | dali2_isr(); 30 | TIMER_ICR_TATOCINT_bit = 1; 31 | } -------------------------------------------------------------------------------- /example/c/ARM/TIVA/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2_AVR.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration AVR : 8 | 9 | MCU : ATMEGA32 10 | Dev. Board : EasyAVR v7 11 | AVR Compiler ver : v7.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2_AVR.mcpav: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=ATMEGA32 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_AVR.c 9 | File1=..\..\..\library\__dali2_Driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\library\ 16 | Path1=..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2_AVR.mcpav.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=ATMEGA32 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_AVR.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_AVR_LT 22 | File4=easyavr_v7_ATMEGA32 23 | File5=//SPI 24 | File6=//TWI 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 3 ] = 5 | { 6 | _SPI_MASTER, 7 | _SPI_FCY_DIV32, 8 | _SPI_CLK_LO_LEADING 9 | }; 10 | #endif 11 | 12 | #ifdef ENABLE_I2C 13 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 14 | { 15 | 100000 16 | }; 17 | #endif 18 | 19 | #ifdef ENABLE_UART 20 | const uint32_t _DALI2_UART_CFG [ 3 ] = 21 | { 22 | 9600, 23 | _UART_NOPARITY, 24 | _UART_ONE_STOPBIT 25 | }; 26 | #endif 27 | -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | SREG_I_bit = 1; 16 | TCCR1A = 0x80; 17 | TCCR1B = 0x09; 18 | OCR1AH = 0x03; 19 | OCR1AL = 0x3F; 20 | OCIE1A_bit = 1; 21 | } 22 | 23 | void Timer_interrupt() org IVT_ADDR_TIMER1_COMPA 24 | { 25 | dali2_isr(); 26 | } -------------------------------------------------------------------------------- /example/c/AVR/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_DSPIC.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration dsPIC : 8 | 9 | MCU : P33FJ256GP710A 10 | Dev. Board : EasyPIC Fusion v7 11 | dsPIC Compiler ver : v7.0.1.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_DSPIC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P33FJ256GP710A 5 | 6 | 8 7 | 8 | $F80000:$00CF 9 | 10 | 11 | $F80002:$00CF 12 | 13 | 14 | $F80004:$0007 15 | 16 | 17 | $F80006:$00A2 18 | 19 | 20 | $F80008:$0085 21 | 22 | 23 | $F8000A:$007F 24 | 25 | 26 | $F8000C:$00E7 27 | 28 | 29 | $F8000E:$00C1 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_DSPIC.mcpds: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P33FJ256GP710A 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_DSPIC.c 9 | File1=..\..\..\library\__dali2_Driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\library\ 16 | Path1=..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_DSPIC.mcpds.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P33FJ256GP710A 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_DSPIC.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_DSPIC 22 | File4=easypicfusion_v7_P33FJ256GP710A 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 8 ] = 5 | { 6 | _SPI_MASTER, 7 | _SPI_8_BIT, 8 | _SPI_PRESCALE_SEC_4, 9 | _SPI_PRESCALE_PRI_4, 10 | _SPI_SS_DISABLE, 11 | _SPI_DATA_SAMPLE_MIDDLE, 12 | _SPI_CLK_IDLE_LOW, 13 | _SPI_IDLE_2_ACTIVE 14 | }; 15 | #endif 16 | 17 | #ifdef ENABLE_I2C 18 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 19 | { 20 | 100000 21 | }; 22 | #endif 23 | 24 | #ifdef ENABLE_UART 25 | const uint32_t _DALI2_UART_CFG[ 1 ] = 26 | { 27 | 9600 28 | }; 29 | #endif 30 | -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | T1CON = 0x8000; 16 | T1IE_bit = 1; 17 | T1IF_bit = 0; 18 | IPC0 = IPC0 | 0x1000; 19 | PR1 = 416; 20 | } 21 | 22 | void Timer_interrupt() iv IVT_ADDR_T1INTERRUPT 23 | { 24 | T1IF_bit = 0; 25 | dali2_isr(); 26 | } -------------------------------------------------------------------------------- /example/c/DSPIC/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2_FT90x.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration FT90x : 8 | 9 | MCU : FT900 10 | Dev. Board : EasyFT90x v7 11 | FT90x Compiler ver : v2.2.1.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2_FT90x.mcpf9: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=FT900 3 | Clock=100000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_FT90x.c 9 | File1=..\..\..\library\__dali2_Driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\library\ 16 | Path1=..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2_FT90x.mcpf9.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=FT900 3 | Clock=100000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_FT90x.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_FT90x 22 | File4=easyft90x_v7_FT900 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 3 ] = 5 | { 6 | _SPI_MASTER_CLK_RATIO_256, 7 | _SPI_CFG_POLARITY_IDLE_HIGH | 8 | _SPI_CFG_PHASE_CAPTURE_RISING | 9 | _SPI_CFG_SS_AUTO_DISABLE | 10 | _SPI_CFG_FIFO_DISABLE, 11 | _SPI_SS_LINE_NONE 12 | }; 13 | #endif 14 | 15 | #ifdef ENABLE_I2C 16 | const uint32_t _DALI2_I2C_CFG[ 2 ] = 17 | { 18 | _I2CM_SPEED_MODE_STANDARD, 19 | _I2CM_SWAP_DISABLE 20 | }; 21 | #endif 22 | 23 | #ifdef ENABLE_UART 24 | const uint32_t _DALI2_UART_CFG[ 1 ] = 25 | { 26 | 9600 27 | }; 28 | #endif 29 | -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | TIMER_CONTROL_0 = 2; 16 | TIMER_SELECT = 0; 17 | TIMER_PRESC_LS = 0; 18 | TIMER_PRESC_MS = 0; 19 | TIMER_WRITE_LS = 159; 20 | TIMER_WRITE_MS = 40; 21 | TIMER_CONTROL_3 = 0; 22 | TIMER_CONTROL_4 |= 17; 23 | TIMER_CONTROL_2 |= 0; 24 | TIMER_INT |= 2; 25 | TIMER_CONTROL_1 |= 1; 26 | IRQ_CTRL &= ~((uint32_t)1 << GLOBAL_INTERRUPT_MASK ); 27 | } 28 | 29 | void Timer_interrupt() iv IVT_TIMERS_IRQ 30 | { 31 | if (TIMER_INT_A_bit) 32 | { 33 | TIMER_INT = (TIMER_INT & 0xAA) | (1 << 0); 34 | } 35 | dali2_isr(); 36 | } -------------------------------------------------------------------------------- /example/c/FT90x/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_PIC.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration PIC : 8 | 9 | MCU : P18F87K22 10 | Dev. Board : EasyPIC PRO v7 11 | PIC Compiler ver : v7.1.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_PIC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P18F87K22 5 | 6 | 13 7 | 8 | $300000:$0015 9 | 10 | 11 | $300001:$0013 12 | 13 | 14 | $300002:$007F 15 | 16 | 17 | $300003:$007C 18 | 19 | 20 | $300004:$00F9 21 | 22 | 23 | $300005:$008B 24 | 25 | 26 | $300006:$0091 27 | 28 | 29 | $300008:$00FF 30 | 31 | 32 | $300009:$00C0 33 | 34 | 35 | $30000A:$00FF 36 | 37 | 38 | $30000B:$00E0 39 | 40 | 41 | $30000C:$00FF 42 | 43 | 44 | $30000D:$0040 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_PIC.mcppi: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P18F87K22 3 | Clock=64000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_PIC.c 9 | File1=..\..\..\library\__dali2_Driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\library\ 16 | Path1=..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_PIC.mcppi.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P18F87K22 3 | Clock=64000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_PIC.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_P18 22 | File4=easypicpro_v7_P18F87K22 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 4 ] = 5 | { 6 | _SPI_MASTER_OSC_DIV64, 7 | _SPI_DATA_SAMPLE_MIDDLE, 8 | _SPI_CLK_IDLE_LOW, 9 | _SPI_LOW_2_HIGH 10 | }; 11 | #endif 12 | 13 | #ifdef ENABLE_I2C 14 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 15 | { 16 | 100000 17 | }; 18 | #endif 19 | 20 | #ifdef ENABLE_UART 21 | const uint32_t _DALI2_UART_CFG[ 1 ] = 22 | { 23 | 9600 24 | }; 25 | #endif 26 | -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | T0CON = 0xC2; 16 | TMR0L = 0x30; 17 | GIE_bit = 1; 18 | TMR0IE_bit = 1; 19 | } 20 | 21 | void Interrupt() 22 | { 23 | if (TMR0IF_bit) 24 | { 25 | TMR0IF_bit = 0; 26 | TMR0L = 0x30; 27 | dali2_isr(); 28 | } 29 | } -------------------------------------------------------------------------------- /example/c/PIC/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_PIC32.c: -------------------------------------------------------------------------------- 1 | /* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration PIC32 : 8 | 9 | MCU : P32MX795F512L 10 | Dev. Board : EasyPIC Fusion v7 11 | PIC32 Compiler ver : v4.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | */ 28 | 29 | #include "Click_DALI_2_types.h" 30 | #include "Click_DALI_2_config.h" 31 | #include "Click_DALI_2_timer.h" 32 | 33 | uint8_t current_state; 34 | 35 | void systemInit() 36 | { 37 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT ); 38 | mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT ); 39 | } 40 | 41 | void applicationInit() 42 | { 43 | dali2_gpioDriverInit( (T_DALI2_P)&_MIKROBUS1_GPIO ); 44 | dali2_masterInit(); 45 | dali2_configTimer(); 46 | } 47 | 48 | void applicationTask() 49 | { 50 | uint8_t counter; 51 | 52 | for (counter = 0; counter < 2; counter++) 53 | { 54 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 55 | Delay_ms( 1000 ); 56 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 57 | Delay_ms( 1000 ); 58 | } 59 | 60 | for (counter = 0; counter < 8; counter++) 61 | { 62 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 63 | Delay_ms( 500 ); 64 | } 65 | 66 | for (counter = 0; counter < 8; counter++) 67 | { 68 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 69 | Delay_ms( 500 ); 70 | } 71 | 72 | current_state = dali2_masterStatus(); 73 | } 74 | 75 | void main() 76 | { 77 | systemInit(); 78 | applicationInit(); 79 | 80 | while (1) 81 | { 82 | applicationTask(); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_PIC32.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P32MX795F512L 5 | 6 | 4 7 | 8 | $1FC02FF0:$C7070000 9 | 10 | 11 | $1FC02FF4:$0151 12 | 13 | 14 | $1FC02FF8:$14C503 15 | 16 | 17 | $1FC02FFC:$110FF00F 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_PIC32.mcp32: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P32MX795F512L 3 | Clock=80000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=2 8 | File0=Click_DALI_2_PIC32.c 9 | File1=..\..\..\library\__dali2_Driver.c 10 | [SEARCH_PATH] 11 | Count=1 12 | Path0=..\..\..\library\HAL\ 13 | [HEADER_PATH] 14 | Count=2 15 | Path0=..\..\..\library\ 16 | Path1=..\..\..\library\HAL\ 17 | [HEADERS] 18 | Count=3 19 | File0=..\..\..\library\__dali2_driver.h 20 | File1=Click_DALI_2_config.h 21 | File2=Click_DALI_2_types.h 22 | [PLDS] 23 | Count=1 24 | File0=Click_DALI_2.pld 25 | 26 | -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_PIC32.mcp32.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P32MX795F512L 3 | Clock=80000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=1 8 | File0=Click_DALI_2_PIC32.c 9 | [HEADERS] 10 | Count=3 11 | File0=Click_DALI_2_config.h 12 | File1=Click_DALI_2_types.h 13 | File2=Click_DALI_2_timer.h 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=C_String 21 | File3=DALI_2_P32MX 22 | File4=easypicfusion_v7_P32MX795F512L 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_config.h: -------------------------------------------------------------------------------- 1 | #include "Click_DALI_2_types.h" 2 | 3 | #ifdef ENABLE_SPI 4 | const uint32_t _DALI2_SPI_CFG[ 7 ] = 5 | { 6 | _SPI_MASTER, 7 | _SPI_8_BIT, 8 | 80, 9 | _SPI_SS_DISABLE, 10 | _SPI_DATA_SAMPLE_MIDDLE, 11 | _SPI_CLK_IDLE_LOW, 12 | _SPI_IDLE_2_ACTIVE 13 | }; 14 | #endif 15 | 16 | #ifdef ENABLE_I2C 17 | const uint32_t _DALI2_I2C_CFG[ 1 ] = 18 | { 19 | 100000 20 | }; 21 | #endif 22 | 23 | #ifdef ENABLE_UART 24 | const uint32_t _DALI2_UART_CFG[ 1 ] = 25 | { 26 | 9600 27 | }; 28 | #endif 29 | -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | */ 9 | #include "Click_DALI_2_types.h" 10 | 11 | #define __DALI_2_TIMER__ 12 | 13 | static void dali2_configTimer() 14 | { 15 | T1CON = 0x8000; 16 | T1IP0_bit = 1; 17 | T1IP1_bit = 1; 18 | T1IP2_bit = 1; 19 | T1IF_bit = 0; 20 | T1IE_bit = 1; 21 | PR1 = 8320; 22 | TMR1 = 0; 23 | EnableInterrupts(); 24 | } 25 | 26 | void Timer_interrupt() iv IVT_TIMER_1 ilevel 7 ics ICS_SRS 27 | { 28 | T1IF_bit = 0; 29 | dali2_isr(); 30 | } -------------------------------------------------------------------------------- /example/c/PIC32/Click_DALI_2_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _DALI2_T_ 2 | #define _DALI2_T_ 3 | 4 | #include "stdint.h" 5 | 6 | #ifndef _DALI2_H_ 7 | 8 | #define T_DALI2_P const uint8_t* 9 | 10 | #endif 11 | #endif -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2_CEC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CEC1702 5 | 6 | 3 7 | 8 | $40080108:$01E0 9 | 10 | 11 | $40080104:$0001 12 | 13 | 14 | $4000A408:$0000 15 | 16 | 17 | 18 | 0 19 | 0 20 | 21 | -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2_CEC.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration CEC : 8 | 9 | MCU : CEC1702 10 | Dev. Board : Clicker 2 for CEC1702 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_CEC; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2_CEC.mppar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=CEC1702 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_CEC.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_CEC_M4 22 | File4=clicker_2_CEC1702 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2_config.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_config; 2 | 3 | uses Click_DALI_2_types; 4 | 5 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | 21 | end; 22 | 23 | procedure Timer_interrupt(); 24 | begin 25 | 26 | dali2_isr(); 27 | 28 | end; 29 | 30 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/CEC/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/KINETIS/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/ARM/KINETIS/Click_DALI_2_KINETIS.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MK64FN1M0XXX12 5 | 6 | 22 7 | 8 | $40065000:$0000 9 | 10 | 11 | $40047000:$C0000 12 | 13 | 14 | $40048004:$10000 15 | 16 | 17 | $40048044:$1140000 18 | 19 | 20 | $40064000:$0022 21 | 22 | 23 | $40064001:$0024 24 | 25 | 26 | $40064003:$0000 27 | 28 | 29 | $40064004:$0002 30 | 31 | 32 | $40064005:$0046 33 | 34 | 35 | $40064008:$0000 36 | 37 | 38 | $4006400C:$0000 39 | 40 | 41 | $40048048:$0000 42 | 43 | 44 | $40052000:$0000 45 | 46 | 47 | $020000:$0007 48 | 49 | 50 | $000408:$00FF 51 | 52 | 53 | $000409:$00FF 54 | 55 | 56 | $00040A:$00FF 57 | 58 | 59 | $00040B:$00FF 60 | 61 | 62 | $00040C:$0002 63 | 64 | 65 | $00040D:$00FD 66 | 67 | 68 | $00040E:$00FF 69 | 70 | 71 | $00040F:$00FF 72 | 73 | 74 | 75 | 0 76 | 0 77 | 78 | -------------------------------------------------------------------------------- /example/pascal/ARM/KINETIS/Click_DALI_2_KINETIS.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration KINETIS : 8 | 9 | MCU : MK64 10 | Dev. Board : HEXIWEAR 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_KINETIS; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/KINETIS/Click_DALI_2_KINETIS.mppar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MK64FN1M0XXX12 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_KINETIS.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_MK_M4 22 | File4=docking_station_HEXIWEAR 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/pascal/ARM/KINETIS/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | SIM_SCGC6 := SIM_SCGC6 or (1 shl PIT); 21 | NVIC_IntEnable(IVT_INT_PIT0); 22 | PIT_MCR := 0x00; 23 | PIT_LDVAL0 := 12479; 24 | PIT_TCTRL0 := PIT_TCTRL0 or 2; 25 | PIT_TCTRL0 := PIT_TCTRL0 or 1; 26 | EnableInterrupts(); 27 | 28 | end; 29 | 30 | procedure Timer_interrupt(); iv IVT_INT_PIT0; 31 | begin 32 | 33 | dali2_isr(); 34 | PIT_TFLG0.TIF := 1; 35 | 36 | end; 37 | 38 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/KINETIS/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/MSP/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/ARM/MSP/Click_DALI_2_MSP.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MSP432P401R 5 | 6 | 5 7 | 8 | $40010404:$50000 9 | 10 | 11 | $40010408:$0033 12 | 13 | 14 | $4001040C:$10003 15 | 16 | 17 | $4000480C:$0084 18 | 19 | 20 | $40011010:$1000 21 | 22 | 23 | 24 | 0 25 | 26 | -------------------------------------------------------------------------------- /example/pascal/ARM/MSP/Click_DALI_2_MSP.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration MSP : 8 | 9 | MCU : MSP432 10 | Dev. Board : Clicker 2 for MSP432 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_MSP; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/MSP/Click_DALI_2_MSP.mppar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=MSP432P401R 3 | Clock=48000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_MSP.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_MSP_M4 22 | File4=clicker_2_MSP432 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/pascal/ARM/MSP/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | TIMER32_T32CONTROL1 := (TIMER32_T32CONTROL1 and 0xFFFFFFFE); 21 | TIMER32_T32CONTROL1 := (TIMER32_T32CONTROL1 or 0x02); 22 | TIMER32_T32CONTROL1 := (TIMER32_T32CONTROL1 or 0); 23 | TIMER32_T32CONTROL1 := (TIMER32_T32CONTROL1 or 0x20); 24 | TIMER32_T32CONTROL1 := (TIMER32_T32CONTROL1 or 0x40); 25 | TIMER32_T32LOAD1 := 0x0000BB80; 26 | NVIC_IntEnable(IVT_INT_T32_INT1); 27 | IVT_INT_T32_INT1TIMER32_T32CONTROL1 := (IVT_INT_T32_INT1TIMER32_T32CONTROL1 or 0x80); 28 | EnableInterrupts(); 29 | 30 | end; 31 | 32 | procedure Timer_interrupt(); iv IVT_INT_T32_INT1; 33 | begin 34 | 35 | dali2_isr(); 36 | TIMER32_T32INTCLR1 := 1; 37 | 38 | end; 39 | 40 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/MSP/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/STM/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/ARM/STM/Click_DALI_2_STM.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | STM32F107VC 5 | 6 | 3 7 | 8 | $400FE060:$5010081 9 | 10 | 11 | $40021004:$1D8402 12 | 13 | 14 | $400FE060:$10644 15 | 16 | 17 | 18 | 0 19 | 20 | -------------------------------------------------------------------------------- /example/pascal/ARM/STM/Click_DALI_2_STM.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration STM32 : 8 | 9 | MCU : STM32F107VCT6 10 | Dev. Board : EasyMx PRO v7 for STM32 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_STM; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/STM/Click_DALI_2_STM.mppar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=STM32F107VC 3 | Clock=72000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_STM.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_STM32_M3 22 | File4=easymx_v7_STM32F107VC 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/pascal/ARM/STM/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | RCC_APB1ENR.TIM2EN := 1; 21 | TIM2_CR1.CEN := 0; 22 | TIM2_PSC := 0; 23 | TIM2_ARR := 7487; 24 | NVIC_IntEnable(IVT_INT_TIM2); 25 | TIM2_DIER.UIE := 1; 26 | TIM2_CR1.CEN := 1; 27 | 28 | end; 29 | 30 | procedure Timer_interrupt(); iv IVT_INT_TIM2; 31 | begin 32 | 33 | dali2_isr(); 34 | TIM2_SR.UIF := 0; 35 | 36 | end; 37 | 38 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/STM/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/TIVA/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/ARM/TIVA/Click_DALI_2_TIVA.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TM4C129XNCZAD 5 | 6 | 4 7 | 8 | $400FE0B0:$33300004 9 | 10 | 11 | $400FE07C:$0011 12 | 13 | 14 | $400FE160:$800018 15 | 16 | 17 | $400FE164:$0000 18 | 19 | 20 | 21 | 0 22 | 23 | -------------------------------------------------------------------------------- /example/pascal/ARM/TIVA/Click_DALI_2_TIVA.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration TIVA : 8 | 9 | MCU : TM4C129XNCZAD 10 | Dev. Board : EasyMx PRO v7 for TIVA ARM 11 | ARM Compiler ver : v6.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_TIVA; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/TIVA/Click_DALI_2_TIVA.mppar.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=TM4C129XNCZAD 3 | Clock=120000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_TIVA.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_TIVA_M4 22 | File4=easymx_v7_TM4C129XNCZAD 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/pascal/ARM/TIVA/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | SYSCTL_RCGCTIMER_R0_bit := 1; 21 | EnableInterrupts(); 22 | TIMER_CTL_TAEN_bit := 0; 23 | TIMER0_CFG := 4; 24 | TIMER0_TAMR := TIMER0_TAMR or 2; 25 | TIMER0_TAPR := 0; 26 | TIMER0_TAILR := 12480; 27 | NVIC_IntEnable(IVT_INT_TIMER0A_16_32_bit); 28 | TIMER_IMR_TATOIM_bit := 1; 29 | TIMER_CTL_TAEN_bit := 1; 30 | 31 | end; 32 | 33 | procedure Timer_interrupt(); iv IVT_INT_TIMER0A_16_32_bit; 34 | begin 35 | 36 | dali2_isr(); 37 | TIMER_ICR_TATOCINT_bit := 1; 38 | 39 | end; 40 | 41 | end. -------------------------------------------------------------------------------- /example/pascal/ARM/TIVA/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/AVR/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/AVR/Click_DALI_2_AVR.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration AVR : 8 | 9 | MCU : ATMEGA32 10 | Dev. Board : EasyAVR v7 11 | AVR Compiler ver : v7.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_AVR; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/AVR/Click_DALI_2_AVR.mppav.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=ATMEGA32 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_AVR.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_AVR_LT 22 | File4=easyavr_v7_ATMEGA32 23 | File5=//SPI 24 | File6=//TWI 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/pascal/AVR/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | SREG_I_bit := 1; 21 | TCCR1A := 0x80; 22 | TCCR1B := 0x09; 23 | OCR1AH := 0x03; 24 | OCR1AL := 0x3F; 25 | OCIE1A_bit := 1; 26 | 27 | end; 28 | 29 | procedure Timer_interrupt(); org IVT_ADDR_TIMER1_COMPA; 30 | begin 31 | 32 | dali2_isr(); 33 | 34 | end; 35 | 36 | end. -------------------------------------------------------------------------------- /example/pascal/AVR/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/DSPIC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/DSPIC/Click_DALI_2_DSPIC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P33FJ256GP710A 5 | 6 | 8 7 | 8 | $F80000:$00CF 9 | 10 | 11 | $F80002:$00CF 12 | 13 | 14 | $F80004:$0007 15 | 16 | 17 | $F80006:$00A2 18 | 19 | 20 | $F80008:$0085 21 | 22 | 23 | $F8000A:$007F 24 | 25 | 26 | $F8000C:$00E7 27 | 28 | 29 | $F8000E:$00C1 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/pascal/DSPIC/Click_DALI_2_DSPIC.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration dsPIC : 8 | 9 | MCU : P33FJ256GP710A 10 | Dev. Board : EasyPIC Fusion v7 11 | dsPIC Compiler ver : v7.0.1.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_DSPIC; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/DSPIC/Click_DALI_2_DSPIC.mppds.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P33FJ256GP710A 3 | Clock=8000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_DSPIC.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_DSPIC 22 | File4=easypicfusion_v7_P33FJ256GP710A 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/pascal/DSPIC/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | T1CON := 0x8000; 21 | T1IE_bit := 1; 22 | T1IF_bit := 0; 23 | IPC0 := IPC0 or 0x1000; 24 | PR1 := 416; 25 | 26 | end; 27 | 28 | procedure Timer_interrupt(); iv IVT_ADDR_T1INTERRUPT; 29 | begin 30 | 31 | dali2_isr(); 32 | T1IF_bit := 0; 33 | 34 | end; 35 | 36 | end. -------------------------------------------------------------------------------- /example/pascal/DSPIC/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/FT90x/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/FT90x/Click_DALI_2_FT90x.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration FT90x : 8 | 9 | MCU : FT900 10 | Dev. Board : EasyFT90x v7 11 | FT90x Compiler ver : v2.2.1.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_FT90x; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/FT90x/Click_DALI_2_FT90x.mppf9.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=FT900 3 | Clock=100000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_FT90x.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_FT90x 22 | File4=easyft90x_v7_FT900 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 -------------------------------------------------------------------------------- /example/pascal/FT90x/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | TIMER_CONTROL_0 := 2; 21 | TIMER_SELECT := 0; 22 | TIMER_PRESC_LS := 0; 23 | TIMER_PRESC_MS := 0; 24 | TIMER_WRITE_LS := 159; 25 | TIMER_WRITE_MS := 40; 26 | TIMER_CONTROL_3 := 0; 27 | TIMER_CONTROL_4 := TIMER_CONTROL_4 or 17; 28 | TIMER_CONTROL_2 := TIMER_CONTROL_2 or 0; 29 | TIMER_INT := TIMER_INT or 2; 30 | TIMER_CONTROL_1 := TIMER_CONTROL_1 or 1; 31 | IRQ_CTRL := (IRQ_CTRL and not uint32_t((1 shl GLOBAL_INTERRUPT_MASK))); 32 | 33 | end; 34 | 35 | procedure Timer_interrupt(); iv IVT_TIMERS_IRQ; 36 | begin 37 | 38 | if (TIMER_INT_A_bit) then 39 | begin 40 | TIMER_INT := ((TIMER_INT and 0xAA) or (1 shl 0)); 41 | end; 42 | dali2_isr(); 43 | 44 | end; 45 | 46 | end. -------------------------------------------------------------------------------- /example/pascal/FT90x/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/PIC/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/PIC/Click_DALI_2_PIC.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P18F87K22 5 | 6 | 13 7 | 8 | $300000:$0015 9 | 10 | 11 | $300001:$0013 12 | 13 | 14 | $300002:$007F 15 | 16 | 17 | $300003:$007C 18 | 19 | 20 | $300004:$00F9 21 | 22 | 23 | $300005:$008B 24 | 25 | 26 | $300006:$0091 27 | 28 | 29 | $300008:$00FF 30 | 31 | 32 | $300009:$00C0 33 | 34 | 35 | $30000A:$00FF 36 | 37 | 38 | $30000B:$00E0 39 | 40 | 41 | $30000C:$00FF 42 | 43 | 44 | $30000D:$0040 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /example/pascal/PIC/Click_DALI_2_PIC.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration PIC : 8 | 9 | MCU : P18F87K22 10 | Dev. Board : EasyPIC PRO v7 11 | PIC Compiler ver : v7.1.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_PIC; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/PIC/Click_DALI_2_PIC.mpppi.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P18F87K22 3 | Clock=64000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_PIC.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_P18 22 | File4=easypicpro_v7_P18F87K22 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | 27 | -------------------------------------------------------------------------------- /example/pascal/PIC/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | T0CON := 0xC2; 21 | TMR0L := 0x30; 22 | GIE_bit := 1; 23 | TMR1IE_bit := 1; 24 | 25 | end; 26 | 27 | procedure Interrupt(); 28 | begin 29 | 30 | if ((TMR1IF_bit <> 0)) then 31 | begin 32 | dali2_isr(); 33 | TMR1IF_bit := 0; 34 | TMR1L := 0x30; 35 | end; 36 | 37 | end; 38 | 39 | end. -------------------------------------------------------------------------------- /example/pascal/PIC/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /example/pascal/PIC32/Click_DALI_2.pld: -------------------------------------------------------------------------------- 1 | ENABLE_LOG 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/pascal/PIC32/Click_DALI_2_PIC32.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P32MX795F512L 5 | 6 | 4 7 | 8 | $1FC02FF0:$C7070000 9 | 10 | 11 | $1FC02FF4:$0151 12 | 13 | 14 | $1FC02FF8:$14C503 15 | 16 | 17 | $1FC02FFC:$110FF00F 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /example/pascal/PIC32/Click_DALI_2_PIC32.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | Example for DALI_2 Click 3 | 4 | Date : Feb 2018. 5 | Author : MikroE Team 6 | 7 | Test configuration PIC32 : 8 | 9 | MCU : P32MX795F512L 10 | Dev. Board : EasyPIC Fusion v7 11 | PIC32 Compiler ver : v4.0.0.0 12 | 13 | --- 14 | 15 | Description : 16 | 17 | The application is composed of three sections : 18 | 19 | - System Initialization - Initializes GPIO pins for TX and RX 20 | - Application Initialization - Initializes driver, initializes DALI master functionality and configures timer 21 | - Application Task - (code snippet) - Application task is composed of three sequences, first sequence toggling 22 | light twice with delay of one second. Second sequence decreases intensity of light by 8 steps with delay of 23 | half second. Third sequence increases intensity of light by 8 steps with delay of half second. 24 | 25 | **Note** This implementation of DALI master requires timer with exact 104 uS interrupt time. 26 | 27 | *} 28 | program Click_DALI_2_PIC32; 29 | 30 | uses Click_DALI_2_types, Click_DALI_2_config, Click_DALI_2_timer; 31 | 32 | var 33 | current_state : uint8_t; 34 | 35 | procedure systemInit(); 36 | begin 37 | 38 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_OUTPUT); 39 | mikrobus_gpioInit(_MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT); 40 | 41 | end; 42 | 43 | procedure applicationInit(); 44 | begin 45 | 46 | dali2_gpioDriverInit(T_DALI2_P(@_MIKROBUS1_GPIO)); 47 | dali2_masterInit(); 48 | dali2_configTimer(); 49 | 50 | end; 51 | 52 | procedure applicationTask(); 53 | var 54 | counter : uint8_t; 55 | begin 56 | 57 | for counter := 0 to 2-1 do 58 | begin 59 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_OFF, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 60 | Delay_ms(1000); 61 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_RECALL_MAX_LEVEL, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 62 | Delay_ms(1000); 63 | end; 64 | for counter := 0 to 8-1 do 65 | begin 66 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_DOWN, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 67 | Delay_ms(500); 68 | end; 69 | for counter := 0 to 8-1 do 70 | begin 71 | dali2_sendCmd(_DALI2_ADDRESS01, _DALI2_UP, _DALI2_BROADCAST_CMD, _DALI2_FOLLOWING_COMMAND); 72 | Delay_ms(500); 73 | end; 74 | current_state := dali2_masterStatus(); 75 | 76 | end; 77 | 78 | begin 79 | 80 | systemInit(); 81 | applicationInit(); 82 | while (1) do 83 | begin 84 | applicationTask(); 85 | end; 86 | 87 | end. -------------------------------------------------------------------------------- /example/pascal/PIC32/Click_DALI_2_PIC32.mpp32.example: -------------------------------------------------------------------------------- 1 | [DEVICE] 2 | Name=P32MX795F512L 3 | Clock=80000000 4 | [BUILD_TYPE] 5 | Value=0 6 | [FILES] 7 | Count=4 8 | File0=Click_DALI_2_PIC32.mpas 9 | File1=Click_DALI_2_config.mpas 10 | File2=Click_DALI_2_types.mpas 11 | File3=Click_DALI_2_timer.mpas 12 | [HEADERS] 13 | Count=0 14 | [PLDS] 15 | Count=1 16 | File0=Click_DALI_2.pld 17 | [Useses] 18 | File0=UART 19 | File1=Conversions 20 | File2=String 21 | File3=DALI_2_P32MX 22 | File4=easypicfusion_v7_P32MX795F512L 23 | File5=//SPI 24 | File6=//I2C 25 | Count=7 26 | -------------------------------------------------------------------------------- /example/pascal/PIC32/Click_DALI_2_timer.mpas: -------------------------------------------------------------------------------- 1 | {* 2 | 3 | Use mikroE Timer Calculator to generate proper timer configuration 4 | and timer ISR. 5 | 6 | https://www.mikroe.com/timer-calculator 7 | 8 | *} 9 | unit Click_DALI_2_timer; 10 | 11 | uses Click_DALI_2_types; 12 | 13 | procedure dali2_configTimer(); 14 | 15 | implementation 16 | 17 | procedure dali2_configTimer(); 18 | begin 19 | 20 | T1CON := 0x8000; 21 | T1IP0_bit := 1; 22 | T1IP1_bit := 1; 23 | T1IP2_bit := 1; 24 | T1IF_bit := 0; 25 | T1IE_bit := 1; 26 | PR1 := 8320; 27 | TMR1 := 0; 28 | EnableInterrupts(); 29 | 30 | end; 31 | 32 | // 33 | procedure Timer_interrupt(); iv IVT_TIMER_1; ilevel 7; ics ICS_SRS; 34 | begin 35 | 36 | dali2_isr(); 37 | T1IF_bit := 0; 38 | 39 | end; 40 | 41 | end. -------------------------------------------------------------------------------- /example/pascal/PIC32/Click_DALI_2_types.mpas: -------------------------------------------------------------------------------- 1 | unit Click_DALI_2_types; 2 | 3 | type uint8_t = byte; 4 | type int8_t = short; 5 | type uint16_t = word; 6 | type int16_t = integer; 7 | type uint32_t = dword; 8 | type int32_t = longint; 9 | 10 | type T_DALI2_P = ^const uint8_t; 11 | 12 | end. -------------------------------------------------------------------------------- /packages/basic/DALI 2 Click ARM.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/basic/DALI 2 Click ARM.mpkg -------------------------------------------------------------------------------- /packages/basic/DALI 2 Click AVR.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/basic/DALI 2 Click AVR.mpkg -------------------------------------------------------------------------------- /packages/basic/DALI 2 Click FT90x.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/basic/DALI 2 Click FT90x.mpkg -------------------------------------------------------------------------------- /packages/basic/DALI 2 Click PIC.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/basic/DALI 2 Click PIC.mpkg -------------------------------------------------------------------------------- /packages/basic/DALI 2 Click PIC32.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/basic/DALI 2 Click PIC32.mpkg -------------------------------------------------------------------------------- /packages/basic/DALI 2 Click dsPIC.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/basic/DALI 2 Click dsPIC.mpkg -------------------------------------------------------------------------------- /packages/c/DALI 2 Click ARM.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/c/DALI 2 Click ARM.mpkg -------------------------------------------------------------------------------- /packages/c/DALI 2 Click AVR.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/c/DALI 2 Click AVR.mpkg -------------------------------------------------------------------------------- /packages/c/DALI 2 Click FT90x.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/c/DALI 2 Click FT90x.mpkg -------------------------------------------------------------------------------- /packages/c/DALI 2 Click PIC.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/c/DALI 2 Click PIC.mpkg -------------------------------------------------------------------------------- /packages/c/DALI 2 Click PIC32.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/c/DALI 2 Click PIC32.mpkg -------------------------------------------------------------------------------- /packages/c/DALI 2 Click dsPIC.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/c/DALI 2 Click dsPIC.mpkg -------------------------------------------------------------------------------- /packages/pascal/DALI 2 Click ARM.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/pascal/DALI 2 Click ARM.mpkg -------------------------------------------------------------------------------- /packages/pascal/DALI 2 Click AVR.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/pascal/DALI 2 Click AVR.mpkg -------------------------------------------------------------------------------- /packages/pascal/DALI 2 Click FT90x.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/pascal/DALI 2 Click FT90x.mpkg -------------------------------------------------------------------------------- /packages/pascal/DALI 2 Click PIC.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/pascal/DALI 2 Click PIC.mpkg -------------------------------------------------------------------------------- /packages/pascal/DALI 2 Click PIC32.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/pascal/DALI 2 Click PIC32.mpkg -------------------------------------------------------------------------------- /packages/pascal/DALI 2 Click dsPIC.mpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikroElektronika/DALI_2_click/294fd63da6d8a3c2c95e5b57803b1785ef04e2ec/packages/pascal/DALI 2 Click dsPIC.mpkg --------------------------------------------------------------------------------