Implement the button HAL for platform native

This commit is contained in:
George Oikonomou 2018-03-30 19:59:14 +01:00
parent 4ededd17d6
commit b8a43e8bf9
4 changed files with 45 additions and 1 deletions

View File

@ -10,7 +10,7 @@ CONTIKI_TARGET_DIRS = . dev
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
CONTIKI_TARGET_SOURCEFILES += platform.c clock.c xmem.c leds-arch.c
CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c
CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c buttons.c
ifeq ($(HOST_OS),Windows)
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c

View File

@ -91,6 +91,8 @@ typedef unsigned long clock_time_t;
#define LOG_CONF_ENABLED 1
#define PLATFORM_SUPPORTS_BUTTON_HAL 1
/* Not part of C99 but actually present */
int strcasecmp(const char*, const char*);

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "dev/button-hal.h"
#include <stdint.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
button_hal_button_t *button_hal_buttons[] = { NULL };
const uint8_t button_hal_button_count = 0;
/*---------------------------------------------------------------------------*/

View File

@ -56,6 +56,7 @@
#include "net/netstack.h"
#include "dev/serial-line.h"
#include "dev/button-hal.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-debug.h"
@ -251,6 +252,7 @@ platform_process_args(int argc, char**argv)
void
platform_init_stage_one()
{
button_hal_init();
return;
}
/*---------------------------------------------------------------------------*/