/** * Shift Register library demo * * Author: Jan Dvořák z Vozerovic * E-mail: dvorkaman@gmail.com * Web: dvorkaman.asp2.cz * Created: 2014 */ /* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Includes #include "stdio.h" #include "libSystem.h" #include "libSystemTime.h" #include "libShiftRegister.h" /** * Main method */ int main(void) { u8 i = 0; libShiftRegister sr; // init system_initialize(1); // GPIO A only systemTime_initialize(); shiftRegister_initialize(&sr, GPIOA, GPIO_Pin_0, GPIO_Pin_2, GPIO_Pin_1); while (1) { for (i = 0; i < 8; i++) { shiftRegister_write(&sr, 0x1 << i); systemTime_delayMs(125); } shiftRegister_write(&sr, 0xFF); systemTime_delayMs(500); shiftRegister_write(&sr, 0x0); systemTime_delayMs(500); } }