Sync work

This commit is contained in:
Jochen Friedrich 2021-03-27 18:23:58 +01:00
parent 945d2870aa
commit efa5673e71
15 changed files with 1369 additions and 419 deletions

View file

@ -9,8 +9,12 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdint.h>
#include "n76e003.h"
#include <nuvoton/functions.h>
#include <nuvoton/N76E003.h>
#include <nuvoton/Common.h>
#include <nuvoton/Delay.h>
#include <nuvoton/SFR_Macro.h>
// 16Mhz clock
#define CLOCK 16000000L
@ -19,14 +23,14 @@
// Per milisecond
#define T0_1MS ((T0CLOCK)/1000L)
static void msdelay(uint32_t count)
static void msdelay(unsigned long int count)
{
int16_t reload = -T0_1MS;
int reload = -T0_1MS;
// Input = Fsys/12
SET_FIELD(CKCON, T0M, 0);
clr_T0M;
// Mode 1
SET_FIELD(TMOD, T0M, 1);
set_GATE_T0;
// Start
TR0 = 1;