Changeset 38f2eef in avrstuff


Ignore:
Timestamp:
Jul 31, 2010, 9:36:19 AM (14 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
bb69525
Parents:
08d5388
Message:

Amiga_keybaord : add non-blocking function to get a char when it's ready.

git-svn-id: svn://pulkomandy.tk/avrstuff@8 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

Location:
libs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libs/amiga_keyboard/amiga_keyboard.c

    r08d5388 r38f2eef  
    1010#include <util/delay.h>
    1111
     12#include "amiga_keyboard.h"
    1213#include "keymap.h"
    1314
     
    107108
    108109
    109 uint8_t ak_read_scancode(){
     110uint8_t ak_wait_scancode(){
    110111        while(!char_waiting);
     112        return ak_read_scancode();
     113}
    111114
    112         while (AK_PORT & (1<<AK_CLK) == 0);
     115
     116uint8_t ak_read_scancode() {
     117        while ((AK_PORT & (1<<AK_CLK)) == 0);
    113118        _delay_us(30);
    114119        acknowledge_char();
  • libs/amiga_keyboard/amiga_keyboard.h

    r08d5388 r38f2eef  
    55#include <inttypes.h>
    66
     7extern volatile uint8_t char_waiting;
    78
    89void ak_init_keyboard();
    910        // Call this to set up the I/O pins
     11uint8_t ak_wait_scancode();
     12        // Wait for a char to come from the keyboard
    1013uint8_t ak_read_scancode();
    11         // Wait for a char to come from the keyboard
     14        // Get char from keyboard. Only call this if char_waiting  is set !
    1215char ak_scancode_to_ascii(uint8_t);
    1316        // Convert a keycode to a printable ASCII char
  • libs/usart/usart.h

    r08d5388 r38f2eef  
    33 * Distributed under the terms of the MIT Licence */
    44
     5#include <stdint.h>
     6
    57void USARTInit(uint16_t ubrr_value);
    68void USARTWriteChar(char data);
Note: See TracChangeset for help on using the changeset viewer.