示例#1
0
void main(void)
{
	writeCmd(0x01);
	writeCMD(0xF);
	writeCMD(0x06);

	WriteData('A');
	WriteData('a');
	WriteData('r');
	WriteData('o');
	WriteData('n');
}
示例#2
0
/** @brief Set the Configuration of the Transmitter for RFM01.

Not all parameters are configurable. The wakeup timer, low battery and the
clock out are disabled. The transmitter chain is powered off.
*/
void receiverConfigure()
{
    _delay_ms(150);
	writeCMD(CONFIGURATION, 16);    /* Configure command */
/* Set the low battery threshold and the microprocessor clock output */
	writeCMD(BATTERY, 16);
	writeCMD(FREQUENCY, 16);        /* Set carrier frequency */
/* Receiver Setting Command, disable the receiver chain */
	writeCMD(RECEIVER, 16);
/* Receiver Setting Command, enable the entire receiver chain */
	writeCMD(RECEIVER | _BV(0), 16);
/* Set the FIFO options */
	resetFIFO();
/* Set the Baseband Data Filter and Clock Recovery options */
	writeCMD(BASEFILTER, 16);
/* Set the expected data bitrate */
	writeCMD(DATARATE, 16);
/* Set the AFC enable pattern, range limits and measurement mode */
	writeCMD(AFC, 16);
}
示例#3
0
文件: keypad.c 项目: ivanc95/lab2_1
/* This function will be called AFTER you have determined that someone pressed
 * SOME key. This function is to figure out WHICH key has been pressed.
 * This function should return -1 if more than one key is pressed or if
 * no key is pressed at all. Otherwise, it should return the ASCII character of
 * the key that is pressed. The ascii character c programmatically is just 'c'
 */
char scanKeypad(void){
    
    char key = -1;
    
    int pressed = 0;
    
    //Scan Row 1
    ROW_1 = 0; ROW_2 = 1; ROW_3 = 1; ROW_4 = 1;
    
    if(COL_1 == 0){
        key = '1';
        pressed++;
    }
    if(COL_2 == 0){
        key = '2';
        pressed++;
    }
    if(COL_3 == 0){
        key = '3';
        pressed++;
    }
    if(pressed > 1){
        return 'e';
    }
    else if( pressed == 1) {
        return key;
    }
    
    //Scan Row 2
    ROW_1 = 1; ROW_2 = 0; ROW_3 = 1; ROW_4 = 1;
    
    if(COL_1 == 0){
        key = '4';
        pressed++;
    }
    if(COL_2 == 0){
        key = '5';
        pressed++;
    }
    if(COL_3 == 0){
        key = '6';
        pressed++;
    }
    if(pressed > 1){
        return 'e';
    }
    else if( pressed == 1) {
        return key;
    }
    
    //Scan Row 3
    ROW_1 = 1; ROW_2 = 1; ROW_3 = 0; ROW_4 = 1;
    
    if(COL_1 == 0){
        key = '7';
        pressed++;
    }
    if(COL_2 == 0){
        key = '8';
        pressed++;
    }
    if(COL_3 == 0){
        key = '9';
        pressed++;
    }
    if(pressed > 1){
        return 'e';
    }
    else if( pressed == 1) {
        return key;
    }
    
    //Scan Row 4
    ROW_1 = 1; ROW_2 = 1; ROW_3 = 1; ROW_4 = 0;
    
    if(COL_1 == 0){
        key = '*';
        pressed++;
    }
    if(COL_2 == 0){
        key = '0';
        pressed++;
    }
    if(COL_3 == 0){
        writeCMD(0x01);
    }
    if(pressed > 1){
        return 'e';
    }
    
    return key;
    
}
示例#4
0
/** @brief Reset the FIFO

Clearing bit 1 of the FIFO command will clear the FIFO and restart the synchron
word detection. Set it to restart the FIFO counter.
*/
void resetFIFO(void)
{
    writeCMD(FIFO, 16);
	writeCMD(FIFO | _BV(1), 16);
}