Innan jag påbörjar arbetet så vill jag bara kolla med er om följande.
Den där MAC-drivern, som kräver att man ska skapa eget hårdvarulager.
Tittar vi här så verkar det som att WF200 skickar en signal via SPI
Skärmbild 2023-02-10 130806.png
Skärmbild 2023-02-11 175420.png
Tittar man på MAC-driven så är det bara denna fil som man behöver göra en .c fil till
Skärmbild 2023-02-11 180449.png
Exempel på kod från .h filen
Kod: Markera allt
/**************************************************************************//**
* @brief Hold the WFx chip in reset mode
* @returns Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
*
* @note The reset pin is asserted by the host to keep the WFx chip in reset
*****************************************************************************/
sl_status_t sl_wfx_host_hold_in_reset(void);
/**************************************************************************//**
* @brief Set up the next event that the driver will wait
*
* @param event_id is the ID to be waited
* @returns Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
*
* @note Called every time a API command is called
*****************************************************************************/
sl_status_t sl_wfx_host_setup_waited_event(uint8_t event_id);
/**************************************************************************//**
* @brief Called when the driver is waiting for a confirmation
*
* @param confirmation_id is the ID to be waited
* @param timeout_ms is the time before the command times out
* @param event_payload_out is a pointer to the data returned by the
* confirmation
* @returns Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
*
* @note Called every time a API command is called
*****************************************************************************/
sl_status_t sl_wfx_host_wait_for_confirmation(uint8_t confirmation_id,
uint32_t timeout_ms,
void **event_payload_out);
Det finns en annan fil som används för att styra denna MAC-driver. Det är
sl_wfx.h
Exempel på kod.
Kod: Markera allt
sl_status_t sl_wfx_set_tx_rate_parameters(sl_wfx_rate_set_bitmask_t rate_set_bitmask,
uint8_t use_minstrel,
sl_wfx_interface_t interface);
sl_status_t sl_wfx_set_max_tx_power(int32_t max_tx_power, sl_wfx_interface_t interface);
sl_status_t sl_wfx_get_max_tx_power(int32_t *max_tx_power_rf_port_1,
int32_t *max_tx_power_rf_port_2,
sl_wfx_interface_t interface);
sl_status_t sl_wfx_get_pmk(sl_wfx_password_t *password,
uint32_t *password_length,
sl_wfx_interface_t interface);
sl_status_t sl_wfx_get_ap_client_signal_strength(const sl_wfx_mac_address_t *client, uint32_t *signal_strength);
sl_status_t sl_wfx_ext_auth(sl_wfx_ext_auth_data_type_t auth_data_type,
uint16_t auth_data_length,
const uint8_t *auth_data);
sl_status_t sl_wfx_set_probe_request_filter(const uint8_t *ie_data_mask,
const uint8_t *ie_data,
uint16_t ie_data_length);
sl_status_t sl_wfx_get_statistics(sl_wfx_statistics_t *stats);
/*
* Asynchronous WF200 commands
*/
sl_status_t sl_wfx_send_join_command(const uint8_t *ssid,
uint32_t ssid_length,
const sl_wfx_mac_address_t *bssid,
uint16_t channel,
sl_wfx_security_mode_t security_mode,
uint8_t prevent_roaming,
uint16_t management_frame_protection,
const uint8_t *passkey,
uint16_t passkey_length,
const uint8_t *ie_data,
uint16_t ie_data_length);
sl_status_t sl_wfx_send_disconnect_command(void);
Frågeställning:
Visst är det så att jag ska skriva en .c fil som använder samma funktionsnamn i filen
sl_wfx_host_api.h.
Denna .c fil skall använda sig av SPI-bussen. Hur vet jag då vad jag ska skriva?
För detta så verkar det logiskt. Det handlar bara om en digital pinne som kopplas ihop med WUP.
Kod: Markera allt
/**************************************************************************//**
* @brief Drive the wake up pin in the requested state
*
* @param state to be applied to the wake up pin
* @returns Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
*
* @note Called if the sleep mode is enabled
*****************************************************************************/
sl_status_t sl_wfx_host_set_wake_up_pin(uint8_t state);
Skärmbild 2023-02-11 181359.png
Men när det kommer till detta, så har jag ingen aning alls vad jag ska skriva här.
Kod: Markera allt
/**************************************************************************//**
* @brief Driver hook to get the number of lines of the PDS
*
* @param pds_size is a pointer to the PDS size value
* @returns Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
*
* @note Called once during the driver initialization phase
*****************************************************************************/
sl_status_t sl_wfx_host_get_pds_size(uint16_t *pds_size);
Eller i vilken ordning jag ska skicka dessa data över SPI bussen.
Kod: Markera allt
/**************************************************************************//**
* @brief Send data on the SPI bus
*
* @param type is the type of bus action (see ::sl_wfx_host_bus_transfer_type_t)
* @param header is a pointer to the header data
* @param header_length is the length of the header data
* @param buffer is a pointer to the buffer data
* @param buffer_length is the length of the buffer data
* @returns Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
*****************************************************************************/
sl_status_t sl_wfx_host_spi_transfer_no_cs_assert(sl_wfx_host_bus_transfer_type_t type,
uint8_t *header,
uint16_t header_length,
uint8_t *buffer,
uint16_t buffer_length);
Jag vet inte heller vem, när, och vart jag ska anropa dessa funktioner i sl_wfx.h filen. Ska LwIP styra den?
Kod: Markera allt
sl_status_t sl_wfx_receive_frame(uint16_t *ctrl_reg);
sl_status_t sl_wfx_send_configuration(const char *pds_data, uint32_t pds_data_length);
sl_status_t sl_wfx_control_gpio(uint8_t gpio_label, uint8_t gpio_mode, uint32_t *value);
sl_status_t sl_wfx_pta_settings(uint8_t pta_mode,
uint8_t request_signal_active_level,
uint8_t priority_signal_active_level,
uint8_t freq_signal_active_level,
uint8_t grant_signal_active_level,
uint8_t coex_type,
uint8_t default_grant_state,
uint8_t simultaneous_rx_access,
uint8_t priority_sampling_time,
uint8_t tx_rx_sampling_time,
uint8_t freq_sampling_time,
uint8_t grant_valid_time,
uint8_t fem_control_time,
uint8_t first_slot_time,
uint16_t periodic_tx_rx_sampling_time,
uint16_t coex_quota,
uint16_t wlan_quota);
Hur skulle ni ha gjort? Använda sig av FreeRTOS?